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
29 #include <srrestoreptapi.h>
31 #include "wine/test.h"
33 static const char msifile[] = "winetest-package.msi";
34 char CURR_DIR[MAX_PATH];
36 static UINT (WINAPI *pMsiApplyMultiplePatchesA)(LPCSTR, LPCSTR, LPCSTR);
38 static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
39 static BOOL (WINAPI *pGetTokenInformation)( HANDLE, TOKEN_INFORMATION_CLASS, LPVOID, DWORD, PDWORD );
40 static BOOL (WINAPI *pOpenProcessToken)( HANDLE, DWORD, PHANDLE );
41 static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
42 static LONG (WINAPI *pRegDeleteKeyExW)(HKEY, LPCWSTR, REGSAM, DWORD);
43 static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
45 static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
46 static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA*, STATEMGRSTATUS*);
48 static void init_functionpointers(void)
50 HMODULE hmsi = GetModuleHandleA("msi.dll");
51 HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
52 HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
55 #define GET_PROC(mod, func) \
56 p ## func = (void*)GetProcAddress(mod, #func);
58 GET_PROC(hmsi, MsiApplyMultiplePatchesA);
60 GET_PROC(hadvapi32, ConvertSidToStringSidA);
61 GET_PROC(hadvapi32, GetTokenInformation);
62 GET_PROC(hadvapi32, OpenProcessToken);
63 GET_PROC(hadvapi32, RegDeleteKeyExA)
64 GET_PROC(hadvapi32, RegDeleteKeyExW)
65 GET_PROC(hkernel32, IsWow64Process)
67 hsrclient = LoadLibraryA("srclient.dll");
68 GET_PROC(hsrclient, SRRemoveRestorePoint);
69 GET_PROC(hsrclient, SRSetRestorePointA);
73 static BOOL is_process_limited(void)
77 if (!pOpenProcessToken || !pGetTokenInformation) return FALSE;
79 if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
82 TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault;
85 ret = pGetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size);
87 return (ret && type == TokenElevationTypeLimited);
92 static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access )
95 return pRegDeleteKeyExA( key, subkey, access, 0 );
96 return RegDeleteKeyA( key, subkey );
99 static LPSTR get_user_sid(LPSTR *usersid)
106 if (!pConvertSidToStringSidA)
108 win_skip("ConvertSidToStringSidA is not available\n");
113 OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
115 GetTokenInformation(token, TokenUser, buf, size, &size);
116 user = (PTOKEN_USER)buf;
117 pConvertSidToStringSidA(user->User.Sid, usersid);
118 ok(*usersid != NULL, "pConvertSidToStringSidA failed lre=%d\n", GetLastError());
123 /* RegDeleteTreeW from dlls/advapi32/registry.c */
124 static LSTATUS package_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey, REGSAM access)
127 DWORD dwMaxSubkeyLen, dwMaxValueLen;
128 DWORD dwMaxLen, dwSize;
129 WCHAR szNameBuf[MAX_PATH], *lpszName = szNameBuf;
134 ret = RegOpenKeyExW(hKey, lpszSubKey, 0, access, &hSubKey);
138 ret = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL,
139 &dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL);
140 if (ret) goto cleanup;
144 dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen);
145 if (dwMaxLen > sizeof(szNameBuf)/sizeof(WCHAR))
147 /* Name too big: alloc a buffer for it */
148 if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen*sizeof(WCHAR))))
150 ret = ERROR_NOT_ENOUGH_MEMORY;
155 /* Recursively delete all the subkeys */
159 if (RegEnumKeyExW(hSubKey, 0, lpszName, &dwSize, NULL,
160 NULL, NULL, NULL)) break;
162 ret = package_RegDeleteTreeW(hSubKey, lpszName, access);
163 if (ret) goto cleanup;
168 if (pRegDeleteKeyExW)
169 ret = pRegDeleteKeyExW(hKey, lpszSubKey, access, 0);
171 ret = RegDeleteKeyW(hKey, lpszSubKey);
177 if (RegEnumValueW(hKey, 0, lpszName, &dwSize,
178 NULL, NULL, NULL, NULL)) break;
180 ret = RegDeleteValueW(hKey, lpszName);
181 if (ret) goto cleanup;
185 if (lpszName != szNameBuf)
186 HeapFree(GetProcessHeap(), 0, lpszName);
188 RegCloseKey(hSubKey);
192 static BOOL squash_guid(LPCWSTR in, LPWSTR out)
197 if (FAILED(CLSIDFromString((LPCOLESTR)in, &guid)))
211 out[17+i*2] = in[n++];
212 out[16+i*2] = in[n++];
217 out[17+i*2] = in[n++];
218 out[16+i*2] = in[n++];
224 static void create_test_guid(LPSTR prodcode, LPSTR squashed)
226 WCHAR guidW[MAX_PATH];
227 WCHAR squashedW[MAX_PATH];
232 hr = CoCreateGuid(&guid);
233 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
235 size = StringFromGUID2(&guid, guidW, MAX_PATH);
236 ok(size == 39, "Expected 39, got %d\n", hr);
238 WideCharToMultiByte(CP_ACP, 0, guidW, size, prodcode, MAX_PATH, NULL, NULL);
239 squash_guid(guidW, squashedW);
240 WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
243 static void set_component_path(LPCSTR filename, MSIINSTALLCONTEXT context,
244 LPCSTR guid, LPSTR usersid, BOOL dir)
246 WCHAR guidW[MAX_PATH];
247 WCHAR squashedW[MAX_PATH];
248 CHAR squashed[MAX_PATH];
249 CHAR comppath[MAX_PATH];
250 CHAR prodpath[MAX_PATH];
254 REGSAM access = KEY_ALL_ACCESS;
257 if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64)
258 access |= KEY_WOW64_64KEY;
260 MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
261 squash_guid(guidW, squashedW);
262 WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
264 if (context == MSIINSTALLCONTEXT_MACHINE)
266 prod = "3D0DAE300FACA1300AD792060BCDAA92";
268 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
269 "Installer\\UserData\\S-1-5-18\\Components\\%s", squashed);
271 "SOFTWARE\\Classes\\Installer\\"
272 "Products\\3D0DAE300FACA1300AD792060BCDAA92");
274 else if (context == MSIINSTALLCONTEXT_USERUNMANAGED)
276 prod = "7D2F387510109040002000060BECB6AB";
278 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
279 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
281 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
282 "Installer\\%s\\Installer\\Products\\"
283 "7D2F387510109040002000060BECB6AB", usersid);
285 else if (context == MSIINSTALLCONTEXT_USERMANAGED)
287 prod = "7D2F387510109040002000060BECB6AB";
289 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
290 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
292 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
293 "Installer\\Managed\\%s\\Installer\\Products\\"
294 "7D2F387510109040002000060BECB6AB", usersid);
297 RegCreateKeyExA(HKEY_LOCAL_MACHINE, comppath, 0, NULL, 0, access, NULL, &hkey, NULL);
299 lstrcpyA(path, CURR_DIR);
300 lstrcatA(path, "\\");
301 if (!dir) lstrcatA(path, filename);
303 RegSetValueExA(hkey, prod, 0, REG_SZ, (LPBYTE)path, lstrlenA(path));
306 RegCreateKeyExA(HKEY_LOCAL_MACHINE, prodpath, 0, NULL, 0, access, NULL, &hkey, NULL);
310 static void delete_component_path(LPCSTR guid, MSIINSTALLCONTEXT context, LPSTR usersid)
312 WCHAR guidW[MAX_PATH];
313 WCHAR squashedW[MAX_PATH];
314 WCHAR substrW[MAX_PATH];
315 CHAR squashed[MAX_PATH];
316 CHAR comppath[MAX_PATH];
317 CHAR prodpath[MAX_PATH];
318 REGSAM access = KEY_ALL_ACCESS;
321 if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64)
322 access |= KEY_WOW64_64KEY;
324 MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
325 squash_guid(guidW, squashedW);
326 WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
328 if (context == MSIINSTALLCONTEXT_MACHINE)
331 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
332 "Installer\\UserData\\S-1-5-18\\Components\\%s", squashed);
334 "SOFTWARE\\Classes\\Installer\\"
335 "Products\\3D0DAE300FACA1300AD792060BCDAA92");
337 else if (context == MSIINSTALLCONTEXT_USERUNMANAGED)
340 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
341 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
343 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
344 "Installer\\%s\\Installer\\Products\\"
345 "7D2F387510109040002000060BECB6AB", usersid);
347 else if (context == MSIINSTALLCONTEXT_USERMANAGED)
350 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
351 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
353 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
354 "Installer\\Managed\\%s\\Installer\\Products\\"
355 "7D2F387510109040002000060BECB6AB", usersid);
358 MultiByteToWideChar(CP_ACP, 0, comppath, -1, substrW, MAX_PATH);
359 package_RegDeleteTreeW(HKEY_LOCAL_MACHINE, substrW, access);
361 MultiByteToWideChar(CP_ACP, 0, prodpath, -1, substrW, MAX_PATH);
362 package_RegDeleteTreeW(HKEY_LOCAL_MACHINE, substrW, access);
365 static UINT do_query(MSIHANDLE hdb, const char *query, MSIHANDLE *phrec)
370 /* open a select query */
371 r = MsiDatabaseOpenView(hdb, query, &hview);
372 if (r != ERROR_SUCCESS)
374 r = MsiViewExecute(hview, 0);
375 if (r != ERROR_SUCCESS)
377 ret = MsiViewFetch(hview, phrec);
378 r = MsiViewClose(hview);
379 if (r != ERROR_SUCCESS)
381 r = MsiCloseHandle(hview);
382 if (r != ERROR_SUCCESS)
387 static UINT run_query( MSIHANDLE hdb, const char *query )
392 r = MsiDatabaseOpenView(hdb, query, &hview);
393 if( r != ERROR_SUCCESS )
396 r = MsiViewExecute(hview, 0);
397 if( r == ERROR_SUCCESS )
398 r = MsiViewClose(hview);
399 MsiCloseHandle(hview);
403 static UINT create_component_table( MSIHANDLE hdb )
405 return run_query( hdb,
406 "CREATE TABLE `Component` ( "
407 "`Component` CHAR(72) NOT NULL, "
408 "`ComponentId` CHAR(38), "
409 "`Directory_` CHAR(72) NOT NULL, "
410 "`Attributes` SHORT NOT NULL, "
411 "`Condition` CHAR(255), "
412 "`KeyPath` CHAR(72) "
413 "PRIMARY KEY `Component`)" );
416 static UINT create_feature_table( MSIHANDLE hdb )
418 return run_query( hdb,
419 "CREATE TABLE `Feature` ( "
420 "`Feature` CHAR(38) NOT NULL, "
421 "`Feature_Parent` CHAR(38), "
423 "`Description` CHAR(255), "
424 "`Display` SHORT NOT NULL, "
425 "`Level` SHORT NOT NULL, "
426 "`Directory_` CHAR(72), "
427 "`Attributes` SHORT NOT NULL "
428 "PRIMARY KEY `Feature`)" );
431 static UINT create_feature_components_table( MSIHANDLE hdb )
433 return run_query( hdb,
434 "CREATE TABLE `FeatureComponents` ( "
435 "`Feature_` CHAR(38) NOT NULL, "
436 "`Component_` CHAR(72) NOT NULL "
437 "PRIMARY KEY `Feature_`, `Component_` )" );
440 static UINT create_file_table( MSIHANDLE hdb )
442 return run_query( hdb,
443 "CREATE TABLE `File` ("
444 "`File` CHAR(72) NOT NULL, "
445 "`Component_` CHAR(72) NOT NULL, "
446 "`FileName` CHAR(255) NOT NULL, "
447 "`FileSize` LONG NOT NULL, "
448 "`Version` CHAR(72), "
449 "`Language` CHAR(20), "
450 "`Attributes` SHORT, "
451 "`Sequence` SHORT NOT NULL "
452 "PRIMARY KEY `File`)" );
455 static UINT create_remove_file_table( MSIHANDLE hdb )
457 return run_query( hdb,
458 "CREATE TABLE `RemoveFile` ("
459 "`FileKey` CHAR(72) NOT NULL, "
460 "`Component_` CHAR(72) NOT NULL, "
461 "`FileName` CHAR(255) LOCALIZABLE, "
462 "`DirProperty` CHAR(72) NOT NULL, "
463 "`InstallMode` SHORT NOT NULL "
464 "PRIMARY KEY `FileKey`)" );
467 static UINT create_appsearch_table( MSIHANDLE hdb )
469 return run_query( hdb,
470 "CREATE TABLE `AppSearch` ("
471 "`Property` CHAR(72) NOT NULL, "
472 "`Signature_` CHAR(72) NOT NULL "
473 "PRIMARY KEY `Property`, `Signature_`)" );
476 static UINT create_reglocator_table( MSIHANDLE hdb )
478 return run_query( hdb,
479 "CREATE TABLE `RegLocator` ("
480 "`Signature_` CHAR(72) NOT NULL, "
481 "`Root` SHORT NOT NULL, "
482 "`Key` CHAR(255) NOT NULL, "
485 "PRIMARY KEY `Signature_`)" );
488 static UINT create_signature_table( MSIHANDLE hdb )
490 return run_query( hdb,
491 "CREATE TABLE `Signature` ("
492 "`Signature` CHAR(72) NOT NULL, "
493 "`FileName` CHAR(255) NOT NULL, "
494 "`MinVersion` CHAR(20), "
495 "`MaxVersion` CHAR(20), "
500 "`Languages` CHAR(255) "
501 "PRIMARY KEY `Signature`)" );
504 static UINT create_launchcondition_table( MSIHANDLE hdb )
506 return run_query( hdb,
507 "CREATE TABLE `LaunchCondition` ("
508 "`Condition` CHAR(255) NOT NULL, "
509 "`Description` CHAR(255) NOT NULL "
510 "PRIMARY KEY `Condition`)" );
513 static UINT create_property_table( MSIHANDLE hdb )
515 return run_query( hdb,
516 "CREATE TABLE `Property` ("
517 "`Property` CHAR(72) NOT NULL, "
519 "PRIMARY KEY `Property`)" );
522 static UINT create_install_execute_sequence_table( MSIHANDLE hdb )
524 return run_query( hdb,
525 "CREATE TABLE `InstallExecuteSequence` ("
526 "`Action` CHAR(72) NOT NULL, "
527 "`Condition` CHAR(255), "
529 "PRIMARY KEY `Action`)" );
532 static UINT create_media_table( MSIHANDLE hdb )
534 return run_query( hdb,
535 "CREATE TABLE `Media` ("
536 "`DiskId` SHORT NOT NULL, "
537 "`LastSequence` SHORT NOT NULL, "
538 "`DiskPrompt` CHAR(64), "
539 "`Cabinet` CHAR(255), "
540 "`VolumeLabel` CHAR(32), "
542 "PRIMARY KEY `DiskId`)" );
545 static UINT create_ccpsearch_table( MSIHANDLE hdb )
547 return run_query( hdb,
548 "CREATE TABLE `CCPSearch` ("
549 "`Signature_` CHAR(72) NOT NULL "
550 "PRIMARY KEY `Signature_`)" );
553 static UINT create_drlocator_table( MSIHANDLE hdb )
555 return run_query( hdb,
556 "CREATE TABLE `DrLocator` ("
557 "`Signature_` CHAR(72) NOT NULL, "
558 "`Parent` CHAR(72), "
561 "PRIMARY KEY `Signature_`, `Parent`, `Path`)" );
564 static UINT create_complocator_table( MSIHANDLE hdb )
566 return run_query( hdb,
567 "CREATE TABLE `CompLocator` ("
568 "`Signature_` CHAR(72) NOT NULL, "
569 "`ComponentId` CHAR(38) NOT NULL, "
571 "PRIMARY KEY `Signature_`)" );
574 static UINT create_inilocator_table( MSIHANDLE hdb )
576 return run_query( hdb,
577 "CREATE TABLE `IniLocator` ("
578 "`Signature_` CHAR(72) NOT NULL, "
579 "`FileName` CHAR(255) NOT NULL, "
580 "`Section` CHAR(96)NOT NULL, "
581 "`Key` CHAR(128)NOT NULL, "
584 "PRIMARY KEY `Signature_`)" );
587 #define make_add_entry(type, qtext) \
588 static UINT add##_##type##_##entry( MSIHANDLE hdb, const char *values ) \
590 char insert[] = qtext; \
593 sz = strlen(values) + sizeof insert; \
594 query = HeapAlloc(GetProcessHeap(),0,sz); \
595 sprintf(query,insert,values); \
596 r = run_query( hdb, query ); \
597 HeapFree(GetProcessHeap(), 0, query); \
601 make_add_entry(component,
602 "INSERT INTO `Component` "
603 "(`Component`, `ComponentId`, `Directory_`, "
604 "`Attributes`, `Condition`, `KeyPath`) VALUES( %s )")
606 make_add_entry(directory,
607 "INSERT INTO `Directory` "
608 "(`Directory`,`Directory_Parent`,`DefaultDir`) VALUES( %s )")
610 make_add_entry(feature,
611 "INSERT INTO `Feature` "
612 "(`Feature`, `Feature_Parent`, `Title`, `Description`, "
613 "`Display`, `Level`, `Directory_`, `Attributes`) VALUES( %s )")
615 make_add_entry(feature_components,
616 "INSERT INTO `FeatureComponents` "
617 "(`Feature_`, `Component_`) VALUES( %s )")
620 "INSERT INTO `File` "
621 "(`File`, `Component_`, `FileName`, `FileSize`, "
622 "`Version`, `Language`, `Attributes`, `Sequence`) VALUES( %s )")
624 make_add_entry(appsearch,
625 "INSERT INTO `AppSearch` "
626 "(`Property`, `Signature_`) VALUES( %s )")
628 make_add_entry(reglocator,
629 "INSERT INTO `RegLocator` "
630 "(`Signature_`, `Root`, `Key`, `Name`, `Type`) VALUES( %s )")
632 make_add_entry(signature,
633 "INSERT INTO `Signature` "
634 "(`Signature`, `FileName`, `MinVersion`, `MaxVersion`,"
635 " `MinSize`, `MaxSize`, `MinDate`, `MaxDate`, `Languages`) "
638 make_add_entry(launchcondition,
639 "INSERT INTO `LaunchCondition` "
640 "(`Condition`, `Description`) VALUES( %s )")
642 make_add_entry(property,
643 "INSERT INTO `Property` (`Property`, `Value`) VALUES( %s )")
645 make_add_entry(install_execute_sequence,
646 "INSERT INTO `InstallExecuteSequence` "
647 "(`Action`, `Condition`, `Sequence`) VALUES( %s )")
649 make_add_entry(media,
650 "INSERT INTO `Media` "
651 "(`DiskId`, `LastSequence`, `DiskPrompt`, "
652 "`Cabinet`, `VolumeLabel`, `Source`) VALUES( %s )")
654 make_add_entry(ccpsearch,
655 "INSERT INTO `CCPSearch` (`Signature_`) VALUES( %s )")
657 make_add_entry(drlocator,
658 "INSERT INTO `DrLocator` "
659 "(`Signature_`, `Parent`, `Path`, `Depth`) VALUES( %s )")
661 make_add_entry(complocator,
662 "INSERT INTO `CompLocator` "
663 "(`Signature_`, `ComponentId`, `Type`) VALUES( %s )")
665 make_add_entry(inilocator,
666 "INSERT INTO `IniLocator` "
667 "(`Signature_`, `FileName`, `Section`, `Key`, `Field`, `Type`) "
670 static UINT set_summary_info(MSIHANDLE hdb)
675 /* build summary info */
676 res = MsiGetSummaryInformation(hdb, NULL, 7, &suminfo);
677 ok( res == ERROR_SUCCESS , "Failed to open summaryinfo\n" );
679 res = MsiSummaryInfoSetProperty(suminfo,2, VT_LPSTR, 0,NULL,
680 "Installation Database");
681 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
683 res = MsiSummaryInfoSetProperty(suminfo,3, VT_LPSTR, 0,NULL,
684 "Installation Database");
685 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
687 res = MsiSummaryInfoSetProperty(suminfo,4, VT_LPSTR, 0,NULL,
689 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
691 res = MsiSummaryInfoSetProperty(suminfo,7, VT_LPSTR, 0,NULL,
693 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
695 res = MsiSummaryInfoSetProperty(suminfo,9, VT_LPSTR, 0,NULL,
696 "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}");
697 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
699 res = MsiSummaryInfoSetProperty(suminfo, 14, VT_I4, 100, NULL, NULL);
700 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
702 res = MsiSummaryInfoSetProperty(suminfo, 15, VT_I4, 0, NULL, NULL);
703 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
705 res = MsiSummaryInfoPersist(suminfo);
706 ok( res == ERROR_SUCCESS , "Failed to make summary info persist\n" );
708 res = MsiCloseHandle( suminfo);
709 ok( res == ERROR_SUCCESS , "Failed to close suminfo\n" );
715 static MSIHANDLE create_package_db(void)
722 /* create an empty database */
723 res = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb );
724 ok( res == ERROR_SUCCESS , "Failed to create database %u\n", res );
725 if( res != ERROR_SUCCESS )
728 res = MsiDatabaseCommit( hdb );
729 ok( res == ERROR_SUCCESS , "Failed to commit database\n" );
731 res = set_summary_info(hdb);
733 res = run_query( hdb,
734 "CREATE TABLE `Directory` ( "
735 "`Directory` CHAR(255) NOT NULL, "
736 "`Directory_Parent` CHAR(255), "
737 "`DefaultDir` CHAR(255) NOT NULL "
738 "PRIMARY KEY `Directory`)" );
739 ok( res == ERROR_SUCCESS , "Failed to create directory table\n" );
744 static UINT package_from_db(MSIHANDLE hdb, MSIHANDLE *handle)
750 sprintf(szPackage, "#%u", hdb);
751 res = MsiOpenPackage(szPackage, &hPackage);
752 if (res != ERROR_SUCCESS)
758 res = MsiCloseHandle(hdb);
759 if (res != ERROR_SUCCESS)
761 MsiCloseHandle(hPackage);
766 return ERROR_SUCCESS;
769 static void create_test_file(const CHAR *name)
774 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
775 ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
776 WriteFile(file, name, strlen(name), &written, NULL);
777 WriteFile(file, "\n", strlen("\n"), &written, NULL);
781 typedef struct _tagVS_VERSIONINFO
788 VS_FIXEDFILEINFO Value;
793 #define roundoffs(a, b, r) (((BYTE *)(b) - (BYTE *)(a) + ((r) - 1)) & ~((r) - 1))
794 #define roundpos(a, b, r) (((BYTE *)(a)) + roundoffs(a, b, r))
796 static BOOL create_file_with_version(const CHAR *name, LONG ms, LONG ls)
798 VS_VERSIONINFO *pVerInfo;
799 VS_FIXEDFILEINFO *pFixedInfo;
806 GetSystemDirectory(path, MAX_PATH);
807 /* Some dlls can't be updated on Vista/W2K8 */
808 lstrcatA(path, "\\version.dll");
810 CopyFileA(path, name, FALSE);
812 size = GetFileVersionInfoSize(path, &handle);
813 buffer = HeapAlloc(GetProcessHeap(), 0, size);
815 GetFileVersionInfoA(path, 0, size, buffer);
817 pVerInfo = (VS_VERSIONINFO *)buffer;
818 ofs = (BYTE *)&pVerInfo->szKey[lstrlenW(pVerInfo->szKey) + 1];
819 pFixedInfo = (VS_FIXEDFILEINFO *)roundpos(pVerInfo, ofs, 4);
821 pFixedInfo->dwFileVersionMS = ms;
822 pFixedInfo->dwFileVersionLS = ls;
823 pFixedInfo->dwProductVersionMS = ms;
824 pFixedInfo->dwProductVersionLS = ls;
826 resource = BeginUpdateResource(name, FALSE);
830 if (!UpdateResource(resource, RT_VERSION, MAKEINTRESOURCE(VS_VERSION_INFO),
831 MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), buffer, size))
834 if (!EndUpdateResource(resource, FALSE))
840 HeapFree(GetProcessHeap(), 0, buffer);
844 static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
846 RESTOREPOINTINFOA spec;
848 spec.dwEventType = event_type;
849 spec.dwRestorePtType = APPLICATION_INSTALL;
850 spec.llSequenceNumber = status->llSequenceNumber;
851 lstrcpyA(spec.szDescription, "msitest restore point");
853 return pSRSetRestorePointA(&spec, status);
856 static void remove_restore_point(DWORD seq_number)
860 res = pSRRemoveRestorePoint(seq_number);
861 if (res != ERROR_SUCCESS)
862 trace("Failed to remove the restore point : %08x\n", res);
865 static void test_createpackage(void)
867 MSIHANDLE hPackage = 0;
870 res = package_from_db(create_package_db(), &hPackage);
871 if (res == ERROR_INSTALL_PACKAGE_REJECTED)
873 skip("Not enough rights to perform tests\n");
877 ok( res == ERROR_SUCCESS, " Failed to create package %u\n", res );
879 res = MsiCloseHandle( hPackage);
880 ok( res == ERROR_SUCCESS , "Failed to close package\n" );
884 static void test_doaction( void )
889 r = MsiDoAction( -1, NULL );
890 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
892 r = package_from_db(create_package_db(), &hpkg);
893 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
895 skip("Not enough rights to perform tests\n");
899 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
901 r = MsiDoAction(hpkg, NULL);
902 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
904 r = MsiDoAction(0, "boo");
905 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
907 r = MsiDoAction(hpkg, "boo");
908 ok( r == ERROR_FUNCTION_NOT_CALLED, "wrong return val\n");
910 MsiCloseHandle( hpkg );
914 static void test_gettargetpath_bad(void)
916 static const WCHAR boo[] = {'b','o','o',0};
917 static const WCHAR empty[] = {0};
924 r = package_from_db(create_package_db(), &hpkg);
925 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
927 skip("Not enough rights to perform tests\n");
931 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
933 r = MsiGetTargetPath( 0, NULL, NULL, NULL );
934 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
936 r = MsiGetTargetPath( 0, NULL, NULL, &sz );
937 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
939 r = MsiGetTargetPath( 0, "boo", NULL, NULL );
940 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
942 r = MsiGetTargetPath( 0, "boo", NULL, NULL );
943 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
945 r = MsiGetTargetPath( hpkg, "boo", NULL, NULL );
946 ok( r == ERROR_DIRECTORY, "wrong return val\n");
948 r = MsiGetTargetPath( hpkg, "boo", buffer, NULL );
949 ok( r == ERROR_DIRECTORY, "wrong return val\n");
952 r = MsiGetTargetPath( hpkg, "", buffer, &sz );
953 ok( r == ERROR_DIRECTORY, "wrong return val\n");
955 r = MsiGetTargetPathW( 0, NULL, NULL, NULL );
956 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
958 r = MsiGetTargetPathW( 0, NULL, NULL, &sz );
959 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
961 r = MsiGetTargetPathW( 0, boo, NULL, NULL );
962 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
964 r = MsiGetTargetPathW( 0, boo, NULL, NULL );
965 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
967 r = MsiGetTargetPathW( hpkg, boo, NULL, NULL );
968 ok( r == ERROR_DIRECTORY, "wrong return val\n");
970 r = MsiGetTargetPathW( hpkg, boo, bufferW, NULL );
971 ok( r == ERROR_DIRECTORY, "wrong return val\n");
974 r = MsiGetTargetPathW( hpkg, empty, bufferW, &sz );
975 ok( r == ERROR_DIRECTORY, "wrong return val\n");
977 MsiCloseHandle( hpkg );
981 static void query_file_path(MSIHANDLE hpkg, LPCSTR file, LPSTR buff)
987 rec = MsiCreateRecord( 1 );
988 ok(rec, "MsiCreate record failed\n");
990 r = MsiRecordSetString( rec, 0, file );
991 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
994 r = MsiFormatRecord( hpkg, rec, buff, &size );
995 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
997 MsiCloseHandle( rec );
1000 static void test_settargetpath(void)
1002 char tempdir[MAX_PATH+8], buffer[MAX_PATH], file[MAX_PATH];
1008 hdb = create_package_db();
1009 ok ( hdb, "failed to create package database\n" );
1011 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'" );
1012 ok( r == S_OK, "failed to add directory entry: %d\n" , r );
1014 r = create_component_table( hdb );
1015 ok( r == S_OK, "cannot create Component table: %d\n", r );
1017 r = add_component_entry( hdb, "'RootComp', '{83e2694d-0864-4124-9323-6d37630912a1}', 'TARGETDIR', 8, '', 'RootFile'" );
1018 ok( r == S_OK, "cannot add dummy component: %d\n", r );
1020 r = add_component_entry( hdb, "'TestComp', '{A3FB59C8-C293-4F7E-B8C5-F0E1D8EEE4E5}', 'TestDir', 0, '', 'TestFile'" );
1021 ok( r == S_OK, "cannot add test component: %d\n", r );
1023 r = create_feature_table( hdb );
1024 ok( r == S_OK, "cannot create Feature table: %d\n", r );
1026 r = add_feature_entry( hdb, "'TestFeature', '', '', '', 0, 1, '', 0" );
1027 ok( r == ERROR_SUCCESS, "cannot add TestFeature to Feature table: %d\n", r );
1029 r = create_feature_components_table( hdb );
1030 ok( r == S_OK, "cannot create FeatureComponents table: %d\n", r );
1032 r = add_feature_components_entry( hdb, "'TestFeature', 'RootComp'" );
1033 ok( r == S_OK, "cannot insert component into FeatureComponents table: %d\n", r );
1035 r = add_feature_components_entry( hdb, "'TestFeature', 'TestComp'" );
1036 ok( r == S_OK, "cannot insert component into FeatureComponents table: %d\n", r );
1038 add_directory_entry( hdb, "'TestParent', 'TARGETDIR', 'TestParent'" );
1039 add_directory_entry( hdb, "'TestDir', 'TestParent', 'TestDir'" );
1041 r = create_file_table( hdb );
1042 ok( r == S_OK, "cannot create File table: %d\n", r );
1044 r = add_file_entry( hdb, "'RootFile', 'RootComp', 'rootfile.txt', 0, '', '1033', 8192, 1" );
1045 ok( r == S_OK, "cannot add file to the File table: %d\n", r );
1047 r = add_file_entry( hdb, "'TestFile', 'TestComp', 'testfile.txt', 0, '', '1033', 8192, 1" );
1048 ok( r == S_OK, "cannot add file to the File table: %d\n", r );
1050 r = package_from_db( hdb, &hpkg );
1051 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
1053 skip("Not enough rights to perform tests\n");
1054 DeleteFile(msifile);
1057 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
1059 r = MsiDoAction( hpkg, "CostInitialize");
1060 ok( r == ERROR_SUCCESS, "cost init failed\n");
1062 r = MsiDoAction( hpkg, "FileCost");
1063 ok( r == ERROR_SUCCESS, "file cost failed\n");
1065 r = MsiDoAction( hpkg, "CostFinalize");
1066 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
1068 r = MsiSetTargetPath( 0, NULL, NULL );
1069 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1071 r = MsiSetTargetPath( 0, "boo", "C:\\bogusx" );
1072 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
1074 r = MsiSetTargetPath( hpkg, "boo", NULL );
1075 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1077 r = MsiSetTargetPath( hpkg, "boo", "c:\\bogusx" );
1078 ok( r == ERROR_DIRECTORY, "wrong return val\n");
1080 sz = sizeof tempdir - 1;
1081 r = MsiGetTargetPath( hpkg, "TARGETDIR", tempdir, &sz );
1082 sprintf( file, "%srootfile.txt", tempdir );
1084 query_file_path( hpkg, "[#RootFile]", buffer );
1085 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
1086 ok( !lstrcmp(buffer, file), "Expected %s, got %s\n", file, buffer );
1088 GetTempFileName( tempdir, "_wt", 0, buffer );
1089 sprintf( tempdir, "%s\\subdir", buffer );
1091 r = MsiSetTargetPath( hpkg, "TARGETDIR", buffer );
1092 ok( r == ERROR_SUCCESS || r == ERROR_DIRECTORY,
1093 "MsiSetTargetPath on file returned %d\n", r );
1095 r = MsiSetTargetPath( hpkg, "TARGETDIR", tempdir );
1096 ok( r == ERROR_SUCCESS || r == ERROR_DIRECTORY,
1097 "MsiSetTargetPath on 'subdir' of file returned %d\n", r );
1099 DeleteFile( buffer );
1101 r = MsiSetTargetPath( hpkg, "TARGETDIR", buffer );
1102 ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
1104 r = GetFileAttributes( buffer );
1105 ok ( r == INVALID_FILE_ATTRIBUTES, "file/directory exists after MsiSetTargetPath. Attributes: %08X\n", r );
1107 r = MsiSetTargetPath( hpkg, "TARGETDIR", tempdir );
1108 ok( r == ERROR_SUCCESS, "MsiSetTargetPath on subsubdir returned %d\n", r );
1110 sz = sizeof buffer - 1;
1111 lstrcat( tempdir, "\\" );
1112 r = MsiGetTargetPath( hpkg, "TARGETDIR", buffer, &sz );
1113 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
1114 ok( !lstrcmp(buffer, tempdir), "Expected %s, got %s\n", tempdir, buffer);
1116 sprintf( file, "%srootfile.txt", tempdir );
1117 query_file_path( hpkg, "[#RootFile]", buffer );
1118 ok( !lstrcmp(buffer, file), "Expected %s, got %s\n", file, buffer);
1120 r = MsiSetTargetPath( hpkg, "TestParent", "C:\\one\\two" );
1121 ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
1123 query_file_path( hpkg, "[#TestFile]", buffer );
1124 ok( !lstrcmpi(buffer, "C:\\one\\two\\TestDir\\testfile.txt"),
1125 "Expected C:\\one\\two\\TestDir\\testfile.txt, got %s\n", buffer );
1127 sz = sizeof buffer - 1;
1128 r = MsiGetTargetPath( hpkg, "TestParent", buffer, &sz );
1129 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
1130 ok( !lstrcmpi(buffer, "C:\\one\\two\\"), "Expected C:\\one\\two\\, got %s\n", buffer);
1132 r = MsiSetTargetPath( hpkg, "TestParent", "C:\\one\\two\\three" );
1133 ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
1135 sz = sizeof buffer - 1;
1136 r = MsiGetTargetPath( hpkg, "TestParent", buffer, &sz );
1137 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
1138 ok( !lstrcmpi(buffer, "C:\\one\\two\\three\\"), "Expected C:\\one\\two\\three\\, got %s\n", buffer);
1140 MsiCloseHandle( hpkg );
1143 static void test_condition(void)
1148 r = package_from_db(create_package_db(), &hpkg);
1149 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
1151 skip("Not enough rights to perform tests\n");
1152 DeleteFile(msifile);
1155 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
1157 r = MsiEvaluateCondition(0, NULL);
1158 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1160 r = MsiEvaluateCondition(hpkg, NULL);
1161 ok( r == MSICONDITION_NONE, "wrong return val\n");
1163 r = MsiEvaluateCondition(hpkg, "");
1164 ok( r == MSICONDITION_NONE, "wrong return val\n");
1166 r = MsiEvaluateCondition(hpkg, "1");
1167 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1169 r = MsiEvaluateCondition(hpkg, "0");
1170 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1172 r = MsiEvaluateCondition(hpkg, "-1");
1173 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1175 r = MsiEvaluateCondition(hpkg, "0 = 0");
1176 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1178 r = MsiEvaluateCondition(hpkg, "0 <> 0");
1179 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1181 r = MsiEvaluateCondition(hpkg, "0 = 1");
1182 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1184 r = MsiEvaluateCondition(hpkg, "0 > 1");
1185 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1187 r = MsiEvaluateCondition(hpkg, "0 ~> 1");
1188 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1190 r = MsiEvaluateCondition(hpkg, "1 > 1");
1191 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1193 r = MsiEvaluateCondition(hpkg, "1 ~> 1");
1194 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1196 r = MsiEvaluateCondition(hpkg, "0 >= 1");
1197 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1199 r = MsiEvaluateCondition(hpkg, "0 ~>= 1");
1200 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1202 r = MsiEvaluateCondition(hpkg, "1 >= 1");
1203 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1205 r = MsiEvaluateCondition(hpkg, "1 ~>= 1");
1206 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1208 r = MsiEvaluateCondition(hpkg, "0 < 1");
1209 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1211 r = MsiEvaluateCondition(hpkg, "0 ~< 1");
1212 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1214 r = MsiEvaluateCondition(hpkg, "1 < 1");
1215 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1217 r = MsiEvaluateCondition(hpkg, "1 ~< 1");
1218 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1220 r = MsiEvaluateCondition(hpkg, "0 <= 1");
1221 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1223 r = MsiEvaluateCondition(hpkg, "0 ~<= 1");
1224 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1226 r = MsiEvaluateCondition(hpkg, "1 <= 1");
1227 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1229 r = MsiEvaluateCondition(hpkg, "1 ~<= 1");
1230 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1232 r = MsiEvaluateCondition(hpkg, "0 >=");
1233 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1235 r = MsiEvaluateCondition(hpkg, " ");
1236 ok( r == MSICONDITION_NONE, "wrong return val\n");
1238 r = MsiEvaluateCondition(hpkg, "LicView <> \"1\"");
1239 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1241 r = MsiEvaluateCondition(hpkg, "LicView <> \"0\"");
1242 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1244 r = MsiEvaluateCondition(hpkg, "LicView <> LicView");
1245 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1247 r = MsiEvaluateCondition(hpkg, "not 0");
1248 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1250 r = MsiEvaluateCondition(hpkg, "not LicView");
1251 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1253 r = MsiEvaluateCondition(hpkg, "\"Testing\" ~<< \"Testing\"");
1254 ok (r == MSICONDITION_TRUE, "wrong return val\n");
1256 r = MsiEvaluateCondition(hpkg, "LicView ~<< \"Testing\"");
1257 ok (r == MSICONDITION_FALSE, "wrong return val\n");
1259 r = MsiEvaluateCondition(hpkg, "Not LicView ~<< \"Testing\"");
1260 ok (r == MSICONDITION_TRUE, "wrong return val\n");
1262 r = MsiEvaluateCondition(hpkg, "not \"A\"");
1263 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1265 r = MsiEvaluateCondition(hpkg, "~not \"A\"");
1266 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1268 r = MsiEvaluateCondition(hpkg, "\"0\"");
1269 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1271 r = MsiEvaluateCondition(hpkg, "1 and 2");
1272 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1274 r = MsiEvaluateCondition(hpkg, "not 0 and 3");
1275 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1277 r = MsiEvaluateCondition(hpkg, "not 0 and 0");
1278 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1280 r = MsiEvaluateCondition(hpkg, "not 0 or 1");
1281 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1283 r = MsiEvaluateCondition(hpkg, "(0)");
1284 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1286 r = MsiEvaluateCondition(hpkg, "(((((1))))))");
1287 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1289 r = MsiEvaluateCondition(hpkg, "(((((1)))))");
1290 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1292 r = MsiEvaluateCondition(hpkg, " \"A\" < \"B\" ");
1293 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1295 r = MsiEvaluateCondition(hpkg, " \"A\" > \"B\" ");
1296 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1298 r = MsiEvaluateCondition(hpkg, " \"1\" > \"12\" ");
1299 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1301 r = MsiEvaluateCondition(hpkg, " \"100\" < \"21\" ");
1302 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1304 r = MsiEvaluateCondition(hpkg, "0 < > 0");
1305 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1307 r = MsiEvaluateCondition(hpkg, "(1<<1) == 2");
1308 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1310 r = MsiEvaluateCondition(hpkg, " \"A\" = \"a\" ");
1311 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1313 r = MsiEvaluateCondition(hpkg, " \"A\" ~ = \"a\" ");
1314 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1316 r = MsiEvaluateCondition(hpkg, " \"A\" ~= \"a\" ");
1317 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1319 r = MsiEvaluateCondition(hpkg, " \"A\" ~= 1 ");
1320 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1322 r = MsiEvaluateCondition(hpkg, " \"A\" = 1 ");
1323 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1325 r = MsiEvaluateCondition(hpkg, " 1 ~= 1 ");
1326 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1328 r = MsiEvaluateCondition(hpkg, " 1 ~= \"1\" ");
1329 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1331 r = MsiEvaluateCondition(hpkg, " 1 = \"1\" ");
1332 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1334 r = MsiEvaluateCondition(hpkg, " 0 = \"1\" ");
1335 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1337 r = MsiEvaluateCondition(hpkg, " 0 < \"100\" ");
1338 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1340 r = MsiEvaluateCondition(hpkg, " 100 > \"0\" ");
1341 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1343 r = MsiEvaluateCondition(hpkg, "1 XOR 1");
1344 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1346 r = MsiEvaluateCondition(hpkg, "1 IMP 1");
1347 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1349 r = MsiEvaluateCondition(hpkg, "1 IMP 0");
1350 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1352 r = MsiEvaluateCondition(hpkg, "0 IMP 0");
1353 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1355 r = MsiEvaluateCondition(hpkg, "0 EQV 0");
1356 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1358 r = MsiEvaluateCondition(hpkg, "0 EQV 1");
1359 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1361 r = MsiEvaluateCondition(hpkg, "1 IMP 1 OR 0");
1362 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1364 r = MsiEvaluateCondition(hpkg, "1 IMPL 1");
1365 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1367 r = MsiEvaluateCondition(hpkg, "\"ASFD\" >< \"S\" ");
1368 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1370 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"s\" ");
1371 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1373 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"\" ");
1374 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1376 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"sss\" ");
1377 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1379 MsiSetProperty(hpkg, "mm", "5" );
1381 r = MsiEvaluateCondition(hpkg, "mm = 5");
1382 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1384 r = MsiEvaluateCondition(hpkg, "mm < 6");
1385 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1387 r = MsiEvaluateCondition(hpkg, "mm <= 5");
1388 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1390 r = MsiEvaluateCondition(hpkg, "mm > 4");
1391 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1393 r = MsiEvaluateCondition(hpkg, "mm < 12");
1394 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1396 r = MsiEvaluateCondition(hpkg, "mm = \"5\"");
1397 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1399 r = MsiEvaluateCondition(hpkg, "0 = \"\"");
1400 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1402 r = MsiEvaluateCondition(hpkg, "0 AND \"\"");
1403 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1405 r = MsiEvaluateCondition(hpkg, "1 AND \"\"");
1406 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1408 r = MsiEvaluateCondition(hpkg, "1 AND \"1\"");
1409 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1411 r = MsiEvaluateCondition(hpkg, "3 >< 1");
1412 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1414 r = MsiEvaluateCondition(hpkg, "3 >< 4");
1415 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1417 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 0");
1418 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1420 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 1");
1421 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1423 r = MsiEvaluateCondition(hpkg, "NOT 1 OR 0");
1424 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1426 r = MsiEvaluateCondition(hpkg, "0 AND 1 OR 1");
1427 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1429 r = MsiEvaluateCondition(hpkg, "0 AND 0 OR 1");
1430 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1432 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 1 OR 0");
1433 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1435 r = MsiEvaluateCondition(hpkg, "_1 = _1");
1436 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1438 r = MsiEvaluateCondition(hpkg, "( 1 AND 1 ) = 2");
1439 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1441 r = MsiEvaluateCondition(hpkg, "NOT ( 1 AND 1 )");
1442 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1444 r = MsiEvaluateCondition(hpkg, "NOT A AND (BBBBBBBBBB=2 OR CCC=1) AND Ddddddddd");
1445 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1447 r = MsiEvaluateCondition(hpkg, "Installed<>\"\"");
1448 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1450 r = MsiEvaluateCondition(hpkg, "NOT 1 AND 0");
1451 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1453 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1454 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1456 r = MsiEvaluateCondition(hpkg, "bandalmael<>0");
1457 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1459 r = MsiEvaluateCondition(hpkg, "bandalmael<0");
1460 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1462 r = MsiEvaluateCondition(hpkg, "bandalmael>0");
1463 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1465 r = MsiEvaluateCondition(hpkg, "bandalmael>=0");
1466 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1468 r = MsiEvaluateCondition(hpkg, "bandalmael<=0");
1469 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1471 r = MsiEvaluateCondition(hpkg, "bandalmael~<>0");
1472 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1474 MsiSetProperty(hpkg, "bandalmael", "0" );
1475 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1476 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1478 MsiSetProperty(hpkg, "bandalmael", "" );
1479 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1480 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1482 MsiSetProperty(hpkg, "bandalmael", "asdf" );
1483 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1484 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1486 MsiSetProperty(hpkg, "bandalmael", "0asdf" );
1487 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1488 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1490 MsiSetProperty(hpkg, "bandalmael", "0 " );
1491 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1492 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1494 MsiSetProperty(hpkg, "bandalmael", "-0" );
1495 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1496 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1498 MsiSetProperty(hpkg, "bandalmael", "0000000000000" );
1499 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1500 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1502 MsiSetProperty(hpkg, "bandalmael", "--0" );
1503 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1504 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1506 MsiSetProperty(hpkg, "bandalmael", "0x00" );
1507 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1508 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1510 MsiSetProperty(hpkg, "bandalmael", "-" );
1511 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1512 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1514 MsiSetProperty(hpkg, "bandalmael", "+0" );
1515 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1516 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1518 MsiSetProperty(hpkg, "bandalmael", "0.0" );
1519 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1520 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1521 r = MsiEvaluateCondition(hpkg, "bandalmael<>0");
1522 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1524 MsiSetProperty(hpkg, "one", "hi");
1525 MsiSetProperty(hpkg, "two", "hithere");
1526 r = MsiEvaluateCondition(hpkg, "one >< two");
1527 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1529 MsiSetProperty(hpkg, "one", "hithere");
1530 MsiSetProperty(hpkg, "two", "hi");
1531 r = MsiEvaluateCondition(hpkg, "one >< two");
1532 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1534 MsiSetProperty(hpkg, "one", "hello");
1535 MsiSetProperty(hpkg, "two", "hi");
1536 r = MsiEvaluateCondition(hpkg, "one >< two");
1537 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1539 MsiSetProperty(hpkg, "one", "hellohithere");
1540 MsiSetProperty(hpkg, "two", "hi");
1541 r = MsiEvaluateCondition(hpkg, "one >< two");
1542 ok( r == MSICONDITION_TRUE, "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", "hi");
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", "one 1234");
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", "hi");
1571 r = MsiEvaluateCondition(hpkg, "one << two");
1572 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1574 MsiSetProperty(hpkg, "one", "hi");
1575 MsiSetProperty(hpkg, "two", "hithere");
1576 r = MsiEvaluateCondition(hpkg, "one << two");
1577 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1579 MsiSetProperty(hpkg, "one", "hi");
1580 MsiSetProperty(hpkg, "two", "hi");
1581 r = MsiEvaluateCondition(hpkg, "one << two");
1582 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1584 MsiSetProperty(hpkg, "one", "abcdhithere");
1585 MsiSetProperty(hpkg, "two", "hi");
1586 r = MsiEvaluateCondition(hpkg, "one << two");
1587 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1589 MsiSetProperty(hpkg, "one", "");
1590 MsiSetProperty(hpkg, "two", "hi");
1591 r = MsiEvaluateCondition(hpkg, "one << two");
1592 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1594 MsiSetProperty(hpkg, "one", "hithere");
1595 MsiSetProperty(hpkg, "two", "");
1596 r = MsiEvaluateCondition(hpkg, "one << two");
1597 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1599 MsiSetProperty(hpkg, "one", "");
1600 MsiSetProperty(hpkg, "two", "");
1601 r = MsiEvaluateCondition(hpkg, "one << two");
1602 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1604 MsiSetProperty(hpkg, "one", "1234");
1605 MsiSetProperty(hpkg, "two", "1");
1606 r = MsiEvaluateCondition(hpkg, "one << two");
1607 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1609 MsiSetProperty(hpkg, "one", "1234 one");
1610 MsiSetProperty(hpkg, "two", "1");
1611 r = MsiEvaluateCondition(hpkg, "one << two");
1612 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1614 MsiSetProperty(hpkg, "one", "hithere");
1615 MsiSetProperty(hpkg, "two", "there");
1616 r = MsiEvaluateCondition(hpkg, "one >> two");
1617 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1619 MsiSetProperty(hpkg, "one", "hithere");
1620 MsiSetProperty(hpkg, "two", "hi");
1621 r = MsiEvaluateCondition(hpkg, "one >> two");
1622 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1624 MsiSetProperty(hpkg, "one", "there");
1625 MsiSetProperty(hpkg, "two", "hithere");
1626 r = MsiEvaluateCondition(hpkg, "one >> two");
1627 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1629 MsiSetProperty(hpkg, "one", "there");
1630 MsiSetProperty(hpkg, "two", "there");
1631 r = MsiEvaluateCondition(hpkg, "one >> two");
1632 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1634 MsiSetProperty(hpkg, "one", "abcdhithere");
1635 MsiSetProperty(hpkg, "two", "hi");
1636 r = MsiEvaluateCondition(hpkg, "one >> two");
1637 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1639 MsiSetProperty(hpkg, "one", "");
1640 MsiSetProperty(hpkg, "two", "there");
1641 r = MsiEvaluateCondition(hpkg, "one >> two");
1642 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1644 MsiSetProperty(hpkg, "one", "there");
1645 MsiSetProperty(hpkg, "two", "");
1646 r = MsiEvaluateCondition(hpkg, "one >> two");
1647 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1649 MsiSetProperty(hpkg, "one", "");
1650 MsiSetProperty(hpkg, "two", "");
1651 r = MsiEvaluateCondition(hpkg, "one >> two");
1652 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1654 MsiSetProperty(hpkg, "one", "1234");
1655 MsiSetProperty(hpkg, "two", "4");
1656 r = MsiEvaluateCondition(hpkg, "one >> two");
1657 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1659 MsiSetProperty(hpkg, "one", "one 1234");
1660 MsiSetProperty(hpkg, "two", "4");
1661 r = MsiEvaluateCondition(hpkg, "one >> two");
1662 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1664 MsiSetProperty(hpkg, "MsiNetAssemblySupport", NULL); /* make sure it's empty */
1666 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322\"");
1667 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1669 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport > \"1.1.4322\"");
1670 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1672 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport >= \"1.1.4322\"");
1673 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1675 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport <= \"1.1.4322\"");
1676 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1678 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport <> \"1.1.4322\"");
1679 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1681 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport ~< \"1.1.4322\"");
1682 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1684 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"abcd\"");
1685 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1687 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a1.1.4322\"");
1688 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1690 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322a\"");
1691 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1693 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"0000001.1.4322\"");
1694 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1696 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322.1\"");
1697 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1699 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322.1.1\"");
1700 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1702 r = MsiEvaluateCondition(hpkg, "\"2\" < \"1.1");
1703 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1705 r = MsiEvaluateCondition(hpkg, "\"2\" < \"1.1\"");
1706 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1708 r = MsiEvaluateCondition(hpkg, "\"2\" < \"12.1\"");
1709 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1711 r = MsiEvaluateCondition(hpkg, "\"02.1\" < \"2.11\"");
1712 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1714 r = MsiEvaluateCondition(hpkg, "\"02.1.1\" < \"2.1\"");
1715 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1717 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1\"");
1718 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1720 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1\"");
1721 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1723 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"0\"");
1724 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1726 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"-1\"");
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 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"!\"");
1733 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1735 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"!\"");
1736 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1738 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"/\"");
1739 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1741 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \" \"");
1742 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1744 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"azAZ_\"");
1745 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1747 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a[a]\"");
1748 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1750 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a[a]a\"");
1751 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1753 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a]\"");
1754 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1756 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a]a\"");
1757 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1759 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"{a}\"");
1760 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1762 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"{a\"");
1763 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1765 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a\"");
1766 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1768 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a{\"");
1769 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1771 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a]\"");
1772 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1774 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"A\"");
1775 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1777 MsiSetProperty(hpkg, "MsiNetAssemblySupport", "1.1.4322");
1778 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322\"");
1779 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1781 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.14322\"");
1782 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1784 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.5\"");
1785 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1787 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1\"");
1788 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1790 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1\"");
1791 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1793 MsiSetProperty(hpkg, "one", "1");
1794 r = MsiEvaluateCondition(hpkg, "one < \"1\"");
1795 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1797 MsiSetProperty(hpkg, "X", "5.0");
1799 r = MsiEvaluateCondition(hpkg, "X != \"\"");
1800 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1802 r = MsiEvaluateCondition(hpkg, "X =\"5.0\"");
1803 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1805 r = MsiEvaluateCondition(hpkg, "X =\"5.1\"");
1806 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1808 r = MsiEvaluateCondition(hpkg, "X =\"6.0\"");
1809 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1811 r = MsiEvaluateCondition(hpkg, "X =\"5.0\" or X =\"5.1\" or X =\"6.0\"");
1812 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1814 r = MsiEvaluateCondition(hpkg, "(X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1815 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1817 r = MsiEvaluateCondition(hpkg, "X !=\"\" and (X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1818 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1820 /* feature doesn't exist */
1821 r = MsiEvaluateCondition(hpkg, "&nofeature");
1822 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1824 MsiSetProperty(hpkg, "A", "2");
1825 MsiSetProperty(hpkg, "X", "50");
1827 r = MsiEvaluateCondition(hpkg, "2 <= X");
1828 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1830 r = MsiEvaluateCondition(hpkg, "A <= X");
1831 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1833 r = MsiEvaluateCondition(hpkg, "A <= 50");
1834 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1836 MsiSetProperty(hpkg, "X", "50val");
1838 r = MsiEvaluateCondition(hpkg, "2 <= X");
1839 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1841 r = MsiEvaluateCondition(hpkg, "A <= X");
1842 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1844 MsiSetProperty(hpkg, "A", "7");
1845 MsiSetProperty(hpkg, "X", "50");
1847 r = MsiEvaluateCondition(hpkg, "7 <= X");
1848 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1850 r = MsiEvaluateCondition(hpkg, "A <= X");
1851 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1853 r = MsiEvaluateCondition(hpkg, "A <= 50");
1854 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1856 MsiSetProperty(hpkg, "X", "50val");
1858 r = MsiEvaluateCondition(hpkg, "2 <= X");
1859 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1861 r = MsiEvaluateCondition(hpkg, "A <= X");
1862 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1864 MsiCloseHandle( hpkg );
1865 DeleteFile(msifile);
1868 static BOOL check_prop_empty( MSIHANDLE hpkg, const char * prop)
1876 r = MsiGetProperty( hpkg, prop, buffer, &sz );
1877 return r == ERROR_SUCCESS && buffer[0] == 0 && sz == 0;
1880 static void test_props(void)
1882 MSIHANDLE hpkg, hdb;
1887 hdb = create_package_db();
1889 "CREATE TABLE `Property` ( "
1890 "`Property` CHAR(255) NOT NULL, "
1891 "`Value` CHAR(255) "
1892 "PRIMARY KEY `Property`)" );
1893 ok( r == ERROR_SUCCESS , "Failed\n" );
1896 "INSERT INTO `Property` "
1897 "(`Property`, `Value`) "
1898 "VALUES( 'MetadataCompName', 'Photoshop.dll' )");
1899 ok( r == ERROR_SUCCESS , "Failed\n" );
1901 r = package_from_db( hdb, &hpkg );
1902 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
1904 skip("Not enough rights to perform tests\n");
1905 DeleteFile(msifile);
1908 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
1910 /* test invalid values */
1911 r = MsiGetProperty( 0, NULL, NULL, NULL );
1912 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1914 r = MsiGetProperty( hpkg, NULL, NULL, NULL );
1915 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1917 r = MsiGetProperty( hpkg, "boo", NULL, NULL );
1918 ok( r == ERROR_SUCCESS, "wrong return val\n");
1920 r = MsiGetProperty( hpkg, "boo", buffer, NULL );
1921 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1923 /* test retrieving an empty/nonexistent property */
1925 r = MsiGetProperty( hpkg, "boo", NULL, &sz );
1926 ok( r == ERROR_SUCCESS, "wrong return val\n");
1927 ok( sz == 0, "wrong size returned\n");
1929 check_prop_empty( hpkg, "boo");
1932 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1933 ok( r == ERROR_MORE_DATA, "wrong return val\n");
1934 ok( !strcmp(buffer,"x"), "buffer was changed\n");
1935 ok( sz == 0, "wrong size returned\n");
1939 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1940 ok( r == ERROR_SUCCESS, "wrong return val\n");
1941 ok( buffer[0] == 0, "buffer was not changed\n");
1942 ok( sz == 0, "wrong size returned\n");
1944 /* set the property to something */
1945 r = MsiSetProperty( 0, NULL, NULL );
1946 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
1948 r = MsiSetProperty( hpkg, NULL, NULL );
1949 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1951 r = MsiSetProperty( hpkg, "", NULL );
1952 ok( r == ERROR_SUCCESS, "wrong return val\n");
1954 /* try set and get some illegal property identifiers */
1955 r = MsiSetProperty( hpkg, "", "asdf" );
1956 ok( r == ERROR_FUNCTION_FAILED, "wrong return val\n");
1958 r = MsiSetProperty( hpkg, "=", "asdf" );
1959 ok( r == ERROR_SUCCESS, "wrong return val\n");
1961 r = MsiSetProperty( hpkg, " ", "asdf" );
1962 ok( r == ERROR_SUCCESS, "wrong return val\n");
1964 r = MsiSetProperty( hpkg, "'", "asdf" );
1965 ok( r == ERROR_SUCCESS, "wrong return val\n");
1969 r = MsiGetProperty( hpkg, "'", buffer, &sz );
1970 ok( r == ERROR_SUCCESS, "wrong return val\n");
1971 ok( !strcmp(buffer,"asdf"), "buffer was not changed\n");
1973 /* set empty values */
1974 r = MsiSetProperty( hpkg, "boo", NULL );
1975 ok( r == ERROR_SUCCESS, "wrong return val\n");
1976 ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
1978 r = MsiSetProperty( hpkg, "boo", "" );
1979 ok( r == ERROR_SUCCESS, "wrong return val\n");
1980 ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
1982 /* set a non-empty value */
1983 r = MsiSetProperty( hpkg, "boo", "xyz" );
1984 ok( r == ERROR_SUCCESS, "wrong return val\n");
1988 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1989 ok( r == ERROR_MORE_DATA, "wrong return val\n");
1990 ok( buffer[0] == 0, "buffer was not changed\n");
1991 ok( sz == 3, "wrong size returned\n");
1995 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1996 ok( r == ERROR_SUCCESS, "wrong return val\n");
1997 ok( !strcmp(buffer,"xyz"), "buffer was not changed\n");
1998 ok( sz == 3, "wrong size returned\n");
2002 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
2003 ok( r == ERROR_MORE_DATA, "wrong return val\n");
2004 ok( !strcmp(buffer,"xy"), "buffer was not changed\n");
2005 ok( sz == 3, "wrong size returned\n");
2007 r = MsiSetProperty(hpkg, "SourceDir", "foo");
2008 ok( r == ERROR_SUCCESS, "wrong return val\n");
2011 r = MsiGetProperty(hpkg, "SOURCEDIR", buffer, &sz);
2012 ok( r == ERROR_SUCCESS, "wrong return val\n");
2013 ok( !strcmp(buffer,""), "buffer wrong\n");
2014 ok( sz == 0, "wrong size returned\n");
2017 r = MsiGetProperty(hpkg, "SOMERANDOMNAME", buffer, &sz);
2018 ok( r == ERROR_SUCCESS, "wrong return val\n");
2019 ok( !strcmp(buffer,""), "buffer wrong\n");
2020 ok( sz == 0, "wrong size returned\n");
2023 r = MsiGetProperty(hpkg, "SourceDir", buffer, &sz);
2024 ok( r == ERROR_SUCCESS, "wrong return val\n");
2025 ok( !strcmp(buffer,"foo"), "buffer wrong\n");
2026 ok( sz == 3, "wrong size returned\n");
2028 r = MsiSetProperty(hpkg, "MetadataCompName", "Photoshop.dll");
2029 ok( r == ERROR_SUCCESS, "wrong return val\n");
2032 r = MsiGetProperty(hpkg, "MetadataCompName", NULL, &sz );
2033 ok( r == ERROR_SUCCESS, "return wrong\n");
2034 ok( sz == 13, "size wrong (%d)\n", sz);
2037 r = MsiGetProperty(hpkg, "MetadataCompName", buffer, &sz );
2038 ok( r == ERROR_MORE_DATA, "return wrong\n");
2039 ok( !strcmp(buffer,"Photoshop.dl"), "buffer wrong\n");
2041 r = MsiSetProperty(hpkg, "property", "value");
2042 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2045 r = MsiGetProperty(hpkg, "property", buffer, &sz);
2046 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2047 ok( !strcmp(buffer, "value"), "Expected value, got %s\n", buffer);
2049 r = MsiSetProperty(hpkg, "property", NULL);
2050 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2053 r = MsiGetProperty(hpkg, "property", buffer, &sz);
2054 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2055 ok( !strlen(buffer), "Expected empty string, got %s\n", buffer);
2057 MsiCloseHandle( hpkg );
2058 DeleteFile(msifile);
2061 static BOOL find_prop_in_property(MSIHANDLE hdb, LPCSTR prop, LPCSTR val)
2063 MSIHANDLE hview, hrec;
2065 CHAR buffer[MAX_PATH];
2069 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Property`", &hview);
2070 ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
2071 r = MsiViewExecute(hview, 0);
2072 ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n");
2075 while (r == ERROR_SUCCESS && !found)
2077 r = MsiViewFetch(hview, &hrec);
2078 if (r != ERROR_SUCCESS) break;
2081 r = MsiRecordGetString(hrec, 1, buffer, &sz);
2082 if (r == ERROR_SUCCESS && !lstrcmpA(buffer, prop))
2085 r = MsiRecordGetString(hrec, 2, buffer, &sz);
2086 if (r == ERROR_SUCCESS && !lstrcmpA(buffer, val))
2090 MsiCloseHandle(hrec);
2093 MsiViewClose(hview);
2094 MsiCloseHandle(hview);
2099 static void test_property_table(void)
2103 MSIHANDLE hpkg, hdb, hrec;
2104 char buffer[MAX_PATH], package[10];
2108 hdb = create_package_db();
2109 ok( hdb, "failed to create package\n");
2111 r = package_from_db(hdb, &hpkg);
2112 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2114 skip("Not enough rights to perform tests\n");
2115 DeleteFile(msifile);
2118 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
2120 MsiCloseHandle(hdb);
2122 hdb = MsiGetActiveDatabase(hpkg);
2124 query = "CREATE TABLE `_Property` ( "
2125 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
2126 r = run_query(hdb, query);
2127 ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
2129 MsiCloseHandle(hdb);
2130 MsiCloseHandle(hpkg);
2131 DeleteFile(msifile);
2133 hdb = create_package_db();
2134 ok( hdb, "failed to create package\n");
2136 query = "CREATE TABLE `_Property` ( "
2137 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
2138 r = run_query(hdb, query);
2139 ok(r == ERROR_SUCCESS, "failed to create table\n");
2141 query = "ALTER `_Property` ADD `foo` INTEGER";
2142 r = run_query(hdb, query);
2143 ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n");
2145 query = "ALTER TABLE `_Property` ADD `foo` INTEGER";
2146 r = run_query(hdb, query);
2147 ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n");
2149 query = "ALTER TABLE `_Property` ADD `extra` INTEGER";
2150 r = run_query(hdb, query);
2151 ok(r == ERROR_SUCCESS, "failed to add column\n");
2153 sprintf(package, "#%i", hdb);
2154 r = MsiOpenPackage(package, &hpkg);
2155 todo_wine ok(r != ERROR_SUCCESS, "MsiOpenPackage succeeded\n");
2156 if (r == ERROR_SUCCESS)
2157 MsiCloseHandle(hpkg);
2159 r = MsiCloseHandle(hdb);
2160 ok(r == ERROR_SUCCESS, "MsiCloseHandle failed %u\n", r);
2162 hdb = create_package_db();
2163 ok (hdb, "failed to create package database\n");
2165 r = create_property_table(hdb);
2166 ok(r == ERROR_SUCCESS, "cannot create Property table: %d\n", r);
2168 r = add_property_entry(hdb, "'prop', 'val'");
2169 ok(r == ERROR_SUCCESS, "cannot add property: %d\n", r);
2171 r = package_from_db(hdb, &hpkg);
2172 ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
2174 MsiCloseHandle(hdb);
2177 r = MsiGetProperty(hpkg, "prop", buffer, &sz);
2178 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2179 ok(!lstrcmp(buffer, "val"), "Expected val, got %s\n", buffer);
2181 hdb = MsiGetActiveDatabase(hpkg);
2183 found = find_prop_in_property(hdb, "prop", "val");
2184 ok(found, "prop should be in the _Property table\n");
2186 r = add_property_entry(hdb, "'dantes', 'mercedes'");
2187 ok(r == ERROR_SUCCESS, "cannot add property: %d\n", r);
2189 query = "SELECT * FROM `_Property` WHERE `Property` = 'dantes'";
2190 r = do_query(hdb, query, &hrec);
2191 ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
2193 found = find_prop_in_property(hdb, "dantes", "mercedes");
2194 ok(found == FALSE, "dantes should not be in the _Property table\n");
2197 lstrcpy(buffer, "aaa");
2198 r = MsiGetProperty(hpkg, "dantes", buffer, &sz);
2199 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2200 ok(lstrlenA(buffer) == 0, "Expected empty string, got %s\n", buffer);
2202 r = MsiSetProperty(hpkg, "dantes", "mercedes");
2203 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2205 found = find_prop_in_property(hdb, "dantes", "mercedes");
2206 ok(found == TRUE, "dantes should be in the _Property table\n");
2208 MsiCloseHandle(hdb);
2209 MsiCloseHandle(hpkg);
2210 DeleteFile(msifile);
2213 static UINT try_query_param( MSIHANDLE hdb, LPCSTR szQuery, MSIHANDLE hrec )
2218 res = MsiDatabaseOpenView( hdb, szQuery, &htab );
2219 if( res == ERROR_SUCCESS )
2223 r = MsiViewExecute( htab, hrec );
2224 if( r != ERROR_SUCCESS )
2227 fprintf(stderr,"MsiViewExecute failed %08x\n", res);
2230 r = MsiViewClose( htab );
2231 if( r != ERROR_SUCCESS )
2234 r = MsiCloseHandle( htab );
2235 if( r != ERROR_SUCCESS )
2241 static UINT try_query( MSIHANDLE hdb, LPCSTR szQuery )
2243 return try_query_param( hdb, szQuery, 0 );
2246 static void set_summary_str(MSIHANDLE hdb, DWORD pid, LPCSTR value)
2251 r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2252 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2254 r = MsiSummaryInfoSetPropertyA(summary, pid, VT_LPSTR, 0, NULL, value);
2255 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2257 r = MsiSummaryInfoPersist(summary);
2258 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2260 MsiCloseHandle(summary);
2263 static void set_summary_dword(MSIHANDLE hdb, DWORD pid, DWORD value)
2268 r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2269 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2271 r = MsiSummaryInfoSetPropertyA(summary, pid, VT_I4, value, NULL, NULL);
2272 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2274 r = MsiSummaryInfoPersist(summary);
2275 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2277 MsiCloseHandle(summary);
2280 static void test_msipackage(void)
2282 MSIHANDLE hdb = 0, hpack = 100;
2287 /* NULL szPackagePath */
2288 r = MsiOpenPackage(NULL, &hpack);
2289 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2291 /* empty szPackagePath */
2292 r = MsiOpenPackage("", &hpack);
2293 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2295 skip("Not enough rights to perform tests\n");
2300 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2303 if (r == ERROR_SUCCESS)
2304 MsiCloseHandle(hpack);
2306 /* nonexistent szPackagePath */
2307 r = MsiOpenPackage("nonexistent", &hpack);
2308 ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
2311 r = MsiOpenPackage(msifile, NULL);
2312 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2316 r = MsiOpenPackage(name, &hpack);
2317 ok(r == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", r);
2319 r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
2320 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2322 /* database exists, but is emtpy */
2323 sprintf(name, "#%d", hdb);
2324 r = MsiOpenPackage(name, &hpack);
2325 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2326 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2328 query = "CREATE TABLE `Property` ( "
2329 "`Property` CHAR(72), `Value` CHAR(0) "
2330 "PRIMARY KEY `Property`)";
2331 r = try_query(hdb, query);
2332 ok(r == ERROR_SUCCESS, "failed to create Properties table\n");
2334 query = "CREATE TABLE `InstallExecuteSequence` ("
2335 "`Action` CHAR(72), `Condition` CHAR(0), `Sequence` INTEGER "
2336 "PRIMARY KEY `Action`)";
2337 r = try_query(hdb, query);
2338 ok(r == ERROR_SUCCESS, "failed to create InstallExecuteSequence table\n");
2340 /* a few key tables exist */
2341 sprintf(name, "#%d", hdb);
2342 r = MsiOpenPackage(name, &hpack);
2343 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2344 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2346 MsiCloseHandle(hdb);
2347 DeleteFile(msifile);
2349 /* start with a clean database to show what constitutes a valid package */
2350 r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
2351 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2353 sprintf(name, "#%d", hdb);
2355 /* The following summary information props must exist:
2360 set_summary_dword(hdb, PID_PAGECOUNT, 100);
2361 r = MsiOpenPackage(name, &hpack);
2362 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2363 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2365 set_summary_str(hdb, PID_REVNUMBER, "{004757CD-5092-49c2-AD20-28E1CE0DF5F2}");
2366 r = MsiOpenPackage(name, &hpack);
2367 ok(r == ERROR_SUCCESS,
2368 "Expected ERROR_SUCCESS, got %d\n", r);
2370 MsiCloseHandle(hpack);
2371 MsiCloseHandle(hdb);
2372 DeleteFile(msifile);
2375 static void test_formatrecord2(void)
2377 MSIHANDLE hpkg, hrec ;
2382 r = package_from_db(create_package_db(), &hpkg);
2383 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2385 skip("Not enough rights to perform tests\n");
2386 DeleteFile(msifile);
2389 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
2391 r = MsiSetProperty(hpkg, "Manufacturer", " " );
2392 ok( r == ERROR_SUCCESS, "set property failed\n");
2394 hrec = MsiCreateRecord(2);
2395 ok(hrec, "create record failed\n");
2397 r = MsiRecordSetString( hrec, 0, "[ProgramFilesFolder][Manufacturer]\\asdf");
2398 ok( r == ERROR_SUCCESS, "format record failed\n");
2402 r = MsiFormatRecord( hpkg, hrec, buffer, &sz );
2404 r = MsiRecordSetString(hrec, 0, "[foo][1]");
2405 r = MsiRecordSetString(hrec, 1, "hoo");
2407 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2408 ok( sz == 3, "size wrong\n");
2409 ok( 0 == strcmp(buffer,"hoo"), "wrong output %s\n",buffer);
2410 ok( r == ERROR_SUCCESS, "format failed\n");
2412 r = MsiRecordSetString(hrec, 0, "x[~]x");
2414 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2415 ok( sz == 3, "size wrong\n");
2416 ok( 0 == strcmp(buffer,"x"), "wrong output %s\n",buffer);
2417 ok( r == ERROR_SUCCESS, "format failed\n");
2419 r = MsiRecordSetString(hrec, 0, "[foo.$%}][1]");
2420 r = MsiRecordSetString(hrec, 1, "hoo");
2422 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2423 ok( sz == 3, "size wrong\n");
2424 ok( 0 == strcmp(buffer,"hoo"), "wrong output %s\n",buffer);
2425 ok( r == ERROR_SUCCESS, "format failed\n");
2427 r = MsiRecordSetString(hrec, 0, "[\\[]");
2429 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2430 ok( sz == 1, "size wrong\n");
2431 ok( 0 == strcmp(buffer,"["), "wrong output %s\n",buffer);
2432 ok( r == ERROR_SUCCESS, "format failed\n");
2434 SetEnvironmentVariable("FOO", "BAR");
2435 r = MsiRecordSetString(hrec, 0, "[%FOO]");
2437 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2438 ok( sz == 3, "size wrong\n");
2439 ok( 0 == strcmp(buffer,"BAR"), "wrong output %s\n",buffer);
2440 ok( r == ERROR_SUCCESS, "format failed\n");
2442 r = MsiRecordSetString(hrec, 0, "[[1]]");
2443 r = MsiRecordSetString(hrec, 1, "%FOO");
2445 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2446 ok( sz == 3, "size wrong\n");
2447 ok( 0 == strcmp(buffer,"BAR"), "wrong output %s\n",buffer);
2448 ok( r == ERROR_SUCCESS, "format failed\n");
2450 MsiCloseHandle( hrec );
2451 MsiCloseHandle( hpkg );
2452 DeleteFile(msifile);
2455 static void test_states(void)
2460 INSTALLSTATE state, action;
2462 static const CHAR msifile2[] = "winetest2-package.msi";
2463 static const CHAR msifile3[] = "winetest3-package.msi";
2464 static const CHAR msifile4[] = "winetest4-package.msi";
2466 if (is_process_limited())
2468 skip("process is limited\n");
2472 hdb = create_package_db();
2473 ok ( hdb, "failed to create package database\n" );
2475 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
2476 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
2478 r = create_property_table( hdb );
2479 ok( r == ERROR_SUCCESS, "cannot create Property table: %d\n", r );
2481 r = add_property_entry( hdb, "'ProductCode', '{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}'" );
2482 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2484 r = add_property_entry( hdb, "'ProductLanguage', '1033'" );
2485 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2487 r = add_property_entry( hdb, "'ProductName', 'MSITEST'" );
2488 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2490 r = add_property_entry( hdb, "'ProductVersion', '1.1.1'" );
2491 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2493 r = create_install_execute_sequence_table( hdb );
2494 ok( r == ERROR_SUCCESS, "cannot create InstallExecuteSequence table: %d\n", r );
2496 r = add_install_execute_sequence_entry( hdb, "'CostInitialize', '', '800'" );
2497 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2499 r = add_install_execute_sequence_entry( hdb, "'FileCost', '', '900'" );
2500 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2502 r = add_install_execute_sequence_entry( hdb, "'CostFinalize', '', '1000'" );
2503 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2505 r = add_install_execute_sequence_entry( hdb, "'InstallValidate', '', '1400'" );
2506 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2508 r = add_install_execute_sequence_entry( hdb, "'InstallInitialize', '', '1500'" );
2509 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2511 r = add_install_execute_sequence_entry( hdb, "'ProcessComponents', '', '1600'" );
2512 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2514 r = add_install_execute_sequence_entry( hdb, "'UnpublishFeatures', '', '1800'" );
2515 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2517 r = add_install_execute_sequence_entry( hdb, "'RegisterProduct', '', '6100'" );
2518 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2520 r = add_install_execute_sequence_entry( hdb, "'PublishFeatures', '', '6300'" );
2521 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2523 r = add_install_execute_sequence_entry( hdb, "'PublishProduct', '', '6400'" );
2524 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2526 r = add_install_execute_sequence_entry( hdb, "'InstallFinalize', '', '6600'" );
2527 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2529 r = create_media_table( hdb );
2530 ok( r == ERROR_SUCCESS, "cannot create media table: %d\n", r );
2532 r = add_media_entry( hdb, "'1', '3', '', '', 'DISK1', ''");
2533 ok( r == ERROR_SUCCESS, "cannot add media entry: %d\n", r );
2535 r = create_feature_table( hdb );
2536 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
2538 r = create_component_table( hdb );
2539 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
2541 /* msidbFeatureAttributesFavorLocal */
2542 r = add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
2543 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2545 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
2546 r = add_component_entry( hdb, "'alpha', '{467EC132-739D-4784-A37B-677AA43DBC94}', 'TARGETDIR', 0, '', 'alpha_file'" );
2547 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2549 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
2550 r = add_component_entry( hdb, "'beta', '{2C1F189C-24A6-4C34-B26B-994A6C026506}', 'TARGETDIR', 1, '', 'beta_file'" );
2551 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2553 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
2554 r = add_component_entry( hdb, "'gamma', '{C271E2A4-DE2E-4F70-86D1-6984AF7DE2CA}', 'TARGETDIR', 2, '', 'gamma_file'" );
2555 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2557 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSharedDllRefCount */
2558 r = add_component_entry( hdb, "'theta', '{4EB3129D-81A8-48D5-9801-75600FED3DD9}', 'TARGETDIR', 8, '', 'theta_file'" );
2559 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2561 /* msidbFeatureAttributesFavorSource */
2562 r = add_feature_entry( hdb, "'two', '', '', '', 2, 1, '', 1" );
2563 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2565 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
2566 r = add_component_entry( hdb, "'delta', '{938FD4F2-C648-4259-A03C-7AA3B45643F3}', 'TARGETDIR', 0, '', 'delta_file'" );
2567 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2569 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2570 r = add_component_entry( hdb, "'epsilon', '{D59713B6-C11D-47F2-A395-1E5321781190}', 'TARGETDIR', 1, '', 'epsilon_file'" );
2571 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2573 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
2574 r = add_component_entry( hdb, "'zeta', '{377D33AB-2FAA-42B9-A629-0C0DAE9B9C7A}', 'TARGETDIR', 2, '', 'zeta_file'" );
2575 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2577 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSharedDllRefCount */
2578 r = add_component_entry( hdb, "'iota', '{5D36F871-B5ED-4801-9E0F-C46B9E5C9669}', 'TARGETDIR', 8, '', 'iota_file'" );
2579 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2581 /* msidbFeatureAttributesFavorSource */
2582 r = add_feature_entry( hdb, "'three', '', '', '', 2, 1, '', 1" );
2583 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2585 /* msidbFeatureAttributesFavorLocal */
2586 r = add_feature_entry( hdb, "'four', '', '', '', 2, 1, '', 0" );
2587 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2590 r = add_feature_entry( hdb, "'five', '', '', '', 2, 0, '', 1" );
2591 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2593 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2594 r = add_component_entry( hdb, "'eta', '{DD89003F-0DD4-41B8-81C0-3411A7DA2695}', 'TARGETDIR', 1, '', 'eta_file'" );
2595 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2597 /* no feature parent:msidbComponentAttributesLocalOnly */
2598 r = add_component_entry( hdb, "'kappa', '{D6B93DC3-8DA5-4769-9888-42BFE156BB8B}', 'TARGETDIR', 1, '', 'kappa_file'" );
2599 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2601 /* msidbFeatureAttributesFavorLocal:removed */
2602 r = add_feature_entry( hdb, "'six', '', '', '', 2, 1, '', 0" );
2603 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2605 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesLocalOnly */
2606 r = add_component_entry( hdb, "'lambda', '{6528C5E4-02A4-4636-A214-7A66A6C35B64}', 'TARGETDIR', 0, '', 'lambda_file'" );
2607 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2609 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSourceOnly */
2610 r = add_component_entry( hdb, "'mu', '{97014BAB-6C56-4013-9A63-2BF913B42519}', 'TARGETDIR', 1, '', 'mu_file'" );
2611 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2613 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesOptional */
2614 r = add_component_entry( hdb, "'nu', '{943DD0D8-5808-4954-8526-3B8493FEDDCD}', 'TARGETDIR', 2, '', 'nu_file'" );
2615 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2617 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSharedDllRefCount */
2618 r = add_component_entry( hdb, "'xi', '{D6CF9EF7-6FCF-4930-B34B-F938AEFF9BDB}', 'TARGETDIR', 8, '', 'xi_file'" );
2619 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2621 /* msidbFeatureAttributesFavorSource:removed */
2622 r = add_feature_entry( hdb, "'seven', '', '', '', 2, 1, '', 1" );
2623 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2625 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesLocalOnly */
2626 r = add_component_entry( hdb, "'omicron', '{7B57521D-15DB-4141-9AA6-01D934A4433F}', 'TARGETDIR', 0, '', 'omicron_file'" );
2627 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2629 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSourceOnly */
2630 r = add_component_entry( hdb, "'pi', '{FB85346B-378E-4492-8769-792305471C81}', 'TARGETDIR', 1, '', 'pi_file'" );
2631 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2633 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesOptional */
2634 r = add_component_entry( hdb, "'rho', '{798F2047-7B0C-4783-8BB0-D703E554114B}', 'TARGETDIR', 2, '', 'rho_file'" );
2635 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2637 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSharedDllRefCount */
2638 r = add_component_entry( hdb, "'sigma', '{5CE9DDA8-B67B-4736-9D93-99D61C5B93E7}', 'TARGETDIR', 8, '', 'sigma_file'" );
2639 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2641 /* msidbFeatureAttributesFavorLocal */
2642 r = add_feature_entry( hdb, "'eight', '', '', '', 2, 1, '', 0" );
2643 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2645 r = add_component_entry( hdb, "'tau', '{07DEB510-677C-4A6F-A0A6-7CD8EFEA77ED}', 'TARGETDIR', 1, '', 'tau_file'" );
2646 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2648 /* msidbFeatureAttributesFavorSource */
2649 r = add_feature_entry( hdb, "'nine', '', '', '', 2, 1, '', 1" );
2650 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2652 r = add_component_entry( hdb, "'phi', '{9F0594C5-35AD-43EA-94DD-8DF73FAA664D}', 'TARGETDIR', 1, '', 'phi_file'" );
2653 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2655 /* msidbFeatureAttributesFavorAdvertise */
2656 r = add_feature_entry( hdb, "'ten', '', '', '', 2, 1, '', 4" );
2657 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2659 r = add_component_entry( hdb, "'chi', '{E6B539AB-5DA9-4236-A2D2-E341A50B4C38}', 'TARGETDIR', 1, '', 'chi_file'" );
2660 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2662 r = create_feature_components_table( hdb );
2663 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
2665 r = add_feature_components_entry( hdb, "'one', 'alpha'" );
2666 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2668 r = add_feature_components_entry( hdb, "'one', 'beta'" );
2669 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2671 r = add_feature_components_entry( hdb, "'one', 'gamma'" );
2672 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2674 r = add_feature_components_entry( hdb, "'one', 'theta'" );
2675 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2677 r = add_feature_components_entry( hdb, "'two', 'delta'" );
2678 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2680 r = add_feature_components_entry( hdb, "'two', 'epsilon'" );
2681 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2683 r = add_feature_components_entry( hdb, "'two', 'zeta'" );
2684 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2686 r = add_feature_components_entry( hdb, "'two', 'iota'" );
2687 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2689 r = add_feature_components_entry( hdb, "'three', 'eta'" );
2690 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2692 r = add_feature_components_entry( hdb, "'four', 'eta'" );
2693 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2695 r = add_feature_components_entry( hdb, "'five', 'eta'" );
2696 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2698 r = add_feature_components_entry( hdb, "'six', 'lambda'" );
2699 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2701 r = add_feature_components_entry( hdb, "'six', 'mu'" );
2702 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2704 r = add_feature_components_entry( hdb, "'six', 'nu'" );
2705 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2707 r = add_feature_components_entry( hdb, "'six', 'xi'" );
2708 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2710 r = add_feature_components_entry( hdb, "'seven', 'omicron'" );
2711 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2713 r = add_feature_components_entry( hdb, "'seven', 'pi'" );
2714 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2716 r = add_feature_components_entry( hdb, "'seven', 'rho'" );
2717 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2719 r = add_feature_components_entry( hdb, "'seven', 'sigma'" );
2720 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2722 r = add_feature_components_entry( hdb, "'eight', 'tau'" );
2723 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2725 r = add_feature_components_entry( hdb, "'nine', 'phi'" );
2726 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2728 r = add_feature_components_entry( hdb, "'ten', 'chi'" );
2729 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2731 r = create_file_table( hdb );
2732 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
2734 r = add_file_entry( hdb, "'alpha_file', 'alpha', 'alpha.txt', 100, '', '1033', 8192, 1" );
2735 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2737 r = add_file_entry( hdb, "'beta_file', 'beta', 'beta.txt', 0, '', '1033', 8192, 1" );
2738 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2740 r = add_file_entry( hdb, "'gamma_file', 'gamma', 'gamma.txt', 0, '', '1033', 8192, 1" );
2741 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2743 r = add_file_entry( hdb, "'theta_file', 'theta', 'theta.txt', 0, '', '1033', 8192, 1" );
2744 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2746 r = add_file_entry( hdb, "'delta_file', 'delta', 'delta.txt', 0, '', '1033', 8192, 1" );
2747 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2749 r = add_file_entry( hdb, "'epsilon_file', 'epsilon', 'epsilon.txt', 0, '', '1033', 8192, 1" );
2750 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2752 r = add_file_entry( hdb, "'zeta_file', 'zeta', 'zeta.txt', 0, '', '1033', 8192, 1" );
2753 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2755 r = add_file_entry( hdb, "'iota_file', 'iota', 'iota.txt', 0, '', '1033', 8192, 1" );
2756 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2758 /* compressed file */
2759 r = add_file_entry( hdb, "'eta_file', 'eta', 'eta.txt', 0, '', '1033', 16384, 1" );
2760 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2762 r = add_file_entry( hdb, "'kappa_file', 'kappa', 'kappa.txt', 0, '', '1033', 8192, 1" );
2763 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2765 r = add_file_entry( hdb, "'lambda_file', 'lambda', 'lambda.txt', 100, '', '1033', 8192, 1" );
2766 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2768 r = add_file_entry( hdb, "'mu_file', 'mu', 'mu.txt', 100, '', '1033', 8192, 1" );
2769 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2771 r = add_file_entry( hdb, "'nu_file', 'nu', 'nu.txt', 100, '', '1033', 8192, 1" );
2772 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2774 r = add_file_entry( hdb, "'xi_file', 'xi', 'xi.txt', 100, '', '1033', 8192, 1" );
2775 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2777 r = add_file_entry( hdb, "'omicron_file', 'omicron', 'omicron.txt', 100, '', '1033', 8192, 1" );
2778 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2780 r = add_file_entry( hdb, "'pi_file', 'pi', 'pi.txt', 100, '', '1033', 8192, 1" );
2781 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2783 r = add_file_entry( hdb, "'rho_file', 'rho', 'rho.txt', 100, '', '1033', 8192, 1" );
2784 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2786 r = add_file_entry( hdb, "'sigma_file', 'sigma', 'sigma.txt', 100, '', '1033', 8192, 1" );
2787 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2789 r = add_file_entry( hdb, "'tau_file', 'tau', 'tau.txt', 100, '', '1033', 8192, 1" );
2790 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2792 r = add_file_entry( hdb, "'phi_file', 'phi', 'phi.txt', 100, '', '1033', 8192, 1" );
2793 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2795 r = add_file_entry( hdb, "'chi_file', 'chi', 'chi.txt', 100, '', '1033', 8192, 1" );
2796 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2798 MsiDatabaseCommit(hdb);
2800 /* these properties must not be in the saved msi file */
2801 r = add_property_entry( hdb, "'ADDLOCAL', 'one,four'");
2802 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2804 r = add_property_entry( hdb, "'ADDSOURCE', 'two,three'");
2805 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2807 r = add_property_entry( hdb, "'REMOVE', 'six,seven'");
2808 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2810 r = add_property_entry( hdb, "'REINSTALL', 'eight,nine,ten'");
2811 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2813 r = add_property_entry( hdb, "'REINSTALLMODE', 'omus'");
2814 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2816 r = package_from_db( hdb, &hpkg );
2817 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2819 skip("Not enough rights to perform tests\n");
2820 DeleteFile(msifile);
2823 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
2825 MsiCloseHandle(hdb);
2827 CopyFileA(msifile, msifile2, FALSE);
2828 CopyFileA(msifile, msifile3, FALSE);
2829 CopyFileA(msifile, msifile4, FALSE);
2833 r = MsiGetFeatureState(hpkg, "one", &state, &action);
2834 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2835 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2836 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2840 r = MsiGetFeatureState(hpkg, "two", &state, &action);
2841 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2842 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2843 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2847 r = MsiGetFeatureState(hpkg, "three", &state, &action);
2848 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2849 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2850 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2854 r = MsiGetFeatureState(hpkg, "four", &state, &action);
2855 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2856 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2857 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2861 r = MsiGetFeatureState(hpkg, "five", &state, &action);
2862 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2863 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2864 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2868 r = MsiGetFeatureState(hpkg, "six", &state, &action);
2869 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2870 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2871 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2875 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
2876 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2877 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2878 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2882 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
2883 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2884 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2885 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2889 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
2890 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2891 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2892 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2896 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
2897 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2898 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2899 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2903 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
2904 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2905 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2906 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2910 r = MsiGetComponentState(hpkg, "beta", &state, &action);
2911 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2912 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2913 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2917 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
2918 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2919 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2920 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2924 r = MsiGetComponentState(hpkg, "theta", &state, &action);
2925 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2926 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2927 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2931 r = MsiGetComponentState(hpkg, "delta", &state, &action);
2932 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2933 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2934 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2938 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
2939 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2940 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2941 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2945 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
2946 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2947 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2948 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2952 r = MsiGetComponentState(hpkg, "iota", &state, &action);
2953 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2954 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2955 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2959 r = MsiGetComponentState(hpkg, "eta", &state, &action);
2960 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2961 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2962 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2966 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
2967 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2968 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2969 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2973 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
2974 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2975 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2976 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2980 r = MsiGetComponentState(hpkg, "mu", &state, &action);
2981 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2982 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2983 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2987 r = MsiGetComponentState(hpkg, "nu", &state, &action);
2988 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2989 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2990 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2994 r = MsiGetComponentState(hpkg, "xi", &state, &action);
2995 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2996 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2997 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3001 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3002 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3003 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3004 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3008 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3009 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3010 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3011 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3015 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3016 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3017 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3018 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3022 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3023 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3024 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3025 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3029 r = MsiGetComponentState(hpkg, "tau", &state, &action);
3030 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3031 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3032 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3036 r = MsiGetComponentState(hpkg, "phi", &state, &action);
3037 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3038 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3039 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3043 r = MsiGetComponentState(hpkg, "chi", &state, &action);
3044 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3045 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3046 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3048 r = MsiDoAction( hpkg, "CostInitialize");
3049 ok( r == ERROR_SUCCESS, "cost init failed\n");
3053 r = MsiGetFeatureState(hpkg, "one", &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);
3060 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3061 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3062 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3063 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3067 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3068 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3069 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3070 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3074 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3075 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3076 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3077 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3081 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3082 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3083 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3084 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3088 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3089 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3090 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3091 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3095 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3096 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3097 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3098 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3102 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3103 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3104 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3105 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3109 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3110 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3111 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3112 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3116 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3117 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3118 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3119 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3123 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3124 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3125 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3126 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3130 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3131 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3132 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3133 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3137 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3138 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3139 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3140 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3144 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3145 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3146 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3147 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3151 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3152 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3153 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3154 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3158 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3159 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3160 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3161 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3165 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3166 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3167 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3168 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3172 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3173 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3174 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3175 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3179 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3180 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3181 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3182 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3186 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3187 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3188 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3189 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3193 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3194 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3195 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3196 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3200 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3201 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3202 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3203 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3207 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3208 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3209 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3210 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3214 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3215 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3216 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3217 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3221 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3222 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3223 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3224 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3228 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3229 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3230 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3231 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3235 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3236 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3237 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3238 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3242 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3243 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3244 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3245 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3249 r = MsiGetComponentState(hpkg, "tau", &state, &action);
3250 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3251 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3252 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3256 r = MsiGetComponentState(hpkg, "phi", &state, &action);
3257 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3258 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3259 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3263 r = MsiGetComponentState(hpkg, "chi", &state, &action);
3264 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3265 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3266 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3268 r = MsiDoAction( hpkg, "FileCost");
3269 ok( r == ERROR_SUCCESS, "file cost failed\n");
3273 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3274 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3275 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3276 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3280 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3281 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3282 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3283 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3287 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3288 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3289 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3290 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3294 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3295 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3296 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3297 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3301 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3302 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3303 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3304 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3308 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3309 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3310 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3311 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3315 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3316 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3317 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3318 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3322 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3323 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3324 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3325 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3329 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3330 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3331 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3332 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3336 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3337 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3338 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3339 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3343 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3344 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3345 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3346 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3350 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3351 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3352 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3353 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3357 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3358 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3359 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3360 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3364 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3365 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3366 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3367 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3371 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3372 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3373 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3374 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3378 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3379 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3380 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3381 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3385 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3386 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3387 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3388 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3392 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3393 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3394 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3395 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3399 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3400 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3401 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3402 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3406 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3407 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3408 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3409 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3413 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3414 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3415 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3416 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3420 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3421 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3422 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3423 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3427 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3428 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3429 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3430 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3434 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3435 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3436 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3437 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3441 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3442 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3443 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3444 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3448 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3449 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3450 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3451 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3455 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3456 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3457 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3458 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3462 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3463 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3464 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3465 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3469 r = MsiGetComponentState(hpkg, "tau", &state, &action);
3470 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3471 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3472 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3476 r = MsiGetComponentState(hpkg, "phi", &state, &action);
3477 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3478 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3479 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3483 r = MsiGetComponentState(hpkg, "chi", &state, &action);
3484 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3485 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3486 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3488 r = MsiDoAction( hpkg, "CostFinalize");
3489 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
3493 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3494 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3495 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3496 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3500 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3501 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3502 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3503 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3507 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3508 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3509 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3510 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3514 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3515 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3516 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3517 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3521 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3522 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3523 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3524 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3528 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3529 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3530 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3531 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3535 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3536 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3537 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3538 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3542 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3543 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3544 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3545 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3549 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3550 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3551 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3552 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3556 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3557 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3558 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3559 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3563 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3564 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3565 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3566 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3570 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3571 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3572 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3573 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3577 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3578 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3579 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3580 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3584 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3585 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3586 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3587 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3591 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3592 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3593 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3594 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3598 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3599 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3600 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3601 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3605 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3606 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3607 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3608 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3612 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3613 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3614 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3615 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3619 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3620 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3621 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3622 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3626 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3627 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3628 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3629 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3633 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3634 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3635 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3636 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3640 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3641 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3642 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3643 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3647 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3648 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3649 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3650 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3654 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3655 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3656 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3657 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3661 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3662 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3663 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3664 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3668 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3669 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3670 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3671 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3675 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3676 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3677 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3678 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3682 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3683 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3684 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3685 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3689 r = MsiGetComponentState(hpkg, "tau", &state, &action);
3690 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3691 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3692 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3696 r = MsiGetComponentState(hpkg, "phi", &state, &action);
3697 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3698 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3699 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3703 r = MsiGetComponentState(hpkg, "chi", &state, &action);
3704 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3705 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3706 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3708 MsiCloseHandle( hpkg );
3710 /* publish the features and components */
3711 r = MsiInstallProduct(msifile, "ADDLOCAL=one,four ADDSOURCE=two,three REMOVE=six,seven REINSTALL=eight,nine,ten");
3712 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3714 r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
3715 ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
3717 /* these properties must not be in the saved msi file */
3718 r = add_property_entry( hdb, "'ADDLOCAL', 'one,four'");
3719 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3721 r = add_property_entry( hdb, "'ADDSOURCE', 'two,three'");
3722 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3724 r = add_property_entry( hdb, "'REMOVE', 'six,seven'");
3725 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3727 r = add_property_entry( hdb, "'REINSTALL', 'eight,nine,ten'");
3728 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3730 r = package_from_db( hdb, &hpkg );
3731 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
3733 MsiCloseHandle(hdb);
3737 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3738 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3739 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3740 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3744 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3745 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3746 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3747 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3751 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3752 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3753 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3754 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3758 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3759 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3760 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3761 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3765 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3766 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3767 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3768 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3772 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3773 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3774 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3775 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3779 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3780 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3781 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3782 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3786 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3787 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3788 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3789 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3793 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3794 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3795 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3796 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3800 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3801 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3802 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3803 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3807 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3808 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3809 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3810 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3814 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3815 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3816 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3817 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3821 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3822 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3823 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3824 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3828 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3829 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3830 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3831 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3835 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3836 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3837 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3838 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3842 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3843 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3844 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3845 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3849 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3850 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3851 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3852 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3856 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3857 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3858 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3859 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3863 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3864 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3865 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3866 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3870 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3871 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3872 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3873 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3877 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3878 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3879 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3880 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3884 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3885 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3886 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3887 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3891 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3892 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3893 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3894 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3898 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3899 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3900 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3901 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3905 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3906 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3907 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3908 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3912 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3913 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3914 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3915 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3919 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3920 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3921 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3922 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3926 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3927 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3928 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3929 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3933 r = MsiGetComponentState(hpkg, "tau", &state, &action);
3934 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3935 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3936 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3940 r = MsiGetComponentState(hpkg, "phi", &state, &action);
3941 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3942 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3943 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3947 r = MsiGetComponentState(hpkg, "chi", &state, &action);
3948 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3949 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3950 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3952 r = MsiDoAction( hpkg, "CostInitialize");
3953 ok( r == ERROR_SUCCESS, "cost init failed\n");
3957 r = MsiGetFeatureState(hpkg, "one", &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);
3964 r = MsiGetFeatureState(hpkg, "two", &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);
3971 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3972 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3973 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3974 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3978 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3979 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3980 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3981 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3985 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3986 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3987 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3988 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3992 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3993 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3994 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3995 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3999 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4000 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4001 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4002 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4006 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4007 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4008 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4009 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4013 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4014 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4015 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4016 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4020 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
4021 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4022 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4023 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4027 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4028 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4029 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4030 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4034 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4035 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4036 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4037 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4041 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4042 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4043 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4044 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4048 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4049 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4050 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4051 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4055 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4056 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4057 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4058 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4062 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4063 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4064 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4065 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4069 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4070 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4071 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4072 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4076 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4077 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4078 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4079 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4083 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4084 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4085 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4086 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4090 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4091 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4092 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4093 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4097 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4098 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4099 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4100 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4104 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4105 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4106 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4107 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4111 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4112 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4113 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4114 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4118 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4119 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4120 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4121 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4125 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4126 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4127 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4128 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4132 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4133 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4134 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4135 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4139 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4140 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4141 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4142 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4146 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4147 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4148 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4149 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4153 r = MsiGetComponentState(hpkg, "tau", &state, &action);
4154 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4155 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4156 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4160 r = MsiGetComponentState(hpkg, "phi", &state, &action);
4161 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4162 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4163 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4167 r = MsiGetComponentState(hpkg, "chi", &state, &action);
4168 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4169 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4170 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4172 r = MsiDoAction( hpkg, "FileCost");
4173 ok( r == ERROR_SUCCESS, "file cost failed\n");
4177 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4178 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4179 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4180 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4184 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4185 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4186 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4187 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4191 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4192 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4193 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4194 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4198 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4199 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4200 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4201 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4205 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4206 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4207 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4208 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4212 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4213 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4214 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4215 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4219 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4220 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4221 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4222 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4226 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4227 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4228 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4229 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4233 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4234 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4235 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4236 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4240 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4241 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4242 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4243 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4247 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4248 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4249 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4250 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4254 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4255 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4256 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4257 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4261 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4262 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4263 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4264 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4268 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4269 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4270 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4271 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4275 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4276 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4277 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4278 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4282 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4283 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4284 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4285 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4289 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4290 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4291 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4292 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4296 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4297 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4298 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4299 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4303 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4304 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4305 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4306 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4310 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4311 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4312 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4313 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4317 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4318 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4319 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4320 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4324 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4325 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4326 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4327 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4331 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4332 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4333 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4334 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4338 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4339 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4340 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4341 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4345 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4346 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4347 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4348 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4352 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4353 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4354 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4355 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4359 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4360 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4361 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4362 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4366 r = MsiGetComponentState(hpkg, "tau", &state, &action);
4367 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4368 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4369 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4373 r = MsiGetComponentState(hpkg, "phi", &state, &action);
4374 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4375 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4376 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4380 r = MsiGetComponentState(hpkg, "chi", &state, &action);
4381 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4382 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4383 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4385 r = MsiDoAction( hpkg, "CostFinalize");
4386 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
4390 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4391 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4392 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4393 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4397 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4398 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4399 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4400 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
4404 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4405 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4406 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4407 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4411 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4412 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4413 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4414 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4418 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4419 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4420 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4421 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4425 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4426 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4427 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4428 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4432 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4433 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4434 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4435 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4439 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4440 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4441 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4442 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4446 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4447 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4448 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4449 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4453 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
4454 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4455 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4456 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4460 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4461 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4462 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4463 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4467 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4468 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4469 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4470 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
4474 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4475 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4476 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4477 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4481 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4482 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4483 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4484 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4488 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4489 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4490 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4491 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4495 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4496 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4497 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4498 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4502 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4503 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4504 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4505 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4509 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4510 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4511 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4512 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4516 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4517 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4518 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4519 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4523 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4524 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4525 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4526 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4530 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4531 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4532 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4533 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4537 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4538 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4539 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4540 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4544 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4545 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4546 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4547 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4551 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4552 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4553 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4554 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4558 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4559 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4560 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4561 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4565 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4566 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4567 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4568 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4572 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4573 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4574 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4575 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4579 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4580 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4581 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4582 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4586 r = MsiGetComponentState(hpkg, "tau", &state, &action);
4587 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4588 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4589 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4593 r = MsiGetComponentState(hpkg, "phi", &state, &action);
4594 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4595 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4596 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4600 r = MsiGetComponentState(hpkg, "chi", &state, &action);
4601 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4602 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4603 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4605 MsiCloseHandle(hpkg);
4607 /* uninstall the product */
4608 r = MsiInstallProduct(msifile, "REMOVE=ALL");
4609 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4611 /* all features installed locally */
4612 r = MsiInstallProduct(msifile2, "ADDLOCAL=ALL");
4613 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4615 r = MsiOpenDatabase(msifile2, MSIDBOPEN_DIRECT, &hdb);
4616 ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
4618 /* these properties must not be in the saved msi file */
4619 r = add_property_entry( hdb, "'ADDLOCAL', 'one,two,three,four,five,six,seven,eight,nine,ten'");
4620 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
4622 r = package_from_db( hdb, &hpkg );
4623 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
4627 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4628 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4629 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4630 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4634 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4635 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4636 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4637 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4641 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4642 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4643 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4644 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4648 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4649 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4650 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4651 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4655 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4656 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4657 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4658 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4662 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4663 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4664 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4665 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4669 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4670 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4671 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4672 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4676 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4677 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4678 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4679 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4683 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4684 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4685 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4686 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4690 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
4691 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4692 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4693 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4697 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4698 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4699 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4700 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4704 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4705 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4706 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4707 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4711 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4712 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4713 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4714 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4718 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4719 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4720 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4721 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4725 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4726 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4727 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4728 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4732 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4733 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4734 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4735 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4739 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4740 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4741 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4742 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4746 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4747 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4748 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4749 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4753 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4754 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4755 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4756 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4760 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4761 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4762 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4763 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4767 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4768 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4769 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4770 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4774 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4775 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4776 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4777 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4781 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4782 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4783 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4784 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4788 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4789 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4790 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4791 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4795 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4796 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4797 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4798 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4802 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4803 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4804 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4805 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4809 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4810 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4811 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4812 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4816 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4817 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4818 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4819 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4823 r = MsiGetComponentState(hpkg, "tau", &state, &action);
4824 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4825 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4826 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4830 r = MsiGetComponentState(hpkg, "phi", &state, &action);
4831 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4832 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4833 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4837 r = MsiGetComponentState(hpkg, "chi", &state, &action);
4838 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4839 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4840 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4842 r = MsiDoAction( hpkg, "CostInitialize");
4843 ok( r == ERROR_SUCCESS, "cost init failed\n");
4847 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4848 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4849 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4850 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4854 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4855 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4856 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4857 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4861 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4862 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4863 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4864 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4868 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4869 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4870 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4871 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4875 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4876 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4877 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4878 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4882 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4883 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4884 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4885 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4889 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4890 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4891 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4892 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4896 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4897 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4898 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4899 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4903 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4904 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4905 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4906 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4910 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
4911 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4912 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4913 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4917 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4918 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4919 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4920 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4924 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4925 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4926 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4927 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4931 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4932 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4933 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4934 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4938 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4939 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4940 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4941 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4945 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4946 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4947 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4948 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4952 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4953 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4954 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4955 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4959 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4960 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4961 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4962 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4966 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4967 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4968 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4969 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4973 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4974 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4975 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4976 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4980 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4981 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4982 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4983 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4987 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4988 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4989 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4990 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4994 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4995 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4996 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4997 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5001 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5002 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5003 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5004 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5008 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5009 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5010 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5011 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5015 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5016 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5017 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5018 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5022 r = MsiGetComponentState(hpkg, "pi", &state, &action);
5023 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5024 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5025 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5029 r = MsiGetComponentState(hpkg, "rho", &state, &action);
5030 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5031 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5032 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5036 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5037 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5038 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5039 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5043 r = MsiGetComponentState(hpkg, "tau", &state, &action);
5044 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5045 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5046 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5050 r = MsiGetComponentState(hpkg, "phi", &state, &action);
5051 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5052 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5053 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5057 r = MsiGetComponentState(hpkg, "chi", &state, &action);
5058 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5059 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5060 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5062 r = MsiDoAction( hpkg, "FileCost");
5063 ok( r == ERROR_SUCCESS, "file cost failed\n");
5067 r = MsiGetFeatureState(hpkg, "one", &state, &action);
5068 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5069 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5070 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5074 r = MsiGetFeatureState(hpkg, "two", &state, &action);
5075 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5076 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5077 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5081 r = MsiGetFeatureState(hpkg, "three", &state, &action);
5082 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5083 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5084 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5088 r = MsiGetFeatureState(hpkg, "four", &state, &action);
5089 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5090 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5091 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5095 r = MsiGetFeatureState(hpkg, "five", &state, &action);
5096 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5097 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5098 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5102 r = MsiGetFeatureState(hpkg, "six", &state, &action);
5103 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5104 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5105 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5109 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5110 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5111 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5112 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5116 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5117 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5118 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5119 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5123 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5124 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5125 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5126 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5130 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5131 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5132 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5133 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5137 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5138 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5139 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5140 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5144 r = MsiGetComponentState(hpkg, "beta", &state, &action);
5145 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5146 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5147 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5151 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5152 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5153 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5154 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5158 r = MsiGetComponentState(hpkg, "theta", &state, &action);
5159 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5160 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5161 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5165 r = MsiGetComponentState(hpkg, "delta", &state, &action);
5166 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5167 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5168 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5172 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5173 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5174 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5175 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5179 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5180 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5181 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5182 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5186 r = MsiGetComponentState(hpkg, "iota", &state, &action);
5187 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5188 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5189 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5193 r = MsiGetComponentState(hpkg, "eta", &state, &action);
5194 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5195 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5196 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5200 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5201 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5202 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5203 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5207 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5208 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5209 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5210 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5214 r = MsiGetComponentState(hpkg, "mu", &state, &action);
5215 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5216 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5217 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5221 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5222 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5223 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5224 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5228 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5229 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5230 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5231 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5235 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5236 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5237 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5238 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5242 r = MsiGetComponentState(hpkg, "pi", &state, &action);
5243 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5244 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5245 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5249 r = MsiGetComponentState(hpkg, "rho", &state, &action);
5250 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5251 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5252 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5256 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5257 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5258 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5259 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5263 r = MsiGetComponentState(hpkg, "tau", &state, &action);
5264 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5265 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5266 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5270 r = MsiGetComponentState(hpkg, "phi", &state, &action);
5271 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5272 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5273 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5277 r = MsiGetComponentState(hpkg, "chi", &state, &action);
5278 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5279 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5280 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5282 r = MsiDoAction( hpkg, "CostFinalize");
5283 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
5287 r = MsiGetFeatureState(hpkg, "one", &state, &action);
5288 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5289 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5290 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5294 r = MsiGetFeatureState(hpkg, "two", &state, &action);
5295 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5296 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5297 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5301 r = MsiGetFeatureState(hpkg, "three", &state, &action);
5302 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5303 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5304 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5308 r = MsiGetFeatureState(hpkg, "four", &state, &action);
5309 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5310 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5311 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5315 r = MsiGetFeatureState(hpkg, "five", &state, &action);
5316 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5317 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
5318 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5322 r = MsiGetFeatureState(hpkg, "six", &state, &action);
5323 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5324 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5325 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5329 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5330 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5331 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5332 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5336 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5337 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5338 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5339 todo_wine ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5343 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5344 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5345 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5346 todo_wine ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5350 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5351 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5352 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5353 todo_wine ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5357 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5358 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5359 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5360 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5364 r = MsiGetComponentState(hpkg, "beta", &state, &action);
5365 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5366 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5367 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5371 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5372 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5373 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5374 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5378 r = MsiGetComponentState(hpkg, "theta", &state, &action);
5379 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5380 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5381 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5385 r = MsiGetComponentState(hpkg, "delta", &state, &action);
5386 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5387 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5388 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5392 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5393 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5394 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5395 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5399 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5400 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5401 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5402 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5406 r = MsiGetComponentState(hpkg, "iota", &state, &action);
5407 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5408 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5409 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5413 r = MsiGetComponentState(hpkg, "eta", &state, &action);
5414 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5415 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5416 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5420 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5421 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5422 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
5423 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5427 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5428 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5429 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5430 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5434 r = MsiGetComponentState(hpkg, "mu", &state, &action);
5435 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5436 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5437 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5441 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5442 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5443 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5444 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5448 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5449 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5450 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5451 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5455 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5456 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5457 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5458 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5462 r = MsiGetComponentState(hpkg, "pi", &state, &action);
5463 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5464 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5465 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5469 r = MsiGetComponentState(hpkg, "rho", &state, &action);
5470 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5471 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5472 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5476 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5477 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5478 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5479 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5483 r = MsiGetComponentState(hpkg, "tau", &state, &action);
5484 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5485 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5486 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5490 r = MsiGetComponentState(hpkg, "phi", &state, &action);
5491 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5492 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5493 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5497 r = MsiGetComponentState(hpkg, "chi", &state, &action);
5498 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5499 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5500 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5502 MsiCloseHandle(hpkg);
5504 /* uninstall the product */
5505 r = MsiInstallProduct(msifile2, "REMOVE=ALL");
5506 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5508 /* all features installed from source */
5509 r = MsiInstallProduct(msifile3, "ADDSOURCE=ALL");
5510 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5512 r = MsiOpenDatabase(msifile3, MSIDBOPEN_DIRECT, &hdb);
5513 ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
5515 /* this property must not be in the saved msi file */
5516 r = add_property_entry( hdb, "'ADDSOURCE', 'one,two,three,four,five,six,seven,eight,nine,ten'");
5517 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
5519 r = package_from_db( hdb, &hpkg );
5520 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
5524 r = MsiGetFeatureState(hpkg, "one", &state, &action);
5525 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5526 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5527 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5531 r = MsiGetFeatureState(hpkg, "two", &state, &action);
5532 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5533 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5534 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5538 r = MsiGetFeatureState(hpkg, "three", &state, &action);
5539 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5540 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5541 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5545 r = MsiGetFeatureState(hpkg, "four", &state, &action);
5546 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5547 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5548 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5552 r = MsiGetFeatureState(hpkg, "five", &state, &action);
5553 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5554 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5555 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5559 r = MsiGetFeatureState(hpkg, "six", &state, &action);
5560 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5561 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5562 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5566 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5567 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5568 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5569 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5573 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5574 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5575 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5576 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5580 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5581 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5582 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5583 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5587 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5588 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5589 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5590 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5594 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5595 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5596 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5597 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5601 r = MsiGetComponentState(hpkg, "beta", &state, &action);
5602 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5603 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5604 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5608 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5609 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5610 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5611 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5615 r = MsiGetComponentState(hpkg, "theta", &state, &action);
5616 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5617 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5618 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5622 r = MsiGetComponentState(hpkg, "delta", &state, &action);
5623 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5624 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5625 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5629 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5630 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5631 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5632 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5636 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5637 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5638 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5639 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5643 r = MsiGetComponentState(hpkg, "iota", &state, &action);
5644 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5645 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5646 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5650 r = MsiGetComponentState(hpkg, "eta", &state, &action);
5651 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5652 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5653 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5657 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5658 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5659 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5660 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5664 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5665 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5666 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5667 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5671 r = MsiGetComponentState(hpkg, "mu", &state, &action);
5672 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5673 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5674 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5678 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5679 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5680 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5681 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5685 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5686 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5687 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5688 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5692 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5693 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5694 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5695 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5699 r = MsiGetComponentState(hpkg, "pi", &state, &action);
5700 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5701 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5702 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5706 r = MsiGetComponentState(hpkg, "rho", &state, &action);
5707 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5708 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5709 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5713 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5714 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5715 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5716 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5720 r = MsiGetComponentState(hpkg, "tau", &state, &action);
5721 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5722 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5723 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5727 r = MsiGetComponentState(hpkg, "phi", &state, &action);
5728 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5729 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5730 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5734 r = MsiGetComponentState(hpkg, "chi", &state, &action);
5735 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5736 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5737 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5739 r = MsiDoAction( hpkg, "CostInitialize");
5740 ok( r == ERROR_SUCCESS, "cost init failed\n");
5744 r = MsiGetFeatureState(hpkg, "one", &state, &action);
5745 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5746 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5747 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5751 r = MsiGetFeatureState(hpkg, "two", &state, &action);
5752 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5753 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5754 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5758 r = MsiGetFeatureState(hpkg, "three", &state, &action);
5759 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5760 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5761 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5765 r = MsiGetFeatureState(hpkg, "four", &state, &action);
5766 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5767 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5768 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5772 r = MsiGetFeatureState(hpkg, "five", &state, &action);
5773 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5774 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5775 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5779 r = MsiGetFeatureState(hpkg, "six", &state, &action);
5780 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5781 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5782 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5786 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5787 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5788 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5789 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5793 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5794 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5795 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5796 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5800 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5801 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5802 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5803 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5807 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5808 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5809 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5810 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5814 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5815 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5816 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5817 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5821 r = MsiGetComponentState(hpkg, "beta", &state, &action);
5822 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5823 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5824 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5828 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5829 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5830 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5831 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5835 r = MsiGetComponentState(hpkg, "theta", &state, &action);
5836 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5837 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5838 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5842 r = MsiGetComponentState(hpkg, "delta", &state, &action);
5843 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5844 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5845 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5849 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5850 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5851 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5852 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5856 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5857 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5858 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5859 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5863 r = MsiGetComponentState(hpkg, "iota", &state, &action);
5864 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5865 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5866 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5870 r = MsiGetComponentState(hpkg, "eta", &state, &action);
5871 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5872 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5873 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5877 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5878 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5879 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5880 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5884 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5885 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5886 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5887 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5891 r = MsiGetComponentState(hpkg, "mu", &state, &action);
5892 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5893 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5894 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5898 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5899 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5900 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5901 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5905 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5906 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5907 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5908 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5912 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5913 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5914 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5915 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5919 r = MsiGetComponentState(hpkg, "pi", &state, &action);
5920 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5921 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5922 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5926 r = MsiGetComponentState(hpkg, "rho", &state, &action);
5927 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5928 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5929 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5933 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5934 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5935 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5936 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5940 r = MsiGetComponentState(hpkg, "tau", &state, &action);
5941 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5942 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5943 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5947 r = MsiGetComponentState(hpkg, "phi", &state, &action);
5948 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5949 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5950 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5954 r = MsiGetComponentState(hpkg, "chi", &state, &action);
5955 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5956 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5957 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5959 r = MsiDoAction( hpkg, "FileCost");
5960 ok( r == ERROR_SUCCESS, "file cost failed\n");
5964 r = MsiGetFeatureState(hpkg, "one", &state, &action);
5965 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5966 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5967 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5971 r = MsiGetFeatureState(hpkg, "two", &state, &action);
5972 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5973 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5974 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5978 r = MsiGetFeatureState(hpkg, "three", &state, &action);
5979 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5980 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5981 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5985 r = MsiGetFeatureState(hpkg, "four", &state, &action);
5986 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5987 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5988 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5992 r = MsiGetFeatureState(hpkg, "five", &state, &action);
5993 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5994 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5995 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5999 r = MsiGetFeatureState(hpkg, "six", &state, &action);
6000 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6001 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6002 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6006 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6007 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6008 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6009 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6013 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6014 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6015 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6016 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6020 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6021 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6022 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6023 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6027 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6028 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6029 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6030 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6034 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6035 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6036 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6037 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6041 r = MsiGetComponentState(hpkg, "beta", &state, &action);
6042 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6043 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6044 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6048 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6049 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6050 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6051 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6055 r = MsiGetComponentState(hpkg, "theta", &state, &action);
6056 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6057 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6058 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6062 r = MsiGetComponentState(hpkg, "delta", &state, &action);
6063 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6064 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6065 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6069 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6070 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6071 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6072 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6076 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6077 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6078 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6079 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6083 r = MsiGetComponentState(hpkg, "iota", &state, &action);
6084 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6085 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6086 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6090 r = MsiGetComponentState(hpkg, "eta", &state, &action);
6091 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6092 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6093 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6097 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6098 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6099 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6100 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6104 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6105 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6106 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6107 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6111 r = MsiGetComponentState(hpkg, "mu", &state, &action);
6112 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6113 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6114 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6118 r = MsiGetComponentState(hpkg, "nu", &state, &action);
6119 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6120 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6121 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6125 r = MsiGetComponentState(hpkg, "xi", &state, &action);
6126 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6127 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6128 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6132 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6133 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6134 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6135 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6139 r = MsiGetComponentState(hpkg, "pi", &state, &action);
6140 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6141 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6142 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6146 r = MsiGetComponentState(hpkg, "rho", &state, &action);
6147 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6148 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6149 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6153 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6154 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6155 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6156 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6160 r = MsiGetComponentState(hpkg, "tau", &state, &action);
6161 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6162 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6163 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6167 r = MsiGetComponentState(hpkg, "phi", &state, &action);
6168 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6169 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6170 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6174 r = MsiGetComponentState(hpkg, "chi", &state, &action);
6175 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6176 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6177 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6179 r = MsiDoAction( hpkg, "CostFinalize");
6180 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
6184 r = MsiGetFeatureState(hpkg, "one", &state, &action);
6185 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6186 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6187 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6191 r = MsiGetFeatureState(hpkg, "two", &state, &action);
6192 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6193 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6194 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6198 r = MsiGetFeatureState(hpkg, "three", &state, &action);
6199 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6200 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6201 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6205 r = MsiGetFeatureState(hpkg, "four", &state, &action);
6206 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6207 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6208 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6212 r = MsiGetFeatureState(hpkg, "five", &state, &action);
6213 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6214 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
6215 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6219 r = MsiGetFeatureState(hpkg, "six", &state, &action);
6220 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6221 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6222 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6226 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6227 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6228 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6229 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6233 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6234 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6235 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6236 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6240 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6241 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6242 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6243 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6247 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6248 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6249 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6250 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6254 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6255 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6256 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6257 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6261 r = MsiGetComponentState(hpkg, "beta", &state, &action);
6262 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6263 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6264 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6268 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6269 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6270 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6271 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6275 r = MsiGetComponentState(hpkg, "theta", &state, &action);
6276 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6277 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6278 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6282 r = MsiGetComponentState(hpkg, "delta", &state, &action);
6283 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6284 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6285 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6289 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6290 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6291 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6292 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6296 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6297 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6298 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6299 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6303 r = MsiGetComponentState(hpkg, "iota", &state, &action);
6304 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6305 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6306 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6310 r = MsiGetComponentState(hpkg, "eta", &state, &action);
6311 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6312 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6313 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6317 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6318 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6319 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
6320 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6324 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6325 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6326 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6327 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6331 r = MsiGetComponentState(hpkg, "mu", &state, &action);
6332 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6333 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6334 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6338 r = MsiGetComponentState(hpkg, "nu", &state, &action);
6339 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6340 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6341 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6345 r = MsiGetComponentState(hpkg, "xi", &state, &action);
6346 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6347 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6348 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6352 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6353 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6354 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6355 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6359 r = MsiGetComponentState(hpkg, "pi", &state, &action);
6360 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6361 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6362 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6366 r = MsiGetComponentState(hpkg, "rho", &state, &action);
6367 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6368 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6369 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6373 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6374 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6375 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6376 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6380 r = MsiGetComponentState(hpkg, "tau", &state, &action);
6381 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6382 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6383 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6387 r = MsiGetComponentState(hpkg, "phi", &state, &action);
6388 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6389 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6390 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6394 r = MsiGetComponentState(hpkg, "chi", &state, &action);
6395 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6396 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6397 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6399 MsiCloseHandle(hpkg);
6401 /* reinstall the product */
6402 r = MsiInstallProduct(msifile3, "REINSTALL=ALL");
6403 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6405 r = MsiOpenDatabase(msifile4, MSIDBOPEN_DIRECT, &hdb);
6406 ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
6408 /* this property must not be in the saved msi file */
6409 r = add_property_entry( hdb, "'ADDSOURCE', 'one,two,three,four,five,six,seven,eight,nine,ten'");
6410 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
6412 r = package_from_db( hdb, &hpkg );
6413 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
6417 r = MsiGetFeatureState(hpkg, "one", &state, &action);
6418 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6419 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6420 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6424 r = MsiGetFeatureState(hpkg, "two", &state, &action);
6425 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6426 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6427 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6431 r = MsiGetFeatureState(hpkg, "three", &state, &action);
6432 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6433 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6434 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6438 r = MsiGetFeatureState(hpkg, "four", &state, &action);
6439 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6440 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6441 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6445 r = MsiGetFeatureState(hpkg, "five", &state, &action);
6446 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6447 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6448 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6452 r = MsiGetFeatureState(hpkg, "six", &state, &action);
6453 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6454 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6455 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6459 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6460 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6461 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6462 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6466 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6467 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6468 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6469 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6473 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6474 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6475 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6476 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6480 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6481 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6482 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6483 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6487 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6488 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6489 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6490 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6494 r = MsiGetComponentState(hpkg, "beta", &state, &action);
6495 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6496 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6497 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6501 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6502 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6503 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6504 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6508 r = MsiGetComponentState(hpkg, "theta", &state, &action);
6509 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6510 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6511 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6515 r = MsiGetComponentState(hpkg, "delta", &state, &action);
6516 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6517 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6518 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6522 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6523 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6524 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6525 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6529 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6530 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6531 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6532 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6536 r = MsiGetComponentState(hpkg, "iota", &state, &action);
6537 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6538 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6539 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6543 r = MsiGetComponentState(hpkg, "eta", &state, &action);
6544 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6545 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6546 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6550 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6551 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6552 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6553 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6557 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6558 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6559 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6560 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6564 r = MsiGetComponentState(hpkg, "mu", &state, &action);
6565 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6566 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6567 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6571 r = MsiGetComponentState(hpkg, "nu", &state, &action);
6572 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6573 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6574 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6578 r = MsiGetComponentState(hpkg, "xi", &state, &action);
6579 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6580 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6581 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6585 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6586 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6587 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6588 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6592 r = MsiGetComponentState(hpkg, "pi", &state, &action);
6593 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6594 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6595 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6599 r = MsiGetComponentState(hpkg, "rho", &state, &action);
6600 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6601 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6602 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6606 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6607 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6608 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6609 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6613 r = MsiGetComponentState(hpkg, "tau", &state, &action);
6614 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6615 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6616 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6620 r = MsiGetComponentState(hpkg, "phi", &state, &action);
6621 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6622 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6623 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6627 r = MsiGetComponentState(hpkg, "chi", &state, &action);
6628 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6629 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6630 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6632 r = MsiDoAction( hpkg, "CostInitialize");
6633 ok( r == ERROR_SUCCESS, "cost init failed\n");
6637 r = MsiGetFeatureState(hpkg, "one", &state, &action);
6638 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6639 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6640 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6644 r = MsiGetFeatureState(hpkg, "two", &state, &action);
6645 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6646 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6647 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6651 r = MsiGetFeatureState(hpkg, "three", &state, &action);
6652 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6653 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6654 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6658 r = MsiGetFeatureState(hpkg, "four", &state, &action);
6659 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6660 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6661 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6665 r = MsiGetFeatureState(hpkg, "five", &state, &action);
6666 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6667 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6668 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6672 r = MsiGetFeatureState(hpkg, "six", &state, &action);
6673 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6674 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6675 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6679 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6680 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6681 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6682 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6686 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6687 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6688 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6689 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6693 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6694 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6695 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6696 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6700 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6701 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6702 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6703 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6707 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6708 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6709 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6710 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6714 r = MsiGetComponentState(hpkg, "beta", &state, &action);
6715 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6716 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6717 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6721 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6722 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6723 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6724 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6728 r = MsiGetComponentState(hpkg, "theta", &state, &action);
6729 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6730 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6731 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6735 r = MsiGetComponentState(hpkg, "delta", &state, &action);
6736 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6737 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6738 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6742 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6743 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6744 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6745 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6749 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6750 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6751 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6752 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6756 r = MsiGetComponentState(hpkg, "iota", &state, &action);
6757 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6758 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6759 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6763 r = MsiGetComponentState(hpkg, "eta", &state, &action);
6764 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6765 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6766 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6770 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6771 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6772 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6773 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6777 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6778 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6779 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6780 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6784 r = MsiGetComponentState(hpkg, "mu", &state, &action);
6785 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6786 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6787 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6791 r = MsiGetComponentState(hpkg, "nu", &state, &action);
6792 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6793 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6794 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6798 r = MsiGetComponentState(hpkg, "xi", &state, &action);
6799 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6800 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6801 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6805 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6806 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6807 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6808 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6812 r = MsiGetComponentState(hpkg, "pi", &state, &action);
6813 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6814 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6815 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6819 r = MsiGetComponentState(hpkg, "rho", &state, &action);
6820 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6821 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6822 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6826 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6827 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6828 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6829 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6833 r = MsiGetComponentState(hpkg, "tau", &state, &action);
6834 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6835 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6836 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6840 r = MsiGetComponentState(hpkg, "phi", &state, &action);
6841 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6842 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6843 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6847 r = MsiGetComponentState(hpkg, "chi", &state, &action);
6848 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6849 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6850 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6852 r = MsiDoAction( hpkg, "FileCost");
6853 ok( r == ERROR_SUCCESS, "file cost failed\n");
6857 r = MsiGetFeatureState(hpkg, "one", &state, &action);
6858 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6859 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6860 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6864 r = MsiGetFeatureState(hpkg, "two", &state, &action);
6865 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6866 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6867 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6871 r = MsiGetFeatureState(hpkg, "three", &state, &action);
6872 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6873 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6874 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6878 r = MsiGetFeatureState(hpkg, "four", &state, &action);
6879 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6880 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6881 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6885 r = MsiGetFeatureState(hpkg, "five", &state, &action);
6886 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6887 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6888 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6892 r = MsiGetFeatureState(hpkg, "six", &state, &action);
6893 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6894 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6895 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6899 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6900 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6901 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6902 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6906 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6907 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6908 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6909 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6913 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6914 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6915 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6916 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6920 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6921 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6922 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6923 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6927 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6928 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6929 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6930 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6934 r = MsiGetComponentState(hpkg, "beta", &state, &action);
6935 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6936 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6937 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6941 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6942 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6943 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6944 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6948 r = MsiGetComponentState(hpkg, "theta", &state, &action);
6949 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6950 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6951 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6955 r = MsiGetComponentState(hpkg, "delta", &state, &action);
6956 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6957 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6958 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6962 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6963 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6964 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6965 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6969 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6970 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6971 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6972 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6976 r = MsiGetComponentState(hpkg, "iota", &state, &action);
6977 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6978 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6979 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6983 r = MsiGetComponentState(hpkg, "eta", &state, &action);
6984 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6985 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6986 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6990 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6991 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6992 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6993 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6997 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6998 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6999 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7000 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7004 r = MsiGetComponentState(hpkg, "mu", &state, &action);
7005 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7006 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7007 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7011 r = MsiGetComponentState(hpkg, "nu", &state, &action);
7012 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7013 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7014 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7018 r = MsiGetComponentState(hpkg, "xi", &state, &action);
7019 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7020 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7021 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7025 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
7026 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7027 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7028 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7032 r = MsiGetComponentState(hpkg, "pi", &state, &action);
7033 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7034 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7035 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7039 r = MsiGetComponentState(hpkg, "rho", &state, &action);
7040 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7041 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7042 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7046 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
7047 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7048 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7049 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7053 r = MsiGetComponentState(hpkg, "tau", &state, &action);
7054 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7055 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7056 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7060 r = MsiGetComponentState(hpkg, "phi", &state, &action);
7061 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7062 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7063 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7067 r = MsiGetComponentState(hpkg, "chi", &state, &action);
7068 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7069 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7070 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7072 r = MsiDoAction( hpkg, "CostFinalize");
7073 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
7077 r = MsiGetFeatureState(hpkg, "one", &state, &action);
7078 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7079 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7080 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7084 r = MsiGetFeatureState(hpkg, "two", &state, &action);
7085 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7086 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7087 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7091 r = MsiGetFeatureState(hpkg, "three", &state, &action);
7092 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7093 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7094 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7098 r = MsiGetFeatureState(hpkg, "four", &state, &action);
7099 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7100 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7101 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7105 r = MsiGetFeatureState(hpkg, "five", &state, &action);
7106 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7107 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
7108 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7112 r = MsiGetFeatureState(hpkg, "six", &state, &action);
7113 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7114 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7115 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7119 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
7120 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7121 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7122 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7126 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
7127 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7128 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7129 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7133 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
7134 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7135 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7136 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7140 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
7141 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7142 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7143 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7147 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
7148 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7149 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7150 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7154 r = MsiGetComponentState(hpkg, "beta", &state, &action);
7155 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7156 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7157 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7161 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
7162 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7163 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7164 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7168 r = MsiGetComponentState(hpkg, "theta", &state, &action);
7169 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7170 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7171 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7175 r = MsiGetComponentState(hpkg, "delta", &state, &action);
7176 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7177 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7178 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7182 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
7183 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7184 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7185 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7189 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
7190 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7191 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7192 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7196 r = MsiGetComponentState(hpkg, "iota", &state, &action);
7197 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7198 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7199 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7203 r = MsiGetComponentState(hpkg, "eta", &state, &action);
7204 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7205 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7206 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7210 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
7211 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7212 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
7213 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7217 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
7218 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7219 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7220 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7224 r = MsiGetComponentState(hpkg, "mu", &state, &action);
7225 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7226 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7227 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7231 r = MsiGetComponentState(hpkg, "nu", &state, &action);
7232 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7233 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7234 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7238 r = MsiGetComponentState(hpkg, "xi", &state, &action);
7239 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7240 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7241 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7245 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
7246 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7247 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7248 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7252 r = MsiGetComponentState(hpkg, "pi", &state, &action);
7253 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7254 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7255 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7259 r = MsiGetComponentState(hpkg, "rho", &state, &action);
7260 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7261 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7262 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7266 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
7267 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7268 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7269 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7273 r = MsiGetComponentState(hpkg, "tau", &state, &action);
7274 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7275 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7276 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7280 r = MsiGetComponentState(hpkg, "phi", &state, &action);
7281 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7282 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7283 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7287 r = MsiGetComponentState(hpkg, "chi", &state, &action);
7288 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7289 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7290 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7292 MsiCloseHandle(hpkg);
7294 /* uninstall the product */
7295 r = MsiInstallProduct(msifile4, "REMOVE=ALL");
7296 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7298 DeleteFileA(msifile);
7299 DeleteFileA(msifile2);
7300 DeleteFileA(msifile3);
7301 DeleteFileA(msifile4);
7304 static void test_getproperty(void)
7306 MSIHANDLE hPackage = 0;
7308 static CHAR empty[] = "";
7312 r = package_from_db(create_package_db(), &hPackage);
7313 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
7315 skip("Not enough rights to perform tests\n");
7316 DeleteFile(msifile);
7319 ok( r == ERROR_SUCCESS, "Failed to create package %u\n", r );
7321 /* set the property */
7322 r = MsiSetProperty(hPackage, "Name", "Value");
7323 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7325 /* retrieve the size, NULL pointer */
7327 r = MsiGetProperty(hPackage, "Name", NULL, &size);
7328 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7329 ok( size == 5, "Expected 5, got %d\n", size);
7331 /* retrieve the size, empty string */
7333 r = MsiGetProperty(hPackage, "Name", empty, &size);
7334 ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
7335 ok( size == 5, "Expected 5, got %d\n", size);
7337 /* don't change size */
7338 r = MsiGetProperty(hPackage, "Name", prop, &size);
7339 ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
7340 ok( size == 5, "Expected 5, got %d\n", size);
7341 ok( !lstrcmp(prop, "Valu"), "Expected Valu, got %s\n", prop);
7343 /* increase the size by 1 */
7345 r = MsiGetProperty(hPackage, "Name", prop, &size);
7346 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7347 ok( size == 5, "Expected 5, got %d\n", size);
7348 ok( !lstrcmp(prop, "Value"), "Expected Value, got %s\n", prop);
7350 r = MsiCloseHandle( hPackage);
7351 ok( r == ERROR_SUCCESS , "Failed to close package\n" );
7352 DeleteFile(msifile);
7355 static void test_removefiles(void)
7361 hdb = create_package_db();
7362 ok ( hdb, "failed to create package database\n" );
7364 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
7365 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
7367 r = create_feature_table( hdb );
7368 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
7370 r = create_component_table( hdb );
7371 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
7373 r = add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
7374 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
7376 r = add_component_entry( hdb, "'hydrogen', '', 'TARGETDIR', 0, '', 'hydrogen_file'" );
7377 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7379 r = add_component_entry( hdb, "'helium', '', 'TARGETDIR', 0, '', 'helium_file'" );
7380 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7382 r = add_component_entry( hdb, "'lithium', '', 'TARGETDIR', 0, '', 'lithium_file'" );
7383 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7385 r = add_component_entry( hdb, "'beryllium', '', 'TARGETDIR', 0, '', 'beryllium_file'" );
7386 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7388 r = add_component_entry( hdb, "'boron', '', 'TARGETDIR', 0, '', 'boron_file'" );
7389 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7391 r = add_component_entry( hdb, "'carbon', '', 'TARGETDIR', 0, '', 'carbon_file'" );
7392 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7394 r = create_feature_components_table( hdb );
7395 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
7397 r = add_feature_components_entry( hdb, "'one', 'hydrogen'" );
7398 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7400 r = add_feature_components_entry( hdb, "'one', 'helium'" );
7401 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7403 r = add_feature_components_entry( hdb, "'one', 'lithium'" );
7404 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7406 r = add_feature_components_entry( hdb, "'one', 'beryllium'" );
7407 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7409 r = add_feature_components_entry( hdb, "'one', 'boron'" );
7410 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7412 r = add_feature_components_entry( hdb, "'one', 'carbon'" );
7413 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7415 r = create_file_table( hdb );
7416 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
7418 r = add_file_entry( hdb, "'hydrogen_file', 'hydrogen', 'hydrogen.txt', 0, '', '1033', 8192, 1" );
7419 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7421 r = add_file_entry( hdb, "'helium_file', 'helium', 'helium.txt', 0, '', '1033', 8192, 1" );
7422 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7424 r = add_file_entry( hdb, "'lithium_file', 'lithium', 'lithium.txt', 0, '', '1033', 8192, 1" );
7425 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7427 r = add_file_entry( hdb, "'beryllium_file', 'beryllium', 'beryllium.txt', 0, '', '1033', 16384, 1" );
7428 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7430 r = add_file_entry( hdb, "'boron_file', 'boron', 'boron.txt', 0, '', '1033', 16384, 1" );
7431 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7433 r = add_file_entry( hdb, "'carbon_file', 'carbon', 'carbon.txt', 0, '', '1033', 16384, 1" );
7434 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7436 r = create_remove_file_table( hdb );
7437 ok( r == ERROR_SUCCESS, "cannot create Remove File table: %d\n", r);
7439 r = package_from_db( hdb, &hpkg );
7440 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
7442 skip("Not enough rights to perform tests\n");
7443 DeleteFile(msifile);
7446 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
7448 MsiCloseHandle( hdb );
7450 create_test_file( "hydrogen.txt" );
7451 create_test_file( "helium.txt" );
7452 create_test_file( "lithium.txt" );
7453 create_test_file( "beryllium.txt" );
7454 create_test_file( "boron.txt" );
7455 create_test_file( "carbon.txt" );
7457 r = MsiSetProperty( hpkg, "TARGETDIR", CURR_DIR );
7458 ok( r == ERROR_SUCCESS, "set property failed\n");
7460 r = MsiDoAction( hpkg, "CostInitialize");
7461 ok( r == ERROR_SUCCESS, "cost init failed\n");
7463 r = MsiDoAction( hpkg, "FileCost");
7464 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
7466 r = MsiDoAction( hpkg, "CostFinalize");
7467 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
7469 r = MsiDoAction( hpkg, "InstallValidate");
7470 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
7472 r = MsiSetComponentState( hpkg, "hydrogen", INSTALLSTATE_ABSENT );
7473 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7475 r = MsiSetComponentState( hpkg, "helium", INSTALLSTATE_LOCAL );
7476 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7478 r = MsiSetComponentState( hpkg, "lithium", INSTALLSTATE_SOURCE );
7479 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7481 r = MsiSetComponentState( hpkg, "beryllium", INSTALLSTATE_ABSENT );
7482 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7484 r = MsiSetComponentState( hpkg, "boron", INSTALLSTATE_LOCAL );
7485 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7487 r = MsiSetComponentState( hpkg, "carbon", INSTALLSTATE_SOURCE );
7488 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7490 r = MsiDoAction( hpkg, "RemoveFiles");
7491 ok( r == ERROR_SUCCESS, "remove files failed\n");
7493 ok(DeleteFileA("hydrogen.txt"), "Expected hydrogen.txt to exist\n");
7494 ok(DeleteFileA("lithium.txt"), "Expected lithium.txt to exist\n");
7495 ok(DeleteFileA("beryllium.txt"), "Expected beryllium.txt to exist\n");
7496 ok(DeleteFileA("carbon.txt"), "Expected carbon.txt to exist\n");
7497 ok(DeleteFileA("helium.txt"), "Expected helium.txt to exist\n");
7498 ok(DeleteFileA("boron.txt"), "Expected boron.txt to exist\n");
7500 MsiCloseHandle( hpkg );
7501 DeleteFileA(msifile);
7504 static void test_appsearch(void)
7509 CHAR prop[MAX_PATH];
7510 DWORD size = MAX_PATH;
7512 hdb = create_package_db();
7513 ok ( hdb, "failed to create package database\n" );
7515 r = create_appsearch_table( hdb );
7516 ok( r == ERROR_SUCCESS, "cannot create AppSearch table: %d\n", r );
7518 r = add_appsearch_entry( hdb, "'WEBBROWSERPROG', 'NewSignature1'" );
7519 ok( r == ERROR_SUCCESS, "cannot add entry: %d\n", r );
7521 r = create_reglocator_table( hdb );
7522 ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
7524 r = add_reglocator_entry( hdb, "'NewSignature1', 0, 'htmlfile\\shell\\open\\command', '', 1" );
7525 ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
7527 r = create_signature_table( hdb );
7528 ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r );
7530 r = add_signature_entry( hdb, "'NewSignature1', 'FileName', '', '', '', '', '', '', ''" );
7531 ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r );
7533 r = package_from_db( hdb, &hpkg );
7534 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
7536 skip("Not enough rights to perform tests\n");
7537 DeleteFile(msifile);
7540 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
7542 MsiCloseHandle( hdb );
7544 r = MsiDoAction( hpkg, "AppSearch" );
7545 ok( r == ERROR_SUCCESS, "AppSearch failed: %d\n", r);
7547 r = MsiGetPropertyA( hpkg, "WEBBROWSERPROG", prop, &size );
7548 ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
7551 ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
7554 MsiCloseHandle( hpkg );
7555 DeleteFileA(msifile);
7558 static void test_appsearch_complocator(void)
7560 MSIHANDLE hpkg, hdb;
7561 CHAR path[MAX_PATH];
7562 CHAR prop[MAX_PATH];
7567 if (!get_user_sid(&usersid))
7570 if (is_process_limited())
7572 skip("process is limited\n");
7576 create_test_file("FileName1");
7577 create_test_file("FileName4");
7578 set_component_path("FileName1", MSIINSTALLCONTEXT_MACHINE,
7579 "{A8AE6692-96BA-4198-8399-145D7D1D0D0E}", NULL, FALSE);
7581 create_test_file("FileName2");
7582 set_component_path("FileName2", MSIINSTALLCONTEXT_USERUNMANAGED,
7583 "{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}", usersid, FALSE);
7585 create_test_file("FileName3");
7586 set_component_path("FileName3", MSIINSTALLCONTEXT_USERMANAGED,
7587 "{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}", usersid, FALSE);
7589 create_test_file("FileName5");
7590 set_component_path("FileName5", MSIINSTALLCONTEXT_MACHINE,
7591 "{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}", NULL, TRUE);
7593 create_test_file("FileName6");
7594 set_component_path("FileName6", MSIINSTALLCONTEXT_MACHINE,
7595 "{C0ECD96F-7898-4410-9667-194BD8C1B648}", NULL, TRUE);
7597 create_test_file("FileName7");
7598 set_component_path("FileName7", MSIINSTALLCONTEXT_MACHINE,
7599 "{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}", NULL, FALSE);
7601 /* dir is FALSE, but we're pretending it's a directory */
7602 set_component_path("IDontExist\\", MSIINSTALLCONTEXT_MACHINE,
7603 "{91B7359B-07F2-4221-AA8D-DE102BB87A5F}", NULL, FALSE);
7605 create_file_with_version("FileName8.dll", MAKELONG(2, 1), MAKELONG(4, 3));
7606 set_component_path("FileName8.dll", MSIINSTALLCONTEXT_MACHINE,
7607 "{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}", NULL, FALSE);
7609 create_file_with_version("FileName9.dll", MAKELONG(1, 2), MAKELONG(3, 4));
7610 set_component_path("FileName9.dll", MSIINSTALLCONTEXT_MACHINE,
7611 "{A204DF48-7346-4635-BA2E-66247DBAC9DF}", NULL, FALSE);
7613 create_file_with_version("FileName10.dll", MAKELONG(2, 1), MAKELONG(4, 3));
7614 set_component_path("FileName10.dll", MSIINSTALLCONTEXT_MACHINE,
7615 "{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}", NULL, FALSE);
7617 hdb = create_package_db();
7618 ok(hdb, "Expected a valid database handle\n");
7620 r = create_appsearch_table(hdb);
7621 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7623 r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
7624 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7626 r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
7627 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7629 r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
7630 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7632 r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
7633 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7635 r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
7636 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7638 r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
7639 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7641 r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
7642 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7644 r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
7645 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7647 r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
7648 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7650 r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
7651 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7653 r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
7654 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7656 r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
7657 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7659 r = create_complocator_table(hdb);
7660 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7662 /* published component, machine, file, signature, misdbLocatorTypeFile */
7663 r = add_complocator_entry(hdb, "'NewSignature1', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 1");
7664 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7666 /* published component, user-unmanaged, file, signature, misdbLocatorTypeFile */
7667 r = add_complocator_entry(hdb, "'NewSignature2', '{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}', 1");
7668 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7670 /* published component, user-managed, file, signature, misdbLocatorTypeFile */
7671 r = add_complocator_entry(hdb, "'NewSignature3', '{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}', 1");
7672 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7674 /* published component, machine, file, signature, misdbLocatorTypeDirectory */
7675 r = add_complocator_entry(hdb, "'NewSignature4', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 0");
7676 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7678 /* published component, machine, dir, signature, misdbLocatorTypeDirectory */
7679 r = add_complocator_entry(hdb, "'NewSignature5', '{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}', 0");
7680 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7682 /* published component, machine, dir, no signature, misdbLocatorTypeDirectory */
7683 r = add_complocator_entry(hdb, "'NewSignature6', '{C0ECD96F-7898-4410-9667-194BD8C1B648}', 0");
7684 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7686 /* published component, machine, file, no signature, misdbLocatorTypeFile */
7687 r = add_complocator_entry(hdb, "'NewSignature7', '{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}', 1");
7688 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7690 /* unpublished component, no signature, misdbLocatorTypeDir */
7691 r = add_complocator_entry(hdb, "'NewSignature8', '{FB671D5B-5083-4048-90E0-481C48D8F3A5}', 0");
7692 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7694 /* published component, no signature, dir does not exist misdbLocatorTypeDir */
7695 r = add_complocator_entry(hdb, "'NewSignature9', '{91B7359B-07F2-4221-AA8D-DE102BB87A5F}', 0");
7696 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7698 /* published component, signature w/ ver, misdbLocatorTypeFile */
7699 r = add_complocator_entry(hdb, "'NewSignature10', '{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}', 1");
7700 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7702 /* published component, signature w/ ver, ver > max, misdbLocatorTypeFile */
7703 r = add_complocator_entry(hdb, "'NewSignature11', '{A204DF48-7346-4635-BA2E-66247DBAC9DF}', 1");
7704 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7706 /* published component, signature w/ ver, sig->name ignored, misdbLocatorTypeFile */
7707 r = add_complocator_entry(hdb, "'NewSignature12', '{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}', 1");
7708 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7710 r = create_signature_table(hdb);
7711 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7713 r = add_signature_entry(hdb, "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''");
7714 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7716 r = add_signature_entry(hdb, "'NewSignature2', 'FileName2', '', '', '', '', '', '', ''");
7717 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7719 r = add_signature_entry(hdb, "'NewSignature3', 'FileName3', '', '', '', '', '', '', ''");
7720 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7722 r = add_signature_entry(hdb, "'NewSignature4', 'FileName4', '', '', '', '', '', '', ''");
7723 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7725 r = add_signature_entry(hdb, "'NewSignature5', 'FileName5', '', '', '', '', '', '', ''");
7726 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7728 r = add_signature_entry(hdb, "'NewSignature10', 'FileName8.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
7729 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7731 r = add_signature_entry(hdb, "'NewSignature11', 'FileName9.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
7732 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7734 r = add_signature_entry(hdb, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
7735 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7737 r = package_from_db(hdb, &hpkg);
7738 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
7740 skip("Not enough rights to perform tests\n");
7743 ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
7745 r = MsiSetPropertyA(hpkg, "SIGPROP8", "october");
7746 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7748 r = MsiDoAction(hpkg, "AppSearch");
7749 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7752 sprintf(path, "%s\\FileName1", CURR_DIR);
7753 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
7754 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7755 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7758 sprintf(path, "%s\\FileName2", CURR_DIR);
7759 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
7760 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7761 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7764 sprintf(path, "%s\\FileName3", CURR_DIR);
7765 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
7766 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7767 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7770 sprintf(path, "%s\\FileName4", CURR_DIR);
7771 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
7772 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7773 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
7776 sprintf(path, "%s\\FileName5", CURR_DIR);
7777 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
7778 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7779 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7782 sprintf(path, "%s\\", CURR_DIR);
7783 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
7784 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7785 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7788 sprintf(path, "%s\\", CURR_DIR);
7789 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
7790 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7791 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7794 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
7795 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7796 ok(!lstrcmpA(prop, "october"), "Expected \"october\", got \"%s\"\n", prop);
7799 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
7800 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7801 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
7804 sprintf(path, "%s\\FileName8.dll", CURR_DIR);
7805 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
7806 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7807 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7810 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
7811 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7812 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
7815 sprintf(path, "%s\\FileName10.dll", CURR_DIR);
7816 r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
7817 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7818 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7820 delete_component_path("{A8AE6692-96BA-4198-8399-145D7D1D0D0E}",
7821 MSIINSTALLCONTEXT_MACHINE, NULL);
7822 delete_component_path("{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}",
7823 MSIINSTALLCONTEXT_USERUNMANAGED, usersid);
7824 delete_component_path("{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}",
7825 MSIINSTALLCONTEXT_USERMANAGED, usersid);
7826 delete_component_path("{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}",
7827 MSIINSTALLCONTEXT_MACHINE, NULL);
7828 delete_component_path("{C0ECD96F-7898-4410-9667-194BD8C1B648}",
7829 MSIINSTALLCONTEXT_MACHINE, NULL);
7830 delete_component_path("{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}",
7831 MSIINSTALLCONTEXT_MACHINE, NULL);
7832 delete_component_path("{91B7359B-07F2-4221-AA8D-DE102BB87A5F}",
7833 MSIINSTALLCONTEXT_MACHINE, NULL);
7834 delete_component_path("{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}",
7835 MSIINSTALLCONTEXT_MACHINE, NULL);
7836 delete_component_path("{A204DF48-7346-4635-BA2E-66247DBAC9DF}",
7837 MSIINSTALLCONTEXT_MACHINE, NULL);
7838 delete_component_path("{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}",
7839 MSIINSTALLCONTEXT_MACHINE, NULL);
7841 MsiCloseHandle(hpkg);
7844 DeleteFileA("FileName1");
7845 DeleteFileA("FileName2");
7846 DeleteFileA("FileName3");
7847 DeleteFileA("FileName4");
7848 DeleteFileA("FileName5");
7849 DeleteFileA("FileName6");
7850 DeleteFileA("FileName7");
7851 DeleteFileA("FileName8.dll");
7852 DeleteFileA("FileName9.dll");
7853 DeleteFileA("FileName10.dll");
7854 DeleteFileA(msifile);
7858 static void test_appsearch_reglocator(void)
7860 MSIHANDLE hpkg, hdb;
7861 CHAR path[MAX_PATH], prop[MAX_PATH];
7862 DWORD binary[2], size, val;
7863 BOOL space, version;
7864 HKEY hklm, classes, hkcu, users;
7865 LPSTR pathdata, pathvar, ptr;
7869 REGSAM access = KEY_ALL_ACCESS;
7872 if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64)
7873 access |= KEY_WOW64_64KEY;
7876 if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
7879 DeleteFileA("test.dll");
7881 res = RegCreateKeyA(HKEY_CLASSES_ROOT, "Software\\Wine", &classes);
7882 if (res == ERROR_ACCESS_DENIED)
7884 skip("Not enough rights to perform tests\n");
7887 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7889 res = RegSetValueExA(classes, "Value1", 0, REG_SZ,
7890 (const BYTE *)"regszdata", 10);
7891 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7893 res = RegCreateKeyA(HKEY_CURRENT_USER, "Software\\Wine", &hkcu);
7894 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7896 res = RegSetValueExA(hkcu, "Value1", 0, REG_SZ,
7897 (const BYTE *)"regszdata", 10);
7898 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7901 res = RegCreateKeyA(HKEY_USERS, "S-1-5-18\\Software\\Wine", &users);
7902 ok(res == ERROR_SUCCESS ||
7903 broken(res == ERROR_INVALID_PARAMETER),
7904 "Expected ERROR_SUCCESS, got %d\n", res);
7906 if (res == ERROR_SUCCESS)
7908 res = RegSetValueExA(users, "Value1", 0, REG_SZ,
7909 (const BYTE *)"regszdata", 10);
7910 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7913 res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine", 0, NULL, 0, access, NULL, &hklm, NULL);
7914 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7916 res = RegSetValueA(hklm, NULL, REG_SZ, "defvalue", 8);
7917 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7919 res = RegSetValueExA(hklm, "Value1", 0, REG_SZ,
7920 (const BYTE *)"regszdata", 10);
7921 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7924 res = RegSetValueExA(hklm, "Value2", 0, REG_DWORD,
7925 (const BYTE *)&val, sizeof(DWORD));
7926 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7929 res = RegSetValueExA(hklm, "Value3", 0, REG_DWORD,
7930 (const BYTE *)&val, sizeof(DWORD));
7931 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7933 res = RegSetValueExA(hklm, "Value4", 0, REG_EXPAND_SZ,
7934 (const BYTE *)"%PATH%", 7);
7935 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7937 res = RegSetValueExA(hklm, "Value5", 0, REG_EXPAND_SZ,
7938 (const BYTE *)"my%NOVAR%", 10);
7939 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7941 res = RegSetValueExA(hklm, "Value6", 0, REG_MULTI_SZ,
7942 (const BYTE *)"one\0two\0", 9);
7943 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7945 binary[0] = 0x1234abcd;
7946 binary[1] = 0x567890ef;
7947 res = RegSetValueExA(hklm, "Value7", 0, REG_BINARY,
7948 (const BYTE *)binary, sizeof(binary));
7949 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7951 res = RegSetValueExA(hklm, "Value8", 0, REG_SZ,
7952 (const BYTE *)"#regszdata", 11);
7953 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7955 create_test_file("FileName1");
7956 sprintf(path, "%s\\FileName1", CURR_DIR);
7957 res = RegSetValueExA(hklm, "Value9", 0, REG_SZ,
7958 (const BYTE *)path, lstrlenA(path) + 1);
7959 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7961 sprintf(path, "%s\\FileName2", CURR_DIR);
7962 res = RegSetValueExA(hklm, "Value10", 0, REG_SZ,
7963 (const BYTE *)path, lstrlenA(path) + 1);
7964 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7966 lstrcpyA(path, CURR_DIR);
7967 res = RegSetValueExA(hklm, "Value11", 0, REG_SZ,
7968 (const BYTE *)path, lstrlenA(path) + 1);
7969 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7971 res = RegSetValueExA(hklm, "Value12", 0, REG_SZ,
7972 (const BYTE *)"", 1);
7973 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7975 create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
7976 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
7977 res = RegSetValueExA(hklm, "Value13", 0, REG_SZ,
7978 (const BYTE *)path, lstrlenA(path) + 1);
7979 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7981 create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
7982 sprintf(path, "%s\\FileName4.dll", CURR_DIR);
7983 res = RegSetValueExA(hklm, "Value14", 0, REG_SZ,
7984 (const BYTE *)path, lstrlenA(path) + 1);
7985 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7987 create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
7988 sprintf(path, "%s\\FileName5.dll", CURR_DIR);
7989 res = RegSetValueExA(hklm, "Value15", 0, REG_SZ,
7990 (const BYTE *)path, lstrlenA(path) + 1);
7991 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7993 sprintf(path, "\"%s\\FileName1\" -option", CURR_DIR);
7994 res = RegSetValueExA(hklm, "value16", 0, REG_SZ,
7995 (const BYTE *)path, lstrlenA(path) + 1);
7997 space = (strchr(CURR_DIR, ' ')) ? TRUE : FALSE;
7998 sprintf(path, "%s\\FileName1 -option", CURR_DIR);
7999 res = RegSetValueExA(hklm, "value17", 0, REG_SZ,
8000 (const BYTE *)path, lstrlenA(path) + 1);
8002 hdb = create_package_db();
8003 ok(hdb, "Expected a valid database handle\n");
8005 r = create_appsearch_table(hdb);
8006 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8008 r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
8009 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8011 r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
8012 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8014 r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
8015 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8017 r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
8018 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8020 r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
8021 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8023 r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
8024 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8026 r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
8027 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8029 r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
8030 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8032 r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
8033 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8035 r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
8036 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8038 r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
8039 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8041 r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
8042 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8044 r = add_appsearch_entry(hdb, "'SIGPROP13', 'NewSignature13'");
8045 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8047 r = add_appsearch_entry(hdb, "'SIGPROP14', 'NewSignature14'");
8048 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8050 r = add_appsearch_entry(hdb, "'SIGPROP15', 'NewSignature15'");
8051 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8053 r = add_appsearch_entry(hdb, "'SIGPROP16', 'NewSignature16'");
8054 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8056 r = add_appsearch_entry(hdb, "'SIGPROP17', 'NewSignature17'");
8057 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8059 r = add_appsearch_entry(hdb, "'SIGPROP18', 'NewSignature18'");
8060 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8062 r = add_appsearch_entry(hdb, "'SIGPROP19', 'NewSignature19'");
8063 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8065 r = add_appsearch_entry(hdb, "'SIGPROP20', 'NewSignature20'");
8066 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8068 r = add_appsearch_entry(hdb, "'SIGPROP21', 'NewSignature21'");
8069 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8071 r = add_appsearch_entry(hdb, "'SIGPROP22', 'NewSignature22'");
8072 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8074 r = add_appsearch_entry(hdb, "'SIGPROP23', 'NewSignature23'");
8075 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8077 r = add_appsearch_entry(hdb, "'SIGPROP24', 'NewSignature24'");
8078 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8080 r = add_appsearch_entry(hdb, "'SIGPROP25', 'NewSignature25'");
8081 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8083 r = add_appsearch_entry(hdb, "'SIGPROP26', 'NewSignature26'");
8084 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8086 r = add_appsearch_entry(hdb, "'SIGPROP27', 'NewSignature27'");
8087 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8089 r = add_appsearch_entry(hdb, "'SIGPROP28', 'NewSignature28'");
8090 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8092 r = add_appsearch_entry(hdb, "'SIGPROP29', 'NewSignature29'");
8093 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8095 r = add_appsearch_entry(hdb, "'SIGPROP30', 'NewSignature30'");
8096 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8098 r = create_reglocator_table(hdb);
8099 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8101 /* HKLM, msidbLocatorTypeRawValue, REG_SZ */
8102 str = "'NewSignature1', 2, 'Software\\Wine', 'Value1', 2";
8103 r = add_reglocator_entry(hdb, str);
8104 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8106 /* HKLM, msidbLocatorTypeRawValue, positive DWORD */
8107 str = "'NewSignature2', 2, 'Software\\Wine', 'Value2', 2";
8108 r = add_reglocator_entry(hdb, str);
8109 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8111 /* HKLM, msidbLocatorTypeRawValue, negative DWORD */
8112 str = "'NewSignature3', 2, 'Software\\Wine', 'Value3', 2";
8113 r = add_reglocator_entry(hdb, str);
8114 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8116 /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
8117 str = "'NewSignature4', 2, 'Software\\Wine', 'Value4', 2";
8118 r = add_reglocator_entry(hdb, str);
8119 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8121 /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
8122 str = "'NewSignature5', 2, 'Software\\Wine', 'Value5', 2";
8123 r = add_reglocator_entry(hdb, str);
8124 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8126 /* HKLM, msidbLocatorTypeRawValue, REG_MULTI_SZ */
8127 str = "'NewSignature6', 2, 'Software\\Wine', 'Value6', 2";
8128 r = add_reglocator_entry(hdb, str);
8129 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8131 /* HKLM, msidbLocatorTypeRawValue, REG_BINARY */
8132 str = "'NewSignature7', 2, 'Software\\Wine', 'Value7', 2";
8133 r = add_reglocator_entry(hdb, str);
8134 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8136 /* HKLM, msidbLocatorTypeRawValue, REG_SZ first char is # */
8137 str = "'NewSignature8', 2, 'Software\\Wine', 'Value8', 2";
8138 r = add_reglocator_entry(hdb, str);
8139 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8141 /* HKLM, msidbLocatorTypeFileName, signature, file exists */
8142 str = "'NewSignature9', 2, 'Software\\Wine', 'Value9', 1";
8143 r = add_reglocator_entry(hdb, str);
8144 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8146 /* HKLM, msidbLocatorTypeFileName, signature, file does not exist */
8147 str = "'NewSignature10', 2, 'Software\\Wine', 'Value10', 1";
8148 r = add_reglocator_entry(hdb, str);
8149 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8151 /* HKLM, msidbLocatorTypeFileName, no signature */
8152 str = "'NewSignature11', 2, 'Software\\Wine', 'Value9', 1";
8153 r = add_reglocator_entry(hdb, str);
8154 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8156 /* HKLM, msidbLocatorTypeDirectory, no signature, file exists */
8157 str = "'NewSignature12', 2, 'Software\\Wine', 'Value9', 0";
8158 r = add_reglocator_entry(hdb, str);
8159 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8161 /* HKLM, msidbLocatorTypeDirectory, no signature, directory exists */
8162 str = "'NewSignature13', 2, 'Software\\Wine', 'Value11', 0";
8163 r = add_reglocator_entry(hdb, str);
8164 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8166 /* HKLM, msidbLocatorTypeDirectory, signature, file exists */
8167 str = "'NewSignature14', 2, 'Software\\Wine', 'Value9', 0";
8168 r = add_reglocator_entry(hdb, str);
8169 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8171 /* HKCR, msidbLocatorTypeRawValue, REG_SZ */
8172 str = "'NewSignature15', 0, 'Software\\Wine', 'Value1', 2";
8173 r = add_reglocator_entry(hdb, str);
8174 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8176 /* HKCU, msidbLocatorTypeRawValue, REG_SZ */
8177 str = "'NewSignature16', 1, 'Software\\Wine', 'Value1', 2";
8178 r = add_reglocator_entry(hdb, str);
8179 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8181 /* HKU, msidbLocatorTypeRawValue, REG_SZ */
8182 str = "'NewSignature17', 3, 'S-1-5-18\\Software\\Wine', 'Value1', 2";
8183 r = add_reglocator_entry(hdb, str);
8184 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8186 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, NULL Name */
8187 str = "'NewSignature18', 2, 'Software\\Wine', '', 2";
8188 r = add_reglocator_entry(hdb, str);
8189 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8191 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, key does not exist */
8192 str = "'NewSignature19', 2, 'Software\\IDontExist', '', 2";
8193 r = add_reglocator_entry(hdb, str);
8194 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8196 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, value is empty */
8197 str = "'NewSignature20', 2, 'Software\\Wine', 'Value12', 2";
8198 r = add_reglocator_entry(hdb, str);
8199 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8201 /* HKLM, msidbLocatorTypeFileName, signature, file exists w/ version */
8202 str = "'NewSignature21', 2, 'Software\\Wine', 'Value13', 1";
8203 r = add_reglocator_entry(hdb, str);
8204 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8206 /* HKLM, msidbLocatorTypeFileName, file exists w/ version, version > max */
8207 str = "'NewSignature22', 2, 'Software\\Wine', 'Value14', 1";
8208 r = add_reglocator_entry(hdb, str);
8209 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8211 /* HKLM, msidbLocatorTypeFileName, file exists w/ version, sig->name ignored */
8212 str = "'NewSignature23', 2, 'Software\\Wine', 'Value15', 1";
8213 r = add_reglocator_entry(hdb, str);
8214 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8216 /* HKLM, msidbLocatorTypeFileName, no signature, directory exists */
8217 str = "'NewSignature24', 2, 'Software\\Wine', 'Value11', 1";
8218 r = add_reglocator_entry(hdb, str);
8219 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8221 /* HKLM, msidbLocatorTypeFileName, no signature, file does not exist */
8222 str = "'NewSignature25', 2, 'Software\\Wine', 'Value10', 1";
8223 r = add_reglocator_entry(hdb, str);
8224 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8226 /* HKLM, msidbLocatorTypeDirectory, signature, directory exists */
8227 str = "'NewSignature26', 2, 'Software\\Wine', 'Value11', 0";
8228 r = add_reglocator_entry(hdb, str);
8229 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8231 /* HKLM, msidbLocatorTypeDirectory, signature, file does not exist */
8232 str = "'NewSignature27', 2, 'Software\\Wine', 'Value10', 0";
8233 r = add_reglocator_entry(hdb, str);
8234 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8236 /* HKLM, msidbLocatorTypeDirectory, no signature, file does not exist */
8237 str = "'NewSignature28', 2, 'Software\\Wine', 'Value10', 0";
8238 r = add_reglocator_entry(hdb, str);
8239 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8241 /* HKLM, msidbLocatorTypeFile, file exists, in quotes */
8242 str = "'NewSignature29', 2, 'Software\\Wine', 'Value16', 1";
8243 r = add_reglocator_entry(hdb, str);
8244 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8246 /* HKLM, msidbLocatorTypeFile, file exists, no quotes */
8247 str = "'NewSignature30', 2, 'Software\\Wine', 'Value17', 1";
8248 r = add_reglocator_entry(hdb, str);
8249 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8251 r = create_signature_table(hdb);
8252 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8254 str = "'NewSignature9', 'FileName1', '', '', '', '', '', '', ''";
8255 r = add_signature_entry(hdb, str);
8256 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8258 str = "'NewSignature10', 'FileName2', '', '', '', '', '', '', ''";
8259 r = add_signature_entry(hdb, str);
8260 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8262 str = "'NewSignature14', 'FileName1', '', '', '', '', '', '', ''";
8263 r = add_signature_entry(hdb, str);
8264 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8266 str = "'NewSignature21', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
8267 r = add_signature_entry(hdb, str);
8268 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8270 str = "'NewSignature22', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
8271 r = add_signature_entry(hdb, str);
8272 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8274 str = "'NewSignature23', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
8275 r = add_signature_entry(hdb, str);
8276 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8278 ptr = strrchr(CURR_DIR, '\\') + 1;
8279 sprintf(path, "'NewSignature26', '%s', '', '', '', '', '', '', ''", ptr);
8280 r = add_signature_entry(hdb, path);
8281 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8283 str = "'NewSignature27', 'FileName2', '', '', '', '', '', '', ''";
8284 r = add_signature_entry(hdb, str);
8285 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8287 str = "'NewSignature29', 'FileName1', '', '', '', '', '', '', ''";
8288 r = add_signature_entry(hdb, str);
8289 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8291 str = "'NewSignature30', 'FileName1', '', '', '', '', '', '', ''";
8292 r = add_signature_entry(hdb, str);
8293 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8295 r = package_from_db(hdb, &hpkg);
8296 ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
8298 r = MsiDoAction(hpkg, "AppSearch");
8299 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8302 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
8303 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8304 ok(!lstrcmpA(prop, "regszdata"),
8305 "Expected \"regszdata\", got \"%s\"\n", prop);
8308 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
8309 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8310 ok(!lstrcmpA(prop, "#42"), "Expected \"#42\", got \"%s\"\n", prop);
8313 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
8314 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8315 ok(!lstrcmpA(prop, "#-42"), "Expected \"#-42\", got \"%s\"\n", prop);
8317 size = ExpandEnvironmentStringsA("%PATH%", NULL, 0);
8318 if (size == 0 && GetLastError() == ERROR_INVALID_PARAMETER)
8320 /* Workaround for Win95 */
8322 size = ExpandEnvironmentStringsA("%PATH%", tempbuf, 0);
8324 pathvar = HeapAlloc(GetProcessHeap(), 0, size);
8325 ExpandEnvironmentStringsA("%PATH%", pathvar, size);
8328 r = MsiGetPropertyA(hpkg, "SIGPROP4", NULL, &size);
8329 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8331 pathdata = HeapAlloc(GetProcessHeap(), 0, ++size);
8332 r = MsiGetPropertyA(hpkg, "SIGPROP4", pathdata, &size);
8333 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8334 ok(!lstrcmpA(pathdata, pathvar),
8335 "Expected \"%s\", got \"%s\"\n", pathvar, pathdata);
8337 HeapFree(GetProcessHeap(), 0, pathvar);
8338 HeapFree(GetProcessHeap(), 0, pathdata);
8341 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
8342 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8344 "my%NOVAR%"), "Expected \"my%%NOVAR%%\", got \"%s\"\n", prop);
8347 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
8348 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8351 ok(!memcmp(prop, "\0one\0two\0\0", 10),
8352 "Expected \"\\0one\\0two\\0\\0\"\n");
8356 lstrcpyA(path, "#xCDAB3412EF907856");
8357 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
8358 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8359 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8362 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
8363 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8364 ok(!lstrcmpA(prop, "##regszdata"),
8365 "Expected \"##regszdata\", got \"%s\"\n", prop);
8368 sprintf(path, "%s\\FileName1", CURR_DIR);
8369 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
8370 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8371 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8374 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
8375 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8376 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8379 sprintf(path, "%s\\", CURR_DIR);
8380 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
8381 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8382 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8385 r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
8386 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8387 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8390 sprintf(path, "%s\\", CURR_DIR);
8391 r = MsiGetPropertyA(hpkg, "SIGPROP13", prop, &size);
8392 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8393 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8396 r = MsiGetPropertyA(hpkg, "SIGPROP14", prop, &size);
8397 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8398 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8401 r = MsiGetPropertyA(hpkg, "SIGPROP15", prop, &size);
8402 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8403 ok(!lstrcmpA(prop, "regszdata"),
8404 "Expected \"regszdata\", got \"%s\"\n", prop);
8407 r = MsiGetPropertyA(hpkg, "SIGPROP16", prop, &size);
8408 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8409 ok(!lstrcmpA(prop, "regszdata"),
8410 "Expected \"regszdata\", got \"%s\"\n", prop);
8415 r = MsiGetPropertyA(hpkg, "SIGPROP17", prop, &size);
8416 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8417 ok(!lstrcmpA(prop, "regszdata"),
8418 "Expected \"regszdata\", got \"%s\"\n", prop);
8422 r = MsiGetPropertyA(hpkg, "SIGPROP18", prop, &size);
8423 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8424 ok(!lstrcmpA(prop, "defvalue"),
8425 "Expected \"defvalue\", got \"%s\"\n", prop);
8428 r = MsiGetPropertyA(hpkg, "SIGPROP19", prop, &size);
8429 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8430 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8433 r = MsiGetPropertyA(hpkg, "SIGPROP20", prop, &size);
8434 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8435 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8440 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
8441 r = MsiGetPropertyA(hpkg, "SIGPROP21", prop, &size);
8442 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8443 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8446 r = MsiGetPropertyA(hpkg, "SIGPROP22", prop, &size);
8447 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8448 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8451 sprintf(path, "%s\\FileName5.dll", CURR_DIR);
8452 r = MsiGetPropertyA(hpkg, "SIGPROP23", prop, &size);
8453 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8454 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8458 lstrcpyA(path, CURR_DIR);
8459 ptr = strrchr(path, '\\') + 1;
8461 r = MsiGetPropertyA(hpkg, "SIGPROP24", prop, &size);
8462 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8463 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8466 sprintf(path, "%s\\", CURR_DIR);
8467 r = MsiGetPropertyA(hpkg, "SIGPROP25", prop, &size);
8468 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8469 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8472 r = MsiGetPropertyA(hpkg, "SIGPROP26", prop, &size);
8473 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8474 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8477 r = MsiGetPropertyA(hpkg, "SIGPROP27", prop, &size);
8478 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8479 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8482 r = MsiGetPropertyA(hpkg, "SIGPROP28", prop, &size);
8483 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8484 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8487 sprintf(path, "%s\\FileName1", CURR_DIR);
8488 r = MsiGetPropertyA(hpkg, "SIGPROP29", prop, &size);
8489 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8490 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8493 sprintf(path, "%s\\FileName1", CURR_DIR);
8494 r = MsiGetPropertyA(hpkg, "SIGPROP30", prop, &size);
8495 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8497 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8499 todo_wine ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8501 RegSetValueA(hklm, NULL, REG_SZ, "", 0);
8502 RegDeleteValueA(hklm, "Value1");
8503 RegDeleteValueA(hklm, "Value2");
8504 RegDeleteValueA(hklm, "Value3");
8505 RegDeleteValueA(hklm, "Value4");
8506 RegDeleteValueA(hklm, "Value5");
8507 RegDeleteValueA(hklm, "Value6");
8508 RegDeleteValueA(hklm, "Value7");
8509 RegDeleteValueA(hklm, "Value8");
8510 RegDeleteValueA(hklm, "Value9");
8511 RegDeleteValueA(hklm, "Value10");
8512 RegDeleteValueA(hklm, "Value11");
8513 RegDeleteValueA(hklm, "Value12");
8514 RegDeleteValueA(hklm, "Value13");
8515 RegDeleteValueA(hklm, "Value14");
8516 RegDeleteValueA(hklm, "Value15");
8517 RegDeleteValueA(hklm, "Value16");
8518 RegDeleteValueA(hklm, "Value17");
8519 delete_key(hklm, "", access);
8522 RegDeleteValueA(classes, "Value1");
8523 RegDeleteKeyA(classes, "");
8524 RegCloseKey(classes);
8526 RegDeleteValueA(hkcu, "Value1");
8527 RegDeleteKeyA(hkcu, "");
8530 RegDeleteValueA(users, "Value1");
8531 RegDeleteKeyA(users, "");
8534 DeleteFileA("FileName1");
8535 DeleteFileA("FileName3.dll");
8536 DeleteFileA("FileName4.dll");
8537 DeleteFileA("FileName5.dll");
8538 MsiCloseHandle(hpkg);
8539 DeleteFileA(msifile);
8542 static void delete_win_ini(LPCSTR file)
8544 CHAR path[MAX_PATH];
8546 GetWindowsDirectoryA(path, MAX_PATH);
8547 lstrcatA(path, "\\");
8548 lstrcatA(path, file);
8553 static void test_appsearch_inilocator(void)
8555 MSIHANDLE hpkg, hdb;
8556 CHAR path[MAX_PATH];
8557 CHAR prop[MAX_PATH];
8565 if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
8568 DeleteFileA("test.dll");
8570 WritePrivateProfileStringA("Section", "Key", "keydata,field2", "IniFile.ini");
8572 create_test_file("FileName1");
8573 sprintf(path, "%s\\FileName1", CURR_DIR);
8574 WritePrivateProfileStringA("Section", "Key2", path, "IniFile.ini");
8576 WritePrivateProfileStringA("Section", "Key3", CURR_DIR, "IniFile.ini");
8578 sprintf(path, "%s\\IDontExist", CURR_DIR);
8579 WritePrivateProfileStringA("Section", "Key4", path, "IniFile.ini");
8581 create_file_with_version("FileName2.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8582 sprintf(path, "%s\\FileName2.dll", CURR_DIR);
8583 WritePrivateProfileStringA("Section", "Key5", path, "IniFile.ini");
8585 create_file_with_version("FileName3.dll", MAKELONG(1, 2), MAKELONG(3, 4));
8586 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
8587 WritePrivateProfileStringA("Section", "Key6", path, "IniFile.ini");
8589 create_file_with_version("FileName4.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8590 sprintf(path, "%s\\FileName4.dll", CURR_DIR);
8591 WritePrivateProfileStringA("Section", "Key7", path, "IniFile.ini");
8593 hdb = create_package_db();
8594 ok(hdb, "Expected a valid database handle\n");
8596 r = create_appsearch_table(hdb);
8597 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8599 r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
8600 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8602 r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
8603 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8605 r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
8606 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8608 r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
8609 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8611 r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
8612 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8614 r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
8615 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8617 r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
8618 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8620 r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
8621 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8623 r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
8624 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8626 r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
8627 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8629 r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
8630 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8632 r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
8633 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8635 r = create_inilocator_table(hdb);
8636 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8638 /* msidbLocatorTypeRawValue, field 1 */
8639 str = "'NewSignature1', 'IniFile.ini', 'Section', 'Key', 1, 2";
8640 r = add_inilocator_entry(hdb, str);
8641 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8643 /* msidbLocatorTypeRawValue, field 2 */
8644 str = "'NewSignature2', 'IniFile.ini', 'Section', 'Key', 2, 2";
8645 r = add_inilocator_entry(hdb, str);
8646 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8648 /* msidbLocatorTypeRawValue, entire field */
8649 str = "'NewSignature3', 'IniFile.ini', 'Section', 'Key', 0, 2";
8650 r = add_inilocator_entry(hdb, str);
8651 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8653 /* msidbLocatorTypeFile */
8654 str = "'NewSignature4', 'IniFile.ini', 'Section', 'Key2', 1, 1";
8655 r = add_inilocator_entry(hdb, str);
8656 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8658 /* msidbLocatorTypeDirectory, file */
8659 str = "'NewSignature5', 'IniFile.ini', 'Section', 'Key2', 1, 0";
8660 r = add_inilocator_entry(hdb, str);
8661 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8663 /* msidbLocatorTypeDirectory, directory */
8664 str = "'NewSignature6', 'IniFile.ini', 'Section', 'Key3', 1, 0";
8665 r = add_inilocator_entry(hdb, str);
8666 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8668 /* msidbLocatorTypeFile, file, no signature */
8669 str = "'NewSignature7', 'IniFile.ini', 'Section', 'Key2', 1, 1";
8670 r = add_inilocator_entry(hdb, str);
8671 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8673 /* msidbLocatorTypeFile, dir, no signature */
8674 str = "'NewSignature8', 'IniFile.ini', 'Section', 'Key3', 1, 1";
8675 r = add_inilocator_entry(hdb, str);
8676 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8678 /* msidbLocatorTypeFile, file does not exist */
8679 str = "'NewSignature9', 'IniFile.ini', 'Section', 'Key4', 1, 1";
8680 r = add_inilocator_entry(hdb, str);
8681 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8683 /* msidbLocatorTypeFile, signature with version */
8684 str = "'NewSignature10', 'IniFile.ini', 'Section', 'Key5', 1, 1";
8685 r = add_inilocator_entry(hdb, str);
8686 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8688 /* msidbLocatorTypeFile, signature with version, ver > max */
8689 str = "'NewSignature11', 'IniFile.ini', 'Section', 'Key6', 1, 1";
8690 r = add_inilocator_entry(hdb, str);
8691 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8693 /* msidbLocatorTypeFile, signature with version, sig->name ignored */
8694 str = "'NewSignature12', 'IniFile.ini', 'Section', 'Key7', 1, 1";
8695 r = add_inilocator_entry(hdb, str);
8696 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8698 r = create_signature_table(hdb);
8699 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8701 r = add_signature_entry(hdb, "'NewSignature4', 'FileName1', '', '', '', '', '', '', ''");
8702 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8704 r = add_signature_entry(hdb, "'NewSignature9', 'IDontExist', '', '', '', '', '', '', ''");
8705 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8707 r = add_signature_entry(hdb, "'NewSignature10', 'FileName2.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
8708 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8710 r = add_signature_entry(hdb, "'NewSignature11', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
8711 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8713 r = add_signature_entry(hdb, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
8714 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8716 r = package_from_db(hdb, &hpkg);
8717 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
8719 skip("Not enough rights to perform tests\n");
8722 ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
8724 r = MsiDoAction(hpkg, "AppSearch");
8725 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8728 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
8729 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8730 ok(!lstrcmpA(prop, "keydata"), "Expected \"keydata\", got \"%s\"\n", prop);
8733 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
8734 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8735 ok(!lstrcmpA(prop, "field2"), "Expected \"field2\", got \"%s\"\n", prop);
8738 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
8739 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8740 ok(!lstrcmpA(prop, "keydata,field2"),
8741 "Expected \"keydata,field2\", got \"%s\"\n", prop);
8744 sprintf(path, "%s\\FileName1", CURR_DIR);
8745 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
8746 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8747 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8750 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
8751 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8752 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8755 sprintf(path, "%s\\", CURR_DIR);
8756 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
8757 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8758 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8761 sprintf(path, "%s\\", CURR_DIR);
8762 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
8763 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8764 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8767 lstrcpyA(path, CURR_DIR);
8768 ptr = strrchr(path, '\\');
8770 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
8771 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8772 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8775 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
8776 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8777 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8782 sprintf(path, "%s\\FileName2.dll", CURR_DIR);
8783 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
8784 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8785 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8788 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
8789 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8790 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8793 sprintf(path, "%s\\FileName4.dll", CURR_DIR);
8794 r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
8795 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8796 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8799 MsiCloseHandle(hpkg);
8802 delete_win_ini("IniFile.ini");
8803 DeleteFileA("FileName1");
8804 DeleteFileA("FileName2.dll");
8805 DeleteFileA("FileName3.dll");
8806 DeleteFileA("FileName4.dll");
8807 DeleteFileA(msifile);
8811 * MSI AppSearch action on DrLocator table always returns absolute paths.
8812 * If a relative path was set, it returns the first absolute path that
8813 * matches or an empty string if it didn't find anything.
8814 * This helper function replicates this behaviour.
8816 static void search_absolute_directory(LPSTR absolute, LPCSTR relative)
8821 size = lstrlenA(relative);
8822 drives = GetLogicalDrives();
8823 lstrcpyA(absolute, "A:\\");
8824 for (i = 0; i < 26; absolute[0] = '\0', i++)
8826 if (!(drives & (1 << i)))
8829 absolute[0] = 'A' + i;
8830 if (GetDriveType(absolute) != DRIVE_FIXED)
8833 lstrcpynA(absolute + 3, relative, size + 1);
8834 attr = GetFileAttributesA(absolute);
8835 if (attr != INVALID_FILE_ATTRIBUTES &&
8836 (attr & FILE_ATTRIBUTE_DIRECTORY))
8838 if (absolute[3 + size - 1] != '\\')
8839 lstrcatA(absolute, "\\");
8846 static void test_appsearch_drlocator(void)
8848 MSIHANDLE hpkg, hdb;
8849 CHAR path[MAX_PATH];
8850 CHAR prop[MAX_PATH];
8857 if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
8860 DeleteFileA("test.dll");
8862 create_test_file("FileName1");
8863 CreateDirectoryA("one", NULL);
8864 CreateDirectoryA("one\\two", NULL);
8865 CreateDirectoryA("one\\two\\three", NULL);
8866 create_test_file("one\\two\\three\\FileName2");
8867 CreateDirectoryA("another", NULL);
8868 create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8869 create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
8870 create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8872 hdb = create_package_db();
8873 ok(hdb, "Expected a valid database handle\n");
8875 r = create_appsearch_table(hdb);
8876 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8878 r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
8879 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8881 r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
8882 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8884 r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
8885 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8887 r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
8888 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8890 r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
8891 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8893 r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
8894 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8896 r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
8897 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8899 r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
8900 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8902 r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
8903 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8905 r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
8906 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8908 r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
8909 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8911 r = add_appsearch_entry(hdb, "'SIGPROP13', 'NewSignature13'");
8912 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8914 r = create_drlocator_table(hdb);
8915 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8917 /* no parent, full path, depth 0, signature */
8918 sprintf(path, "'NewSignature1', '', '%s', 0", CURR_DIR);
8919 r = add_drlocator_entry(hdb, path);
8920 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8922 /* no parent, full path, depth 0, no signature */
8923 sprintf(path, "'NewSignature2', '', '%s', 0", CURR_DIR);
8924 r = add_drlocator_entry(hdb, path);
8925 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8927 /* no parent, relative path, depth 0, no signature */
8928 sprintf(path, "'NewSignature3', '', '%s', 0", CURR_DIR + 3);
8929 r = add_drlocator_entry(hdb, path);
8930 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8932 /* no parent, full path, depth 2, signature */
8933 sprintf(path, "'NewSignature4', '', '%s', 2", CURR_DIR);
8934 r = add_drlocator_entry(hdb, path);
8935 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8937 /* no parent, full path, depth 3, signature */
8938 sprintf(path, "'NewSignature5', '', '%s', 3", CURR_DIR);
8939 r = add_drlocator_entry(hdb, path);
8940 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8942 /* no parent, full path, depth 1, signature is dir */
8943 sprintf(path, "'NewSignature6', '', '%s', 1", CURR_DIR);
8944 r = add_drlocator_entry(hdb, path);
8945 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8947 /* parent is in DrLocator, relative path, depth 0, signature */
8948 sprintf(path, "'NewSignature7', 'NewSignature1', 'one\\two\\three', 1");
8949 r = add_drlocator_entry(hdb, path);
8950 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8952 /* no parent, full path, depth 0, signature w/ version */
8953 sprintf(path, "'NewSignature8', '', '%s', 0", CURR_DIR);
8954 r = add_drlocator_entry(hdb, path);
8955 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8957 /* no parent, full path, depth 0, signature w/ version, ver > max */
8958 sprintf(path, "'NewSignature9', '', '%s', 0", CURR_DIR);
8959 r = add_drlocator_entry(hdb, path);
8960 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8962 /* no parent, full path, depth 0, signature w/ version, sig->name not ignored */
8963 sprintf(path, "'NewSignature10', '', '%s', 0", CURR_DIR);
8964 r = add_drlocator_entry(hdb, path);
8965 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8967 /* no parent, relative empty path, depth 0, no signature */
8968 sprintf(path, "'NewSignature11', '', '', 0");
8969 r = add_drlocator_entry(hdb, path);
8970 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8972 r = create_reglocator_table(hdb);
8973 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8976 r = add_reglocator_entry(hdb, "'NewSignature12', 2, 'htmlfile\\shell\\open\\nonexistent', '', 1");
8977 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8979 /* parent is in RegLocator, no path, depth 0, no signature */
8980 sprintf(path, "'NewSignature13', 'NewSignature12', '', 0");
8981 r = add_drlocator_entry(hdb, path);
8982 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8984 r = create_signature_table(hdb);
8985 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8987 str = "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''";
8988 r = add_signature_entry(hdb, str);
8989 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8991 str = "'NewSignature4', 'FileName2', '', '', '', '', '', '', ''";
8992 r = add_signature_entry(hdb, str);
8993 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8995 str = "'NewSignature5', 'FileName2', '', '', '', '', '', '', ''";
8996 r = add_signature_entry(hdb, str);
8997 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8999 str = "'NewSignature6', 'another', '', '', '', '', '', '', ''";
9000 r = add_signature_entry(hdb, str);
9001 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9003 str = "'NewSignature7', 'FileName2', '', '', '', '', '', '', ''";
9004 r = add_signature_entry(hdb, str);
9005 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9007 str = "'NewSignature8', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
9008 r = add_signature_entry(hdb, str);
9009 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9011 str = "'NewSignature9', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
9012 r = add_signature_entry(hdb, str);
9013 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9015 str = "'NewSignature10', 'necessary', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
9016 r = add_signature_entry(hdb, str);
9017 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9019 r = package_from_db(hdb, &hpkg);
9020 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
9022 skip("Not enough rights to perform tests\n");
9025 ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
9027 r = MsiDoAction(hpkg, "AppSearch");
9028 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9031 sprintf(path, "%s\\FileName1", CURR_DIR);
9032 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
9033 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9034 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9037 sprintf(path, "%s\\", CURR_DIR);
9038 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
9039 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9040 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9043 search_absolute_directory(path, CURR_DIR + 3);
9044 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
9045 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9046 ok(!lstrcmpiA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9049 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
9050 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9051 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
9054 sprintf(path, "%s\\one\\two\\three\\FileName2", CURR_DIR);
9055 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
9056 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9057 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9060 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
9061 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9062 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
9065 sprintf(path, "%s\\one\\two\\three\\FileName2", CURR_DIR);
9066 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
9067 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9068 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9073 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
9074 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
9075 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9076 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9079 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
9080 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9081 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
9084 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
9085 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9086 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
9090 search_absolute_directory(path, "");
9091 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
9092 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9093 ok(!lstrcmpiA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9096 strcpy(path, "c:\\");
9097 r = MsiGetPropertyA(hpkg, "SIGPROP13", prop, &size);
9098 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9099 ok(!prop[0], "Expected \"\", got \"%s\"\n", prop);
9101 MsiCloseHandle(hpkg);
9104 DeleteFileA("FileName1");
9105 DeleteFileA("FileName3.dll");
9106 DeleteFileA("FileName4.dll");
9107 DeleteFileA("FileName5.dll");
9108 DeleteFileA("one\\two\\three\\FileName2");
9109 RemoveDirectoryA("one\\two\\three");
9110 RemoveDirectoryA("one\\two");
9111 RemoveDirectoryA("one");
9112 RemoveDirectoryA("another");
9113 DeleteFileA(msifile);
9116 static void test_featureparents(void)
9121 INSTALLSTATE state, action;
9123 hdb = create_package_db();
9124 ok ( hdb, "failed to create package database\n" );
9126 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
9127 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
9129 r = create_feature_table( hdb );
9130 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
9132 r = create_component_table( hdb );
9133 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
9135 r = create_feature_components_table( hdb );
9136 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
9138 r = create_file_table( hdb );
9139 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
9141 /* msidbFeatureAttributesFavorLocal */
9142 r = add_feature_entry( hdb, "'zodiac', '', '', '', 2, 1, '', 0" );
9143 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
9145 /* msidbFeatureAttributesFavorSource */
9146 r = add_feature_entry( hdb, "'perseus', '', '', '', 2, 1, '', 1" );
9147 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
9149 /* msidbFeatureAttributesFavorLocal */
9150 r = add_feature_entry( hdb, "'orion', '', '', '', 2, 1, '', 0" );
9151 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
9153 /* disabled because of install level */
9154 r = add_feature_entry( hdb, "'waters', '', '', '', 15, 101, '', 9" );
9155 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
9157 /* child feature of disabled feature */
9158 r = add_feature_entry( hdb, "'bayer', 'waters', '', '', 14, 1, '', 9" );
9159 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
9161 /* component of disabled feature (install level) */
9162 r = add_component_entry( hdb, "'delphinus', '', 'TARGETDIR', 0, '', 'delphinus_file'" );
9163 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9165 /* component of disabled child feature (install level) */
9166 r = add_component_entry( hdb, "'hydrus', '', 'TARGETDIR', 0, '', 'hydrus_file'" );
9167 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9169 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
9170 r = add_component_entry( hdb, "'leo', '', 'TARGETDIR', 0, '', 'leo_file'" );
9171 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9173 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
9174 r = add_component_entry( hdb, "'virgo', '', 'TARGETDIR', 1, '', 'virgo_file'" );
9175 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9177 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
9178 r = add_component_entry( hdb, "'libra', '', 'TARGETDIR', 2, '', 'libra_file'" );
9179 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9181 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
9182 r = add_component_entry( hdb, "'cassiopeia', '', 'TARGETDIR', 0, '', 'cassiopeia_file'" );
9183 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9185 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
9186 r = add_component_entry( hdb, "'cepheus', '', 'TARGETDIR', 1, '', 'cepheus_file'" );
9187 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9189 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
9190 r = add_component_entry( hdb, "'andromeda', '', 'TARGETDIR', 2, '', 'andromeda_file'" );
9191 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9193 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
9194 r = add_component_entry( hdb, "'canis', '', 'TARGETDIR', 0, '', 'canis_file'" );
9195 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9197 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
9198 r = add_component_entry( hdb, "'monoceros', '', 'TARGETDIR', 1, '', 'monoceros_file'" );
9199 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9201 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
9202 r = add_component_entry( hdb, "'lepus', '', 'TARGETDIR', 2, '', 'lepus_file'" );
9204 r = add_feature_components_entry( hdb, "'zodiac', 'leo'" );
9205 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9207 r = add_feature_components_entry( hdb, "'zodiac', 'virgo'" );
9208 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9210 r = add_feature_components_entry( hdb, "'zodiac', 'libra'" );
9211 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9213 r = add_feature_components_entry( hdb, "'perseus', 'cassiopeia'" );
9214 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9216 r = add_feature_components_entry( hdb, "'perseus', 'cepheus'" );
9217 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9219 r = add_feature_components_entry( hdb, "'perseus', 'andromeda'" );
9220 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9222 r = add_feature_components_entry( hdb, "'orion', 'leo'" );
9223 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9225 r = add_feature_components_entry( hdb, "'orion', 'virgo'" );
9226 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9228 r = add_feature_components_entry( hdb, "'orion', 'libra'" );
9229 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9231 r = add_feature_components_entry( hdb, "'orion', 'cassiopeia'" );
9232 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9234 r = add_feature_components_entry( hdb, "'orion', 'cepheus'" );
9235 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9237 r = add_feature_components_entry( hdb, "'orion', 'andromeda'" );
9238 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9240 r = add_feature_components_entry( hdb, "'orion', 'canis'" );
9241 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9243 r = add_feature_components_entry( hdb, "'orion', 'monoceros'" );
9244 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9246 r = add_feature_components_entry( hdb, "'orion', 'lepus'" );
9247 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9249 r = add_feature_components_entry( hdb, "'waters', 'delphinus'" );
9250 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9252 r = add_feature_components_entry( hdb, "'bayer', 'hydrus'" );
9253 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9255 r = add_file_entry( hdb, "'leo_file', 'leo', 'leo.txt', 100, '', '1033', 8192, 1" );
9256 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9258 r = add_file_entry( hdb, "'virgo_file', 'virgo', 'virgo.txt', 0, '', '1033', 8192, 1" );
9259 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9261 r = add_file_entry( hdb, "'libra_file', 'libra', 'libra.txt', 0, '', '1033', 8192, 1" );
9262 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9264 r = add_file_entry( hdb, "'cassiopeia_file', 'cassiopeia', 'cassiopeia.txt', 0, '', '1033', 8192, 1" );
9265 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9267 r = add_file_entry( hdb, "'cepheus_file', 'cepheus', 'cepheus.txt', 0, '', '1033', 8192, 1" );
9268 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9270 r = add_file_entry( hdb, "'andromeda_file', 'andromeda', 'andromeda.txt', 0, '', '1033', 8192, 1" );
9271 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9273 r = add_file_entry( hdb, "'canis_file', 'canis', 'canis.txt', 0, '', '1033', 8192, 1" );
9274 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9276 r = add_file_entry( hdb, "'monoceros_file', 'monoceros', 'monoceros.txt', 0, '', '1033', 8192, 1" );
9277 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9279 r = add_file_entry( hdb, "'lepus_file', 'lepus', 'lepus.txt', 0, '', '1033', 8192, 1" );
9280 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9282 r = add_file_entry( hdb, "'delphinus_file', 'delphinus', 'delphinus.txt', 0, '', '1033', 8192, 1" );
9283 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9285 r = add_file_entry( hdb, "'hydrus_file', 'hydrus', 'hydrus.txt', 0, '', '1033', 8192, 1" );
9286 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9288 r = package_from_db( hdb, &hpkg );
9289 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
9291 skip("Not enough rights to perform tests\n");
9292 DeleteFile(msifile);
9295 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
9297 MsiCloseHandle( hdb );
9299 r = MsiDoAction( hpkg, "CostInitialize");
9300 ok( r == ERROR_SUCCESS, "cost init failed\n");
9302 r = MsiDoAction( hpkg, "FileCost");
9303 ok( r == ERROR_SUCCESS, "file cost failed\n");
9305 r = MsiDoAction( hpkg, "CostFinalize");
9306 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
9310 r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
9311 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9312 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9313 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
9317 r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
9318 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9319 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9320 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
9324 r = MsiGetFeatureState(hpkg, "orion", &state, &action);
9325 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9326 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9327 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
9331 r = MsiGetFeatureState(hpkg, "waters", &state, &action);
9332 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9333 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9334 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
9338 r = MsiGetFeatureState(hpkg, "bayer", &state, &action);
9339 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9340 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9341 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
9345 r = MsiGetComponentState(hpkg, "leo", &state, &action);
9346 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9347 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
9348 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
9352 r = MsiGetComponentState(hpkg, "virgo", &state, &action);
9353 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9354 ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
9355 ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
9359 r = MsiGetComponentState(hpkg, "libra", &state, &action);
9360 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9361 ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
9362 ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
9366 r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
9367 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9368 ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
9369 ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
9373 r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
9374 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9375 ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
9376 ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
9380 r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
9381 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9382 ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
9383 ok( action == INSTALLSTATE_LOCAL, "Expected andromeda INSTALLSTATE_LOCAL, got %d\n", action);
9387 r = MsiGetComponentState(hpkg, "canis", &state, &action);
9388 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9389 ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
9390 ok( action == INSTALLSTATE_LOCAL, "Expected canis INSTALLSTATE_LOCAL, got %d\n", action);
9394 r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
9395 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9396 ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
9397 ok( action == INSTALLSTATE_SOURCE, "Expected monoceros INSTALLSTATE_SOURCE, got %d\n", action);
9401 r = MsiGetComponentState(hpkg, "lepus", &state, &action);
9402 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9403 ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
9404 ok( action == INSTALLSTATE_LOCAL, "Expected lepus INSTALLSTATE_LOCAL, got %d\n", action);
9408 r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
9409 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9410 ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
9411 ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
9415 r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
9416 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9417 ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
9418 ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
9420 r = MsiSetFeatureState(hpkg, "orion", INSTALLSTATE_ABSENT);
9421 ok( r == ERROR_SUCCESS, "failed to set feature state: %d\n", r);
9423 r = MsiSetFeatureState(hpkg, "nosuchfeature", INSTALLSTATE_ABSENT);
9424 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %u\n", r);
9428 r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
9429 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9430 ok( state == INSTALLSTATE_ABSENT, "Expected zodiac INSTALLSTATE_ABSENT, got %d\n", state);
9431 ok( action == INSTALLSTATE_LOCAL, "Expected zodiac INSTALLSTATE_LOCAL, got %d\n", action);
9435 r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
9436 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9437 ok( state == INSTALLSTATE_ABSENT, "Expected perseus INSTALLSTATE_ABSENT, got %d\n", state);
9438 ok( action == INSTALLSTATE_SOURCE, "Expected perseus INSTALLSTATE_SOURCE, got %d\n", action);
9442 r = MsiGetFeatureState(hpkg, "orion", &state, &action);
9443 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9444 ok( state == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", state);
9445 ok( action == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", action);
9449 r = MsiGetComponentState(hpkg, "leo", &state, &action);
9450 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9451 ok( state == INSTALLSTATE_UNKNOWN, "Expected leo INSTALLSTATE_UNKNOWN, got %d\n", state);
9452 ok( action == INSTALLSTATE_LOCAL, "Expected leo INSTALLSTATE_LOCAL, got %d\n", action);
9456 r = MsiGetComponentState(hpkg, "virgo", &state, &action);
9457 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9458 ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
9459 ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
9463 r = MsiGetComponentState(hpkg, "libra", &state, &action);
9464 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9465 ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
9466 ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
9470 r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
9471 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9472 ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
9473 ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
9477 r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
9478 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9479 ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
9480 ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
9484 r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
9485 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9486 ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
9487 ok( action == INSTALLSTATE_SOURCE, "Expected andromeda INSTALLSTATE_SOURCE, got %d\n", action);
9491 r = MsiGetComponentState(hpkg, "canis", &state, &action);
9492 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9493 ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
9494 ok( action == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", action);
9498 r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
9499 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9500 ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
9501 ok( action == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", action);
9505 r = MsiGetComponentState(hpkg, "lepus", &state, &action);
9506 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9507 ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
9508 ok( action == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", action);
9512 r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
9513 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9514 ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
9515 ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
9519 r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
9520 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9521 ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
9522 ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
9524 MsiCloseHandle(hpkg);
9525 DeleteFileA(msifile);
9528 static void test_installprops(void)
9530 MSIHANDLE hpkg, hdb;
9531 CHAR path[MAX_PATH], buf[MAX_PATH];
9537 REGSAM access = KEY_ALL_ACCESS;
9540 if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64)
9541 access |= KEY_WOW64_64KEY;
9543 GetCurrentDirectory(MAX_PATH, path);
9544 lstrcat(path, "\\");
9545 lstrcat(path, msifile);
9547 hdb = create_package_db();
9548 ok( hdb, "failed to create database\n");
9550 r = package_from_db(hdb, &hpkg);
9551 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
9553 skip("Not enough rights to perform tests\n");
9554 DeleteFile(msifile);
9557 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
9559 MsiCloseHandle(hdb);
9562 r = MsiGetProperty(hpkg, "DATABASE", buf, &size);
9563 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9564 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
9566 RegOpenKey(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\MS Setup (ACME)\\User Info", &hkey1);
9567 RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", 0, access, &hkey2);
9572 if (RegQueryValueEx(hkey1, "DefName", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
9576 RegQueryValueEx(hkey2, "RegisteredOwner", NULL, &type, (LPBYTE)path, &size);
9579 /* win9x doesn't set this */
9583 r = MsiGetProperty(hpkg, "USERNAME", buf, &size);
9584 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9585 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
9591 if (RegQueryValueEx(hkey1, "DefCompany", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
9595 RegQueryValueEx(hkey2, "RegisteredOrganization", NULL, &type, (LPBYTE)path, &size);
9601 r = MsiGetProperty(hpkg, "COMPANYNAME", buf, &size);
9602 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9603 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
9607 r = MsiGetProperty(hpkg, "VersionDatabase", buf, &size);
9608 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9609 trace("VersionDatabase = %s\n", buf);
9612 r = MsiGetProperty(hpkg, "VersionMsi", buf, &size);
9613 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9614 trace("VersionMsi = %s\n", buf);
9617 r = MsiGetProperty(hpkg, "Date", buf, &size);
9618 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9619 trace("Date = %s\n", buf);
9622 r = MsiGetProperty(hpkg, "Time", buf, &size);
9623 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9624 trace("Time = %s\n", buf);
9627 r = MsiGetProperty(hpkg, "PackageCode", buf, &size);
9628 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9629 trace("PackageCode = %s\n", buf);
9631 langid = GetUserDefaultLangID();
9632 sprintf(path, "%d", langid);
9635 r = MsiGetProperty(hpkg, "UserLanguageID", buf, &size);
9636 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS< got %d\n", r);
9637 ok( !lstrcmpA(buf, path), "Expected \"%s\", got \"%s\"\n", path, buf);
9639 res = GetSystemMetrics(SM_CXSCREEN);
9641 r = MsiGetProperty(hpkg, "ScreenX", buf, &size);
9642 ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
9644 res = GetSystemMetrics(SM_CYSCREEN);
9646 r = MsiGetProperty(hpkg, "ScreenY", buf, &size);
9647 ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
9651 MsiCloseHandle(hpkg);
9652 DeleteFile(msifile);
9655 static void test_launchconditions(void)
9661 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
9663 hdb = create_package_db();
9664 ok( hdb, "failed to create package database\n" );
9666 r = create_launchcondition_table( hdb );
9667 ok( r == ERROR_SUCCESS, "cannot create LaunchCondition table: %d\n", r );
9669 r = add_launchcondition_entry( hdb, "'X = \"1\"', 'one'" );
9670 ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
9672 /* invalid condition */
9673 r = add_launchcondition_entry( hdb, "'X != \"1\"', 'one'" );
9674 ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
9676 r = package_from_db( hdb, &hpkg );
9677 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
9679 skip("Not enough rights to perform tests\n");
9680 DeleteFile(msifile);
9683 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
9685 MsiCloseHandle( hdb );
9687 r = MsiSetProperty( hpkg, "X", "1" );
9688 ok( r == ERROR_SUCCESS, "failed to set property\n" );
9690 /* invalid conditions are ignored */
9691 r = MsiDoAction( hpkg, "LaunchConditions" );
9692 ok( r == ERROR_SUCCESS, "cost init failed\n" );
9694 /* verify LaunchConditions still does some verification */
9695 r = MsiSetProperty( hpkg, "X", "2" );
9696 ok( r == ERROR_SUCCESS, "failed to set property\n" );
9698 r = MsiDoAction( hpkg, "LaunchConditions" );
9699 ok( r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %d\n", r );
9701 MsiCloseHandle( hpkg );
9702 DeleteFile( msifile );
9705 static void test_ccpsearch(void)
9707 MSIHANDLE hdb, hpkg;
9708 CHAR prop[MAX_PATH];
9709 DWORD size = MAX_PATH;
9712 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
9714 hdb = create_package_db();
9715 ok(hdb, "failed to create package database\n");
9717 r = create_ccpsearch_table(hdb);
9718 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9720 r = add_ccpsearch_entry(hdb, "'CCP_random'");
9721 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9723 r = add_ccpsearch_entry(hdb, "'RMCCP_random'");
9724 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9726 r = create_reglocator_table(hdb);
9727 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9729 r = add_reglocator_entry(hdb, "'CCP_random', 0, 'htmlfile\\shell\\open\\nonexistent', '', 1");
9730 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9732 r = create_drlocator_table(hdb);
9733 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9735 r = add_drlocator_entry(hdb, "'RMCCP_random', '', 'C:\\', '0'");
9736 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9738 r = create_signature_table(hdb);
9739 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9741 r = package_from_db(hdb, &hpkg);
9742 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
9744 skip("Not enough rights to perform tests\n");
9745 DeleteFile(msifile);
9748 ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
9750 MsiCloseHandle(hdb);
9752 r = MsiDoAction(hpkg, "CCPSearch");
9753 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9755 r = MsiGetPropertyA(hpkg, "CCP_Success", prop, &size);
9756 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9757 ok(!lstrcmpA(prop, "1"), "Expected 1, got %s\n", prop);
9759 MsiCloseHandle(hpkg);
9760 DeleteFileA(msifile);
9763 static void test_complocator(void)
9765 MSIHANDLE hdb, hpkg;
9767 CHAR prop[MAX_PATH];
9768 CHAR expected[MAX_PATH];
9769 DWORD size = MAX_PATH;
9771 hdb = create_package_db();
9772 ok(hdb, "failed to create package database\n");
9774 r = create_appsearch_table(hdb);
9775 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9777 r = add_appsearch_entry(hdb, "'ABELISAURUS', 'abelisaurus'");
9778 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9780 r = add_appsearch_entry(hdb, "'BACTROSAURUS', 'bactrosaurus'");
9781 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9783 r = add_appsearch_entry(hdb, "'CAMELOTIA', 'camelotia'");
9784 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9786 r = add_appsearch_entry(hdb, "'DICLONIUS', 'diclonius'");
9787 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9789 r = add_appsearch_entry(hdb, "'ECHINODON', 'echinodon'");
9790 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9792 r = add_appsearch_entry(hdb, "'FALCARIUS', 'falcarius'");
9793 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9795 r = add_appsearch_entry(hdb, "'GALLIMIMUS', 'gallimimus'");
9796 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9798 r = add_appsearch_entry(hdb, "'HAGRYPHUS', 'hagryphus'");
9799 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9801 r = add_appsearch_entry(hdb, "'IGUANODON', 'iguanodon'");
9802 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9804 r = add_appsearch_entry(hdb, "'JOBARIA', 'jobaria'");
9805 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9807 r = add_appsearch_entry(hdb, "'KAKURU', 'kakuru'");
9808 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9810 r = add_appsearch_entry(hdb, "'LABOCANIA', 'labocania'");
9811 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9813 r = add_appsearch_entry(hdb, "'MEGARAPTOR', 'megaraptor'");
9814 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9816 r = add_appsearch_entry(hdb, "'NEOSODON', 'neosodon'");
9817 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9819 r = add_appsearch_entry(hdb, "'OLOROTITAN', 'olorotitan'");
9820 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9822 r = add_appsearch_entry(hdb, "'PANTYDRACO', 'pantydraco'");
9823 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9825 r = create_complocator_table(hdb);
9826 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9828 r = add_complocator_entry(hdb, "'abelisaurus', '{E3619EED-305A-418C-B9C7-F7D7377F0934}', 1");
9829 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9831 r = add_complocator_entry(hdb, "'bactrosaurus', '{D56B688D-542F-42Ef-90FD-B6DA76EE8119}', 0");
9832 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9834 r = add_complocator_entry(hdb, "'camelotia', '{8211BE36-2466-47E3-AFB7-6AC72E51AED2}', 1");
9835 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9837 r = add_complocator_entry(hdb, "'diclonius', '{5C767B20-A33C-45A4-B80B-555E512F01AE}', 0");
9838 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9840 r = add_complocator_entry(hdb, "'echinodon', '{A19E16C5-C75D-4699-8111-C4338C40C3CB}', 1");
9841 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9843 r = add_complocator_entry(hdb, "'falcarius', '{17762FA1-A7AE-4CC6-8827-62873C35361D}', 0");
9844 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9846 r = add_complocator_entry(hdb, "'gallimimus', '{75EBF568-C959-41E0-A99E-9050638CF5FB}', 1");
9847 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9849 r = add_complocator_entry(hdb, "'hagrphus', '{D4969B72-17D9-4AB6-BE49-78F2FEE857AC}', 0");
9850 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9852 r = add_complocator_entry(hdb, "'iguanodon', '{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}', 1");
9853 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9855 r = add_complocator_entry(hdb, "'jobaria', '{243C22B1-8C51-4151-B9D1-1AE5265E079E}', 0");
9856 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9858 r = add_complocator_entry(hdb, "'kakuru', '{5D0F03BA-50BC-44F2-ABB1-72C972F4E514}', 1");
9859 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9861 r = add_complocator_entry(hdb, "'labocania', '{C7DDB60C-7828-4046-A6F8-699D5E92F1ED}', 0");
9862 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9864 r = add_complocator_entry(hdb, "'megaraptor', '{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}', 1");
9865 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9867 r = add_complocator_entry(hdb, "'neosodon', '{0B499649-197A-48EF-93D2-AF1C17ED6E90}', 0");
9868 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9870 r = add_complocator_entry(hdb, "'olorotitan', '{54E9E91F-AED2-46D5-A25A-7E50AFA24513}', 1");
9871 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9873 r = add_complocator_entry(hdb, "'pantydraco', '{2A989951-5565-4FA7-93A7-E800A3E67D71}', 0");
9874 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9876 r = create_signature_table(hdb);
9877 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9879 r = add_signature_entry(hdb, "'abelisaurus', 'abelisaurus', '', '', '', '', '', '', ''");
9880 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9882 r = add_signature_entry(hdb, "'bactrosaurus', 'bactrosaurus', '', '', '', '', '', '', ''");
9883 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9885 r = add_signature_entry(hdb, "'camelotia', 'camelotia', '', '', '', '', '', '', ''");
9886 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9888 r = add_signature_entry(hdb, "'diclonius', 'diclonius', '', '', '', '', '', '', ''");
9889 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9891 r = add_signature_entry(hdb, "'iguanodon', 'iguanodon', '', '', '', '', '', '', ''");
9892 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9894 r = add_signature_entry(hdb, "'jobaria', 'jobaria', '', '', '', '', '', '', ''");
9895 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9897 r = add_signature_entry(hdb, "'kakuru', 'kakuru', '', '', '', '', '', '', ''");
9898 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9900 r = add_signature_entry(hdb, "'labocania', 'labocania', '', '', '', '', '', '', ''");
9901 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9903 r = package_from_db(hdb, &hpkg);
9904 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
9906 skip("Not enough rights to perform tests\n");
9907 DeleteFile(msifile);
9910 ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
9912 MsiCloseHandle(hdb);
9914 create_test_file("abelisaurus");
9915 create_test_file("bactrosaurus");
9916 create_test_file("camelotia");
9917 create_test_file("diclonius");
9918 create_test_file("echinodon");
9919 create_test_file("falcarius");
9920 create_test_file("gallimimus");
9921 create_test_file("hagryphus");
9922 CreateDirectoryA("iguanodon", NULL);
9923 CreateDirectoryA("jobaria", NULL);
9924 CreateDirectoryA("kakuru", NULL);
9925 CreateDirectoryA("labocania", NULL);
9926 CreateDirectoryA("megaraptor", NULL);
9927 CreateDirectoryA("neosodon", NULL);
9928 CreateDirectoryA("olorotitan", NULL);
9929 CreateDirectoryA("pantydraco", NULL);
9931 set_component_path("abelisaurus", MSIINSTALLCONTEXT_MACHINE,
9932 "{E3619EED-305A-418C-B9C7-F7D7377F0934}", NULL, FALSE);
9933 set_component_path("bactrosaurus", MSIINSTALLCONTEXT_MACHINE,
9934 "{D56B688D-542F-42Ef-90FD-B6DA76EE8119}", NULL, FALSE);
9935 set_component_path("echinodon", MSIINSTALLCONTEXT_MACHINE,
9936 "{A19E16C5-C75D-4699-8111-C4338C40C3CB}", NULL, FALSE);
9937 set_component_path("falcarius", MSIINSTALLCONTEXT_MACHINE,
9938 "{17762FA1-A7AE-4CC6-8827-62873C35361D}", NULL, FALSE);
9939 set_component_path("iguanodon", MSIINSTALLCONTEXT_MACHINE,
9940 "{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}", NULL, FALSE);
9941 set_component_path("jobaria", MSIINSTALLCONTEXT_MACHINE,
9942 "{243C22B1-8C51-4151-B9D1-1AE5265E079E}", NULL, FALSE);
9943 set_component_path("megaraptor", MSIINSTALLCONTEXT_MACHINE,
9944 "{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}", NULL, FALSE);
9945 set_component_path("neosodon", MSIINSTALLCONTEXT_MACHINE,
9946 "{0B499649-197A-48EF-93D2-AF1C17ED6E90}", NULL, FALSE);
9948 r = MsiDoAction(hpkg, "AppSearch");
9949 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9952 r = MsiGetPropertyA(hpkg, "ABELISAURUS", prop, &size);
9953 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9955 lstrcpyA(expected, CURR_DIR);
9956 lstrcatA(expected, "\\abelisaurus");
9957 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
9958 "Expected %s or empty string, got %s\n", expected, prop);
9961 r = MsiGetPropertyA(hpkg, "BACTROSAURUS", prop, &size);
9962 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9963 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9966 r = MsiGetPropertyA(hpkg, "CAMELOTIA", prop, &size);
9967 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9968 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9971 r = MsiGetPropertyA(hpkg, "DICLONIUS", prop, &size);
9972 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9973 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9976 r = MsiGetPropertyA(hpkg, "ECHINODON", prop, &size);
9977 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9979 lstrcpyA(expected, CURR_DIR);
9980 lstrcatA(expected, "\\");
9981 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
9982 "Expected %s or empty string, got %s\n", expected, prop);
9985 r = MsiGetPropertyA(hpkg, "FALCARIUS", prop, &size);
9986 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9987 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9990 r = MsiGetPropertyA(hpkg, "GALLIMIMUS", prop, &size);
9991 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9992 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
9995 r = MsiGetPropertyA(hpkg, "HAGRYPHUS", prop, &size);
9996 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9997 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10000 r = MsiGetPropertyA(hpkg, "IGUANODON", prop, &size);
10001 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10002 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10005 r = MsiGetPropertyA(hpkg, "JOBARIA", prop, &size);
10006 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10007 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10010 r = MsiGetPropertyA(hpkg, "KAKURU", prop, &size);
10011 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10012 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10015 r = MsiGetPropertyA(hpkg, "LABOCANIA", prop, &size);
10016 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10017 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10020 r = MsiGetPropertyA(hpkg, "MEGARAPTOR", prop, &size);
10021 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10023 lstrcpyA(expected, CURR_DIR);
10024 lstrcatA(expected, "\\");
10025 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
10026 "Expected %s or empty string, got %s\n", expected, prop);
10029 r = MsiGetPropertyA(hpkg, "NEOSODON", prop, &size);
10030 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10032 lstrcpyA(expected, CURR_DIR);
10033 lstrcatA(expected, "\\neosodon\\");
10034 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
10035 "Expected %s or empty string, got %s\n", expected, prop);
10038 r = MsiGetPropertyA(hpkg, "OLOROTITAN", prop, &size);
10039 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10040 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10043 r = MsiGetPropertyA(hpkg, "PANTYDRACO", prop, &size);
10044 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10045 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10047 MsiCloseHandle(hpkg);
10048 DeleteFileA("abelisaurus");
10049 DeleteFileA("bactrosaurus");
10050 DeleteFileA("camelotia");
10051 DeleteFileA("diclonius");
10052 DeleteFileA("echinodon");
10053 DeleteFileA("falcarius");
10054 DeleteFileA("gallimimus");
10055 DeleteFileA("hagryphus");
10056 RemoveDirectoryA("iguanodon");
10057 RemoveDirectoryA("jobaria");
10058 RemoveDirectoryA("kakuru");
10059 RemoveDirectoryA("labocania");
10060 RemoveDirectoryA("megaraptor");
10061 RemoveDirectoryA("neosodon");
10062 RemoveDirectoryA("olorotitan");
10063 RemoveDirectoryA("pantydraco");
10064 delete_component_path("{E3619EED-305A-418C-B9C7-F7D7377F0934}",
10065 MSIINSTALLCONTEXT_MACHINE, NULL);
10066 delete_component_path("{D56B688D-542F-42Ef-90FD-B6DA76EE8119}",
10067 MSIINSTALLCONTEXT_MACHINE, NULL);
10068 delete_component_path("{A19E16C5-C75D-4699-8111-C4338C40C3CB}",
10069 MSIINSTALLCONTEXT_MACHINE, NULL);
10070 delete_component_path("{17762FA1-A7AE-4CC6-8827-62873C35361D}",
10071 MSIINSTALLCONTEXT_MACHINE, NULL);
10072 delete_component_path("{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}",
10073 MSIINSTALLCONTEXT_MACHINE, NULL);
10074 delete_component_path("{243C22B1-8C51-4151-B9D1-1AE5265E079E}",
10075 MSIINSTALLCONTEXT_MACHINE, NULL);
10076 delete_component_path("{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}",
10077 MSIINSTALLCONTEXT_MACHINE, NULL);
10078 delete_component_path("{0B499649-197A-48EF-93D2-AF1C17ED6E90}",
10079 MSIINSTALLCONTEXT_MACHINE, NULL);
10080 DeleteFileA(msifile);
10083 static void set_suminfo_prop(MSIHANDLE db, DWORD prop, DWORD val)
10088 r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
10089 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10091 r = MsiSummaryInfoSetPropertyA(summary, prop, VT_I4, val, NULL, NULL);
10092 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10094 r = MsiSummaryInfoPersist(summary);
10095 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
10097 MsiCloseHandle(summary);
10100 static void test_MsiGetSourcePath(void)
10102 MSIHANDLE hdb, hpkg;
10103 CHAR path[MAX_PATH];
10104 CHAR cwd[MAX_PATH];
10105 CHAR subsrc[MAX_PATH];
10106 CHAR sub2[MAX_PATH];
10110 lstrcpyA(cwd, CURR_DIR);
10111 lstrcatA(cwd, "\\");
10113 lstrcpyA(subsrc, cwd);
10114 lstrcatA(subsrc, "subsource");
10115 lstrcatA(subsrc, "\\");
10117 lstrcpyA(sub2, subsrc);
10118 lstrcatA(sub2, "sub2");
10119 lstrcatA(sub2, "\\");
10121 /* uncompressed source */
10123 hdb = create_package_db();
10124 ok( hdb, "failed to create database\n");
10126 set_suminfo_prop(hdb, PID_WORDCOUNT, 0);
10128 r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
10129 ok(r == S_OK, "failed\n");
10131 r = add_directory_entry(hdb, "'SubDir', 'TARGETDIR', 'subtarget:subsource'");
10132 ok(r == S_OK, "failed\n");
10134 r = add_directory_entry(hdb, "'SubDir2', 'SubDir', 'sub2'");
10135 ok(r == S_OK, "failed\n");
10137 r = MsiDatabaseCommit(hdb);
10138 ok(r == ERROR_SUCCESS , "Failed to commit database\n");
10140 r = package_from_db(hdb, &hpkg);
10141 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
10143 skip("Not enough rights to perform tests\n");
10144 DeleteFile(msifile);
10147 ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
10149 MsiCloseHandle(hdb);
10151 /* invalid database handle */
10153 lstrcpyA(path, "kiwi");
10154 r = MsiGetSourcePath(-1, "TARGETDIR", path, &size);
10155 ok(r == ERROR_INVALID_HANDLE,
10156 "Expected ERROR_INVALID_HANDLE, got %d\n", r);
10157 ok(!lstrcmpA(path, "kiwi"),
10158 "Expected path to be unchanged, got \"%s\"\n", path);
10159 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10161 /* NULL szFolder */
10163 lstrcpyA(path, "kiwi");
10164 r = MsiGetSourcePath(hpkg, NULL, path, &size);
10165 ok(r == ERROR_INVALID_PARAMETER,
10166 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
10167 ok(!lstrcmpA(path, "kiwi"),
10168 "Expected path to be unchanged, got \"%s\"\n", path);
10169 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10171 /* empty szFolder */
10173 lstrcpyA(path, "kiwi");
10174 r = MsiGetSourcePath(hpkg, "", path, &size);
10175 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10176 ok(!lstrcmpA(path, "kiwi"),
10177 "Expected path to be unchanged, got \"%s\"\n", path);
10178 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10180 /* try TARGETDIR */
10182 lstrcpyA(path, "kiwi");
10183 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10184 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10185 ok(!lstrcmpA(path, "kiwi"),
10186 "Expected path to be unchanged, got \"%s\"\n", path);
10187 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10190 lstrcpyA(path, "kiwi");
10191 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
10192 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10193 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10194 ok(size == 0, "Expected 0, got %d\n", size);
10197 lstrcpyA(path, "kiwi");
10198 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10199 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10200 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10201 ok(size == 0, "Expected 0, got %d\n", size);
10203 /* try SourceDir */
10205 lstrcpyA(path, "kiwi");
10206 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10207 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10208 ok(!lstrcmpA(path, "kiwi"),
10209 "Expected path to be unchanged, got \"%s\"\n", path);
10210 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10212 /* try SOURCEDIR */
10214 lstrcpyA(path, "kiwi");
10215 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10216 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10217 ok(!lstrcmpA(path, "kiwi"),
10218 "Expected path to be unchanged, got \"%s\"\n", path);
10219 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10221 /* source path does not exist, but the property exists */
10223 lstrcpyA(path, "kiwi");
10224 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
10225 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10226 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10227 ok(size == 0, "Expected 0, got %d\n", size);
10230 lstrcpyA(path, "kiwi");
10231 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10232 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10233 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10234 ok(size == 0, "Expected 0, got %d\n", size);
10238 lstrcpyA(path, "kiwi");
10239 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10240 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10241 ok(!lstrcmpA(path, "kiwi"),
10242 "Expected path to be unchanged, got \"%s\"\n", path);
10243 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10247 lstrcpyA(path, "kiwi");
10248 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10249 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10250 ok(!lstrcmpA(path, "kiwi"),
10251 "Expected path to be unchanged, got \"%s\"\n", path);
10252 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10254 r = MsiDoAction(hpkg, "CostInitialize");
10255 ok(r == ERROR_SUCCESS, "cost init failed\n");
10257 /* try TARGETDIR after CostInitialize */
10259 lstrcpyA(path, "kiwi");
10260 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10261 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10262 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10263 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10265 /* try SourceDir after CostInitialize */
10267 lstrcpyA(path, "kiwi");
10268 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10269 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10270 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10271 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10273 /* try SOURCEDIR after CostInitialize */
10275 lstrcpyA(path, "kiwi");
10276 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10277 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10278 ok(!lstrcmpA(path, "kiwi"),
10279 "Expected path to be unchanged, got \"%s\"\n", path);
10280 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10282 /* source path does not exist, but the property exists */
10284 lstrcpyA(path, "kiwi");
10285 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10286 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10289 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10290 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10293 /* try SubDir after CostInitialize */
10295 lstrcpyA(path, "kiwi");
10296 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10297 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10298 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10299 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10301 /* try SubDir2 after CostInitialize */
10303 lstrcpyA(path, "kiwi");
10304 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10305 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10306 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
10307 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
10309 r = MsiDoAction(hpkg, "ResolveSource");
10310 ok(r == ERROR_SUCCESS, "file cost failed\n");
10312 /* try TARGETDIR after ResolveSource */
10314 lstrcpyA(path, "kiwi");
10315 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10316 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10317 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10318 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10320 /* try SourceDir after ResolveSource */
10322 lstrcpyA(path, "kiwi");
10323 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10324 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10325 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10326 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10328 /* try SOURCEDIR after ResolveSource */
10330 lstrcpyA(path, "kiwi");
10331 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10332 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10333 ok(!lstrcmpA(path, "kiwi"),
10334 "Expected path to be unchanged, got \"%s\"\n", path);
10335 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10337 /* source path does not exist, but the property exists */
10339 lstrcpyA(path, "kiwi");
10340 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10341 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10342 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10343 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10345 /* try SubDir after ResolveSource */
10347 lstrcpyA(path, "kiwi");
10348 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10349 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10350 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10351 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10353 /* try SubDir2 after ResolveSource */
10355 lstrcpyA(path, "kiwi");
10356 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10357 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10358 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
10359 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
10361 r = MsiDoAction(hpkg, "FileCost");
10362 ok(r == ERROR_SUCCESS, "file cost failed\n");
10364 /* try TARGETDIR after FileCost */
10366 lstrcpyA(path, "kiwi");
10367 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10368 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10369 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10370 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10372 /* try SourceDir after FileCost */
10374 lstrcpyA(path, "kiwi");
10375 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10376 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10377 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10378 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10380 /* try SOURCEDIR after FileCost */
10382 lstrcpyA(path, "kiwi");
10383 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10384 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10385 ok(!lstrcmpA(path, "kiwi"),
10386 "Expected path to be unchanged, got \"%s\"\n", path);
10387 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10389 /* source path does not exist, but the property exists */
10391 lstrcpyA(path, "kiwi");
10392 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10393 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10394 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10395 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10397 /* try SubDir after FileCost */
10399 lstrcpyA(path, "kiwi");
10400 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10401 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10402 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10403 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10405 /* try SubDir2 after FileCost */
10407 lstrcpyA(path, "kiwi");
10408 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10409 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10410 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
10411 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
10413 r = MsiDoAction(hpkg, "CostFinalize");
10414 ok(r == ERROR_SUCCESS, "file cost failed\n");
10416 /* try TARGETDIR after CostFinalize */
10418 lstrcpyA(path, "kiwi");
10419 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10420 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10421 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10422 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10424 /* try SourceDir after CostFinalize */
10426 lstrcpyA(path, "kiwi");
10427 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10428 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10429 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10430 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10432 /* try SOURCEDIR after CostFinalize */
10434 lstrcpyA(path, "kiwi");
10435 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10436 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10437 ok(!lstrcmpA(path, "kiwi"),
10438 "Expected path to be unchanged, got \"%s\"\n", path);
10439 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10441 /* source path does not exist, but the property exists */
10443 lstrcpyA(path, "kiwi");
10444 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10445 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10446 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10447 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10449 /* try SubDir after CostFinalize */
10451 lstrcpyA(path, "kiwi");
10452 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10453 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10454 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10455 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10457 /* try SubDir2 after CostFinalize */
10459 lstrcpyA(path, "kiwi");
10460 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10461 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10462 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
10463 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
10465 /* nonexistent directory */
10467 lstrcpyA(path, "kiwi");
10468 r = MsiGetSourcePath(hpkg, "IDontExist", path, &size);
10469 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10470 ok(!lstrcmpA(path, "kiwi"),
10471 "Expected path to be unchanged, got \"%s\"\n", path);
10472 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10474 /* NULL szPathBuf */
10476 r = MsiGetSourcePath(hpkg, "SourceDir", NULL, &size);
10477 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10478 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10480 /* NULL pcchPathBuf */
10481 lstrcpyA(path, "kiwi");
10482 r = MsiGetSourcePath(hpkg, "SourceDir", path, NULL);
10483 ok(r == ERROR_INVALID_PARAMETER,
10484 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
10485 ok(!lstrcmpA(path, "kiwi"),
10486 "Expected path to be unchanged, got \"%s\"\n", path);
10488 /* pcchPathBuf is 0 */
10490 lstrcpyA(path, "kiwi");
10491 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10492 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
10493 ok(!lstrcmpA(path, "kiwi"),
10494 "Expected path to be unchanged, got \"%s\"\n", path);
10495 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10497 /* pcchPathBuf does not have room for NULL terminator */
10498 size = lstrlenA(cwd);
10499 lstrcpyA(path, "kiwi");
10500 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10501 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
10502 ok(!strncmp(path, cwd, lstrlenA(cwd) - 1),
10503 "Expected path with no backslash, got \"%s\"\n", path);
10504 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10506 /* pcchPathBuf has room for NULL terminator */
10507 size = lstrlenA(cwd) + 1;
10508 lstrcpyA(path, "kiwi");
10509 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10510 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10511 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10512 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10514 /* remove property */
10515 r = MsiSetProperty(hpkg, "SourceDir", NULL);
10516 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10518 /* try SourceDir again */
10520 lstrcpyA(path, "kiwi");
10521 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10522 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10523 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10524 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10526 /* set property to a valid directory */
10527 r = MsiSetProperty(hpkg, "SOURCEDIR", cwd);
10528 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10530 /* try SOURCEDIR again */
10532 lstrcpyA(path, "kiwi");
10533 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10534 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10535 ok(!lstrcmpA(path, "kiwi"),
10536 "Expected path to be unchanged, got \"%s\"\n", path);
10537 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10539 MsiCloseHandle(hpkg);
10541 /* compressed source */
10543 r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
10544 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10546 set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeCompressed);
10548 r = package_from_db(hdb, &hpkg);
10549 ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
10551 /* try TARGETDIR */
10553 lstrcpyA(path, "kiwi");
10554 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10555 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10556 ok(!lstrcmpA(path, "kiwi"),
10557 "Expected path to be unchanged, got \"%s\"\n", path);
10558 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10560 /* try SourceDir */
10562 lstrcpyA(path, "kiwi");
10563 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10564 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10565 ok(!lstrcmpA(path, "kiwi"),
10566 "Expected path to be unchanged, got \"%s\"\n", path);
10567 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10569 /* try SOURCEDIR */
10571 lstrcpyA(path, "kiwi");
10572 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10573 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10574 ok(!lstrcmpA(path, "kiwi"),
10575 "Expected path to be unchanged, got \"%s\"\n", path);
10576 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10578 /* source path nor the property exist */
10580 lstrcpyA(path, "kiwi");
10581 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10582 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10583 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10584 ok(size == 0, "Expected 0, got %d\n", size);
10588 lstrcpyA(path, "kiwi");
10589 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10590 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10591 ok(!lstrcmpA(path, "kiwi"),
10592 "Expected path to be unchanged, got \"%s\"\n", path);
10593 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10597 lstrcpyA(path, "kiwi");
10598 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10599 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10600 ok(!lstrcmpA(path, "kiwi"),
10601 "Expected path to be unchanged, got \"%s\"\n", path);
10602 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10604 r = MsiDoAction(hpkg, "CostInitialize");
10605 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10607 /* try TARGETDIR after CostInitialize */
10609 lstrcpyA(path, "kiwi");
10610 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10611 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10612 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10613 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10615 /* try SourceDir after CostInitialize */
10617 lstrcpyA(path, "kiwi");
10618 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10619 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10620 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10621 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10623 /* try SOURCEDIR after CostInitialize */
10625 lstrcpyA(path, "kiwi");
10626 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10629 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10630 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10631 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10634 /* source path does not exist, but the property exists */
10636 lstrcpyA(path, "kiwi");
10637 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10638 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10641 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10642 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10645 /* try SubDir after CostInitialize */
10647 lstrcpyA(path, "kiwi");
10648 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10649 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10650 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10651 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10653 /* try SubDir2 after CostInitialize */
10655 lstrcpyA(path, "kiwi");
10656 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10657 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10658 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10659 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10661 r = MsiDoAction(hpkg, "ResolveSource");
10662 ok(r == ERROR_SUCCESS, "file cost failed\n");
10664 /* try TARGETDIR after ResolveSource */
10666 lstrcpyA(path, "kiwi");
10667 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10668 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10669 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10670 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10672 /* try SourceDir after ResolveSource */
10674 lstrcpyA(path, "kiwi");
10675 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10676 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10677 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10678 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10680 /* try SOURCEDIR after ResolveSource */
10682 lstrcpyA(path, "kiwi");
10683 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10686 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10687 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10688 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10691 /* source path and the property exist */
10693 lstrcpyA(path, "kiwi");
10694 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10695 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10696 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10697 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10699 /* try SubDir after ResolveSource */
10701 lstrcpyA(path, "kiwi");
10702 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10703 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10704 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10705 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10707 /* try SubDir2 after ResolveSource */
10709 lstrcpyA(path, "kiwi");
10710 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10711 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10712 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10713 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10715 r = MsiDoAction(hpkg, "FileCost");
10716 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10718 /* try TARGETDIR after CostFinalize */
10720 lstrcpyA(path, "kiwi");
10721 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10722 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10723 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10724 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10726 /* try SourceDir after CostFinalize */
10728 lstrcpyA(path, "kiwi");
10729 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10730 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10731 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10732 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10734 /* try SOURCEDIR after CostFinalize */
10736 lstrcpyA(path, "kiwi");
10737 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10740 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10741 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10742 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10745 /* source path and the property exist */
10747 lstrcpyA(path, "kiwi");
10748 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10749 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10750 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10751 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10753 /* try SubDir after CostFinalize */
10755 lstrcpyA(path, "kiwi");
10756 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10757 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10758 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10759 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10761 /* try SubDir2 after CostFinalize */
10763 lstrcpyA(path, "kiwi");
10764 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10765 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10766 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10767 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10769 r = MsiDoAction(hpkg, "CostFinalize");
10770 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10772 /* try TARGETDIR after CostFinalize */
10774 lstrcpyA(path, "kiwi");
10775 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10776 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10777 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10778 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10780 /* try SourceDir after CostFinalize */
10782 lstrcpyA(path, "kiwi");
10783 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10784 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10785 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10786 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10788 /* try SOURCEDIR after CostFinalize */
10790 lstrcpyA(path, "kiwi");
10791 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10794 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10795 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10796 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10799 /* source path and the property exist */
10801 lstrcpyA(path, "kiwi");
10802 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10803 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10804 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10805 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10807 /* try SubDir after CostFinalize */
10809 lstrcpyA(path, "kiwi");
10810 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10811 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10812 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10813 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10815 /* try SubDir2 after CostFinalize */
10817 lstrcpyA(path, "kiwi");
10818 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10819 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10820 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10821 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10823 MsiCloseHandle(hpkg);
10824 DeleteFile(msifile);
10827 static void test_shortlongsource(void)
10829 MSIHANDLE hdb, hpkg;
10830 CHAR path[MAX_PATH];
10831 CHAR cwd[MAX_PATH];
10832 CHAR subsrc[MAX_PATH];
10836 lstrcpyA(cwd, CURR_DIR);
10837 lstrcatA(cwd, "\\");
10839 lstrcpyA(subsrc, cwd);
10840 lstrcatA(subsrc, "long");
10841 lstrcatA(subsrc, "\\");
10843 /* long file names */
10845 hdb = create_package_db();
10846 ok( hdb, "failed to create database\n");
10848 set_suminfo_prop(hdb, PID_WORDCOUNT, 0);
10850 r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
10851 ok(r == S_OK, "failed\n");
10853 r = add_directory_entry(hdb, "'SubDir', 'TARGETDIR', 'short|long'");
10854 ok(r == S_OK, "failed\n");
10856 /* CostInitialize:short */
10857 r = add_directory_entry(hdb, "'SubDir2', 'TARGETDIR', 'one|two'");
10858 ok(r == S_OK, "failed\n");
10860 /* CostInitialize:long */
10861 r = add_directory_entry(hdb, "'SubDir3', 'TARGETDIR', 'three|four'");
10862 ok(r == S_OK, "failed\n");
10864 /* FileCost:short */
10865 r = add_directory_entry(hdb, "'SubDir4', 'TARGETDIR', 'five|six'");
10866 ok(r == S_OK, "failed\n");
10868 /* FileCost:long */
10869 r = add_directory_entry(hdb, "'SubDir5', 'TARGETDIR', 'seven|eight'");
10870 ok(r == S_OK, "failed\n");
10872 /* CostFinalize:short */
10873 r = add_directory_entry(hdb, "'SubDir6', 'TARGETDIR', 'nine|ten'");
10874 ok(r == S_OK, "failed\n");
10876 /* CostFinalize:long */
10877 r = add_directory_entry(hdb, "'SubDir7', 'TARGETDIR', 'eleven|twelve'");
10878 ok(r == S_OK, "failed\n");
10880 MsiDatabaseCommit(hdb);
10882 r = package_from_db(hdb, &hpkg);
10883 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
10885 skip("Not enough rights to perform tests\n");
10886 DeleteFile(msifile);
10889 ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
10891 MsiCloseHandle(hdb);
10893 CreateDirectoryA("one", NULL);
10894 CreateDirectoryA("four", NULL);
10896 r = MsiDoAction(hpkg, "CostInitialize");
10897 ok(r == ERROR_SUCCESS, "file cost failed\n");
10899 CreateDirectory("five", NULL);
10900 CreateDirectory("eight", NULL);
10902 r = MsiDoAction(hpkg, "FileCost");
10903 ok(r == ERROR_SUCCESS, "file cost failed\n");
10905 CreateDirectory("nine", NULL);
10906 CreateDirectory("twelve", NULL);
10908 r = MsiDoAction(hpkg, "CostFinalize");
10909 ok(r == ERROR_SUCCESS, "file cost failed\n");
10911 /* neither short nor long source directories exist */
10913 lstrcpyA(path, "kiwi");
10914 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10915 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10916 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10917 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10919 CreateDirectoryA("short", NULL);
10921 /* short source directory exists */
10923 lstrcpyA(path, "kiwi");
10924 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10925 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10926 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10927 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10929 CreateDirectoryA("long", NULL);
10931 /* both short and long source directories exist */
10933 lstrcpyA(path, "kiwi");
10934 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10935 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10936 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10937 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10939 lstrcpyA(subsrc, cwd);
10940 lstrcatA(subsrc, "two");
10941 lstrcatA(subsrc, "\\");
10943 /* short dir exists before CostInitialize */
10945 lstrcpyA(path, "kiwi");
10946 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10947 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10948 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10949 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10951 lstrcpyA(subsrc, cwd);
10952 lstrcatA(subsrc, "four");
10953 lstrcatA(subsrc, "\\");
10955 /* long dir exists before CostInitialize */
10957 lstrcpyA(path, "kiwi");
10958 r = MsiGetSourcePath(hpkg, "SubDir3", path, &size);
10959 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10960 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10961 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10963 lstrcpyA(subsrc, cwd);
10964 lstrcatA(subsrc, "six");
10965 lstrcatA(subsrc, "\\");
10967 /* short dir exists before FileCost */
10969 lstrcpyA(path, "kiwi");
10970 r = MsiGetSourcePath(hpkg, "SubDir4", path, &size);
10971 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10972 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10973 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10975 lstrcpyA(subsrc, cwd);
10976 lstrcatA(subsrc, "eight");
10977 lstrcatA(subsrc, "\\");
10979 /* long dir exists before FileCost */
10981 lstrcpyA(path, "kiwi");
10982 r = MsiGetSourcePath(hpkg, "SubDir5", path, &size);
10983 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10984 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10985 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10987 lstrcpyA(subsrc, cwd);
10988 lstrcatA(subsrc, "ten");
10989 lstrcatA(subsrc, "\\");
10991 /* short dir exists before CostFinalize */
10993 lstrcpyA(path, "kiwi");
10994 r = MsiGetSourcePath(hpkg, "SubDir6", path, &size);
10995 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10996 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10997 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10999 lstrcpyA(subsrc, cwd);
11000 lstrcatA(subsrc, "twelve");
11001 lstrcatA(subsrc, "\\");
11003 /* long dir exists before CostFinalize */
11005 lstrcpyA(path, "kiwi");
11006 r = MsiGetSourcePath(hpkg, "SubDir7", path, &size);
11007 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11008 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11009 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11011 MsiCloseHandle(hpkg);
11012 RemoveDirectoryA("short");
11013 RemoveDirectoryA("long");
11014 RemoveDirectoryA("one");
11015 RemoveDirectoryA("four");
11016 RemoveDirectoryA("five");
11017 RemoveDirectoryA("eight");
11018 RemoveDirectoryA("nine");
11019 RemoveDirectoryA("twelve");
11021 /* short file names */
11023 r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
11024 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11026 set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeSFN);
11028 r = package_from_db(hdb, &hpkg);
11029 ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
11031 MsiCloseHandle(hdb);
11033 CreateDirectoryA("one", NULL);
11034 CreateDirectoryA("four", NULL);
11036 r = MsiDoAction(hpkg, "CostInitialize");
11037 ok(r == ERROR_SUCCESS, "file cost failed\n");
11039 CreateDirectory("five", NULL);
11040 CreateDirectory("eight", NULL);
11042 r = MsiDoAction(hpkg, "FileCost");
11043 ok(r == ERROR_SUCCESS, "file cost failed\n");
11045 CreateDirectory("nine", NULL);
11046 CreateDirectory("twelve", NULL);
11048 r = MsiDoAction(hpkg, "CostFinalize");
11049 ok(r == ERROR_SUCCESS, "file cost failed\n");
11051 lstrcpyA(subsrc, cwd);
11052 lstrcatA(subsrc, "short");
11053 lstrcatA(subsrc, "\\");
11055 /* neither short nor long source directories exist */
11057 lstrcpyA(path, "kiwi");
11058 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11059 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11060 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11061 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11063 CreateDirectoryA("short", NULL);
11065 /* short source directory exists */
11067 lstrcpyA(path, "kiwi");
11068 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11069 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11070 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11071 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11073 CreateDirectoryA("long", NULL);
11075 /* both short and long source directories exist */
11077 lstrcpyA(path, "kiwi");
11078 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11079 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11080 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11081 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11083 lstrcpyA(subsrc, cwd);
11084 lstrcatA(subsrc, "one");
11085 lstrcatA(subsrc, "\\");
11087 /* short dir exists before CostInitialize */
11089 lstrcpyA(path, "kiwi");
11090 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
11091 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11092 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11093 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11095 lstrcpyA(subsrc, cwd);
11096 lstrcatA(subsrc, "three");
11097 lstrcatA(subsrc, "\\");
11099 /* long dir exists before CostInitialize */
11101 lstrcpyA(path, "kiwi");
11102 r = MsiGetSourcePath(hpkg, "SubDir3", path, &size);
11103 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11104 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11105 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11107 lstrcpyA(subsrc, cwd);
11108 lstrcatA(subsrc, "five");
11109 lstrcatA(subsrc, "\\");
11111 /* short dir exists before FileCost */
11113 lstrcpyA(path, "kiwi");
11114 r = MsiGetSourcePath(hpkg, "SubDir4", path, &size);
11115 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11116 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11117 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11119 lstrcpyA(subsrc, cwd);
11120 lstrcatA(subsrc, "seven");
11121 lstrcatA(subsrc, "\\");
11123 /* long dir exists before FileCost */
11125 lstrcpyA(path, "kiwi");
11126 r = MsiGetSourcePath(hpkg, "SubDir5", path, &size);
11127 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11128 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11129 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11131 lstrcpyA(subsrc, cwd);
11132 lstrcatA(subsrc, "nine");
11133 lstrcatA(subsrc, "\\");
11135 /* short dir exists before CostFinalize */
11137 lstrcpyA(path, "kiwi");
11138 r = MsiGetSourcePath(hpkg, "SubDir6", path, &size);
11139 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11140 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11141 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11143 lstrcpyA(subsrc, cwd);
11144 lstrcatA(subsrc, "eleven");
11145 lstrcatA(subsrc, "\\");
11147 /* long dir exists before CostFinalize */
11149 lstrcpyA(path, "kiwi");
11150 r = MsiGetSourcePath(hpkg, "SubDir7", path, &size);
11151 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11152 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11153 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11155 MsiCloseHandle(hpkg);
11156 RemoveDirectoryA("short");
11157 RemoveDirectoryA("long");
11158 RemoveDirectoryA("one");
11159 RemoveDirectoryA("four");
11160 RemoveDirectoryA("five");
11161 RemoveDirectoryA("eight");
11162 RemoveDirectoryA("nine");
11163 RemoveDirectoryA("twelve");
11164 DeleteFileA(msifile);
11167 static void test_sourcedir(void)
11169 MSIHANDLE hdb, hpkg;
11171 CHAR path[MAX_PATH];
11172 CHAR cwd[MAX_PATH];
11173 CHAR subsrc[MAX_PATH];
11177 lstrcpyA(cwd, CURR_DIR);
11178 lstrcatA(cwd, "\\");
11180 lstrcpyA(subsrc, cwd);
11181 lstrcatA(subsrc, "long");
11182 lstrcatA(subsrc, "\\");
11184 hdb = create_package_db();
11185 ok( hdb, "failed to create database\n");
11187 r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
11188 ok(r == S_OK, "failed\n");
11190 sprintf(package, "#%u", hdb);
11191 r = MsiOpenPackage(package, &hpkg);
11192 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
11194 skip("Not enough rights to perform tests\n");
11197 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11199 /* properties only */
11201 /* SourceDir prop */
11203 lstrcpyA(path, "kiwi");
11204 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11205 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11206 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11207 ok(size == 0, "Expected 0, got %d\n", size);
11209 /* SOURCEDIR prop */
11211 lstrcpyA(path, "kiwi");
11212 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11213 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11214 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11215 ok(size == 0, "Expected 0, got %d\n", size);
11217 r = MsiDoAction(hpkg, "CostInitialize");
11218 ok(r == ERROR_SUCCESS, "file cost failed\n");
11220 /* SourceDir after CostInitialize */
11222 lstrcpyA(path, "kiwi");
11223 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11224 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11225 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11226 ok(size == 0, "Expected 0, got %d\n", size);
11228 /* SOURCEDIR after CostInitialize */
11230 lstrcpyA(path, "kiwi");
11231 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11232 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11233 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11234 ok(size == 0, "Expected 0, got %d\n", size);
11236 r = MsiDoAction(hpkg, "FileCost");
11237 ok(r == ERROR_SUCCESS, "file cost failed\n");
11239 /* SourceDir after FileCost */
11241 lstrcpyA(path, "kiwi");
11242 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11243 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11244 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11245 ok(size == 0, "Expected 0, got %d\n", size);
11247 /* SOURCEDIR after FileCost */
11249 lstrcpyA(path, "kiwi");
11250 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11251 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11252 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11253 ok(size == 0, "Expected 0, got %d\n", size);
11255 r = MsiDoAction(hpkg, "CostFinalize");
11256 ok(r == ERROR_SUCCESS, "file cost failed\n");
11258 /* SourceDir after CostFinalize */
11260 lstrcpyA(path, "kiwi");
11261 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11262 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11263 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11264 ok(size == 0, "Expected 0, got %d\n", size);
11266 /* SOURCEDIR after CostFinalize */
11268 lstrcpyA(path, "kiwi");
11269 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11270 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11271 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11272 ok(size == 0, "Expected 0, got %d\n", size);
11274 r = MsiDoAction(hpkg, "ResolveSource");
11275 ok(r == ERROR_SUCCESS, "file cost failed\n");
11277 /* SourceDir after ResolveSource */
11279 lstrcpyA(path, "kiwi");
11280 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11281 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11282 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11283 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11285 /* SOURCEDIR after ResolveSource */
11287 lstrcpyA(path, "kiwi");
11288 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11289 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11290 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11291 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11293 /* random casing */
11295 lstrcpyA(path, "kiwi");
11296 r = MsiGetProperty(hpkg, "SoUrCeDiR", path, &size);
11297 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11298 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11299 ok(size == 0, "Expected 0, got %d\n", size);
11301 MsiCloseHandle(hpkg);
11303 /* reset the package state */
11304 sprintf(package, "#%i", hdb);
11305 r = MsiOpenPackage(package, &hpkg);
11306 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11308 /* test how MsiGetSourcePath affects the properties */
11310 /* SourceDir prop */
11312 lstrcpyA(path, "kiwi");
11313 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11314 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11317 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11318 ok(size == 0, "Expected 0, got %d\n", size);
11322 lstrcpyA(path, "kiwi");
11323 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11324 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11325 ok(!lstrcmpA(path, "kiwi"),
11326 "Expected path to be unchanged, got \"%s\"\n", path);
11327 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11329 /* SourceDir after MsiGetSourcePath */
11331 lstrcpyA(path, "kiwi");
11332 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11333 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11336 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11337 ok(size == 0, "Expected 0, got %d\n", size);
11340 /* SOURCEDIR prop */
11342 lstrcpyA(path, "kiwi");
11343 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11344 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11347 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11348 ok(size == 0, "Expected 0, got %d\n", size);
11352 lstrcpyA(path, "kiwi");
11353 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11354 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11355 ok(!lstrcmpA(path, "kiwi"),
11356 "Expected path to be unchanged, got \"%s\"\n", path);
11357 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11359 /* SOURCEDIR prop after MsiGetSourcePath */
11361 lstrcpyA(path, "kiwi");
11362 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11363 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11366 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11367 ok(size == 0, "Expected 0, got %d\n", size);
11370 r = MsiDoAction(hpkg, "CostInitialize");
11371 ok(r == ERROR_SUCCESS, "file cost failed\n");
11373 /* SourceDir after CostInitialize */
11375 lstrcpyA(path, "kiwi");
11376 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11377 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11380 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11381 ok(size == 0, "Expected 0, got %d\n", size);
11385 lstrcpyA(path, "kiwi");
11386 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11387 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11388 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11389 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11391 /* SourceDir after MsiGetSourcePath */
11393 lstrcpyA(path, "kiwi");
11394 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11395 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11396 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11397 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11399 /* SOURCEDIR after CostInitialize */
11401 lstrcpyA(path, "kiwi");
11402 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11403 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11404 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11405 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11407 /* SOURCEDIR source path still does not exist */
11409 lstrcpyA(path, "kiwi");
11410 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11411 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11412 ok(!lstrcmpA(path, "kiwi"),
11413 "Expected path to be unchanged, got \"%s\"\n", path);
11414 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11416 r = MsiDoAction(hpkg, "FileCost");
11417 ok(r == ERROR_SUCCESS, "file cost failed\n");
11419 /* SourceDir after FileCost */
11421 lstrcpyA(path, "kiwi");
11422 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11423 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11424 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11425 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11427 /* SOURCEDIR after FileCost */
11429 lstrcpyA(path, "kiwi");
11430 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11431 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11432 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11433 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11435 /* SOURCEDIR source path still does not exist */
11437 lstrcpyA(path, "kiwi");
11438 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11439 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11440 ok(!lstrcmpA(path, "kiwi"),
11441 "Expected path to be unchanged, got \"%s\"\n", path);
11442 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11444 r = MsiDoAction(hpkg, "CostFinalize");
11445 ok(r == ERROR_SUCCESS, "file cost failed\n");
11447 /* SourceDir after CostFinalize */
11449 lstrcpyA(path, "kiwi");
11450 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11451 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11452 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11453 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11455 /* SOURCEDIR after CostFinalize */
11457 lstrcpyA(path, "kiwi");
11458 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11459 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11460 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11461 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11463 /* SOURCEDIR source path still does not exist */
11465 lstrcpyA(path, "kiwi");
11466 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11467 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11468 ok(!lstrcmpA(path, "kiwi"),
11469 "Expected path to be unchanged, got \"%s\"\n", path);
11470 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11472 r = MsiDoAction(hpkg, "ResolveSource");
11473 ok(r == ERROR_SUCCESS, "file cost failed\n");
11475 /* SourceDir after ResolveSource */
11477 lstrcpyA(path, "kiwi");
11478 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11479 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11480 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11481 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11483 /* SOURCEDIR after ResolveSource */
11485 lstrcpyA(path, "kiwi");
11486 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11487 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11488 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11489 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11491 /* SOURCEDIR source path still does not exist */
11493 lstrcpyA(path, "kiwi");
11494 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11495 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11496 ok(!lstrcmpA(path, "kiwi"),
11497 "Expected path to be unchanged, got \"%s\"\n", path);
11498 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11500 MsiCloseHandle(hpkg);
11503 MsiCloseHandle(hdb);
11504 DeleteFileA(msifile);
11514 static const struct access_res create[16] =
11516 { TRUE, ERROR_SUCCESS, TRUE },
11517 { TRUE, ERROR_SUCCESS, TRUE },
11518 { TRUE, ERROR_SUCCESS, FALSE },
11519 { TRUE, ERROR_SUCCESS, FALSE },
11520 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11521 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11522 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11523 { TRUE, ERROR_SUCCESS, FALSE },
11524 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11525 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11526 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11527 { TRUE, ERROR_SUCCESS, TRUE },
11528 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11529 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11530 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11531 { TRUE, ERROR_SUCCESS, TRUE }
11534 static const struct access_res create_commit[16] =
11536 { TRUE, ERROR_SUCCESS, TRUE },
11537 { TRUE, ERROR_SUCCESS, TRUE },
11538 { TRUE, ERROR_SUCCESS, FALSE },
11539 { TRUE, ERROR_SUCCESS, FALSE },
11540 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11541 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11542 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11543 { TRUE, ERROR_SUCCESS, FALSE },
11544 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11545 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11546 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11547 { TRUE, ERROR_SUCCESS, TRUE },
11548 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11549 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11550 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11551 { TRUE, ERROR_SUCCESS, TRUE }
11554 static const struct access_res create_close[16] =
11556 { TRUE, ERROR_SUCCESS, FALSE },
11557 { TRUE, ERROR_SUCCESS, FALSE },
11558 { TRUE, ERROR_SUCCESS, FALSE },
11559 { TRUE, ERROR_SUCCESS, FALSE },
11560 { TRUE, ERROR_SUCCESS, FALSE },
11561 { TRUE, ERROR_SUCCESS, FALSE },
11562 { TRUE, ERROR_SUCCESS, FALSE },
11563 { TRUE, ERROR_SUCCESS, FALSE },
11564 { TRUE, ERROR_SUCCESS, FALSE },
11565 { TRUE, ERROR_SUCCESS, FALSE },
11566 { TRUE, ERROR_SUCCESS, FALSE },
11567 { TRUE, ERROR_SUCCESS, FALSE },
11568 { TRUE, ERROR_SUCCESS, FALSE },
11569 { TRUE, ERROR_SUCCESS, FALSE },
11570 { TRUE, ERROR_SUCCESS, FALSE },
11571 { TRUE, ERROR_SUCCESS }
11574 static void _test_file_access(LPCSTR file, const struct access_res *ares, DWORD line)
11576 DWORD access = 0, share = 0;
11581 for (i = 0; i < 4; i++)
11583 if (i == 0) access = 0;
11584 if (i == 1) access = GENERIC_READ;
11585 if (i == 2) access = GENERIC_WRITE;
11586 if (i == 3) access = GENERIC_READ | GENERIC_WRITE;
11588 for (j = 0; j < 4; j++)
11590 if (ares[idx].ignore)
11593 if (j == 0) share = 0;
11594 if (j == 1) share = FILE_SHARE_READ;
11595 if (j == 2) share = FILE_SHARE_WRITE;
11596 if (j == 3) share = FILE_SHARE_READ | FILE_SHARE_WRITE;
11598 SetLastError(0xdeadbeef);
11599 hfile = CreateFileA(file, access, share, NULL, OPEN_EXISTING,
11600 FILE_ATTRIBUTE_NORMAL, 0);
11601 lasterr = GetLastError();
11603 ok((hfile != INVALID_HANDLE_VALUE) == ares[idx].gothandle,
11604 "(%d, handle, %d): Expected %d, got %d\n",
11605 line, idx, ares[idx].gothandle,
11606 (hfile != INVALID_HANDLE_VALUE));
11608 ok(lasterr == ares[idx].lasterr ||
11609 lasterr == 0xdeadbeef, /* win9x */
11610 "(%d, lasterr, %d): Expected %d, got %d\n",
11611 line, idx, ares[idx].lasterr, lasterr);
11613 CloseHandle(hfile);
11619 #define test_file_access(file, ares) _test_file_access(file, ares, __LINE__)
11621 static void test_access(void)
11626 r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
11627 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11629 test_file_access(msifile, create);
11631 r = MsiDatabaseCommit(hdb);
11632 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11634 test_file_access(msifile, create_commit);
11636 MsiCloseHandle(hdb);
11638 test_file_access(msifile, create_close);
11640 DeleteFileA(msifile);
11642 r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATEDIRECT, &hdb);
11643 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11645 test_file_access(msifile, create);
11647 r = MsiDatabaseCommit(hdb);
11648 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11650 test_file_access(msifile, create_commit);
11652 MsiCloseHandle(hdb);
11654 test_file_access(msifile, create_close);
11656 DeleteFileA(msifile);
11659 static void test_emptypackage(void)
11661 MSIHANDLE hpkg = 0, hdb = 0, hsuminfo = 0;
11662 MSIHANDLE hview = 0, hrec = 0;
11663 MSICONDITION condition;
11664 CHAR buffer[MAX_PATH];
11668 r = MsiOpenPackageA("", &hpkg);
11669 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
11671 skip("Not enough rights to perform tests\n");
11676 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11679 hdb = MsiGetActiveDatabase(hpkg);
11682 ok(hdb != 0, "Expected a valid database handle\n");
11685 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Tables`", &hview);
11688 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11690 r = MsiViewExecute(hview, 0);
11693 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11696 r = MsiViewFetch(hview, &hrec);
11699 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11704 r = MsiRecordGetString(hrec, 1, buffer, &size);
11707 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11708 ok(!lstrcmpA(buffer, "_Property"),
11709 "Expected \"_Property\", got \"%s\"\n", buffer);
11712 MsiCloseHandle(hrec);
11714 r = MsiViewFetch(hview, &hrec);
11717 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11721 r = MsiRecordGetString(hrec, 1, buffer, &size);
11724 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11725 ok(!lstrcmpA(buffer, "#_FolderCache"),
11726 "Expected \"_Property\", got \"%s\"\n", buffer);
11729 MsiCloseHandle(hrec);
11730 MsiViewClose(hview);
11731 MsiCloseHandle(hview);
11733 condition = MsiDatabaseIsTablePersistentA(hdb, "_Property");
11736 ok(condition == MSICONDITION_FALSE,
11737 "Expected MSICONDITION_FALSE, got %d\n", condition);
11740 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Property`", &hview);
11743 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11745 r = MsiViewExecute(hview, 0);
11748 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11751 /* _Property table is not empty */
11752 r = MsiViewFetch(hview, &hrec);
11755 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11758 MsiCloseHandle(hrec);
11759 MsiViewClose(hview);
11760 MsiCloseHandle(hview);
11762 condition = MsiDatabaseIsTablePersistentA(hdb, "#_FolderCache");
11765 ok(condition == MSICONDITION_FALSE,
11766 "Expected MSICONDITION_FALSE, got %d\n", condition);
11769 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `#_FolderCache`", &hview);
11772 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11774 r = MsiViewExecute(hview, 0);
11777 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11780 /* #_FolderCache is not empty */
11781 r = MsiViewFetch(hview, &hrec);
11784 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11787 MsiCloseHandle(hrec);
11788 MsiViewClose(hview);
11789 MsiCloseHandle(hview);
11791 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Streams`", &hview);
11794 ok(r == ERROR_BAD_QUERY_SYNTAX,
11795 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
11798 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Storages`", &hview);
11801 ok(r == ERROR_BAD_QUERY_SYNTAX,
11802 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
11805 r = MsiGetSummaryInformationA(hdb, NULL, 0, &hsuminfo);
11808 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
11809 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
11812 MsiCloseHandle(hsuminfo);
11814 r = MsiDatabaseCommit(hdb);
11817 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11820 MsiCloseHandle(hdb);
11821 MsiCloseHandle(hpkg);
11824 static void test_MsiGetProductProperty(void)
11826 MSIHANDLE hprod, hdb;
11827 CHAR val[MAX_PATH];
11828 CHAR path[MAX_PATH];
11829 CHAR query[MAX_PATH];
11830 CHAR keypath[MAX_PATH*2];
11831 CHAR prodcode[MAX_PATH];
11832 CHAR prod_squashed[MAX_PATH];
11833 HKEY prodkey, userkey, props;
11838 REGSAM access = KEY_ALL_ACCESS;
11841 scm = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT);
11842 if (!scm && (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED))
11844 win_skip("Different registry keys on Win9x and WinMe\n");
11847 CloseServiceHandle(scm);
11849 GetCurrentDirectoryA(MAX_PATH, path);
11850 lstrcatA(path, "\\");
11852 create_test_guid(prodcode, prod_squashed);
11854 if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64)
11855 access |= KEY_WOW64_64KEY;
11857 r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
11858 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11860 r = MsiDatabaseCommit(hdb);
11861 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11863 r = set_summary_info(hdb);
11864 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11867 "CREATE TABLE `Directory` ( "
11868 "`Directory` CHAR(255) NOT NULL, "
11869 "`Directory_Parent` CHAR(255), "
11870 "`DefaultDir` CHAR(255) NOT NULL "
11871 "PRIMARY KEY `Directory`)");
11872 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11875 "CREATE TABLE `Property` ( "
11876 "`Property` CHAR(72) NOT NULL, "
11877 "`Value` CHAR(255) "
11878 "PRIMARY KEY `Property`)");
11879 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11881 sprintf(query, "INSERT INTO `Property` "
11882 "(`Property`, `Value`) "
11883 "VALUES( 'ProductCode', '%s' )", prodcode);
11884 r = run_query(hdb, query);
11885 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11887 r = MsiDatabaseCommit(hdb);
11888 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11890 MsiCloseHandle(hdb);
11892 lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
11893 lstrcatA(keypath, prod_squashed);
11895 res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
11896 if (res == ERROR_ACCESS_DENIED)
11898 skip("Not enough rights to perform tests\n");
11899 DeleteFile(msifile);
11902 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
11904 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
11905 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
11906 lstrcatA(keypath, prod_squashed);
11908 res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userkey, NULL);
11909 if (res == ERROR_ACCESS_DENIED)
11911 skip("Not enough rights to perform tests\n");
11912 RegDeleteKeyA(prodkey, "");
11913 RegCloseKey(prodkey);
11916 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
11918 res = RegCreateKeyExA(userkey, "InstallProperties", 0, NULL, 0, access, NULL, &props, NULL);
11919 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
11921 lstrcpyA(val, path);
11922 lstrcatA(val, "\\");
11923 lstrcatA(val, msifile);
11924 res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ,
11925 (const BYTE *)val, lstrlenA(val) + 1);
11926 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
11928 hprod = 0xdeadbeef;
11929 r = MsiOpenProductA(prodcode, &hprod);
11930 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11931 ok(hprod != 0 && hprod != 0xdeadbeef, "Expected a valid product handle\n");
11933 /* hProduct is invalid */
11935 lstrcpyA(val, "apple");
11936 r = MsiGetProductPropertyA(0xdeadbeef, "ProductCode", val, &size);
11937 ok(r == ERROR_INVALID_HANDLE,
11938 "Expected ERROR_INVALID_HANDLE, got %d\n", r);
11939 ok(!lstrcmpA(val, "apple"),
11940 "Expected val to be unchanged, got \"%s\"\n", val);
11941 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11943 /* szProperty is NULL */
11945 lstrcpyA(val, "apple");
11946 r = MsiGetProductPropertyA(hprod, NULL, val, &size);
11947 ok(r == ERROR_INVALID_PARAMETER,
11948 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
11949 ok(!lstrcmpA(val, "apple"),
11950 "Expected val to be unchanged, got \"%s\"\n", val);
11951 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11953 /* szProperty is empty */
11955 lstrcpyA(val, "apple");
11956 r = MsiGetProductPropertyA(hprod, "", val, &size);
11957 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11958 ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val);
11959 ok(size == 0, "Expected 0, got %d\n", size);
11961 /* get the property */
11963 lstrcpyA(val, "apple");
11964 r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
11965 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11966 ok(!lstrcmpA(val, prodcode),
11967 "Expected \"%s\", got \"%s\"\n", prodcode, val);
11968 ok(size == lstrlenA(prodcode),
11969 "Expected %d, got %d\n", lstrlenA(prodcode), size);
11971 /* lpValueBuf is NULL */
11973 r = MsiGetProductPropertyA(hprod, "ProductCode", NULL, &size);
11974 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11975 ok(size == lstrlenA(prodcode),
11976 "Expected %d, got %d\n", lstrlenA(prodcode), size);
11978 /* pcchValueBuf is NULL */
11979 lstrcpyA(val, "apple");
11980 r = MsiGetProductPropertyA(hprod, "ProductCode", val, NULL);
11981 ok(r == ERROR_INVALID_PARAMETER,
11982 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
11983 ok(!lstrcmpA(val, "apple"),
11984 "Expected val to be unchanged, got \"%s\"\n", val);
11985 ok(size == lstrlenA(prodcode),
11986 "Expected %d, got %d\n", lstrlenA(prodcode), size);
11988 /* pcchValueBuf is too small */
11990 lstrcpyA(val, "apple");
11991 r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
11992 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
11993 ok(!strncmp(val, prodcode, 3),
11994 "Expected first 3 chars of \"%s\", got \"%s\"\n", prodcode, val);
11995 ok(size == lstrlenA(prodcode),
11996 "Expected %d, got %d\n", lstrlenA(prodcode), size);
11998 /* pcchValueBuf does not leave room for NULL terminator */
11999 size = lstrlenA(prodcode);
12000 lstrcpyA(val, "apple");
12001 r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
12002 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
12003 ok(!strncmp(val, prodcode, lstrlenA(prodcode) - 1),
12004 "Expected first 37 chars of \"%s\", got \"%s\"\n", prodcode, val);
12005 ok(size == lstrlenA(prodcode),
12006 "Expected %d, got %d\n", lstrlenA(prodcode), size);
12008 /* pcchValueBuf has enough room for NULL terminator */
12009 size = lstrlenA(prodcode) + 1;
12010 lstrcpyA(val, "apple");
12011 r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
12012 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12013 ok(!lstrcmpA(val, prodcode),
12014 "Expected \"%s\", got \"%s\"\n", prodcode, val);
12015 ok(size == lstrlenA(prodcode),
12016 "Expected %d, got %d\n", lstrlenA(prodcode), size);
12018 /* nonexistent property */
12020 lstrcpyA(val, "apple");
12021 r = MsiGetProductPropertyA(hprod, "IDontExist", val, &size);
12022 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12023 ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val);
12024 ok(size == 0, "Expected 0, got %d\n", size);
12026 r = MsiSetPropertyA(hprod, "NewProperty", "value");
12027 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12029 /* non-product property set */
12031 lstrcpyA(val, "apple");
12032 r = MsiGetProductPropertyA(hprod, "NewProperty", val, &size);
12033 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12034 ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val);
12035 ok(size == 0, "Expected 0, got %d\n", size);
12037 r = MsiSetPropertyA(hprod, "ProductCode", "value");
12038 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12040 /* non-product property that is also a product property set */
12042 lstrcpyA(val, "apple");
12043 r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
12044 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12045 ok(!lstrcmpA(val, prodcode),
12046 "Expected \"%s\", got \"%s\"\n", prodcode, val);
12047 ok(size == lstrlenA(prodcode),
12048 "Expected %d, got %d\n", lstrlenA(prodcode), size);
12050 MsiCloseHandle(hprod);
12052 RegDeleteValueA(props, "LocalPackage");
12053 delete_key(props, "", access);
12054 RegCloseKey(props);
12055 delete_key(userkey, "", access);
12056 RegCloseKey(userkey);
12057 delete_key(prodkey, "", access);
12058 RegCloseKey(prodkey);
12059 DeleteFileA(msifile);
12062 static void test_MsiSetProperty(void)
12064 MSIHANDLE hpkg, hdb, hrec;
12065 CHAR buf[MAX_PATH];
12070 r = package_from_db(create_package_db(), &hpkg);
12071 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
12073 skip("Not enough rights to perform tests\n");
12074 DeleteFile(msifile);
12077 ok(r == ERROR_SUCCESS, "Expected a valid package %u\n", r);
12079 /* invalid hInstall */
12080 r = MsiSetPropertyA(0, "Prop", "Val");
12081 ok(r == ERROR_INVALID_HANDLE,
12082 "Expected ERROR_INVALID_HANDLE, got %d\n", r);
12084 /* invalid hInstall */
12085 r = MsiSetPropertyA(0xdeadbeef, "Prop", "Val");
12086 ok(r == ERROR_INVALID_HANDLE,
12087 "Expected ERROR_INVALID_HANDLE, got %d\n", r);
12089 /* szName is NULL */
12090 r = MsiSetPropertyA(hpkg, NULL, "Val");
12091 ok(r == ERROR_INVALID_PARAMETER,
12092 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
12094 /* both szName and szValue are NULL */
12095 r = MsiSetPropertyA(hpkg, NULL, NULL);
12096 ok(r == ERROR_INVALID_PARAMETER,
12097 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
12099 /* szName is empty */
12100 r = MsiSetPropertyA(hpkg, "", "Val");
12101 ok(r == ERROR_FUNCTION_FAILED,
12102 "Expected ERROR_FUNCTION_FAILED, got %d\n", r);
12104 /* szName is empty and szValue is NULL */
12105 r = MsiSetPropertyA(hpkg, "", NULL);
12106 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12108 /* set a property */
12109 r = MsiSetPropertyA(hpkg, "Prop", "Val");
12110 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12112 /* get the property */
12114 r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
12115 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12116 ok(!lstrcmpA(buf, "Val"), "Expected \"Val\", got \"%s\"\n", buf);
12117 ok(size == 3, "Expected 3, got %d\n", size);
12119 /* update the property */
12120 r = MsiSetPropertyA(hpkg, "Prop", "Nuvo");
12121 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12123 /* get the property */
12125 r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
12126 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12127 ok(!lstrcmpA(buf, "Nuvo"), "Expected \"Nuvo\", got \"%s\"\n", buf);
12128 ok(size == 4, "Expected 4, got %d\n", size);
12130 hdb = MsiGetActiveDatabase(hpkg);
12131 ok(hdb != 0, "Expected a valid database handle\n");
12133 /* set prop is not in the _Property table */
12134 query = "SELECT * FROM `_Property` WHERE `Property` = 'Prop'";
12135 r = do_query(hdb, query, &hrec);
12136 ok(r == ERROR_BAD_QUERY_SYNTAX,
12137 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
12139 /* set prop is not in the Property table */
12140 query = "SELECT * FROM `Property` WHERE `Property` = 'Prop'";
12141 r = do_query(hdb, query, &hrec);
12142 ok(r == ERROR_BAD_QUERY_SYNTAX,
12143 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
12145 MsiCloseHandle(hdb);
12147 /* szValue is an empty string */
12148 r = MsiSetPropertyA(hpkg, "Prop", "");
12149 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12151 /* try to get the property */
12153 r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
12154 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12155 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
12156 ok(size == 0, "Expected 0, got %d\n", size);
12158 /* reset the property */
12159 r = MsiSetPropertyA(hpkg, "Prop", "BlueTap");
12160 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12162 /* delete the property */
12163 r = MsiSetPropertyA(hpkg, "Prop", NULL);
12164 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12166 /* try to get the property */
12168 r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
12169 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12170 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
12171 ok(size == 0, "Expected 0, got %d\n", size);
12173 MsiCloseHandle(hpkg);
12174 DeleteFileA(msifile);
12177 static void test_MsiApplyMultiplePatches(void)
12179 UINT r, type = GetDriveType(NULL);
12181 if (!pMsiApplyMultiplePatchesA) {
12182 win_skip("MsiApplyMultiplePatchesA not found\n");
12186 r = pMsiApplyMultiplePatchesA(NULL, NULL, NULL);
12187 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
12189 r = pMsiApplyMultiplePatchesA("", NULL, NULL);
12190 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
12192 r = pMsiApplyMultiplePatchesA(";", NULL, NULL);
12195 if (type == DRIVE_FIXED)
12196 ok(r == ERROR_PATH_NOT_FOUND,
12197 "Expected ERROR_PATH_NOT_FOUND, got %u\n", r);
12199 ok(r == ERROR_INVALID_NAME,
12200 "Expected ERROR_INVALID_NAME, got %u\n", r);
12203 r = pMsiApplyMultiplePatchesA(" ;", NULL, NULL);
12206 if (type == DRIVE_FIXED)
12207 ok(r == ERROR_PATCH_PACKAGE_OPEN_FAILED,
12208 "Expected ERROR_PATCH_PACKAGE_OPEN_FAILED, got %u\n", r);
12210 ok(r == ERROR_INVALID_NAME,
12211 "Expected ERROR_INVALID_NAME, got %u\n", r);
12214 r = pMsiApplyMultiplePatchesA(";;", NULL, NULL);
12217 if (type == DRIVE_FIXED)
12218 ok(r == ERROR_PATH_NOT_FOUND,
12219 "Expected ERROR_PATH_NOT_FOUND, got %u\n", r);
12221 ok(r == ERROR_INVALID_NAME,
12222 "Expected ERROR_INVALID_NAME, got %u\n", r);
12225 r = pMsiApplyMultiplePatchesA("nosuchpatchpackage;", NULL, NULL);
12226 todo_wine ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
12228 r = pMsiApplyMultiplePatchesA(";nosuchpatchpackage", NULL, NULL);
12231 if (type == DRIVE_FIXED)
12232 ok(r == ERROR_PATH_NOT_FOUND,
12233 "Expected ERROR_PATH_NOT_FOUND, got %u\n", r);
12235 ok(r == ERROR_INVALID_NAME,
12236 "Expected ERROR_INVALID_NAME, got %u\n", r);
12239 r = pMsiApplyMultiplePatchesA("nosuchpatchpackage;nosuchpatchpackage", NULL, NULL);
12240 todo_wine ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
12242 r = pMsiApplyMultiplePatchesA(" nosuchpatchpackage ; nosuchpatchpackage ", NULL, NULL);
12243 todo_wine ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
12246 static void test_MsiApplyPatch(void)
12250 r = MsiApplyPatch(NULL, NULL, INSTALLTYPE_DEFAULT, NULL);
12251 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
12253 r = MsiApplyPatch("", NULL, INSTALLTYPE_DEFAULT, NULL);
12254 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
12257 START_TEST(package)
12259 STATEMGRSTATUS status;
12262 init_functionpointers();
12264 GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
12266 /* Create a restore point ourselves so we circumvent the multitude of restore points
12267 * that would have been created by all the installation and removal tests.
12269 if (pSRSetRestorePointA)
12271 memset(&status, 0, sizeof(status));
12272 ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status);
12275 test_createpackage();
12277 test_gettargetpath_bad();
12278 test_settargetpath();
12280 test_property_table();
12283 test_formatrecord2();
12285 test_getproperty();
12286 test_removefiles();
12288 test_appsearch_complocator();
12289 test_appsearch_reglocator();
12290 test_appsearch_inilocator();
12291 test_appsearch_drlocator();
12292 test_featureparents();
12293 test_installprops();
12294 test_launchconditions();
12296 test_complocator();
12297 test_MsiGetSourcePath();
12298 test_shortlongsource();
12301 test_emptypackage();
12302 test_MsiGetProductProperty();
12303 test_MsiSetProperty();
12304 test_MsiApplyMultiplePatches();
12305 test_MsiApplyPatch();
12307 if (pSRSetRestorePointA && ret)
12309 ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status);
12311 remove_restore_point(status.llSequenceNumber);