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);
44 static void (WINAPI *pGetSystemInfo)(LPSYSTEM_INFO);
46 static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
47 static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA*, STATEMGRSTATUS*);
49 static void init_functionpointers(void)
51 HMODULE hmsi = GetModuleHandleA("msi.dll");
52 HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
53 HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
56 #define GET_PROC(mod, func) \
57 p ## func = (void*)GetProcAddress(mod, #func);
59 GET_PROC(hmsi, MsiApplyMultiplePatchesA);
61 GET_PROC(hadvapi32, ConvertSidToStringSidA);
62 GET_PROC(hadvapi32, GetTokenInformation);
63 GET_PROC(hadvapi32, OpenProcessToken);
64 GET_PROC(hadvapi32, RegDeleteKeyExA)
65 GET_PROC(hadvapi32, RegDeleteKeyExW)
66 GET_PROC(hkernel32, IsWow64Process)
67 GET_PROC(hkernel32, GetSystemInfo)
69 hsrclient = LoadLibraryA("srclient.dll");
70 GET_PROC(hsrclient, SRRemoveRestorePoint);
71 GET_PROC(hsrclient, SRSetRestorePointA);
75 static BOOL is_process_limited(void)
79 if (!pOpenProcessToken || !pGetTokenInformation) return FALSE;
81 if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
84 TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault;
87 ret = pGetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size);
89 return (ret && type == TokenElevationTypeLimited);
94 static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access )
97 return pRegDeleteKeyExA( key, subkey, access, 0 );
98 return RegDeleteKeyA( key, subkey );
101 static LPSTR get_user_sid(LPSTR *usersid)
108 if (!pConvertSidToStringSidA)
110 win_skip("ConvertSidToStringSidA is not available\n");
115 OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
117 GetTokenInformation(token, TokenUser, buf, size, &size);
118 user = (PTOKEN_USER)buf;
119 pConvertSidToStringSidA(user->User.Sid, usersid);
120 ok(*usersid != NULL, "pConvertSidToStringSidA failed lre=%d\n", GetLastError());
125 /* RegDeleteTreeW from dlls/advapi32/registry.c */
126 static LSTATUS package_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey, REGSAM access)
129 DWORD dwMaxSubkeyLen, dwMaxValueLen;
130 DWORD dwMaxLen, dwSize;
131 WCHAR szNameBuf[MAX_PATH], *lpszName = szNameBuf;
136 ret = RegOpenKeyExW(hKey, lpszSubKey, 0, access, &hSubKey);
140 ret = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL,
141 &dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL);
142 if (ret) goto cleanup;
146 dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen);
147 if (dwMaxLen > sizeof(szNameBuf)/sizeof(WCHAR))
149 /* Name too big: alloc a buffer for it */
150 if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen*sizeof(WCHAR))))
152 ret = ERROR_NOT_ENOUGH_MEMORY;
157 /* Recursively delete all the subkeys */
161 if (RegEnumKeyExW(hSubKey, 0, lpszName, &dwSize, NULL,
162 NULL, NULL, NULL)) break;
164 ret = package_RegDeleteTreeW(hSubKey, lpszName, access);
165 if (ret) goto cleanup;
170 if (pRegDeleteKeyExW)
171 ret = pRegDeleteKeyExW(hKey, lpszSubKey, access, 0);
173 ret = RegDeleteKeyW(hKey, lpszSubKey);
179 if (RegEnumValueW(hKey, 0, lpszName, &dwSize,
180 NULL, NULL, NULL, NULL)) break;
182 ret = RegDeleteValueW(hKey, lpszName);
183 if (ret) goto cleanup;
187 if (lpszName != szNameBuf)
188 HeapFree(GetProcessHeap(), 0, lpszName);
190 RegCloseKey(hSubKey);
194 static BOOL squash_guid(LPCWSTR in, LPWSTR out)
199 if (FAILED(CLSIDFromString((LPCOLESTR)in, &guid)))
213 out[17+i*2] = in[n++];
214 out[16+i*2] = in[n++];
219 out[17+i*2] = in[n++];
220 out[16+i*2] = in[n++];
226 static void create_test_guid(LPSTR prodcode, LPSTR squashed)
228 WCHAR guidW[MAX_PATH];
229 WCHAR squashedW[MAX_PATH];
234 hr = CoCreateGuid(&guid);
235 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
237 size = StringFromGUID2(&guid, guidW, MAX_PATH);
238 ok(size == 39, "Expected 39, got %d\n", hr);
240 WideCharToMultiByte(CP_ACP, 0, guidW, size, prodcode, MAX_PATH, NULL, NULL);
241 squash_guid(guidW, squashedW);
242 WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
245 static void set_component_path(LPCSTR filename, MSIINSTALLCONTEXT context,
246 LPCSTR guid, LPSTR usersid, BOOL dir)
248 WCHAR guidW[MAX_PATH];
249 WCHAR squashedW[MAX_PATH];
250 CHAR squashed[MAX_PATH];
251 CHAR comppath[MAX_PATH];
252 CHAR prodpath[MAX_PATH];
256 REGSAM access = KEY_ALL_ACCESS;
259 if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64)
260 access |= KEY_WOW64_64KEY;
262 MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
263 squash_guid(guidW, squashedW);
264 WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
266 if (context == MSIINSTALLCONTEXT_MACHINE)
268 prod = "3D0DAE300FACA1300AD792060BCDAA92";
270 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
271 "Installer\\UserData\\S-1-5-18\\Components\\%s", squashed);
273 "SOFTWARE\\Classes\\Installer\\"
274 "Products\\3D0DAE300FACA1300AD792060BCDAA92");
276 else if (context == MSIINSTALLCONTEXT_USERUNMANAGED)
278 prod = "7D2F387510109040002000060BECB6AB";
280 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
281 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
283 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
284 "Installer\\%s\\Installer\\Products\\"
285 "7D2F387510109040002000060BECB6AB", usersid);
287 else if (context == MSIINSTALLCONTEXT_USERMANAGED)
289 prod = "7D2F387510109040002000060BECB6AB";
291 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
292 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
294 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
295 "Installer\\Managed\\%s\\Installer\\Products\\"
296 "7D2F387510109040002000060BECB6AB", usersid);
299 RegCreateKeyExA(HKEY_LOCAL_MACHINE, comppath, 0, NULL, 0, access, NULL, &hkey, NULL);
301 lstrcpyA(path, CURR_DIR);
302 lstrcatA(path, "\\");
303 if (!dir) lstrcatA(path, filename);
305 RegSetValueExA(hkey, prod, 0, REG_SZ, (LPBYTE)path, lstrlenA(path));
308 RegCreateKeyExA(HKEY_LOCAL_MACHINE, prodpath, 0, NULL, 0, access, NULL, &hkey, NULL);
312 static void delete_component_path(LPCSTR guid, MSIINSTALLCONTEXT context, LPSTR usersid)
314 WCHAR guidW[MAX_PATH];
315 WCHAR squashedW[MAX_PATH];
316 WCHAR substrW[MAX_PATH];
317 CHAR squashed[MAX_PATH];
318 CHAR comppath[MAX_PATH];
319 CHAR prodpath[MAX_PATH];
320 REGSAM access = KEY_ALL_ACCESS;
323 if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64)
324 access |= KEY_WOW64_64KEY;
326 MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
327 squash_guid(guidW, squashedW);
328 WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
330 if (context == MSIINSTALLCONTEXT_MACHINE)
333 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
334 "Installer\\UserData\\S-1-5-18\\Components\\%s", squashed);
336 "SOFTWARE\\Classes\\Installer\\"
337 "Products\\3D0DAE300FACA1300AD792060BCDAA92");
339 else if (context == MSIINSTALLCONTEXT_USERUNMANAGED)
342 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
343 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
345 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
346 "Installer\\%s\\Installer\\Products\\"
347 "7D2F387510109040002000060BECB6AB", usersid);
349 else if (context == MSIINSTALLCONTEXT_USERMANAGED)
352 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
353 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
355 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
356 "Installer\\Managed\\%s\\Installer\\Products\\"
357 "7D2F387510109040002000060BECB6AB", usersid);
360 MultiByteToWideChar(CP_ACP, 0, comppath, -1, substrW, MAX_PATH);
361 package_RegDeleteTreeW(HKEY_LOCAL_MACHINE, substrW, access);
363 MultiByteToWideChar(CP_ACP, 0, prodpath, -1, substrW, MAX_PATH);
364 package_RegDeleteTreeW(HKEY_LOCAL_MACHINE, substrW, access);
367 static UINT do_query(MSIHANDLE hdb, const char *query, MSIHANDLE *phrec)
372 /* open a select query */
373 r = MsiDatabaseOpenView(hdb, query, &hview);
374 if (r != ERROR_SUCCESS)
376 r = MsiViewExecute(hview, 0);
377 if (r != ERROR_SUCCESS)
379 ret = MsiViewFetch(hview, phrec);
380 r = MsiViewClose(hview);
381 if (r != ERROR_SUCCESS)
383 r = MsiCloseHandle(hview);
384 if (r != ERROR_SUCCESS)
389 static UINT run_query( MSIHANDLE hdb, const char *query )
394 r = MsiDatabaseOpenView(hdb, query, &hview);
395 if( r != ERROR_SUCCESS )
398 r = MsiViewExecute(hview, 0);
399 if( r == ERROR_SUCCESS )
400 r = MsiViewClose(hview);
401 MsiCloseHandle(hview);
405 static UINT create_component_table( MSIHANDLE hdb )
407 return run_query( hdb,
408 "CREATE TABLE `Component` ( "
409 "`Component` CHAR(72) NOT NULL, "
410 "`ComponentId` CHAR(38), "
411 "`Directory_` CHAR(72) NOT NULL, "
412 "`Attributes` SHORT NOT NULL, "
413 "`Condition` CHAR(255), "
414 "`KeyPath` CHAR(72) "
415 "PRIMARY KEY `Component`)" );
418 static UINT create_feature_table( MSIHANDLE hdb )
420 return run_query( hdb,
421 "CREATE TABLE `Feature` ( "
422 "`Feature` CHAR(38) NOT NULL, "
423 "`Feature_Parent` CHAR(38), "
425 "`Description` CHAR(255), "
426 "`Display` SHORT NOT NULL, "
427 "`Level` SHORT NOT NULL, "
428 "`Directory_` CHAR(72), "
429 "`Attributes` SHORT NOT NULL "
430 "PRIMARY KEY `Feature`)" );
433 static UINT create_feature_components_table( MSIHANDLE hdb )
435 return run_query( hdb,
436 "CREATE TABLE `FeatureComponents` ( "
437 "`Feature_` CHAR(38) NOT NULL, "
438 "`Component_` CHAR(72) NOT NULL "
439 "PRIMARY KEY `Feature_`, `Component_` )" );
442 static UINT create_file_table( MSIHANDLE hdb )
444 return run_query( hdb,
445 "CREATE TABLE `File` ("
446 "`File` CHAR(72) NOT NULL, "
447 "`Component_` CHAR(72) NOT NULL, "
448 "`FileName` CHAR(255) NOT NULL, "
449 "`FileSize` LONG NOT NULL, "
450 "`Version` CHAR(72), "
451 "`Language` CHAR(20), "
452 "`Attributes` SHORT, "
453 "`Sequence` SHORT NOT NULL "
454 "PRIMARY KEY `File`)" );
457 static UINT create_remove_file_table( MSIHANDLE hdb )
459 return run_query( hdb,
460 "CREATE TABLE `RemoveFile` ("
461 "`FileKey` CHAR(72) NOT NULL, "
462 "`Component_` CHAR(72) NOT NULL, "
463 "`FileName` CHAR(255) LOCALIZABLE, "
464 "`DirProperty` CHAR(72) NOT NULL, "
465 "`InstallMode` SHORT NOT NULL "
466 "PRIMARY KEY `FileKey`)" );
469 static UINT create_appsearch_table( MSIHANDLE hdb )
471 return run_query( hdb,
472 "CREATE TABLE `AppSearch` ("
473 "`Property` CHAR(72) NOT NULL, "
474 "`Signature_` CHAR(72) NOT NULL "
475 "PRIMARY KEY `Property`, `Signature_`)" );
478 static UINT create_reglocator_table( MSIHANDLE hdb )
480 return run_query( hdb,
481 "CREATE TABLE `RegLocator` ("
482 "`Signature_` CHAR(72) NOT NULL, "
483 "`Root` SHORT NOT NULL, "
484 "`Key` CHAR(255) NOT NULL, "
487 "PRIMARY KEY `Signature_`)" );
490 static UINT create_signature_table( MSIHANDLE hdb )
492 return run_query( hdb,
493 "CREATE TABLE `Signature` ("
494 "`Signature` CHAR(72) NOT NULL, "
495 "`FileName` CHAR(255) NOT NULL, "
496 "`MinVersion` CHAR(20), "
497 "`MaxVersion` CHAR(20), "
502 "`Languages` CHAR(255) "
503 "PRIMARY KEY `Signature`)" );
506 static UINT create_launchcondition_table( MSIHANDLE hdb )
508 return run_query( hdb,
509 "CREATE TABLE `LaunchCondition` ("
510 "`Condition` CHAR(255) NOT NULL, "
511 "`Description` CHAR(255) NOT NULL "
512 "PRIMARY KEY `Condition`)" );
515 static UINT create_property_table( MSIHANDLE hdb )
517 return run_query( hdb,
518 "CREATE TABLE `Property` ("
519 "`Property` CHAR(72) NOT NULL, "
521 "PRIMARY KEY `Property`)" );
524 static UINT create_install_execute_sequence_table( MSIHANDLE hdb )
526 return run_query( hdb,
527 "CREATE TABLE `InstallExecuteSequence` ("
528 "`Action` CHAR(72) NOT NULL, "
529 "`Condition` CHAR(255), "
531 "PRIMARY KEY `Action`)" );
534 static UINT create_media_table( MSIHANDLE hdb )
536 return run_query( hdb,
537 "CREATE TABLE `Media` ("
538 "`DiskId` SHORT NOT NULL, "
539 "`LastSequence` SHORT NOT NULL, "
540 "`DiskPrompt` CHAR(64), "
541 "`Cabinet` CHAR(255), "
542 "`VolumeLabel` CHAR(32), "
544 "PRIMARY KEY `DiskId`)" );
547 static UINT create_ccpsearch_table( MSIHANDLE hdb )
549 return run_query( hdb,
550 "CREATE TABLE `CCPSearch` ("
551 "`Signature_` CHAR(72) NOT NULL "
552 "PRIMARY KEY `Signature_`)" );
555 static UINT create_drlocator_table( MSIHANDLE hdb )
557 return run_query( hdb,
558 "CREATE TABLE `DrLocator` ("
559 "`Signature_` CHAR(72) NOT NULL, "
560 "`Parent` CHAR(72), "
563 "PRIMARY KEY `Signature_`, `Parent`, `Path`)" );
566 static UINT create_complocator_table( MSIHANDLE hdb )
568 return run_query( hdb,
569 "CREATE TABLE `CompLocator` ("
570 "`Signature_` CHAR(72) NOT NULL, "
571 "`ComponentId` CHAR(38) NOT NULL, "
573 "PRIMARY KEY `Signature_`)" );
576 static UINT create_inilocator_table( MSIHANDLE hdb )
578 return run_query( hdb,
579 "CREATE TABLE `IniLocator` ("
580 "`Signature_` CHAR(72) NOT NULL, "
581 "`FileName` CHAR(255) NOT NULL, "
582 "`Section` CHAR(96)NOT NULL, "
583 "`Key` CHAR(128)NOT NULL, "
586 "PRIMARY KEY `Signature_`)" );
589 #define make_add_entry(type, qtext) \
590 static UINT add##_##type##_##entry( MSIHANDLE hdb, const char *values ) \
592 char insert[] = qtext; \
595 sz = strlen(values) + sizeof insert; \
596 query = HeapAlloc(GetProcessHeap(),0,sz); \
597 sprintf(query,insert,values); \
598 r = run_query( hdb, query ); \
599 HeapFree(GetProcessHeap(), 0, query); \
603 make_add_entry(component,
604 "INSERT INTO `Component` "
605 "(`Component`, `ComponentId`, `Directory_`, "
606 "`Attributes`, `Condition`, `KeyPath`) VALUES( %s )")
608 make_add_entry(directory,
609 "INSERT INTO `Directory` "
610 "(`Directory`,`Directory_Parent`,`DefaultDir`) VALUES( %s )")
612 make_add_entry(feature,
613 "INSERT INTO `Feature` "
614 "(`Feature`, `Feature_Parent`, `Title`, `Description`, "
615 "`Display`, `Level`, `Directory_`, `Attributes`) VALUES( %s )")
617 make_add_entry(feature_components,
618 "INSERT INTO `FeatureComponents` "
619 "(`Feature_`, `Component_`) VALUES( %s )")
622 "INSERT INTO `File` "
623 "(`File`, `Component_`, `FileName`, `FileSize`, "
624 "`Version`, `Language`, `Attributes`, `Sequence`) VALUES( %s )")
626 make_add_entry(appsearch,
627 "INSERT INTO `AppSearch` "
628 "(`Property`, `Signature_`) VALUES( %s )")
630 make_add_entry(reglocator,
631 "INSERT INTO `RegLocator` "
632 "(`Signature_`, `Root`, `Key`, `Name`, `Type`) VALUES( %s )")
634 make_add_entry(signature,
635 "INSERT INTO `Signature` "
636 "(`Signature`, `FileName`, `MinVersion`, `MaxVersion`,"
637 " `MinSize`, `MaxSize`, `MinDate`, `MaxDate`, `Languages`) "
640 make_add_entry(launchcondition,
641 "INSERT INTO `LaunchCondition` "
642 "(`Condition`, `Description`) VALUES( %s )")
644 make_add_entry(property,
645 "INSERT INTO `Property` (`Property`, `Value`) VALUES( %s )")
647 make_add_entry(install_execute_sequence,
648 "INSERT INTO `InstallExecuteSequence` "
649 "(`Action`, `Condition`, `Sequence`) VALUES( %s )")
651 make_add_entry(media,
652 "INSERT INTO `Media` "
653 "(`DiskId`, `LastSequence`, `DiskPrompt`, "
654 "`Cabinet`, `VolumeLabel`, `Source`) VALUES( %s )")
656 make_add_entry(ccpsearch,
657 "INSERT INTO `CCPSearch` (`Signature_`) VALUES( %s )")
659 make_add_entry(drlocator,
660 "INSERT INTO `DrLocator` "
661 "(`Signature_`, `Parent`, `Path`, `Depth`) VALUES( %s )")
663 make_add_entry(complocator,
664 "INSERT INTO `CompLocator` "
665 "(`Signature_`, `ComponentId`, `Type`) VALUES( %s )")
667 make_add_entry(inilocator,
668 "INSERT INTO `IniLocator` "
669 "(`Signature_`, `FileName`, `Section`, `Key`, `Field`, `Type`) "
672 static UINT set_summary_info(MSIHANDLE hdb)
677 /* build summary info */
678 res = MsiGetSummaryInformation(hdb, NULL, 7, &suminfo);
679 ok( res == ERROR_SUCCESS , "Failed to open summaryinfo\n" );
681 res = MsiSummaryInfoSetProperty(suminfo,2, VT_LPSTR, 0,NULL,
682 "Installation Database");
683 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
685 res = MsiSummaryInfoSetProperty(suminfo,3, VT_LPSTR, 0,NULL,
686 "Installation Database");
687 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
689 res = MsiSummaryInfoSetProperty(suminfo,4, VT_LPSTR, 0,NULL,
691 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
693 res = MsiSummaryInfoSetProperty(suminfo,7, VT_LPSTR, 0,NULL,
695 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
697 res = MsiSummaryInfoSetProperty(suminfo,9, VT_LPSTR, 0,NULL,
698 "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}");
699 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
701 res = MsiSummaryInfoSetProperty(suminfo, 14, VT_I4, 100, NULL, NULL);
702 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
704 res = MsiSummaryInfoSetProperty(suminfo, 15, VT_I4, 0, NULL, NULL);
705 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
707 res = MsiSummaryInfoPersist(suminfo);
708 ok( res == ERROR_SUCCESS , "Failed to make summary info persist\n" );
710 res = MsiCloseHandle( suminfo);
711 ok( res == ERROR_SUCCESS , "Failed to close suminfo\n" );
717 static MSIHANDLE create_package_db(void)
724 /* create an empty database */
725 res = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb );
726 ok( res == ERROR_SUCCESS , "Failed to create database %u\n", res );
727 if( res != ERROR_SUCCESS )
730 res = MsiDatabaseCommit( hdb );
731 ok( res == ERROR_SUCCESS , "Failed to commit database\n" );
733 res = set_summary_info(hdb);
735 res = run_query( hdb,
736 "CREATE TABLE `Directory` ( "
737 "`Directory` CHAR(255) NOT NULL, "
738 "`Directory_Parent` CHAR(255), "
739 "`DefaultDir` CHAR(255) NOT NULL "
740 "PRIMARY KEY `Directory`)" );
741 ok( res == ERROR_SUCCESS , "Failed to create directory table\n" );
746 static UINT package_from_db(MSIHANDLE hdb, MSIHANDLE *handle)
752 sprintf(szPackage, "#%u", hdb);
753 res = MsiOpenPackage(szPackage, &hPackage);
754 if (res != ERROR_SUCCESS)
760 res = MsiCloseHandle(hdb);
761 if (res != ERROR_SUCCESS)
763 MsiCloseHandle(hPackage);
768 return ERROR_SUCCESS;
771 static void create_test_file(const CHAR *name)
776 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
777 ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
778 WriteFile(file, name, strlen(name), &written, NULL);
779 WriteFile(file, "\n", strlen("\n"), &written, NULL);
783 typedef struct _tagVS_VERSIONINFO
790 VS_FIXEDFILEINFO Value;
795 #define roundoffs(a, b, r) (((BYTE *)(b) - (BYTE *)(a) + ((r) - 1)) & ~((r) - 1))
796 #define roundpos(a, b, r) (((BYTE *)(a)) + roundoffs(a, b, r))
798 static BOOL create_file_with_version(const CHAR *name, LONG ms, LONG ls)
800 VS_VERSIONINFO *pVerInfo;
801 VS_FIXEDFILEINFO *pFixedInfo;
808 GetSystemDirectory(path, MAX_PATH);
809 /* Some dlls can't be updated on Vista/W2K8 */
810 lstrcatA(path, "\\version.dll");
812 CopyFileA(path, name, FALSE);
814 size = GetFileVersionInfoSize(path, &handle);
815 buffer = HeapAlloc(GetProcessHeap(), 0, size);
817 GetFileVersionInfoA(path, 0, size, buffer);
819 pVerInfo = (VS_VERSIONINFO *)buffer;
820 ofs = (BYTE *)&pVerInfo->szKey[lstrlenW(pVerInfo->szKey) + 1];
821 pFixedInfo = (VS_FIXEDFILEINFO *)roundpos(pVerInfo, ofs, 4);
823 pFixedInfo->dwFileVersionMS = ms;
824 pFixedInfo->dwFileVersionLS = ls;
825 pFixedInfo->dwProductVersionMS = ms;
826 pFixedInfo->dwProductVersionLS = ls;
828 resource = BeginUpdateResource(name, FALSE);
832 if (!UpdateResource(resource, RT_VERSION, MAKEINTRESOURCE(VS_VERSION_INFO),
833 MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), buffer, size))
836 if (!EndUpdateResource(resource, FALSE))
842 HeapFree(GetProcessHeap(), 0, buffer);
846 static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
848 RESTOREPOINTINFOA spec;
850 spec.dwEventType = event_type;
851 spec.dwRestorePtType = APPLICATION_INSTALL;
852 spec.llSequenceNumber = status->llSequenceNumber;
853 lstrcpyA(spec.szDescription, "msitest restore point");
855 return pSRSetRestorePointA(&spec, status);
858 static void remove_restore_point(DWORD seq_number)
862 res = pSRRemoveRestorePoint(seq_number);
863 if (res != ERROR_SUCCESS)
864 trace("Failed to remove the restore point : %08x\n", res);
867 static void test_createpackage(void)
869 MSIHANDLE hPackage = 0;
872 res = package_from_db(create_package_db(), &hPackage);
873 if (res == ERROR_INSTALL_PACKAGE_REJECTED)
875 skip("Not enough rights to perform tests\n");
879 ok( res == ERROR_SUCCESS, " Failed to create package %u\n", res );
881 res = MsiCloseHandle( hPackage);
882 ok( res == ERROR_SUCCESS , "Failed to close package\n" );
886 static void test_doaction( void )
891 r = MsiDoAction( -1, NULL );
892 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
894 r = package_from_db(create_package_db(), &hpkg);
895 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
897 skip("Not enough rights to perform tests\n");
901 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
903 r = MsiDoAction(hpkg, NULL);
904 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
906 r = MsiDoAction(0, "boo");
907 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
909 r = MsiDoAction(hpkg, "boo");
910 ok( r == ERROR_FUNCTION_NOT_CALLED, "wrong return val\n");
912 MsiCloseHandle( hpkg );
916 static void test_gettargetpath_bad(void)
918 static const WCHAR boo[] = {'b','o','o',0};
919 static const WCHAR empty[] = {0};
926 r = package_from_db(create_package_db(), &hpkg);
927 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
929 skip("Not enough rights to perform tests\n");
933 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
935 r = MsiGetTargetPath( 0, NULL, NULL, NULL );
936 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
938 r = MsiGetTargetPath( 0, NULL, NULL, &sz );
939 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
941 r = MsiGetTargetPath( 0, "boo", NULL, NULL );
942 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
944 r = MsiGetTargetPath( 0, "boo", NULL, NULL );
945 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
947 r = MsiGetTargetPath( hpkg, "boo", NULL, NULL );
948 ok( r == ERROR_DIRECTORY, "wrong return val\n");
950 r = MsiGetTargetPath( hpkg, "boo", buffer, NULL );
951 ok( r == ERROR_DIRECTORY, "wrong return val\n");
954 r = MsiGetTargetPath( hpkg, "", buffer, &sz );
955 ok( r == ERROR_DIRECTORY, "wrong return val\n");
957 r = MsiGetTargetPathW( 0, NULL, NULL, NULL );
958 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
960 r = MsiGetTargetPathW( 0, NULL, NULL, &sz );
961 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
963 r = MsiGetTargetPathW( 0, boo, NULL, NULL );
964 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
966 r = MsiGetTargetPathW( 0, boo, NULL, NULL );
967 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
969 r = MsiGetTargetPathW( hpkg, boo, NULL, NULL );
970 ok( r == ERROR_DIRECTORY, "wrong return val\n");
972 r = MsiGetTargetPathW( hpkg, boo, bufferW, NULL );
973 ok( r == ERROR_DIRECTORY, "wrong return val\n");
976 r = MsiGetTargetPathW( hpkg, empty, bufferW, &sz );
977 ok( r == ERROR_DIRECTORY, "wrong return val\n");
979 MsiCloseHandle( hpkg );
983 static void query_file_path(MSIHANDLE hpkg, LPCSTR file, LPSTR buff)
989 rec = MsiCreateRecord( 1 );
990 ok(rec, "MsiCreate record failed\n");
992 r = MsiRecordSetString( rec, 0, file );
993 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
996 r = MsiFormatRecord( hpkg, rec, buff, &size );
997 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
999 MsiCloseHandle( rec );
1002 static void test_settargetpath(void)
1004 char tempdir[MAX_PATH+8], buffer[MAX_PATH], file[MAX_PATH];
1010 hdb = create_package_db();
1011 ok ( hdb, "failed to create package database\n" );
1013 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'" );
1014 ok( r == S_OK, "failed to add directory entry: %d\n" , r );
1016 r = create_component_table( hdb );
1017 ok( r == S_OK, "cannot create Component table: %d\n", r );
1019 r = add_component_entry( hdb, "'RootComp', '{83e2694d-0864-4124-9323-6d37630912a1}', 'TARGETDIR', 8, '', 'RootFile'" );
1020 ok( r == S_OK, "cannot add dummy component: %d\n", r );
1022 r = add_component_entry( hdb, "'TestComp', '{A3FB59C8-C293-4F7E-B8C5-F0E1D8EEE4E5}', 'TestDir', 0, '', 'TestFile'" );
1023 ok( r == S_OK, "cannot add test component: %d\n", r );
1025 r = create_feature_table( hdb );
1026 ok( r == S_OK, "cannot create Feature table: %d\n", r );
1028 r = add_feature_entry( hdb, "'TestFeature', '', '', '', 0, 1, '', 0" );
1029 ok( r == ERROR_SUCCESS, "cannot add TestFeature to Feature table: %d\n", r );
1031 r = create_feature_components_table( hdb );
1032 ok( r == S_OK, "cannot create FeatureComponents table: %d\n", r );
1034 r = add_feature_components_entry( hdb, "'TestFeature', 'RootComp'" );
1035 ok( r == S_OK, "cannot insert component into FeatureComponents table: %d\n", r );
1037 r = add_feature_components_entry( hdb, "'TestFeature', 'TestComp'" );
1038 ok( r == S_OK, "cannot insert component into FeatureComponents table: %d\n", r );
1040 add_directory_entry( hdb, "'TestParent', 'TARGETDIR', 'TestParent'" );
1041 add_directory_entry( hdb, "'TestDir', 'TestParent', 'TestDir'" );
1043 r = create_file_table( hdb );
1044 ok( r == S_OK, "cannot create File table: %d\n", r );
1046 r = add_file_entry( hdb, "'RootFile', 'RootComp', 'rootfile.txt', 0, '', '1033', 8192, 1" );
1047 ok( r == S_OK, "cannot add file to the File table: %d\n", r );
1049 r = add_file_entry( hdb, "'TestFile', 'TestComp', 'testfile.txt', 0, '', '1033', 8192, 1" );
1050 ok( r == S_OK, "cannot add file to the File table: %d\n", r );
1052 r = package_from_db( hdb, &hpkg );
1053 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
1055 skip("Not enough rights to perform tests\n");
1056 DeleteFile(msifile);
1059 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
1061 r = MsiDoAction( hpkg, "CostInitialize");
1062 ok( r == ERROR_SUCCESS, "cost init failed\n");
1064 r = MsiDoAction( hpkg, "FileCost");
1065 ok( r == ERROR_SUCCESS, "file cost failed\n");
1067 r = MsiDoAction( hpkg, "CostFinalize");
1068 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
1070 r = MsiSetTargetPath( 0, NULL, NULL );
1071 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1073 r = MsiSetTargetPath( 0, "boo", "C:\\bogusx" );
1074 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
1076 r = MsiSetTargetPath( hpkg, "boo", NULL );
1077 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1079 r = MsiSetTargetPath( hpkg, "boo", "c:\\bogusx" );
1080 ok( r == ERROR_DIRECTORY, "wrong return val\n");
1082 sz = sizeof tempdir - 1;
1083 r = MsiGetTargetPath( hpkg, "TARGETDIR", tempdir, &sz );
1084 sprintf( file, "%srootfile.txt", tempdir );
1086 query_file_path( hpkg, "[#RootFile]", buffer );
1087 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
1088 ok( !lstrcmp(buffer, file), "Expected %s, got %s\n", file, buffer );
1090 GetTempFileName( tempdir, "_wt", 0, buffer );
1091 sprintf( tempdir, "%s\\subdir", buffer );
1093 r = MsiSetTargetPath( hpkg, "TARGETDIR", buffer );
1094 ok( r == ERROR_SUCCESS || r == ERROR_DIRECTORY,
1095 "MsiSetTargetPath on file returned %d\n", r );
1097 r = MsiSetTargetPath( hpkg, "TARGETDIR", tempdir );
1098 ok( r == ERROR_SUCCESS || r == ERROR_DIRECTORY,
1099 "MsiSetTargetPath on 'subdir' of file returned %d\n", r );
1101 DeleteFile( buffer );
1103 r = MsiSetTargetPath( hpkg, "TARGETDIR", buffer );
1104 ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
1106 r = GetFileAttributes( buffer );
1107 ok ( r == INVALID_FILE_ATTRIBUTES, "file/directory exists after MsiSetTargetPath. Attributes: %08X\n", r );
1109 r = MsiSetTargetPath( hpkg, "TARGETDIR", tempdir );
1110 ok( r == ERROR_SUCCESS, "MsiSetTargetPath on subsubdir returned %d\n", r );
1112 sz = sizeof buffer - 1;
1113 lstrcat( tempdir, "\\" );
1114 r = MsiGetTargetPath( hpkg, "TARGETDIR", buffer, &sz );
1115 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
1116 ok( !lstrcmp(buffer, tempdir), "Expected %s, got %s\n", tempdir, buffer);
1118 sprintf( file, "%srootfile.txt", tempdir );
1119 query_file_path( hpkg, "[#RootFile]", buffer );
1120 ok( !lstrcmp(buffer, file), "Expected %s, got %s\n", file, buffer);
1122 r = MsiSetTargetPath( hpkg, "TestParent", "C:\\one\\two" );
1123 ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
1125 query_file_path( hpkg, "[#TestFile]", buffer );
1126 ok( !lstrcmpi(buffer, "C:\\one\\two\\TestDir\\testfile.txt"),
1127 "Expected C:\\one\\two\\TestDir\\testfile.txt, got %s\n", buffer );
1129 sz = sizeof buffer - 1;
1130 r = MsiGetTargetPath( hpkg, "TestParent", buffer, &sz );
1131 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
1132 ok( !lstrcmpi(buffer, "C:\\one\\two\\"), "Expected C:\\one\\two\\, got %s\n", buffer);
1134 r = MsiSetTargetPath( hpkg, "TestParent", "C:\\one\\two\\three" );
1135 ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
1137 sz = sizeof buffer - 1;
1138 r = MsiGetTargetPath( hpkg, "TestParent", buffer, &sz );
1139 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
1140 ok( !lstrcmpi(buffer, "C:\\one\\two\\three\\"), "Expected C:\\one\\two\\three\\, got %s\n", buffer);
1142 MsiCloseHandle( hpkg );
1145 static void test_condition(void)
1150 r = package_from_db(create_package_db(), &hpkg);
1151 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
1153 skip("Not enough rights to perform tests\n");
1154 DeleteFile(msifile);
1157 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
1159 r = MsiEvaluateCondition(0, NULL);
1160 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1162 r = MsiEvaluateCondition(hpkg, NULL);
1163 ok( r == MSICONDITION_NONE, "wrong return val\n");
1165 r = MsiEvaluateCondition(hpkg, "");
1166 ok( r == MSICONDITION_NONE, "wrong return val\n");
1168 r = MsiEvaluateCondition(hpkg, "1");
1169 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1171 r = MsiEvaluateCondition(hpkg, "0");
1172 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1174 r = MsiEvaluateCondition(hpkg, "-1");
1175 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1177 r = MsiEvaluateCondition(hpkg, "0 = 0");
1178 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1180 r = MsiEvaluateCondition(hpkg, "0 <> 0");
1181 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1183 r = MsiEvaluateCondition(hpkg, "0 = 1");
1184 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1186 r = MsiEvaluateCondition(hpkg, "0 > 1");
1187 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1189 r = MsiEvaluateCondition(hpkg, "0 ~> 1");
1190 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1192 r = MsiEvaluateCondition(hpkg, "1 > 1");
1193 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1195 r = MsiEvaluateCondition(hpkg, "1 ~> 1");
1196 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1198 r = MsiEvaluateCondition(hpkg, "0 >= 1");
1199 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1201 r = MsiEvaluateCondition(hpkg, "0 ~>= 1");
1202 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1204 r = MsiEvaluateCondition(hpkg, "1 >= 1");
1205 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1207 r = MsiEvaluateCondition(hpkg, "1 ~>= 1");
1208 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1210 r = MsiEvaluateCondition(hpkg, "0 < 1");
1211 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1213 r = MsiEvaluateCondition(hpkg, "0 ~< 1");
1214 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1216 r = MsiEvaluateCondition(hpkg, "1 < 1");
1217 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1219 r = MsiEvaluateCondition(hpkg, "1 ~< 1");
1220 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1222 r = MsiEvaluateCondition(hpkg, "0 <= 1");
1223 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1225 r = MsiEvaluateCondition(hpkg, "0 ~<= 1");
1226 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1228 r = MsiEvaluateCondition(hpkg, "1 <= 1");
1229 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1231 r = MsiEvaluateCondition(hpkg, "1 ~<= 1");
1232 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1234 r = MsiEvaluateCondition(hpkg, "0 >=");
1235 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1237 r = MsiEvaluateCondition(hpkg, " ");
1238 ok( r == MSICONDITION_NONE, "wrong return val\n");
1240 r = MsiEvaluateCondition(hpkg, "LicView <> \"1\"");
1241 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1243 r = MsiEvaluateCondition(hpkg, "LicView <> \"0\"");
1244 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1246 r = MsiEvaluateCondition(hpkg, "LicView <> LicView");
1247 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1249 r = MsiEvaluateCondition(hpkg, "not 0");
1250 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1252 r = MsiEvaluateCondition(hpkg, "not LicView");
1253 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1255 r = MsiEvaluateCondition(hpkg, "\"Testing\" ~<< \"Testing\"");
1256 ok (r == MSICONDITION_TRUE, "wrong return val\n");
1258 r = MsiEvaluateCondition(hpkg, "LicView ~<< \"Testing\"");
1259 ok (r == MSICONDITION_FALSE, "wrong return val\n");
1261 r = MsiEvaluateCondition(hpkg, "Not LicView ~<< \"Testing\"");
1262 ok (r == MSICONDITION_TRUE, "wrong return val\n");
1264 r = MsiEvaluateCondition(hpkg, "not \"A\"");
1265 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1267 r = MsiEvaluateCondition(hpkg, "~not \"A\"");
1268 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1270 r = MsiEvaluateCondition(hpkg, "\"0\"");
1271 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1273 r = MsiEvaluateCondition(hpkg, "1 and 2");
1274 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1276 r = MsiEvaluateCondition(hpkg, "not 0 and 3");
1277 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1279 r = MsiEvaluateCondition(hpkg, "not 0 and 0");
1280 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1282 r = MsiEvaluateCondition(hpkg, "not 0 or 1");
1283 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1285 r = MsiEvaluateCondition(hpkg, "(0)");
1286 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1288 r = MsiEvaluateCondition(hpkg, "(((((1))))))");
1289 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1291 r = MsiEvaluateCondition(hpkg, "(((((1)))))");
1292 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1294 r = MsiEvaluateCondition(hpkg, " \"A\" < \"B\" ");
1295 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1297 r = MsiEvaluateCondition(hpkg, " \"A\" > \"B\" ");
1298 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1300 r = MsiEvaluateCondition(hpkg, " \"1\" > \"12\" ");
1301 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1303 r = MsiEvaluateCondition(hpkg, " \"100\" < \"21\" ");
1304 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1306 r = MsiEvaluateCondition(hpkg, "0 < > 0");
1307 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1309 r = MsiEvaluateCondition(hpkg, "(1<<1) == 2");
1310 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1312 r = MsiEvaluateCondition(hpkg, " \"A\" = \"a\" ");
1313 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1315 r = MsiEvaluateCondition(hpkg, " \"A\" ~ = \"a\" ");
1316 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1318 r = MsiEvaluateCondition(hpkg, " \"A\" ~= \"a\" ");
1319 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1321 r = MsiEvaluateCondition(hpkg, " \"A\" ~= 1 ");
1322 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1324 r = MsiEvaluateCondition(hpkg, " \"A\" = 1 ");
1325 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1327 r = MsiEvaluateCondition(hpkg, " 1 ~= 1 ");
1328 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1330 r = MsiEvaluateCondition(hpkg, " 1 ~= \"1\" ");
1331 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1333 r = MsiEvaluateCondition(hpkg, " 1 = \"1\" ");
1334 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1336 r = MsiEvaluateCondition(hpkg, " 0 = \"1\" ");
1337 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1339 r = MsiEvaluateCondition(hpkg, " 0 < \"100\" ");
1340 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1342 r = MsiEvaluateCondition(hpkg, " 100 > \"0\" ");
1343 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1345 r = MsiEvaluateCondition(hpkg, "1 XOR 1");
1346 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1348 r = MsiEvaluateCondition(hpkg, "1 IMP 1");
1349 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1351 r = MsiEvaluateCondition(hpkg, "1 IMP 0");
1352 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1354 r = MsiEvaluateCondition(hpkg, "0 IMP 0");
1355 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1357 r = MsiEvaluateCondition(hpkg, "0 EQV 0");
1358 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1360 r = MsiEvaluateCondition(hpkg, "0 EQV 1");
1361 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1363 r = MsiEvaluateCondition(hpkg, "1 IMP 1 OR 0");
1364 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1366 r = MsiEvaluateCondition(hpkg, "1 IMPL 1");
1367 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1369 r = MsiEvaluateCondition(hpkg, "\"ASFD\" >< \"S\" ");
1370 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1372 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"s\" ");
1373 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1375 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"\" ");
1376 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1378 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"sss\" ");
1379 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1381 MsiSetProperty(hpkg, "mm", "5" );
1383 r = MsiEvaluateCondition(hpkg, "mm = 5");
1384 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1386 r = MsiEvaluateCondition(hpkg, "mm < 6");
1387 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1389 r = MsiEvaluateCondition(hpkg, "mm <= 5");
1390 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1392 r = MsiEvaluateCondition(hpkg, "mm > 4");
1393 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1395 r = MsiEvaluateCondition(hpkg, "mm < 12");
1396 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1398 r = MsiEvaluateCondition(hpkg, "mm = \"5\"");
1399 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1401 r = MsiEvaluateCondition(hpkg, "0 = \"\"");
1402 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1404 r = MsiEvaluateCondition(hpkg, "0 AND \"\"");
1405 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1407 r = MsiEvaluateCondition(hpkg, "1 AND \"\"");
1408 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1410 r = MsiEvaluateCondition(hpkg, "1 AND \"1\"");
1411 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1413 r = MsiEvaluateCondition(hpkg, "3 >< 1");
1414 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1416 r = MsiEvaluateCondition(hpkg, "3 >< 4");
1417 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1419 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 0");
1420 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1422 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 1");
1423 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1425 r = MsiEvaluateCondition(hpkg, "NOT 1 OR 0");
1426 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1428 r = MsiEvaluateCondition(hpkg, "0 AND 1 OR 1");
1429 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1431 r = MsiEvaluateCondition(hpkg, "0 AND 0 OR 1");
1432 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1434 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 1 OR 0");
1435 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1437 r = MsiEvaluateCondition(hpkg, "_1 = _1");
1438 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1440 r = MsiEvaluateCondition(hpkg, "( 1 AND 1 ) = 2");
1441 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1443 r = MsiEvaluateCondition(hpkg, "NOT ( 1 AND 1 )");
1444 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1446 r = MsiEvaluateCondition(hpkg, "NOT A AND (BBBBBBBBBB=2 OR CCC=1) AND Ddddddddd");
1447 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1449 r = MsiEvaluateCondition(hpkg, "Installed<>\"\"");
1450 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1452 r = MsiEvaluateCondition(hpkg, "NOT 1 AND 0");
1453 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1455 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1456 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1458 r = MsiEvaluateCondition(hpkg, "bandalmael<>0");
1459 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1461 r = MsiEvaluateCondition(hpkg, "bandalmael<0");
1462 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1464 r = MsiEvaluateCondition(hpkg, "bandalmael>0");
1465 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1467 r = MsiEvaluateCondition(hpkg, "bandalmael>=0");
1468 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1470 r = MsiEvaluateCondition(hpkg, "bandalmael<=0");
1471 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1473 r = MsiEvaluateCondition(hpkg, "bandalmael~<>0");
1474 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1476 MsiSetProperty(hpkg, "bandalmael", "0" );
1477 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1478 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1480 MsiSetProperty(hpkg, "bandalmael", "" );
1481 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1482 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1484 MsiSetProperty(hpkg, "bandalmael", "asdf" );
1485 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1486 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1488 MsiSetProperty(hpkg, "bandalmael", "0asdf" );
1489 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1490 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1492 MsiSetProperty(hpkg, "bandalmael", "0 " );
1493 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1494 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1496 MsiSetProperty(hpkg, "bandalmael", "-0" );
1497 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1498 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1500 MsiSetProperty(hpkg, "bandalmael", "0000000000000" );
1501 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1502 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1504 MsiSetProperty(hpkg, "bandalmael", "--0" );
1505 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1506 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1508 MsiSetProperty(hpkg, "bandalmael", "0x00" );
1509 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1510 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1512 MsiSetProperty(hpkg, "bandalmael", "-" );
1513 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1514 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1516 MsiSetProperty(hpkg, "bandalmael", "+0" );
1517 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1518 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1520 MsiSetProperty(hpkg, "bandalmael", "0.0" );
1521 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1522 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1523 r = MsiEvaluateCondition(hpkg, "bandalmael<>0");
1524 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1526 MsiSetProperty(hpkg, "one", "hi");
1527 MsiSetProperty(hpkg, "two", "hithere");
1528 r = MsiEvaluateCondition(hpkg, "one >< two");
1529 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1531 MsiSetProperty(hpkg, "one", "hithere");
1532 MsiSetProperty(hpkg, "two", "hi");
1533 r = MsiEvaluateCondition(hpkg, "one >< two");
1534 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1536 MsiSetProperty(hpkg, "one", "hello");
1537 MsiSetProperty(hpkg, "two", "hi");
1538 r = MsiEvaluateCondition(hpkg, "one >< two");
1539 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1541 MsiSetProperty(hpkg, "one", "hellohithere");
1542 MsiSetProperty(hpkg, "two", "hi");
1543 r = MsiEvaluateCondition(hpkg, "one >< two");
1544 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1546 MsiSetProperty(hpkg, "one", "");
1547 MsiSetProperty(hpkg, "two", "hi");
1548 r = MsiEvaluateCondition(hpkg, "one >< two");
1549 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1551 MsiSetProperty(hpkg, "one", "hi");
1552 MsiSetProperty(hpkg, "two", "");
1553 r = MsiEvaluateCondition(hpkg, "one >< two");
1554 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1556 MsiSetProperty(hpkg, "one", "");
1557 MsiSetProperty(hpkg, "two", "");
1558 r = MsiEvaluateCondition(hpkg, "one >< two");
1559 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1561 MsiSetProperty(hpkg, "one", "1234");
1562 MsiSetProperty(hpkg, "two", "1");
1563 r = MsiEvaluateCondition(hpkg, "one >< two");
1564 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1566 MsiSetProperty(hpkg, "one", "one 1234");
1567 MsiSetProperty(hpkg, "two", "1");
1568 r = MsiEvaluateCondition(hpkg, "one >< two");
1569 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1571 MsiSetProperty(hpkg, "one", "hithere");
1572 MsiSetProperty(hpkg, "two", "hi");
1573 r = MsiEvaluateCondition(hpkg, "one << two");
1574 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1576 MsiSetProperty(hpkg, "one", "hi");
1577 MsiSetProperty(hpkg, "two", "hithere");
1578 r = MsiEvaluateCondition(hpkg, "one << two");
1579 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1581 MsiSetProperty(hpkg, "one", "hi");
1582 MsiSetProperty(hpkg, "two", "hi");
1583 r = MsiEvaluateCondition(hpkg, "one << two");
1584 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1586 MsiSetProperty(hpkg, "one", "abcdhithere");
1587 MsiSetProperty(hpkg, "two", "hi");
1588 r = MsiEvaluateCondition(hpkg, "one << two");
1589 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1591 MsiSetProperty(hpkg, "one", "");
1592 MsiSetProperty(hpkg, "two", "hi");
1593 r = MsiEvaluateCondition(hpkg, "one << two");
1594 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1596 MsiSetProperty(hpkg, "one", "hithere");
1597 MsiSetProperty(hpkg, "two", "");
1598 r = MsiEvaluateCondition(hpkg, "one << two");
1599 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1601 MsiSetProperty(hpkg, "one", "");
1602 MsiSetProperty(hpkg, "two", "");
1603 r = MsiEvaluateCondition(hpkg, "one << two");
1604 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1606 MsiSetProperty(hpkg, "one", "1234");
1607 MsiSetProperty(hpkg, "two", "1");
1608 r = MsiEvaluateCondition(hpkg, "one << two");
1609 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1611 MsiSetProperty(hpkg, "one", "1234 one");
1612 MsiSetProperty(hpkg, "two", "1");
1613 r = MsiEvaluateCondition(hpkg, "one << two");
1614 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1616 MsiSetProperty(hpkg, "one", "hithere");
1617 MsiSetProperty(hpkg, "two", "there");
1618 r = MsiEvaluateCondition(hpkg, "one >> two");
1619 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1621 MsiSetProperty(hpkg, "one", "hithere");
1622 MsiSetProperty(hpkg, "two", "hi");
1623 r = MsiEvaluateCondition(hpkg, "one >> two");
1624 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1626 MsiSetProperty(hpkg, "one", "there");
1627 MsiSetProperty(hpkg, "two", "hithere");
1628 r = MsiEvaluateCondition(hpkg, "one >> two");
1629 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1631 MsiSetProperty(hpkg, "one", "there");
1632 MsiSetProperty(hpkg, "two", "there");
1633 r = MsiEvaluateCondition(hpkg, "one >> two");
1634 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1636 MsiSetProperty(hpkg, "one", "abcdhithere");
1637 MsiSetProperty(hpkg, "two", "hi");
1638 r = MsiEvaluateCondition(hpkg, "one >> two");
1639 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1641 MsiSetProperty(hpkg, "one", "");
1642 MsiSetProperty(hpkg, "two", "there");
1643 r = MsiEvaluateCondition(hpkg, "one >> two");
1644 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1646 MsiSetProperty(hpkg, "one", "there");
1647 MsiSetProperty(hpkg, "two", "");
1648 r = MsiEvaluateCondition(hpkg, "one >> two");
1649 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1651 MsiSetProperty(hpkg, "one", "");
1652 MsiSetProperty(hpkg, "two", "");
1653 r = MsiEvaluateCondition(hpkg, "one >> two");
1654 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1656 MsiSetProperty(hpkg, "one", "1234");
1657 MsiSetProperty(hpkg, "two", "4");
1658 r = MsiEvaluateCondition(hpkg, "one >> two");
1659 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1661 MsiSetProperty(hpkg, "one", "one 1234");
1662 MsiSetProperty(hpkg, "two", "4");
1663 r = MsiEvaluateCondition(hpkg, "one >> two");
1664 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1666 MsiSetProperty(hpkg, "MsiNetAssemblySupport", NULL); /* make sure it's empty */
1668 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322\"");
1669 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1671 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport > \"1.1.4322\"");
1672 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1674 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport >= \"1.1.4322\"");
1675 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1677 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport <= \"1.1.4322\"");
1678 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1680 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport <> \"1.1.4322\"");
1681 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1683 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport ~< \"1.1.4322\"");
1684 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1686 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"abcd\"");
1687 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1689 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a1.1.4322\"");
1690 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1692 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322a\"");
1693 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1695 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"0000001.1.4322\"");
1696 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1698 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322.1\"");
1699 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1701 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322.1.1\"");
1702 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1704 r = MsiEvaluateCondition(hpkg, "\"2\" < \"1.1");
1705 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1707 r = MsiEvaluateCondition(hpkg, "\"2\" < \"1.1\"");
1708 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1710 r = MsiEvaluateCondition(hpkg, "\"2\" < \"12.1\"");
1711 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1713 r = MsiEvaluateCondition(hpkg, "\"02.1\" < \"2.11\"");
1714 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1716 r = MsiEvaluateCondition(hpkg, "\"02.1.1\" < \"2.1\"");
1717 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1719 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1\"");
1720 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1722 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1\"");
1723 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1725 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"0\"");
1726 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1728 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"-1\"");
1729 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1731 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a\"");
1732 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1734 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"!\"");
1735 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1737 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"!\"");
1738 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1740 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"/\"");
1741 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1743 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \" \"");
1744 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1746 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"azAZ_\"");
1747 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1749 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a[a]\"");
1750 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1752 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a[a]a\"");
1753 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1755 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a]\"");
1756 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1758 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a]a\"");
1759 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1761 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"{a}\"");
1762 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1764 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"{a\"");
1765 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1767 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a\"");
1768 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1770 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a{\"");
1771 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1773 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a]\"");
1774 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1776 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"A\"");
1777 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1779 MsiSetProperty(hpkg, "MsiNetAssemblySupport", "1.1.4322");
1780 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322\"");
1781 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1783 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.14322\"");
1784 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1786 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.5\"");
1787 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1789 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1\"");
1790 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1792 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1\"");
1793 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1795 MsiSetProperty(hpkg, "one", "1");
1796 r = MsiEvaluateCondition(hpkg, "one < \"1\"");
1797 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1799 MsiSetProperty(hpkg, "X", "5.0");
1801 r = MsiEvaluateCondition(hpkg, "X != \"\"");
1802 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1804 r = MsiEvaluateCondition(hpkg, "X =\"5.0\"");
1805 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1807 r = MsiEvaluateCondition(hpkg, "X =\"5.1\"");
1808 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1810 r = MsiEvaluateCondition(hpkg, "X =\"6.0\"");
1811 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1813 r = MsiEvaluateCondition(hpkg, "X =\"5.0\" or X =\"5.1\" or X =\"6.0\"");
1814 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1816 r = MsiEvaluateCondition(hpkg, "(X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1817 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1819 r = MsiEvaluateCondition(hpkg, "X !=\"\" and (X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1820 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1822 /* feature doesn't exist */
1823 r = MsiEvaluateCondition(hpkg, "&nofeature");
1824 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1826 MsiSetProperty(hpkg, "A", "2");
1827 MsiSetProperty(hpkg, "X", "50");
1829 r = MsiEvaluateCondition(hpkg, "2 <= X");
1830 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1832 r = MsiEvaluateCondition(hpkg, "A <= X");
1833 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1835 r = MsiEvaluateCondition(hpkg, "A <= 50");
1836 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1838 MsiSetProperty(hpkg, "X", "50val");
1840 r = MsiEvaluateCondition(hpkg, "2 <= X");
1841 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1843 r = MsiEvaluateCondition(hpkg, "A <= X");
1844 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1846 MsiSetProperty(hpkg, "A", "7");
1847 MsiSetProperty(hpkg, "X", "50");
1849 r = MsiEvaluateCondition(hpkg, "7 <= X");
1850 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1852 r = MsiEvaluateCondition(hpkg, "A <= X");
1853 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1855 r = MsiEvaluateCondition(hpkg, "A <= 50");
1856 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1858 MsiSetProperty(hpkg, "X", "50val");
1860 r = MsiEvaluateCondition(hpkg, "2 <= X");
1861 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1863 r = MsiEvaluateCondition(hpkg, "A <= X");
1864 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1866 MsiCloseHandle( hpkg );
1867 DeleteFile(msifile);
1870 static BOOL check_prop_empty( MSIHANDLE hpkg, const char * prop)
1878 r = MsiGetProperty( hpkg, prop, buffer, &sz );
1879 return r == ERROR_SUCCESS && buffer[0] == 0 && sz == 0;
1882 static void test_props(void)
1884 MSIHANDLE hpkg, hdb;
1889 hdb = create_package_db();
1891 "CREATE TABLE `Property` ( "
1892 "`Property` CHAR(255) NOT NULL, "
1893 "`Value` CHAR(255) "
1894 "PRIMARY KEY `Property`)" );
1895 ok( r == ERROR_SUCCESS , "Failed\n" );
1898 "INSERT INTO `Property` "
1899 "(`Property`, `Value`) "
1900 "VALUES( 'MetadataCompName', 'Photoshop.dll' )");
1901 ok( r == ERROR_SUCCESS , "Failed\n" );
1903 r = package_from_db( hdb, &hpkg );
1904 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
1906 skip("Not enough rights to perform tests\n");
1907 DeleteFile(msifile);
1910 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
1912 /* test invalid values */
1913 r = MsiGetProperty( 0, NULL, NULL, NULL );
1914 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1916 r = MsiGetProperty( hpkg, NULL, NULL, NULL );
1917 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1919 r = MsiGetProperty( hpkg, "boo", NULL, NULL );
1920 ok( r == ERROR_SUCCESS, "wrong return val\n");
1922 r = MsiGetProperty( hpkg, "boo", buffer, NULL );
1923 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1925 /* test retrieving an empty/nonexistent property */
1927 r = MsiGetProperty( hpkg, "boo", NULL, &sz );
1928 ok( r == ERROR_SUCCESS, "wrong return val\n");
1929 ok( sz == 0, "wrong size returned\n");
1931 check_prop_empty( hpkg, "boo");
1934 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1935 ok( r == ERROR_MORE_DATA, "wrong return val\n");
1936 ok( !strcmp(buffer,"x"), "buffer was changed\n");
1937 ok( sz == 0, "wrong size returned\n");
1941 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1942 ok( r == ERROR_SUCCESS, "wrong return val\n");
1943 ok( buffer[0] == 0, "buffer was not changed\n");
1944 ok( sz == 0, "wrong size returned\n");
1946 /* set the property to something */
1947 r = MsiSetProperty( 0, NULL, NULL );
1948 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
1950 r = MsiSetProperty( hpkg, NULL, NULL );
1951 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1953 r = MsiSetProperty( hpkg, "", NULL );
1954 ok( r == ERROR_SUCCESS, "wrong return val\n");
1956 /* try set and get some illegal property identifiers */
1957 r = MsiSetProperty( hpkg, "", "asdf" );
1958 ok( r == ERROR_FUNCTION_FAILED, "wrong return val\n");
1960 r = MsiSetProperty( hpkg, "=", "asdf" );
1961 ok( r == ERROR_SUCCESS, "wrong return val\n");
1963 r = MsiSetProperty( hpkg, " ", "asdf" );
1964 ok( r == ERROR_SUCCESS, "wrong return val\n");
1966 r = MsiSetProperty( hpkg, "'", "asdf" );
1967 ok( r == ERROR_SUCCESS, "wrong return val\n");
1971 r = MsiGetProperty( hpkg, "'", buffer, &sz );
1972 ok( r == ERROR_SUCCESS, "wrong return val\n");
1973 ok( !strcmp(buffer,"asdf"), "buffer was not changed\n");
1975 /* set empty values */
1976 r = MsiSetProperty( hpkg, "boo", NULL );
1977 ok( r == ERROR_SUCCESS, "wrong return val\n");
1978 ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
1980 r = MsiSetProperty( hpkg, "boo", "" );
1981 ok( r == ERROR_SUCCESS, "wrong return val\n");
1982 ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
1984 /* set a non-empty value */
1985 r = MsiSetProperty( hpkg, "boo", "xyz" );
1986 ok( r == ERROR_SUCCESS, "wrong return val\n");
1990 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1991 ok( r == ERROR_MORE_DATA, "wrong return val\n");
1992 ok( buffer[0] == 0, "buffer was not changed\n");
1993 ok( sz == 3, "wrong size returned\n");
1997 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1998 ok( r == ERROR_SUCCESS, "wrong return val\n");
1999 ok( !strcmp(buffer,"xyz"), "buffer was not changed\n");
2000 ok( sz == 3, "wrong size returned\n");
2004 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
2005 ok( r == ERROR_MORE_DATA, "wrong return val\n");
2006 ok( !strcmp(buffer,"xy"), "buffer was not changed\n");
2007 ok( sz == 3, "wrong size returned\n");
2009 r = MsiSetProperty(hpkg, "SourceDir", "foo");
2010 ok( r == ERROR_SUCCESS, "wrong return val\n");
2013 r = MsiGetProperty(hpkg, "SOURCEDIR", buffer, &sz);
2014 ok( r == ERROR_SUCCESS, "wrong return val\n");
2015 ok( !strcmp(buffer,""), "buffer wrong\n");
2016 ok( sz == 0, "wrong size returned\n");
2019 r = MsiGetProperty(hpkg, "SOMERANDOMNAME", buffer, &sz);
2020 ok( r == ERROR_SUCCESS, "wrong return val\n");
2021 ok( !strcmp(buffer,""), "buffer wrong\n");
2022 ok( sz == 0, "wrong size returned\n");
2025 r = MsiGetProperty(hpkg, "SourceDir", buffer, &sz);
2026 ok( r == ERROR_SUCCESS, "wrong return val\n");
2027 ok( !strcmp(buffer,"foo"), "buffer wrong\n");
2028 ok( sz == 3, "wrong size returned\n");
2030 r = MsiSetProperty(hpkg, "MetadataCompName", "Photoshop.dll");
2031 ok( r == ERROR_SUCCESS, "wrong return val\n");
2034 r = MsiGetProperty(hpkg, "MetadataCompName", NULL, &sz );
2035 ok( r == ERROR_SUCCESS, "return wrong\n");
2036 ok( sz == 13, "size wrong (%d)\n", sz);
2039 r = MsiGetProperty(hpkg, "MetadataCompName", buffer, &sz );
2040 ok( r == ERROR_MORE_DATA, "return wrong\n");
2041 ok( !strcmp(buffer,"Photoshop.dl"), "buffer wrong\n");
2043 r = MsiSetProperty(hpkg, "property", "value");
2044 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2047 r = MsiGetProperty(hpkg, "property", buffer, &sz);
2048 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2049 ok( !strcmp(buffer, "value"), "Expected value, got %s\n", buffer);
2051 r = MsiSetProperty(hpkg, "property", NULL);
2052 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2055 r = MsiGetProperty(hpkg, "property", buffer, &sz);
2056 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2057 ok( !strlen(buffer), "Expected empty string, got %s\n", buffer);
2059 MsiCloseHandle( hpkg );
2060 DeleteFile(msifile);
2063 static BOOL find_prop_in_property(MSIHANDLE hdb, LPCSTR prop, LPCSTR val)
2065 MSIHANDLE hview, hrec;
2067 CHAR buffer[MAX_PATH];
2071 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Property`", &hview);
2072 ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
2073 r = MsiViewExecute(hview, 0);
2074 ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n");
2077 while (r == ERROR_SUCCESS && !found)
2079 r = MsiViewFetch(hview, &hrec);
2080 if (r != ERROR_SUCCESS) break;
2083 r = MsiRecordGetString(hrec, 1, buffer, &sz);
2084 if (r == ERROR_SUCCESS && !lstrcmpA(buffer, prop))
2087 r = MsiRecordGetString(hrec, 2, buffer, &sz);
2088 if (r == ERROR_SUCCESS && !lstrcmpA(buffer, val))
2092 MsiCloseHandle(hrec);
2095 MsiViewClose(hview);
2096 MsiCloseHandle(hview);
2101 static void test_property_table(void)
2105 MSIHANDLE hpkg, hdb, hrec;
2106 char buffer[MAX_PATH], package[10];
2110 hdb = create_package_db();
2111 ok( hdb, "failed to create package\n");
2113 r = package_from_db(hdb, &hpkg);
2114 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2116 skip("Not enough rights to perform tests\n");
2117 DeleteFile(msifile);
2120 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
2122 MsiCloseHandle(hdb);
2124 hdb = MsiGetActiveDatabase(hpkg);
2126 query = "CREATE TABLE `_Property` ( "
2127 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
2128 r = run_query(hdb, query);
2129 ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
2131 MsiCloseHandle(hdb);
2132 MsiCloseHandle(hpkg);
2133 DeleteFile(msifile);
2135 hdb = create_package_db();
2136 ok( hdb, "failed to create package\n");
2138 query = "CREATE TABLE `_Property` ( "
2139 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
2140 r = run_query(hdb, query);
2141 ok(r == ERROR_SUCCESS, "failed to create table\n");
2143 query = "ALTER `_Property` ADD `foo` INTEGER";
2144 r = run_query(hdb, query);
2145 ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n");
2147 query = "ALTER TABLE `_Property` ADD `foo` INTEGER";
2148 r = run_query(hdb, query);
2149 ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n");
2151 query = "ALTER TABLE `_Property` ADD `extra` INTEGER";
2152 r = run_query(hdb, query);
2153 ok(r == ERROR_SUCCESS, "failed to add column\n");
2155 sprintf(package, "#%i", hdb);
2156 r = MsiOpenPackage(package, &hpkg);
2157 todo_wine ok(r != ERROR_SUCCESS, "MsiOpenPackage succeeded\n");
2158 if (r == ERROR_SUCCESS)
2159 MsiCloseHandle(hpkg);
2161 r = MsiCloseHandle(hdb);
2162 ok(r == ERROR_SUCCESS, "MsiCloseHandle failed %u\n", r);
2164 hdb = create_package_db();
2165 ok (hdb, "failed to create package database\n");
2167 r = create_property_table(hdb);
2168 ok(r == ERROR_SUCCESS, "cannot create Property table: %d\n", r);
2170 r = add_property_entry(hdb, "'prop', 'val'");
2171 ok(r == ERROR_SUCCESS, "cannot add property: %d\n", r);
2173 r = package_from_db(hdb, &hpkg);
2174 ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
2176 MsiCloseHandle(hdb);
2179 r = MsiGetProperty(hpkg, "prop", buffer, &sz);
2180 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2181 ok(!lstrcmp(buffer, "val"), "Expected val, got %s\n", buffer);
2183 hdb = MsiGetActiveDatabase(hpkg);
2185 found = find_prop_in_property(hdb, "prop", "val");
2186 ok(found, "prop should be in the _Property table\n");
2188 r = add_property_entry(hdb, "'dantes', 'mercedes'");
2189 ok(r == ERROR_SUCCESS, "cannot add property: %d\n", r);
2191 query = "SELECT * FROM `_Property` WHERE `Property` = 'dantes'";
2192 r = do_query(hdb, query, &hrec);
2193 ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
2195 found = find_prop_in_property(hdb, "dantes", "mercedes");
2196 ok(found == FALSE, "dantes should not be in the _Property table\n");
2199 lstrcpy(buffer, "aaa");
2200 r = MsiGetProperty(hpkg, "dantes", buffer, &sz);
2201 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2202 ok(lstrlenA(buffer) == 0, "Expected empty string, got %s\n", buffer);
2204 r = MsiSetProperty(hpkg, "dantes", "mercedes");
2205 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2207 found = find_prop_in_property(hdb, "dantes", "mercedes");
2208 ok(found == TRUE, "dantes should be in the _Property table\n");
2210 MsiCloseHandle(hdb);
2211 MsiCloseHandle(hpkg);
2212 DeleteFile(msifile);
2215 static UINT try_query_param( MSIHANDLE hdb, LPCSTR szQuery, MSIHANDLE hrec )
2220 res = MsiDatabaseOpenView( hdb, szQuery, &htab );
2221 if( res == ERROR_SUCCESS )
2225 r = MsiViewExecute( htab, hrec );
2226 if( r != ERROR_SUCCESS )
2229 fprintf(stderr,"MsiViewExecute failed %08x\n", res);
2232 r = MsiViewClose( htab );
2233 if( r != ERROR_SUCCESS )
2236 r = MsiCloseHandle( htab );
2237 if( r != ERROR_SUCCESS )
2243 static UINT try_query( MSIHANDLE hdb, LPCSTR szQuery )
2245 return try_query_param( hdb, szQuery, 0 );
2248 static void set_summary_str(MSIHANDLE hdb, DWORD pid, LPCSTR value)
2253 r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2254 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2256 r = MsiSummaryInfoSetPropertyA(summary, pid, VT_LPSTR, 0, NULL, value);
2257 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2259 r = MsiSummaryInfoPersist(summary);
2260 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2262 MsiCloseHandle(summary);
2265 static void set_summary_dword(MSIHANDLE hdb, DWORD pid, DWORD value)
2270 r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2271 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2273 r = MsiSummaryInfoSetPropertyA(summary, pid, VT_I4, value, NULL, NULL);
2274 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2276 r = MsiSummaryInfoPersist(summary);
2277 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2279 MsiCloseHandle(summary);
2282 static void test_msipackage(void)
2284 MSIHANDLE hdb = 0, hpack = 100;
2289 /* NULL szPackagePath */
2290 r = MsiOpenPackage(NULL, &hpack);
2291 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2293 /* empty szPackagePath */
2294 r = MsiOpenPackage("", &hpack);
2295 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2297 skip("Not enough rights to perform tests\n");
2302 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2305 if (r == ERROR_SUCCESS)
2306 MsiCloseHandle(hpack);
2308 /* nonexistent szPackagePath */
2309 r = MsiOpenPackage("nonexistent", &hpack);
2310 ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
2313 r = MsiOpenPackage(msifile, NULL);
2314 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2318 r = MsiOpenPackage(name, &hpack);
2319 ok(r == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", r);
2321 r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
2322 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2324 /* database exists, but is emtpy */
2325 sprintf(name, "#%d", hdb);
2326 r = MsiOpenPackage(name, &hpack);
2327 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2328 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2330 query = "CREATE TABLE `Property` ( "
2331 "`Property` CHAR(72), `Value` CHAR(0) "
2332 "PRIMARY KEY `Property`)";
2333 r = try_query(hdb, query);
2334 ok(r == ERROR_SUCCESS, "failed to create Properties table\n");
2336 query = "CREATE TABLE `InstallExecuteSequence` ("
2337 "`Action` CHAR(72), `Condition` CHAR(0), `Sequence` INTEGER "
2338 "PRIMARY KEY `Action`)";
2339 r = try_query(hdb, query);
2340 ok(r == ERROR_SUCCESS, "failed to create InstallExecuteSequence table\n");
2342 /* a few key tables exist */
2343 sprintf(name, "#%d", hdb);
2344 r = MsiOpenPackage(name, &hpack);
2345 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2346 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2348 MsiCloseHandle(hdb);
2349 DeleteFile(msifile);
2351 /* start with a clean database to show what constitutes a valid package */
2352 r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
2353 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2355 sprintf(name, "#%d", hdb);
2357 /* The following summary information props must exist:
2362 set_summary_dword(hdb, PID_PAGECOUNT, 100);
2363 r = MsiOpenPackage(name, &hpack);
2364 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2365 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2367 set_summary_str(hdb, PID_REVNUMBER, "{004757CD-5092-49c2-AD20-28E1CE0DF5F2}");
2368 r = MsiOpenPackage(name, &hpack);
2369 ok(r == ERROR_SUCCESS,
2370 "Expected ERROR_SUCCESS, got %d\n", r);
2372 MsiCloseHandle(hpack);
2373 MsiCloseHandle(hdb);
2374 DeleteFile(msifile);
2377 static void test_formatrecord2(void)
2379 MSIHANDLE hpkg, hrec ;
2384 r = package_from_db(create_package_db(), &hpkg);
2385 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2387 skip("Not enough rights to perform tests\n");
2388 DeleteFile(msifile);
2391 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
2393 r = MsiSetProperty(hpkg, "Manufacturer", " " );
2394 ok( r == ERROR_SUCCESS, "set property failed\n");
2396 hrec = MsiCreateRecord(2);
2397 ok(hrec, "create record failed\n");
2399 r = MsiRecordSetString( hrec, 0, "[ProgramFilesFolder][Manufacturer]\\asdf");
2400 ok( r == ERROR_SUCCESS, "format record failed\n");
2404 r = MsiFormatRecord( hpkg, hrec, buffer, &sz );
2406 r = MsiRecordSetString(hrec, 0, "[foo][1]");
2407 r = MsiRecordSetString(hrec, 1, "hoo");
2409 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2410 ok( sz == 3, "size wrong\n");
2411 ok( 0 == strcmp(buffer,"hoo"), "wrong output %s\n",buffer);
2412 ok( r == ERROR_SUCCESS, "format failed\n");
2414 r = MsiRecordSetString(hrec, 0, "x[~]x");
2416 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2417 ok( sz == 3, "size wrong\n");
2418 ok( 0 == strcmp(buffer,"x"), "wrong output %s\n",buffer);
2419 ok( r == ERROR_SUCCESS, "format failed\n");
2421 r = MsiRecordSetString(hrec, 0, "[foo.$%}][1]");
2422 r = MsiRecordSetString(hrec, 1, "hoo");
2424 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2425 ok( sz == 3, "size wrong\n");
2426 ok( 0 == strcmp(buffer,"hoo"), "wrong output %s\n",buffer);
2427 ok( r == ERROR_SUCCESS, "format failed\n");
2429 r = MsiRecordSetString(hrec, 0, "[\\[]");
2431 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2432 ok( sz == 1, "size wrong\n");
2433 ok( 0 == strcmp(buffer,"["), "wrong output %s\n",buffer);
2434 ok( r == ERROR_SUCCESS, "format failed\n");
2436 SetEnvironmentVariable("FOO", "BAR");
2437 r = MsiRecordSetString(hrec, 0, "[%FOO]");
2439 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2440 ok( sz == 3, "size wrong\n");
2441 ok( 0 == strcmp(buffer,"BAR"), "wrong output %s\n",buffer);
2442 ok( r == ERROR_SUCCESS, "format failed\n");
2444 r = MsiRecordSetString(hrec, 0, "[[1]]");
2445 r = MsiRecordSetString(hrec, 1, "%FOO");
2447 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2448 ok( sz == 3, "size wrong\n");
2449 ok( 0 == strcmp(buffer,"BAR"), "wrong output %s\n",buffer);
2450 ok( r == ERROR_SUCCESS, "format failed\n");
2452 MsiCloseHandle( hrec );
2453 MsiCloseHandle( hpkg );
2454 DeleteFile(msifile);
2457 static void test_states(void)
2462 INSTALLSTATE state, action;
2464 static const CHAR msifile2[] = "winetest2-package.msi";
2465 static const CHAR msifile3[] = "winetest3-package.msi";
2466 static const CHAR msifile4[] = "winetest4-package.msi";
2468 if (is_process_limited())
2470 skip("process is limited\n");
2474 hdb = create_package_db();
2475 ok ( hdb, "failed to create package database\n" );
2477 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
2478 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
2480 r = create_property_table( hdb );
2481 ok( r == ERROR_SUCCESS, "cannot create Property table: %d\n", r );
2483 r = add_property_entry( hdb, "'ProductCode', '{7262AC98-EEBD-4364-8CE3-D654F6A425B9}'" );
2484 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2486 r = add_property_entry( hdb, "'ProductLanguage', '1033'" );
2487 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2489 r = add_property_entry( hdb, "'ProductName', 'MSITEST'" );
2490 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2492 r = add_property_entry( hdb, "'ProductVersion', '1.1.1'" );
2493 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2495 r = create_install_execute_sequence_table( hdb );
2496 ok( r == ERROR_SUCCESS, "cannot create InstallExecuteSequence table: %d\n", r );
2498 r = add_install_execute_sequence_entry( hdb, "'CostInitialize', '', '800'" );
2499 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2501 r = add_install_execute_sequence_entry( hdb, "'FileCost', '', '900'" );
2502 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2504 r = add_install_execute_sequence_entry( hdb, "'CostFinalize', '', '1000'" );
2505 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2507 r = add_install_execute_sequence_entry( hdb, "'InstallValidate', '', '1400'" );
2508 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2510 r = add_install_execute_sequence_entry( hdb, "'InstallInitialize', '', '1500'" );
2511 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2513 r = add_install_execute_sequence_entry( hdb, "'ProcessComponents', '', '1600'" );
2514 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2516 r = add_install_execute_sequence_entry( hdb, "'UnpublishFeatures', '', '1800'" );
2517 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2519 r = add_install_execute_sequence_entry( hdb, "'RegisterProduct', '', '6100'" );
2520 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2522 r = add_install_execute_sequence_entry( hdb, "'PublishFeatures', '', '6300'" );
2523 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2525 r = add_install_execute_sequence_entry( hdb, "'PublishProduct', '', '6400'" );
2526 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2528 r = add_install_execute_sequence_entry( hdb, "'InstallFinalize', '', '6600'" );
2529 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2531 r = create_media_table( hdb );
2532 ok( r == ERROR_SUCCESS, "cannot create media table: %d\n", r );
2534 r = add_media_entry( hdb, "'1', '3', '', '', 'DISK1', ''");
2535 ok( r == ERROR_SUCCESS, "cannot add media entry: %d\n", r );
2537 r = create_feature_table( hdb );
2538 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
2540 r = create_component_table( hdb );
2541 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
2543 /* msidbFeatureAttributesFavorLocal */
2544 r = add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
2545 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2547 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
2548 r = add_component_entry( hdb, "'alpha', '{467EC132-739D-4784-A37B-677AA43DBC94}', 'TARGETDIR', 0, '', 'alpha_file'" );
2549 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2551 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
2552 r = add_component_entry( hdb, "'beta', '{2C1F189C-24A6-4C34-B26B-994A6C026506}', 'TARGETDIR', 1, '', 'beta_file'" );
2553 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2555 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
2556 r = add_component_entry( hdb, "'gamma', '{C271E2A4-DE2E-4F70-86D1-6984AF7DE2CA}', 'TARGETDIR', 2, '', 'gamma_file'" );
2557 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2559 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSharedDllRefCount */
2560 r = add_component_entry( hdb, "'theta', '{4EB3129D-81A8-48D5-9801-75600FED3DD9}', 'TARGETDIR', 8, '', 'theta_file'" );
2561 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2563 /* msidbFeatureAttributesFavorSource */
2564 r = add_feature_entry( hdb, "'two', '', '', '', 2, 1, '', 1" );
2565 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2567 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
2568 r = add_component_entry( hdb, "'delta', '{938FD4F2-C648-4259-A03C-7AA3B45643F3}', 'TARGETDIR', 0, '', 'delta_file'" );
2569 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2571 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2572 r = add_component_entry( hdb, "'epsilon', '{D59713B6-C11D-47F2-A395-1E5321781190}', 'TARGETDIR', 1, '', 'epsilon_file'" );
2573 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2575 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
2576 r = add_component_entry( hdb, "'zeta', '{377D33AB-2FAA-42B9-A629-0C0DAE9B9C7A}', 'TARGETDIR', 2, '', 'zeta_file'" );
2577 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2579 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSharedDllRefCount */
2580 r = add_component_entry( hdb, "'iota', '{5D36F871-B5ED-4801-9E0F-C46B9E5C9669}', 'TARGETDIR', 8, '', 'iota_file'" );
2581 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2583 /* msidbFeatureAttributesFavorSource */
2584 r = add_feature_entry( hdb, "'three', '', '', '', 2, 1, '', 1" );
2585 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2587 /* msidbFeatureAttributesFavorLocal */
2588 r = add_feature_entry( hdb, "'four', '', '', '', 2, 1, '', 0" );
2589 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2592 r = add_feature_entry( hdb, "'five', '', '', '', 2, 0, '', 1" );
2593 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2595 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2596 r = add_component_entry( hdb, "'eta', '{DD89003F-0DD4-41B8-81C0-3411A7DA2695}', 'TARGETDIR', 1, '', 'eta_file'" );
2597 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2599 /* no feature parent:msidbComponentAttributesLocalOnly */
2600 r = add_component_entry( hdb, "'kappa', '{D6B93DC3-8DA5-4769-9888-42BFE156BB8B}', 'TARGETDIR', 1, '', 'kappa_file'" );
2601 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2603 /* msidbFeatureAttributesFavorLocal:removed */
2604 r = add_feature_entry( hdb, "'six', '', '', '', 2, 1, '', 0" );
2605 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2607 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesLocalOnly */
2608 r = add_component_entry( hdb, "'lambda', '{6528C5E4-02A4-4636-A214-7A66A6C35B64}', 'TARGETDIR', 0, '', 'lambda_file'" );
2609 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2611 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSourceOnly */
2612 r = add_component_entry( hdb, "'mu', '{97014BAB-6C56-4013-9A63-2BF913B42519}', 'TARGETDIR', 1, '', 'mu_file'" );
2613 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2615 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesOptional */
2616 r = add_component_entry( hdb, "'nu', '{943DD0D8-5808-4954-8526-3B8493FEDDCD}', 'TARGETDIR', 2, '', 'nu_file'" );
2617 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2619 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSharedDllRefCount */
2620 r = add_component_entry( hdb, "'xi', '{D6CF9EF7-6FCF-4930-B34B-F938AEFF9BDB}', 'TARGETDIR', 8, '', 'xi_file'" );
2621 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2623 /* msidbFeatureAttributesFavorSource:removed */
2624 r = add_feature_entry( hdb, "'seven', '', '', '', 2, 1, '', 1" );
2625 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2627 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesLocalOnly */
2628 r = add_component_entry( hdb, "'omicron', '{7B57521D-15DB-4141-9AA6-01D934A4433F}', 'TARGETDIR', 0, '', 'omicron_file'" );
2629 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2631 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSourceOnly */
2632 r = add_component_entry( hdb, "'pi', '{FB85346B-378E-4492-8769-792305471C81}', 'TARGETDIR', 1, '', 'pi_file'" );
2633 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2635 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesOptional */
2636 r = add_component_entry( hdb, "'rho', '{798F2047-7B0C-4783-8BB0-D703E554114B}', 'TARGETDIR', 2, '', 'rho_file'" );
2637 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2639 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSharedDllRefCount */
2640 r = add_component_entry( hdb, "'sigma', '{5CE9DDA8-B67B-4736-9D93-99D61C5B93E7}', 'TARGETDIR', 8, '', 'sigma_file'" );
2641 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2643 /* msidbFeatureAttributesFavorLocal */
2644 r = add_feature_entry( hdb, "'eight', '', '', '', 2, 1, '', 0" );
2645 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2647 r = add_component_entry( hdb, "'tau', '{07DEB510-677C-4A6F-A0A6-7CD8EFEA77ED}', 'TARGETDIR', 1, '', 'tau_file'" );
2648 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2650 /* msidbFeatureAttributesFavorSource */
2651 r = add_feature_entry( hdb, "'nine', '', '', '', 2, 1, '', 1" );
2652 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2654 r = add_component_entry( hdb, "'phi', '{9F0594C5-35AD-43EA-94DD-8DF73FAA664D}', 'TARGETDIR', 1, '', 'phi_file'" );
2655 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2657 /* msidbFeatureAttributesFavorAdvertise */
2658 r = add_feature_entry( hdb, "'ten', '', '', '', 2, 1, '', 4" );
2659 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2661 r = add_component_entry( hdb, "'chi', '{E6B539AB-5DA9-4236-A2D2-E341A50B4C38}', 'TARGETDIR', 1, '', 'chi_file'" );
2662 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2664 r = create_feature_components_table( hdb );
2665 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
2667 r = add_feature_components_entry( hdb, "'one', 'alpha'" );
2668 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2670 r = add_feature_components_entry( hdb, "'one', 'beta'" );
2671 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2673 r = add_feature_components_entry( hdb, "'one', 'gamma'" );
2674 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2676 r = add_feature_components_entry( hdb, "'one', 'theta'" );
2677 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2679 r = add_feature_components_entry( hdb, "'two', 'delta'" );
2680 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2682 r = add_feature_components_entry( hdb, "'two', 'epsilon'" );
2683 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2685 r = add_feature_components_entry( hdb, "'two', 'zeta'" );
2686 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2688 r = add_feature_components_entry( hdb, "'two', 'iota'" );
2689 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2691 r = add_feature_components_entry( hdb, "'three', 'eta'" );
2692 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2694 r = add_feature_components_entry( hdb, "'four', 'eta'" );
2695 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2697 r = add_feature_components_entry( hdb, "'five', 'eta'" );
2698 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2700 r = add_feature_components_entry( hdb, "'six', 'lambda'" );
2701 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2703 r = add_feature_components_entry( hdb, "'six', 'mu'" );
2704 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2706 r = add_feature_components_entry( hdb, "'six', 'nu'" );
2707 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2709 r = add_feature_components_entry( hdb, "'six', 'xi'" );
2710 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2712 r = add_feature_components_entry( hdb, "'seven', 'omicron'" );
2713 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2715 r = add_feature_components_entry( hdb, "'seven', 'pi'" );
2716 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2718 r = add_feature_components_entry( hdb, "'seven', 'rho'" );
2719 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2721 r = add_feature_components_entry( hdb, "'seven', 'sigma'" );
2722 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2724 r = add_feature_components_entry( hdb, "'eight', 'tau'" );
2725 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2727 r = add_feature_components_entry( hdb, "'nine', 'phi'" );
2728 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2730 r = add_feature_components_entry( hdb, "'ten', 'chi'" );
2731 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2733 r = create_file_table( hdb );
2734 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
2736 r = add_file_entry( hdb, "'alpha_file', 'alpha', 'alpha.txt', 100, '', '1033', 8192, 1" );
2737 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2739 r = add_file_entry( hdb, "'beta_file', 'beta', 'beta.txt', 0, '', '1033', 8192, 1" );
2740 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2742 r = add_file_entry( hdb, "'gamma_file', 'gamma', 'gamma.txt', 0, '', '1033', 8192, 1" );
2743 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2745 r = add_file_entry( hdb, "'theta_file', 'theta', 'theta.txt', 0, '', '1033', 8192, 1" );
2746 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2748 r = add_file_entry( hdb, "'delta_file', 'delta', 'delta.txt', 0, '', '1033', 8192, 1" );
2749 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2751 r = add_file_entry( hdb, "'epsilon_file', 'epsilon', 'epsilon.txt', 0, '', '1033', 8192, 1" );
2752 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2754 r = add_file_entry( hdb, "'zeta_file', 'zeta', 'zeta.txt', 0, '', '1033', 8192, 1" );
2755 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2757 r = add_file_entry( hdb, "'iota_file', 'iota', 'iota.txt', 0, '', '1033', 8192, 1" );
2758 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2760 /* compressed file */
2761 r = add_file_entry( hdb, "'eta_file', 'eta', 'eta.txt', 0, '', '1033', 16384, 1" );
2762 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2764 r = add_file_entry( hdb, "'kappa_file', 'kappa', 'kappa.txt', 0, '', '1033', 8192, 1" );
2765 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2767 r = add_file_entry( hdb, "'lambda_file', 'lambda', 'lambda.txt', 100, '', '1033', 8192, 1" );
2768 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2770 r = add_file_entry( hdb, "'mu_file', 'mu', 'mu.txt', 100, '', '1033', 8192, 1" );
2771 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2773 r = add_file_entry( hdb, "'nu_file', 'nu', 'nu.txt', 100, '', '1033', 8192, 1" );
2774 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2776 r = add_file_entry( hdb, "'xi_file', 'xi', 'xi.txt', 100, '', '1033', 8192, 1" );
2777 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2779 r = add_file_entry( hdb, "'omicron_file', 'omicron', 'omicron.txt', 100, '', '1033', 8192, 1" );
2780 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2782 r = add_file_entry( hdb, "'pi_file', 'pi', 'pi.txt', 100, '', '1033', 8192, 1" );
2783 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2785 r = add_file_entry( hdb, "'rho_file', 'rho', 'rho.txt', 100, '', '1033', 8192, 1" );
2786 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2788 r = add_file_entry( hdb, "'sigma_file', 'sigma', 'sigma.txt', 100, '', '1033', 8192, 1" );
2789 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2791 r = add_file_entry( hdb, "'tau_file', 'tau', 'tau.txt', 100, '', '1033', 8192, 1" );
2792 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2794 r = add_file_entry( hdb, "'phi_file', 'phi', 'phi.txt', 100, '', '1033', 8192, 1" );
2795 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2797 r = add_file_entry( hdb, "'chi_file', 'chi', 'chi.txt', 100, '', '1033', 8192, 1" );
2798 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2800 MsiDatabaseCommit(hdb);
2802 /* these properties must not be in the saved msi file */
2803 r = add_property_entry( hdb, "'ADDLOCAL', 'one,four'");
2804 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2806 r = add_property_entry( hdb, "'ADDSOURCE', 'two,three'");
2807 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2809 r = add_property_entry( hdb, "'REMOVE', 'six,seven'");
2810 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2812 r = add_property_entry( hdb, "'REINSTALL', 'eight,nine,ten'");
2813 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2815 r = add_property_entry( hdb, "'REINSTALLMODE', 'omus'");
2816 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2818 r = package_from_db( hdb, &hpkg );
2819 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2821 skip("Not enough rights to perform tests\n");
2822 DeleteFile(msifile);
2825 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
2827 MsiCloseHandle(hdb);
2829 CopyFileA(msifile, msifile2, FALSE);
2830 CopyFileA(msifile, msifile3, FALSE);
2831 CopyFileA(msifile, msifile4, FALSE);
2835 r = MsiGetFeatureState(hpkg, "one", &state, &action);
2836 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2837 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2838 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2842 r = MsiGetFeatureState(hpkg, "two", &state, &action);
2843 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2844 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2845 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2849 r = MsiGetFeatureState(hpkg, "three", &state, &action);
2850 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2851 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2852 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2856 r = MsiGetFeatureState(hpkg, "four", &state, &action);
2857 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2858 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2859 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2863 r = MsiGetFeatureState(hpkg, "five", &state, &action);
2864 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2865 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2866 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2870 r = MsiGetFeatureState(hpkg, "six", &state, &action);
2871 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2872 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2873 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2877 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
2878 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2879 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2880 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2884 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
2885 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2886 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2887 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2891 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
2892 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2893 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2894 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2898 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
2899 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2900 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2901 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2905 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
2906 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2907 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2908 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2912 r = MsiGetComponentState(hpkg, "beta", &state, &action);
2913 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2914 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2915 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2919 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
2920 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2921 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2922 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2926 r = MsiGetComponentState(hpkg, "theta", &state, &action);
2927 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2928 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2929 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2933 r = MsiGetComponentState(hpkg, "delta", &state, &action);
2934 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2935 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2936 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2940 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
2941 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2942 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2943 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2947 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
2948 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2949 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2950 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2954 r = MsiGetComponentState(hpkg, "iota", &state, &action);
2955 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2956 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2957 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2961 r = MsiGetComponentState(hpkg, "eta", &state, &action);
2962 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2963 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2964 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2968 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
2969 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2970 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2971 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2975 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
2976 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2977 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2978 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2982 r = MsiGetComponentState(hpkg, "mu", &state, &action);
2983 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2984 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2985 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2989 r = MsiGetComponentState(hpkg, "nu", &state, &action);
2990 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2991 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2992 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2996 r = MsiGetComponentState(hpkg, "xi", &state, &action);
2997 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2998 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2999 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3003 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3004 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3005 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3006 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3010 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3011 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3012 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3013 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3017 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3018 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3019 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3020 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3024 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3025 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3026 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3027 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3031 r = MsiGetComponentState(hpkg, "tau", &state, &action);
3032 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3033 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3034 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3038 r = MsiGetComponentState(hpkg, "phi", &state, &action);
3039 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3040 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3041 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3045 r = MsiGetComponentState(hpkg, "chi", &state, &action);
3046 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3047 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3048 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3050 r = MsiDoAction( hpkg, "CostInitialize");
3051 ok( r == ERROR_SUCCESS, "cost init failed\n");
3055 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3056 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3057 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3058 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3062 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3063 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3064 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3065 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3069 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3070 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3071 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3072 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3076 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3077 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3078 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3079 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3083 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3084 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3085 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3086 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3090 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3091 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3092 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3093 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3097 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3098 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3099 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3100 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3104 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3105 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3106 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3107 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3111 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3112 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3113 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3114 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3118 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3119 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3120 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3121 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3125 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3126 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3127 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3128 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3132 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3133 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3134 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3135 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3139 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3140 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3141 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3142 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3146 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3147 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3148 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3149 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3153 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3154 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3155 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3156 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3160 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3161 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3162 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3163 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3167 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3168 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3169 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3170 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3174 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3175 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3176 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3177 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3181 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3182 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3183 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3184 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3188 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3189 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3190 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3191 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3195 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3196 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3197 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3198 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3202 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3203 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3204 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3205 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3209 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3210 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3211 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3212 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3216 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3217 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3218 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3219 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3223 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3224 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3225 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3226 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3230 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3231 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3232 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3233 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3237 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3238 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3239 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3240 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3244 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3245 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3246 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3247 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3251 r = MsiGetComponentState(hpkg, "tau", &state, &action);
3252 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3253 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3254 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3258 r = MsiGetComponentState(hpkg, "phi", &state, &action);
3259 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3260 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3261 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3265 r = MsiGetComponentState(hpkg, "chi", &state, &action);
3266 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3267 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3268 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3270 r = MsiDoAction( hpkg, "FileCost");
3271 ok( r == ERROR_SUCCESS, "file cost failed\n");
3275 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3276 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3277 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3278 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3282 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3283 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3284 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3285 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3289 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3290 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3291 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3292 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3296 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3297 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3298 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3299 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3303 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3304 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3305 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3306 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3310 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3311 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3312 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3313 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3317 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3318 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3319 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3320 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3324 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3325 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3326 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3327 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3331 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3332 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3333 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3334 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3338 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3339 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3340 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3341 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3345 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3346 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3347 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3348 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3352 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3353 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3354 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3355 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3359 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3360 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3361 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3362 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3366 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3367 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3368 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3369 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3373 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3374 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3375 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3376 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3380 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3381 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3382 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3383 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3387 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3388 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3389 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3390 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3394 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3395 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3396 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3397 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3401 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3402 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3403 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3404 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3408 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3409 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3410 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3411 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3415 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3416 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3417 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3418 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3422 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3423 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3424 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3425 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3429 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3430 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3431 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3432 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3436 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3437 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3438 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3439 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3443 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3444 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3445 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3446 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3450 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3451 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3452 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3453 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3457 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3458 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3459 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3460 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3464 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3465 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3466 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3467 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3471 r = MsiGetComponentState(hpkg, "tau", &state, &action);
3472 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3473 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3474 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3478 r = MsiGetComponentState(hpkg, "phi", &state, &action);
3479 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3480 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3481 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3485 r = MsiGetComponentState(hpkg, "chi", &state, &action);
3486 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3487 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3488 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3490 r = MsiDoAction( hpkg, "CostFinalize");
3491 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
3495 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3496 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3497 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3498 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3502 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3503 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3504 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3505 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3509 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3510 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3511 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3512 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3516 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3517 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3518 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3519 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3523 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3524 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3525 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3526 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3530 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3531 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3532 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3533 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3537 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3538 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3539 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3540 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3544 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3545 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3546 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3547 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3551 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3552 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3553 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3554 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3558 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3559 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3560 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3561 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3565 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3566 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3567 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3568 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3572 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3573 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3574 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3575 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3579 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3580 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3581 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3582 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3586 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3587 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3588 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3589 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3593 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3594 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3595 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3596 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3600 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3601 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3602 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3603 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3607 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3608 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3609 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3610 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3614 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3615 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3616 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3617 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3621 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3622 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3623 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3624 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3628 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3629 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3630 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3631 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3635 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3636 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3637 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3638 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3642 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3643 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3644 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3645 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3649 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3650 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3651 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3652 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3656 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3657 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3658 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3659 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3663 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3664 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3665 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3666 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3670 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3671 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3672 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3673 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3677 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3678 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3679 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3680 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3684 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3685 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3686 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3687 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3691 r = MsiGetComponentState(hpkg, "tau", &state, &action);
3692 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3693 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3694 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3698 r = MsiGetComponentState(hpkg, "phi", &state, &action);
3699 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3700 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3701 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3705 r = MsiGetComponentState(hpkg, "chi", &state, &action);
3706 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3707 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3708 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3710 MsiCloseHandle( hpkg );
3712 /* publish the features and components */
3713 r = MsiInstallProduct(msifile, "ADDLOCAL=one,four ADDSOURCE=two,three REMOVE=six,seven REINSTALL=eight,nine,ten");
3714 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3716 r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
3717 ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
3719 /* these properties must not be in the saved msi file */
3720 r = add_property_entry( hdb, "'ADDLOCAL', 'one,four'");
3721 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3723 r = add_property_entry( hdb, "'ADDSOURCE', 'two,three'");
3724 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3726 r = add_property_entry( hdb, "'REMOVE', 'six,seven'");
3727 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3729 r = add_property_entry( hdb, "'REINSTALL', 'eight,nine,ten'");
3730 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3732 r = package_from_db( hdb, &hpkg );
3733 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
3735 MsiCloseHandle(hdb);
3739 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3740 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3741 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3742 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3746 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3747 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3748 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3749 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3753 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3754 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3755 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3756 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3760 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3761 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3762 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3763 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3767 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3768 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3769 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3770 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3774 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3775 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3776 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3777 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3781 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3782 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3783 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3784 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3788 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
3789 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3790 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3791 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3795 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
3796 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3797 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3798 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3802 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
3803 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3804 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3805 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3809 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3810 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3811 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3812 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3816 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3817 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3818 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3819 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3823 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3824 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3825 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3826 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3830 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3831 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3832 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3833 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3837 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3838 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3839 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3840 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3844 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3845 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3846 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3847 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3851 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3852 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3853 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3854 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3858 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3859 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3860 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3861 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3865 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3866 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3867 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3868 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3872 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3873 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3874 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3875 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3879 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3880 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3881 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3882 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3886 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3887 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3888 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3889 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3893 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3894 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3895 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3896 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3900 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3901 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3902 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3903 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3907 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3908 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3909 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3910 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3914 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3915 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3916 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3917 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3921 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3922 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3923 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3924 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3928 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3929 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3930 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3931 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3935 r = MsiGetComponentState(hpkg, "tau", &state, &action);
3936 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3937 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3938 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3942 r = MsiGetComponentState(hpkg, "phi", &state, &action);
3943 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3944 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3945 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3949 r = MsiGetComponentState(hpkg, "chi", &state, &action);
3950 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3951 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3952 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3954 r = MsiDoAction( hpkg, "CostInitialize");
3955 ok( r == ERROR_SUCCESS, "cost init failed\n");
3959 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3960 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3961 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3962 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3966 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3967 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3968 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3969 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3973 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3974 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3975 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3976 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3980 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3981 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3982 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3983 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3987 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3988 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3989 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3990 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3994 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3995 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3996 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3997 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4001 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4002 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4003 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4004 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4008 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4009 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4010 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4011 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4015 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4016 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4017 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4018 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4022 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
4023 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4024 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4025 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4029 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4030 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4031 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4032 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4036 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4037 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4038 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4039 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4043 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4044 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4045 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4046 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4050 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4051 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4052 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4053 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4057 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4058 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4059 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4060 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4064 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4065 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4066 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4067 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4071 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4072 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4073 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4074 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4078 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4079 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4080 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4081 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4085 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4086 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4087 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4088 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4092 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4093 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4094 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4095 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4099 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4100 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4101 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4102 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4106 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4107 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4108 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4109 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4113 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4114 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4115 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4116 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4120 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4121 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4122 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4123 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4127 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4128 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4129 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4130 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4134 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4135 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4136 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4137 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4141 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4142 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4143 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4144 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4148 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4149 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4150 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4151 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4155 r = MsiGetComponentState(hpkg, "tau", &state, &action);
4156 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4157 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4158 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4162 r = MsiGetComponentState(hpkg, "phi", &state, &action);
4163 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4164 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4165 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4169 r = MsiGetComponentState(hpkg, "chi", &state, &action);
4170 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4171 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4172 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4174 r = MsiDoAction( hpkg, "FileCost");
4175 ok( r == ERROR_SUCCESS, "file cost failed\n");
4179 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4180 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4181 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4182 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4186 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4187 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4188 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4189 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4193 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4194 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4195 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4196 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4200 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4201 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4202 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4203 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4207 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4208 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4209 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4210 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4214 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4215 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4216 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4217 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4221 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4222 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4223 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4224 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4228 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4229 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4230 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4231 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4235 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4236 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4237 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4238 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4242 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4243 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4244 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4245 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4249 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4250 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4251 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4252 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4256 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4257 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4258 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4259 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4263 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4264 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4265 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4266 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4270 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4271 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4272 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4273 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4277 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4278 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4279 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4280 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4284 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4285 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4286 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4287 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4291 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4292 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4293 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4294 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4298 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4299 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4300 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4301 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4305 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4306 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4307 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4308 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4312 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4313 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4314 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4315 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4319 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4320 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4321 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4322 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4326 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4327 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4328 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4329 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4333 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4334 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4335 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4336 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4340 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4341 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4342 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4343 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4347 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4348 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4349 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4350 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4354 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4355 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4356 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4357 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4361 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4362 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4363 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4364 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4368 r = MsiGetComponentState(hpkg, "tau", &state, &action);
4369 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4370 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4371 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4375 r = MsiGetComponentState(hpkg, "phi", &state, &action);
4376 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4377 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4378 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4382 r = MsiGetComponentState(hpkg, "chi", &state, &action);
4383 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4384 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4385 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4387 r = MsiDoAction( hpkg, "CostFinalize");
4388 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
4392 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4393 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4394 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4395 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4399 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4400 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4401 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4402 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
4406 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4407 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4408 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4409 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4413 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4414 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4415 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4416 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4420 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4421 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4422 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4423 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4427 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4428 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4429 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4430 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4434 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4435 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4436 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4437 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4441 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4442 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4443 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4444 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4448 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4449 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4450 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4451 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4455 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
4456 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4457 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4458 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4462 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4463 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4464 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4465 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4469 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4470 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4471 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4472 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
4476 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4477 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4478 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4479 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4483 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4484 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4485 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4486 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4490 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4491 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4492 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4493 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4497 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4498 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4499 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4500 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4504 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4505 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4506 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4507 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4511 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4512 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4513 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4514 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4518 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4519 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4520 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4521 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4525 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4526 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4527 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4528 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4532 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4533 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4534 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4535 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4539 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4540 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4541 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4542 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4546 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4547 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4548 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4549 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4553 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4554 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4555 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4556 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4560 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4561 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4562 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4563 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4567 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4568 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4569 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4570 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4574 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4575 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4576 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4577 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4581 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4582 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4583 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4584 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4588 r = MsiGetComponentState(hpkg, "tau", &state, &action);
4589 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4590 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4591 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4595 r = MsiGetComponentState(hpkg, "phi", &state, &action);
4596 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4597 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4598 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4602 r = MsiGetComponentState(hpkg, "chi", &state, &action);
4603 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4604 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4605 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4607 MsiCloseHandle(hpkg);
4609 /* uninstall the product */
4610 r = MsiInstallProduct(msifile, "REMOVE=ALL");
4611 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4613 /* all features installed locally */
4614 r = MsiInstallProduct(msifile2, "ADDLOCAL=ALL");
4615 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4617 r = MsiOpenDatabase(msifile2, MSIDBOPEN_DIRECT, &hdb);
4618 ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
4620 /* these properties must not be in the saved msi file */
4621 r = add_property_entry( hdb, "'ADDLOCAL', 'one,two,three,four,five,six,seven,eight,nine,ten'");
4622 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
4624 r = package_from_db( hdb, &hpkg );
4625 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
4629 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4630 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4631 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4632 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4636 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4637 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4638 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4639 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4643 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4644 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4645 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4646 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4650 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4651 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4652 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4653 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4657 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4658 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4659 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4660 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4664 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4665 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4666 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4667 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4671 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4672 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4673 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4674 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4678 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4679 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4680 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4681 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4685 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4686 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4687 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4688 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4692 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
4693 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4694 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4695 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4699 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4700 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4701 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4702 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4706 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4707 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4708 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4709 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4713 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4714 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4715 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4716 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4720 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4721 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4722 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4723 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4727 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4728 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4729 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4730 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4734 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4735 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4736 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4737 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4741 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4742 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4743 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4744 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4748 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4749 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4750 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4751 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4755 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4756 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4757 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4758 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4762 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4763 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4764 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4765 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4769 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4770 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4771 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4772 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4776 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4777 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4778 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4779 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4783 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4784 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4785 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4786 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4790 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4791 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4792 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4793 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4797 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4798 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4799 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4800 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4804 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4805 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4806 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4807 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4811 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4812 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4813 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4814 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4818 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4819 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4820 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4821 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4825 r = MsiGetComponentState(hpkg, "tau", &state, &action);
4826 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4827 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4828 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4832 r = MsiGetComponentState(hpkg, "phi", &state, &action);
4833 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4834 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4835 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4839 r = MsiGetComponentState(hpkg, "chi", &state, &action);
4840 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4841 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4842 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4844 r = MsiDoAction( hpkg, "CostInitialize");
4845 ok( r == ERROR_SUCCESS, "cost init failed\n");
4849 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4850 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4851 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4852 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4856 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4857 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4858 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4859 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4863 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4864 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4865 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4866 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4870 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4871 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4872 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4873 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4877 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4878 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4879 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4880 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4884 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4885 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4886 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4887 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4891 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4892 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4893 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4894 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4898 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
4899 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4900 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4901 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4905 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
4906 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4907 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4908 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4912 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
4913 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4914 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4915 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4919 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4920 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4921 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4922 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4926 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4927 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4928 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4929 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4933 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4934 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4935 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4936 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4940 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4941 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4942 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4943 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4947 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4948 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4949 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4950 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4954 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4955 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4956 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4957 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4961 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4962 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4963 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4964 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4968 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4969 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4970 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4971 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4975 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4976 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4977 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4978 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4982 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4983 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4984 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4985 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4989 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4990 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4991 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4992 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4996 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4997 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4998 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4999 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5003 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5004 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5005 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5006 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5010 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5011 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5012 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5013 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5017 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5018 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5019 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5020 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5024 r = MsiGetComponentState(hpkg, "pi", &state, &action);
5025 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5026 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5027 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5031 r = MsiGetComponentState(hpkg, "rho", &state, &action);
5032 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5033 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5034 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5038 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5039 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5040 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5041 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5045 r = MsiGetComponentState(hpkg, "tau", &state, &action);
5046 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5047 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5048 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5052 r = MsiGetComponentState(hpkg, "phi", &state, &action);
5053 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5054 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5055 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5059 r = MsiGetComponentState(hpkg, "chi", &state, &action);
5060 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5061 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5062 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5064 r = MsiDoAction( hpkg, "FileCost");
5065 ok( r == ERROR_SUCCESS, "file cost failed\n");
5069 r = MsiGetFeatureState(hpkg, "one", &state, &action);
5070 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5071 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5072 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5076 r = MsiGetFeatureState(hpkg, "two", &state, &action);
5077 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5078 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5079 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5083 r = MsiGetFeatureState(hpkg, "three", &state, &action);
5084 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5085 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5086 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5090 r = MsiGetFeatureState(hpkg, "four", &state, &action);
5091 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5092 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5093 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5097 r = MsiGetFeatureState(hpkg, "five", &state, &action);
5098 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5099 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5100 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5104 r = MsiGetFeatureState(hpkg, "six", &state, &action);
5105 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5106 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5107 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5111 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5112 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5113 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5114 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5118 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5119 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5120 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5121 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5125 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5126 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5127 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5128 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5132 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5133 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5134 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5135 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5139 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5140 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5141 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5142 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5146 r = MsiGetComponentState(hpkg, "beta", &state, &action);
5147 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5148 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5149 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5153 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5154 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5155 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5156 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5160 r = MsiGetComponentState(hpkg, "theta", &state, &action);
5161 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5162 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5163 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5167 r = MsiGetComponentState(hpkg, "delta", &state, &action);
5168 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5169 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5170 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5174 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5175 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5176 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5177 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5181 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5182 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5183 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5184 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5188 r = MsiGetComponentState(hpkg, "iota", &state, &action);
5189 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5190 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5191 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5195 r = MsiGetComponentState(hpkg, "eta", &state, &action);
5196 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5197 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5198 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5202 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5203 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5204 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5205 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5209 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5210 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5211 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5212 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5216 r = MsiGetComponentState(hpkg, "mu", &state, &action);
5217 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5218 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5219 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5223 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5224 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5225 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5226 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5230 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5231 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5232 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5233 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5237 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5238 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5239 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5240 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5244 r = MsiGetComponentState(hpkg, "pi", &state, &action);
5245 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5246 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5247 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5251 r = MsiGetComponentState(hpkg, "rho", &state, &action);
5252 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5253 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5254 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5258 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5259 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5260 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5261 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5265 r = MsiGetComponentState(hpkg, "tau", &state, &action);
5266 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5267 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5268 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5272 r = MsiGetComponentState(hpkg, "phi", &state, &action);
5273 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5274 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5275 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5279 r = MsiGetComponentState(hpkg, "chi", &state, &action);
5280 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5281 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5282 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5284 r = MsiDoAction( hpkg, "CostFinalize");
5285 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
5289 r = MsiGetFeatureState(hpkg, "one", &state, &action);
5290 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5291 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5292 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5296 r = MsiGetFeatureState(hpkg, "two", &state, &action);
5297 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5298 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5299 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5303 r = MsiGetFeatureState(hpkg, "three", &state, &action);
5304 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5305 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5306 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5310 r = MsiGetFeatureState(hpkg, "four", &state, &action);
5311 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5312 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5313 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5317 r = MsiGetFeatureState(hpkg, "five", &state, &action);
5318 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5319 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
5320 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5324 r = MsiGetFeatureState(hpkg, "six", &state, &action);
5325 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5326 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5327 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5331 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5332 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5333 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5334 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5338 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5339 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5340 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5341 todo_wine ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5345 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5346 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5347 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5348 todo_wine ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5352 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5353 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5354 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5355 todo_wine ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5359 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5360 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5361 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5362 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5366 r = MsiGetComponentState(hpkg, "beta", &state, &action);
5367 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5368 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5369 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5373 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5374 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5375 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5376 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5380 r = MsiGetComponentState(hpkg, "theta", &state, &action);
5381 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5382 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5383 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5387 r = MsiGetComponentState(hpkg, "delta", &state, &action);
5388 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5389 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5390 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5394 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5395 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5396 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5397 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5401 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5402 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5403 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5404 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5408 r = MsiGetComponentState(hpkg, "iota", &state, &action);
5409 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5410 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5411 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5415 r = MsiGetComponentState(hpkg, "eta", &state, &action);
5416 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5417 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5418 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5422 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5423 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5424 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
5425 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5429 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5430 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5431 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5432 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5436 r = MsiGetComponentState(hpkg, "mu", &state, &action);
5437 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5438 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5439 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5443 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5444 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5445 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5446 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5450 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5451 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5452 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5453 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5457 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5458 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5459 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5460 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5464 r = MsiGetComponentState(hpkg, "pi", &state, &action);
5465 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5466 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5467 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
5471 r = MsiGetComponentState(hpkg, "rho", &state, &action);
5472 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5473 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5474 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5478 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5479 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5480 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5481 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5485 r = MsiGetComponentState(hpkg, "tau", &state, &action);
5486 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5487 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5488 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5492 r = MsiGetComponentState(hpkg, "phi", &state, &action);
5493 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5494 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5495 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5499 r = MsiGetComponentState(hpkg, "chi", &state, &action);
5500 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5501 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5502 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5504 MsiCloseHandle(hpkg);
5506 /* uninstall the product */
5507 r = MsiInstallProduct(msifile2, "REMOVE=ALL");
5508 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5510 /* all features installed from source */
5511 r = MsiInstallProduct(msifile3, "ADDSOURCE=ALL");
5512 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5514 r = MsiOpenDatabase(msifile3, MSIDBOPEN_DIRECT, &hdb);
5515 ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
5517 /* this property must not be in the saved msi file */
5518 r = add_property_entry( hdb, "'ADDSOURCE', 'one,two,three,four,five,six,seven,eight,nine,ten'");
5519 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
5521 r = package_from_db( hdb, &hpkg );
5522 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
5526 r = MsiGetFeatureState(hpkg, "one", &state, &action);
5527 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5528 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5529 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5533 r = MsiGetFeatureState(hpkg, "two", &state, &action);
5534 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5535 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5536 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5540 r = MsiGetFeatureState(hpkg, "three", &state, &action);
5541 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5542 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5543 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5547 r = MsiGetFeatureState(hpkg, "four", &state, &action);
5548 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5549 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5550 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5554 r = MsiGetFeatureState(hpkg, "five", &state, &action);
5555 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5556 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5557 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5561 r = MsiGetFeatureState(hpkg, "six", &state, &action);
5562 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5563 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5564 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5568 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5569 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5570 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5571 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5575 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5576 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5577 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5578 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5582 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5583 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5584 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5585 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5589 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5590 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
5591 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5592 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5596 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5597 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5598 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5599 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5603 r = MsiGetComponentState(hpkg, "beta", &state, &action);
5604 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5605 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5606 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5610 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5611 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5612 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5613 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5617 r = MsiGetComponentState(hpkg, "theta", &state, &action);
5618 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5619 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5620 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5624 r = MsiGetComponentState(hpkg, "delta", &state, &action);
5625 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5626 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5627 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5631 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5632 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5633 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5634 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5638 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5639 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5640 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5641 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5645 r = MsiGetComponentState(hpkg, "iota", &state, &action);
5646 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5647 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5648 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5652 r = MsiGetComponentState(hpkg, "eta", &state, &action);
5653 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5654 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5655 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5659 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5660 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5661 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5662 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5666 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5667 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5668 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5669 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5673 r = MsiGetComponentState(hpkg, "mu", &state, &action);
5674 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5675 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5676 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5680 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5681 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5682 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5683 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5687 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5688 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5689 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5690 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5694 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5695 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5696 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5697 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5701 r = MsiGetComponentState(hpkg, "pi", &state, &action);
5702 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5703 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5704 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5708 r = MsiGetComponentState(hpkg, "rho", &state, &action);
5709 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5710 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5711 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5715 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5716 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5717 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5718 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5722 r = MsiGetComponentState(hpkg, "tau", &state, &action);
5723 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5724 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5725 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5729 r = MsiGetComponentState(hpkg, "phi", &state, &action);
5730 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5731 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5732 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5736 r = MsiGetComponentState(hpkg, "chi", &state, &action);
5737 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5738 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5739 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5741 r = MsiDoAction( hpkg, "CostInitialize");
5742 ok( r == ERROR_SUCCESS, "cost init failed\n");
5746 r = MsiGetFeatureState(hpkg, "one", &state, &action);
5747 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5748 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5749 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5753 r = MsiGetFeatureState(hpkg, "two", &state, &action);
5754 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5755 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5756 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5760 r = MsiGetFeatureState(hpkg, "three", &state, &action);
5761 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5762 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5763 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5767 r = MsiGetFeatureState(hpkg, "four", &state, &action);
5768 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5769 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5770 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5774 r = MsiGetFeatureState(hpkg, "five", &state, &action);
5775 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5776 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5777 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5781 r = MsiGetFeatureState(hpkg, "six", &state, &action);
5782 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5783 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5784 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5788 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5789 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5790 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5791 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5795 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
5796 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5797 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5798 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5802 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
5803 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5804 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5805 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5809 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
5810 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5811 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5812 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5816 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5817 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5818 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5819 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5823 r = MsiGetComponentState(hpkg, "beta", &state, &action);
5824 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5825 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5826 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5830 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5831 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5832 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5833 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5837 r = MsiGetComponentState(hpkg, "theta", &state, &action);
5838 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5839 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5840 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5844 r = MsiGetComponentState(hpkg, "delta", &state, &action);
5845 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5846 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5847 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5851 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5852 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5853 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5854 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5858 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5859 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5860 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5861 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5865 r = MsiGetComponentState(hpkg, "iota", &state, &action);
5866 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5867 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5868 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5872 r = MsiGetComponentState(hpkg, "eta", &state, &action);
5873 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5874 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5875 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5879 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5880 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5881 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5882 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5886 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5887 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5888 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5889 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5893 r = MsiGetComponentState(hpkg, "mu", &state, &action);
5894 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5895 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5896 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5900 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5901 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5902 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5903 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5907 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5908 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5909 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5910 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5914 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5915 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5916 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5917 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5921 r = MsiGetComponentState(hpkg, "pi", &state, &action);
5922 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5923 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5924 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5928 r = MsiGetComponentState(hpkg, "rho", &state, &action);
5929 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5930 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5931 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5935 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5936 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5937 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5938 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5942 r = MsiGetComponentState(hpkg, "tau", &state, &action);
5943 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5944 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5945 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5949 r = MsiGetComponentState(hpkg, "phi", &state, &action);
5950 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5951 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5952 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5956 r = MsiGetComponentState(hpkg, "chi", &state, &action);
5957 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5958 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5959 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5961 r = MsiDoAction( hpkg, "FileCost");
5962 ok( r == ERROR_SUCCESS, "file cost failed\n");
5966 r = MsiGetFeatureState(hpkg, "one", &state, &action);
5967 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5968 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5969 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5973 r = MsiGetFeatureState(hpkg, "two", &state, &action);
5974 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5975 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5976 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5980 r = MsiGetFeatureState(hpkg, "three", &state, &action);
5981 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5982 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5983 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5987 r = MsiGetFeatureState(hpkg, "four", &state, &action);
5988 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5989 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5990 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5994 r = MsiGetFeatureState(hpkg, "five", &state, &action);
5995 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5996 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5997 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6001 r = MsiGetFeatureState(hpkg, "six", &state, &action);
6002 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6003 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6004 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6008 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6009 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6010 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6011 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6015 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6016 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6017 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6018 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6022 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6023 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6024 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6025 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6029 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6030 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6031 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6032 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6036 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6037 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6038 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6039 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6043 r = MsiGetComponentState(hpkg, "beta", &state, &action);
6044 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6045 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6046 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6050 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6051 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6052 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6053 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6057 r = MsiGetComponentState(hpkg, "theta", &state, &action);
6058 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6059 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6060 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6064 r = MsiGetComponentState(hpkg, "delta", &state, &action);
6065 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6066 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6067 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6071 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6072 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6073 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6074 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6078 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6079 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6080 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6081 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6085 r = MsiGetComponentState(hpkg, "iota", &state, &action);
6086 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6087 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6088 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6092 r = MsiGetComponentState(hpkg, "eta", &state, &action);
6093 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6094 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6095 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6099 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6100 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6101 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6102 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6106 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6107 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6108 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6109 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6113 r = MsiGetComponentState(hpkg, "mu", &state, &action);
6114 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6115 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6116 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6120 r = MsiGetComponentState(hpkg, "nu", &state, &action);
6121 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6122 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6123 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6127 r = MsiGetComponentState(hpkg, "xi", &state, &action);
6128 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6129 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6130 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6134 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6135 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6136 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6137 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6141 r = MsiGetComponentState(hpkg, "pi", &state, &action);
6142 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6143 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6144 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6148 r = MsiGetComponentState(hpkg, "rho", &state, &action);
6149 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6150 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6151 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6155 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6156 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6157 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6158 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6162 r = MsiGetComponentState(hpkg, "tau", &state, &action);
6163 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6164 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6165 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6169 r = MsiGetComponentState(hpkg, "phi", &state, &action);
6170 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6171 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6172 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6176 r = MsiGetComponentState(hpkg, "chi", &state, &action);
6177 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6178 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6179 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6181 r = MsiDoAction( hpkg, "CostFinalize");
6182 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
6186 r = MsiGetFeatureState(hpkg, "one", &state, &action);
6187 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6188 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6189 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6193 r = MsiGetFeatureState(hpkg, "two", &state, &action);
6194 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6195 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6196 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6200 r = MsiGetFeatureState(hpkg, "three", &state, &action);
6201 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6202 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6203 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6207 r = MsiGetFeatureState(hpkg, "four", &state, &action);
6208 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6209 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6210 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6214 r = MsiGetFeatureState(hpkg, "five", &state, &action);
6215 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6216 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
6217 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6221 r = MsiGetFeatureState(hpkg, "six", &state, &action);
6222 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6223 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6224 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6228 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6229 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6230 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6231 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6235 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6236 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6237 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6238 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6242 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6243 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6244 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6245 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6249 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6250 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6251 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6252 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6256 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6257 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6258 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6259 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6263 r = MsiGetComponentState(hpkg, "beta", &state, &action);
6264 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6265 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6266 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6270 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6271 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6272 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6273 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6277 r = MsiGetComponentState(hpkg, "theta", &state, &action);
6278 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6279 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6280 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6284 r = MsiGetComponentState(hpkg, "delta", &state, &action);
6285 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6286 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6287 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6291 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6292 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6293 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6294 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6298 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6299 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6300 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6301 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6305 r = MsiGetComponentState(hpkg, "iota", &state, &action);
6306 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6307 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6308 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6312 r = MsiGetComponentState(hpkg, "eta", &state, &action);
6313 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6314 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6315 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
6319 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6320 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6321 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
6322 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6326 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6327 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6328 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6329 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6333 r = MsiGetComponentState(hpkg, "mu", &state, &action);
6334 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6335 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6336 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6340 r = MsiGetComponentState(hpkg, "nu", &state, &action);
6341 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6342 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6343 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6347 r = MsiGetComponentState(hpkg, "xi", &state, &action);
6348 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6349 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6350 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6354 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6355 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6356 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6357 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6361 r = MsiGetComponentState(hpkg, "pi", &state, &action);
6362 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6363 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6364 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6368 r = MsiGetComponentState(hpkg, "rho", &state, &action);
6369 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6370 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6371 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6375 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6376 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6377 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6378 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
6382 r = MsiGetComponentState(hpkg, "tau", &state, &action);
6383 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6384 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6385 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6389 r = MsiGetComponentState(hpkg, "phi", &state, &action);
6390 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6391 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6392 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6396 r = MsiGetComponentState(hpkg, "chi", &state, &action);
6397 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6398 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6399 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
6401 MsiCloseHandle(hpkg);
6403 /* reinstall the product */
6404 r = MsiInstallProduct(msifile3, "REINSTALL=ALL");
6405 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6407 r = MsiOpenDatabase(msifile4, MSIDBOPEN_DIRECT, &hdb);
6408 ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
6410 /* this property must not be in the saved msi file */
6411 r = add_property_entry( hdb, "'ADDSOURCE', 'one,two,three,four,five,six,seven,eight,nine,ten'");
6412 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
6414 r = package_from_db( hdb, &hpkg );
6415 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
6419 r = MsiGetFeatureState(hpkg, "one", &state, &action);
6420 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6421 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6422 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6426 r = MsiGetFeatureState(hpkg, "two", &state, &action);
6427 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6428 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6429 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6433 r = MsiGetFeatureState(hpkg, "three", &state, &action);
6434 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6435 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6436 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6440 r = MsiGetFeatureState(hpkg, "four", &state, &action);
6441 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6442 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6443 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6447 r = MsiGetFeatureState(hpkg, "five", &state, &action);
6448 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6449 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6450 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6454 r = MsiGetFeatureState(hpkg, "six", &state, &action);
6455 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6456 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6457 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6461 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6462 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6463 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6464 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6468 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6469 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6470 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6471 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6475 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6476 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6477 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6478 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6482 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6483 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
6484 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6485 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6489 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6490 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6491 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6492 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6496 r = MsiGetComponentState(hpkg, "beta", &state, &action);
6497 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6498 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6499 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6503 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6504 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6505 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6506 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6510 r = MsiGetComponentState(hpkg, "theta", &state, &action);
6511 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6512 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6513 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6517 r = MsiGetComponentState(hpkg, "delta", &state, &action);
6518 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6519 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6520 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6524 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6525 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6526 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6527 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6531 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6532 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6533 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6534 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6538 r = MsiGetComponentState(hpkg, "iota", &state, &action);
6539 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6540 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6541 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6545 r = MsiGetComponentState(hpkg, "eta", &state, &action);
6546 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6547 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6548 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6552 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6553 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6554 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6555 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6559 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6560 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6561 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6562 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6566 r = MsiGetComponentState(hpkg, "mu", &state, &action);
6567 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6568 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6569 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6573 r = MsiGetComponentState(hpkg, "nu", &state, &action);
6574 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6575 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6576 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6580 r = MsiGetComponentState(hpkg, "xi", &state, &action);
6581 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6582 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6583 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6587 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6588 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6589 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6590 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6594 r = MsiGetComponentState(hpkg, "pi", &state, &action);
6595 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6596 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6597 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6601 r = MsiGetComponentState(hpkg, "rho", &state, &action);
6602 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6603 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6604 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6608 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6609 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6610 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6611 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6615 r = MsiGetComponentState(hpkg, "tau", &state, &action);
6616 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6617 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6618 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6622 r = MsiGetComponentState(hpkg, "phi", &state, &action);
6623 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6624 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6625 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6629 r = MsiGetComponentState(hpkg, "chi", &state, &action);
6630 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
6631 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
6632 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
6634 r = MsiDoAction( hpkg, "CostInitialize");
6635 ok( r == ERROR_SUCCESS, "cost init failed\n");
6639 r = MsiGetFeatureState(hpkg, "one", &state, &action);
6640 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6641 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6642 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6646 r = MsiGetFeatureState(hpkg, "two", &state, &action);
6647 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6648 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6649 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6653 r = MsiGetFeatureState(hpkg, "three", &state, &action);
6654 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6655 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6656 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6660 r = MsiGetFeatureState(hpkg, "four", &state, &action);
6661 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6662 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6663 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6667 r = MsiGetFeatureState(hpkg, "five", &state, &action);
6668 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6669 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6670 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6674 r = MsiGetFeatureState(hpkg, "six", &state, &action);
6675 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6676 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6677 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6681 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6682 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6683 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6684 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6688 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6689 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6690 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6691 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6695 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6696 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6697 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6698 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6702 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6703 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6704 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6705 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6709 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6710 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6711 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6712 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6716 r = MsiGetComponentState(hpkg, "beta", &state, &action);
6717 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6718 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6719 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6723 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6724 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6725 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6726 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6730 r = MsiGetComponentState(hpkg, "theta", &state, &action);
6731 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6732 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6733 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6737 r = MsiGetComponentState(hpkg, "delta", &state, &action);
6738 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6739 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6740 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6744 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6745 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6746 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6747 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6751 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6752 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6753 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6754 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6758 r = MsiGetComponentState(hpkg, "iota", &state, &action);
6759 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6760 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6761 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6765 r = MsiGetComponentState(hpkg, "eta", &state, &action);
6766 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6767 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6768 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6772 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6773 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6774 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6775 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6779 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
6780 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6781 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6782 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6786 r = MsiGetComponentState(hpkg, "mu", &state, &action);
6787 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6788 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6789 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6793 r = MsiGetComponentState(hpkg, "nu", &state, &action);
6794 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6795 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6796 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6800 r = MsiGetComponentState(hpkg, "xi", &state, &action);
6801 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6802 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6803 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6807 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
6808 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6809 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6810 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6814 r = MsiGetComponentState(hpkg, "pi", &state, &action);
6815 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6816 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6817 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6821 r = MsiGetComponentState(hpkg, "rho", &state, &action);
6822 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6823 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6824 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6828 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
6829 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6830 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6831 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6835 r = MsiGetComponentState(hpkg, "tau", &state, &action);
6836 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6837 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6838 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6842 r = MsiGetComponentState(hpkg, "phi", &state, &action);
6843 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6844 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6845 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6849 r = MsiGetComponentState(hpkg, "chi", &state, &action);
6850 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6851 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6852 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6854 r = MsiDoAction( hpkg, "FileCost");
6855 ok( r == ERROR_SUCCESS, "file cost failed\n");
6859 r = MsiGetFeatureState(hpkg, "one", &state, &action);
6860 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6861 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6862 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6866 r = MsiGetFeatureState(hpkg, "two", &state, &action);
6867 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6868 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6869 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6873 r = MsiGetFeatureState(hpkg, "three", &state, &action);
6874 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6875 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6876 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6880 r = MsiGetFeatureState(hpkg, "four", &state, &action);
6881 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6882 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6883 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6887 r = MsiGetFeatureState(hpkg, "five", &state, &action);
6888 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6889 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6890 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6894 r = MsiGetFeatureState(hpkg, "six", &state, &action);
6895 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6896 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6897 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6901 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
6902 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6903 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6904 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6908 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
6909 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6910 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6911 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6915 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
6916 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6917 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6918 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6922 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
6923 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6924 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6925 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6929 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
6930 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6931 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6932 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6936 r = MsiGetComponentState(hpkg, "beta", &state, &action);
6937 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6938 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6939 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6943 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
6944 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6945 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6946 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6950 r = MsiGetComponentState(hpkg, "theta", &state, &action);
6951 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6952 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6953 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6957 r = MsiGetComponentState(hpkg, "delta", &state, &action);
6958 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6959 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6960 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6964 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
6965 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6966 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6967 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6971 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
6972 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6973 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6974 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6978 r = MsiGetComponentState(hpkg, "iota", &state, &action);
6979 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6980 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6981 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6985 r = MsiGetComponentState(hpkg, "eta", &state, &action);
6986 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6987 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6988 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6992 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
6993 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
6994 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
6995 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
6999 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
7000 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7001 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7002 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7006 r = MsiGetComponentState(hpkg, "mu", &state, &action);
7007 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7008 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7009 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7013 r = MsiGetComponentState(hpkg, "nu", &state, &action);
7014 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7015 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7016 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7020 r = MsiGetComponentState(hpkg, "xi", &state, &action);
7021 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7022 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7023 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7027 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
7028 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7029 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7030 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7034 r = MsiGetComponentState(hpkg, "pi", &state, &action);
7035 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7036 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7037 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7041 r = MsiGetComponentState(hpkg, "rho", &state, &action);
7042 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7043 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7044 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7048 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
7049 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7050 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7051 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7055 r = MsiGetComponentState(hpkg, "tau", &state, &action);
7056 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7057 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7058 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7062 r = MsiGetComponentState(hpkg, "phi", &state, &action);
7063 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7064 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7065 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7069 r = MsiGetComponentState(hpkg, "chi", &state, &action);
7070 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7071 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7072 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7074 r = MsiDoAction( hpkg, "CostFinalize");
7075 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
7079 r = MsiGetFeatureState(hpkg, "one", &state, &action);
7080 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7081 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7082 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7086 r = MsiGetFeatureState(hpkg, "two", &state, &action);
7087 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7088 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7089 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7093 r = MsiGetFeatureState(hpkg, "three", &state, &action);
7094 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7095 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7096 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7100 r = MsiGetFeatureState(hpkg, "four", &state, &action);
7101 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7102 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7103 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7107 r = MsiGetFeatureState(hpkg, "five", &state, &action);
7108 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7109 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
7110 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7114 r = MsiGetFeatureState(hpkg, "six", &state, &action);
7115 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7116 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7117 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7121 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
7122 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7123 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7124 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7128 r = MsiGetFeatureState(hpkg, "eight", &state, &action);
7129 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7130 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7131 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7135 r = MsiGetFeatureState(hpkg, "nine", &state, &action);
7136 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7137 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7138 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7142 r = MsiGetFeatureState(hpkg, "ten", &state, &action);
7143 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7144 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7145 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7149 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
7150 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7151 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7152 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7156 r = MsiGetComponentState(hpkg, "beta", &state, &action);
7157 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7158 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7159 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7163 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
7164 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7165 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7166 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7170 r = MsiGetComponentState(hpkg, "theta", &state, &action);
7171 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7172 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7173 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7177 r = MsiGetComponentState(hpkg, "delta", &state, &action);
7178 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7179 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7180 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7184 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
7185 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7186 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7187 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7191 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
7192 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7193 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7194 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7198 r = MsiGetComponentState(hpkg, "iota", &state, &action);
7199 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7200 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7201 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7205 r = MsiGetComponentState(hpkg, "eta", &state, &action);
7206 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7207 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7208 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7212 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
7213 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7214 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
7215 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7219 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
7220 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7221 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7222 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7226 r = MsiGetComponentState(hpkg, "mu", &state, &action);
7227 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7228 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7229 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7233 r = MsiGetComponentState(hpkg, "nu", &state, &action);
7234 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7235 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7236 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7240 r = MsiGetComponentState(hpkg, "xi", &state, &action);
7241 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7242 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7243 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7247 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
7248 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7249 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7250 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7254 r = MsiGetComponentState(hpkg, "pi", &state, &action);
7255 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7256 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7257 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7261 r = MsiGetComponentState(hpkg, "rho", &state, &action);
7262 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7263 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7264 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7268 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
7269 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7270 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7271 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
7275 r = MsiGetComponentState(hpkg, "tau", &state, &action);
7276 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7277 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7278 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7282 r = MsiGetComponentState(hpkg, "phi", &state, &action);
7283 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7284 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7285 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7289 r = MsiGetComponentState(hpkg, "chi", &state, &action);
7290 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7291 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7292 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
7294 MsiCloseHandle(hpkg);
7296 /* uninstall the product */
7297 r = MsiInstallProduct(msifile4, "REMOVE=ALL");
7298 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7300 DeleteFileA(msifile);
7301 DeleteFileA(msifile2);
7302 DeleteFileA(msifile3);
7303 DeleteFileA(msifile4);
7306 static void test_getproperty(void)
7308 MSIHANDLE hPackage = 0;
7310 static CHAR empty[] = "";
7314 r = package_from_db(create_package_db(), &hPackage);
7315 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
7317 skip("Not enough rights to perform tests\n");
7318 DeleteFile(msifile);
7321 ok( r == ERROR_SUCCESS, "Failed to create package %u\n", r );
7323 /* set the property */
7324 r = MsiSetProperty(hPackage, "Name", "Value");
7325 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7327 /* retrieve the size, NULL pointer */
7329 r = MsiGetProperty(hPackage, "Name", NULL, &size);
7330 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7331 ok( size == 5, "Expected 5, got %d\n", size);
7333 /* retrieve the size, empty string */
7335 r = MsiGetProperty(hPackage, "Name", empty, &size);
7336 ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
7337 ok( size == 5, "Expected 5, got %d\n", size);
7339 /* don't change size */
7340 r = MsiGetProperty(hPackage, "Name", prop, &size);
7341 ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
7342 ok( size == 5, "Expected 5, got %d\n", size);
7343 ok( !lstrcmp(prop, "Valu"), "Expected Valu, got %s\n", prop);
7345 /* increase the size by 1 */
7347 r = MsiGetProperty(hPackage, "Name", prop, &size);
7348 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7349 ok( size == 5, "Expected 5, got %d\n", size);
7350 ok( !lstrcmp(prop, "Value"), "Expected Value, got %s\n", prop);
7352 r = MsiCloseHandle( hPackage);
7353 ok( r == ERROR_SUCCESS , "Failed to close package\n" );
7354 DeleteFile(msifile);
7357 static void test_removefiles(void)
7363 hdb = create_package_db();
7364 ok ( hdb, "failed to create package database\n" );
7366 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
7367 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
7369 r = create_feature_table( hdb );
7370 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
7372 r = create_component_table( hdb );
7373 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
7375 r = add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
7376 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
7378 r = add_component_entry( hdb, "'hydrogen', '', 'TARGETDIR', 0, '', 'hydrogen_file'" );
7379 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7381 r = add_component_entry( hdb, "'helium', '', 'TARGETDIR', 0, '', 'helium_file'" );
7382 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7384 r = add_component_entry( hdb, "'lithium', '', 'TARGETDIR', 0, '', 'lithium_file'" );
7385 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7387 r = add_component_entry( hdb, "'beryllium', '', 'TARGETDIR', 0, '', 'beryllium_file'" );
7388 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7390 r = add_component_entry( hdb, "'boron', '', 'TARGETDIR', 0, '', 'boron_file'" );
7391 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7393 r = add_component_entry( hdb, "'carbon', '', 'TARGETDIR', 0, '', 'carbon_file'" );
7394 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7396 r = create_feature_components_table( hdb );
7397 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
7399 r = add_feature_components_entry( hdb, "'one', 'hydrogen'" );
7400 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7402 r = add_feature_components_entry( hdb, "'one', 'helium'" );
7403 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7405 r = add_feature_components_entry( hdb, "'one', 'lithium'" );
7406 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7408 r = add_feature_components_entry( hdb, "'one', 'beryllium'" );
7409 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7411 r = add_feature_components_entry( hdb, "'one', 'boron'" );
7412 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7414 r = add_feature_components_entry( hdb, "'one', 'carbon'" );
7415 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7417 r = create_file_table( hdb );
7418 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
7420 r = add_file_entry( hdb, "'hydrogen_file', 'hydrogen', 'hydrogen.txt', 0, '', '1033', 8192, 1" );
7421 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7423 r = add_file_entry( hdb, "'helium_file', 'helium', 'helium.txt', 0, '', '1033', 8192, 1" );
7424 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7426 r = add_file_entry( hdb, "'lithium_file', 'lithium', 'lithium.txt', 0, '', '1033', 8192, 1" );
7427 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7429 r = add_file_entry( hdb, "'beryllium_file', 'beryllium', 'beryllium.txt', 0, '', '1033', 16384, 1" );
7430 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7432 r = add_file_entry( hdb, "'boron_file', 'boron', 'boron.txt', 0, '', '1033', 16384, 1" );
7433 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7435 r = add_file_entry( hdb, "'carbon_file', 'carbon', 'carbon.txt', 0, '', '1033', 16384, 1" );
7436 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7438 r = create_remove_file_table( hdb );
7439 ok( r == ERROR_SUCCESS, "cannot create Remove File table: %d\n", r);
7441 r = package_from_db( hdb, &hpkg );
7442 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
7444 skip("Not enough rights to perform tests\n");
7445 DeleteFile(msifile);
7448 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
7450 MsiCloseHandle( hdb );
7452 create_test_file( "hydrogen.txt" );
7453 create_test_file( "helium.txt" );
7454 create_test_file( "lithium.txt" );
7455 create_test_file( "beryllium.txt" );
7456 create_test_file( "boron.txt" );
7457 create_test_file( "carbon.txt" );
7459 r = MsiSetProperty( hpkg, "TARGETDIR", CURR_DIR );
7460 ok( r == ERROR_SUCCESS, "set property failed\n");
7462 r = MsiDoAction( hpkg, "CostInitialize");
7463 ok( r == ERROR_SUCCESS, "cost init failed\n");
7465 r = MsiDoAction( hpkg, "FileCost");
7466 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
7468 r = MsiDoAction( hpkg, "CostFinalize");
7469 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
7471 r = MsiDoAction( hpkg, "InstallValidate");
7472 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
7474 r = MsiSetComponentState( hpkg, "hydrogen", INSTALLSTATE_ABSENT );
7475 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7477 r = MsiSetComponentState( hpkg, "helium", INSTALLSTATE_LOCAL );
7478 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7480 r = MsiSetComponentState( hpkg, "lithium", INSTALLSTATE_SOURCE );
7481 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7483 r = MsiSetComponentState( hpkg, "beryllium", INSTALLSTATE_ABSENT );
7484 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7486 r = MsiSetComponentState( hpkg, "boron", INSTALLSTATE_LOCAL );
7487 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7489 r = MsiSetComponentState( hpkg, "carbon", INSTALLSTATE_SOURCE );
7490 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
7492 r = MsiDoAction( hpkg, "RemoveFiles");
7493 ok( r == ERROR_SUCCESS, "remove files failed\n");
7495 ok(DeleteFileA("hydrogen.txt"), "Expected hydrogen.txt to exist\n");
7496 ok(DeleteFileA("lithium.txt"), "Expected lithium.txt to exist\n");
7497 ok(DeleteFileA("beryllium.txt"), "Expected beryllium.txt to exist\n");
7498 ok(DeleteFileA("carbon.txt"), "Expected carbon.txt to exist\n");
7499 ok(DeleteFileA("helium.txt"), "Expected helium.txt to exist\n");
7500 ok(DeleteFileA("boron.txt"), "Expected boron.txt to exist\n");
7502 MsiCloseHandle( hpkg );
7503 DeleteFileA(msifile);
7506 static void test_appsearch(void)
7511 CHAR prop[MAX_PATH];
7514 hdb = create_package_db();
7515 ok ( hdb, "failed to create package database\n" );
7517 r = create_appsearch_table( hdb );
7518 ok( r == ERROR_SUCCESS, "cannot create AppSearch table: %d\n", r );
7520 r = add_appsearch_entry( hdb, "'WEBBROWSERPROG', 'NewSignature1'" );
7521 ok( r == ERROR_SUCCESS, "cannot add entry: %d\n", r );
7523 r = add_appsearch_entry( hdb, "'NOTEPAD', 'NewSignature2'" );
7524 ok( r == ERROR_SUCCESS, "cannot add entry: %d\n", r );
7526 r = create_reglocator_table( hdb );
7527 ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
7529 r = add_reglocator_entry( hdb, "'NewSignature1', 0, 'htmlfile\\shell\\open\\command', '', 1" );
7530 ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
7532 r = create_drlocator_table( hdb );
7533 ok( r == ERROR_SUCCESS, "cannot create DrLocator table: %d\n", r );
7535 r = add_drlocator_entry( hdb, "'NewSignature2', 0, 'c:\\windows\\system32', 0" );
7536 ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
7538 r = create_signature_table( hdb );
7539 ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r );
7541 r = add_signature_entry( hdb, "'NewSignature1', 'FileName', '', '', '', '', '', '', ''" );
7542 ok( r == ERROR_SUCCESS, "cannot add signature: %d\n", r );
7544 r = add_signature_entry( hdb, "'NewSignature2', 'NOTEPAD.EXE|notepad.exe', '', '', '', '', '', '', ''" );
7545 ok( r == ERROR_SUCCESS, "cannot add signature: %d\n", r );
7547 r = package_from_db( hdb, &hpkg );
7548 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
7550 skip("Not enough rights to perform tests\n");
7551 DeleteFile(msifile);
7554 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
7555 MsiCloseHandle( hdb );
7556 if (r != ERROR_SUCCESS)
7559 r = MsiDoAction( hpkg, "AppSearch" );
7560 ok( r == ERROR_SUCCESS, "AppSearch failed: %d\n", r);
7562 size = sizeof(prop);
7563 r = MsiGetPropertyA( hpkg, "WEBBROWSERPROG", prop, &size );
7564 ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
7567 ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
7570 size = sizeof(prop);
7571 r = MsiGetPropertyA( hpkg, "NOTEPAD", prop, &size );
7572 ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
7575 MsiCloseHandle( hpkg );
7576 DeleteFileA(msifile);
7579 static void test_appsearch_complocator(void)
7581 MSIHANDLE hpkg, hdb;
7582 CHAR path[MAX_PATH];
7583 CHAR prop[MAX_PATH];
7588 if (!get_user_sid(&usersid))
7591 if (is_process_limited())
7593 skip("process is limited\n");
7597 create_test_file("FileName1");
7598 create_test_file("FileName4");
7599 set_component_path("FileName1", MSIINSTALLCONTEXT_MACHINE,
7600 "{A8AE6692-96BA-4198-8399-145D7D1D0D0E}", NULL, FALSE);
7602 create_test_file("FileName2");
7603 set_component_path("FileName2", MSIINSTALLCONTEXT_USERUNMANAGED,
7604 "{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}", usersid, FALSE);
7606 create_test_file("FileName3");
7607 set_component_path("FileName3", MSIINSTALLCONTEXT_USERMANAGED,
7608 "{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}", usersid, FALSE);
7610 create_test_file("FileName5");
7611 set_component_path("FileName5", MSIINSTALLCONTEXT_MACHINE,
7612 "{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}", NULL, TRUE);
7614 create_test_file("FileName6");
7615 set_component_path("FileName6", MSIINSTALLCONTEXT_MACHINE,
7616 "{C0ECD96F-7898-4410-9667-194BD8C1B648}", NULL, TRUE);
7618 create_test_file("FileName7");
7619 set_component_path("FileName7", MSIINSTALLCONTEXT_MACHINE,
7620 "{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}", NULL, FALSE);
7622 /* dir is FALSE, but we're pretending it's a directory */
7623 set_component_path("IDontExist\\", MSIINSTALLCONTEXT_MACHINE,
7624 "{91B7359B-07F2-4221-AA8D-DE102BB87A5F}", NULL, FALSE);
7626 create_file_with_version("FileName8.dll", MAKELONG(2, 1), MAKELONG(4, 3));
7627 set_component_path("FileName8.dll", MSIINSTALLCONTEXT_MACHINE,
7628 "{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}", NULL, FALSE);
7630 create_file_with_version("FileName9.dll", MAKELONG(1, 2), MAKELONG(3, 4));
7631 set_component_path("FileName9.dll", MSIINSTALLCONTEXT_MACHINE,
7632 "{A204DF48-7346-4635-BA2E-66247DBAC9DF}", NULL, FALSE);
7634 create_file_with_version("FileName10.dll", MAKELONG(2, 1), MAKELONG(4, 3));
7635 set_component_path("FileName10.dll", MSIINSTALLCONTEXT_MACHINE,
7636 "{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}", NULL, FALSE);
7638 hdb = create_package_db();
7639 ok(hdb, "Expected a valid database handle\n");
7641 r = create_appsearch_table(hdb);
7642 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7644 r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
7645 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7647 r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
7648 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7650 r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
7651 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7653 r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
7654 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7656 r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
7657 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7659 r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
7660 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7662 r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
7663 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7665 r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
7666 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7668 r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
7669 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7671 r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
7672 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7674 r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
7675 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7677 r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
7678 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7680 r = create_complocator_table(hdb);
7681 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7683 /* published component, machine, file, signature, misdbLocatorTypeFile */
7684 r = add_complocator_entry(hdb, "'NewSignature1', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 1");
7685 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7687 /* published component, user-unmanaged, file, signature, misdbLocatorTypeFile */
7688 r = add_complocator_entry(hdb, "'NewSignature2', '{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}', 1");
7689 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7691 /* published component, user-managed, file, signature, misdbLocatorTypeFile */
7692 r = add_complocator_entry(hdb, "'NewSignature3', '{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}', 1");
7693 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7695 /* published component, machine, file, signature, misdbLocatorTypeDirectory */
7696 r = add_complocator_entry(hdb, "'NewSignature4', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 0");
7697 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7699 /* published component, machine, dir, signature, misdbLocatorTypeDirectory */
7700 r = add_complocator_entry(hdb, "'NewSignature5', '{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}', 0");
7701 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7703 /* published component, machine, dir, no signature, misdbLocatorTypeDirectory */
7704 r = add_complocator_entry(hdb, "'NewSignature6', '{C0ECD96F-7898-4410-9667-194BD8C1B648}', 0");
7705 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7707 /* published component, machine, file, no signature, misdbLocatorTypeFile */
7708 r = add_complocator_entry(hdb, "'NewSignature7', '{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}', 1");
7709 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7711 /* unpublished component, no signature, misdbLocatorTypeDir */
7712 r = add_complocator_entry(hdb, "'NewSignature8', '{FB671D5B-5083-4048-90E0-481C48D8F3A5}', 0");
7713 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7715 /* published component, no signature, dir does not exist misdbLocatorTypeDir */
7716 r = add_complocator_entry(hdb, "'NewSignature9', '{91B7359B-07F2-4221-AA8D-DE102BB87A5F}', 0");
7717 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7719 /* published component, signature w/ ver, misdbLocatorTypeFile */
7720 r = add_complocator_entry(hdb, "'NewSignature10', '{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}', 1");
7721 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7723 /* published component, signature w/ ver, ver > max, misdbLocatorTypeFile */
7724 r = add_complocator_entry(hdb, "'NewSignature11', '{A204DF48-7346-4635-BA2E-66247DBAC9DF}', 1");
7725 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7727 /* published component, signature w/ ver, sig->name ignored, misdbLocatorTypeFile */
7728 r = add_complocator_entry(hdb, "'NewSignature12', '{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}', 1");
7729 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7731 r = create_signature_table(hdb);
7732 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7734 r = add_signature_entry(hdb, "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''");
7735 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7737 r = add_signature_entry(hdb, "'NewSignature2', 'FileName2', '', '', '', '', '', '', ''");
7738 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7740 r = add_signature_entry(hdb, "'NewSignature3', 'FileName3', '', '', '', '', '', '', ''");
7741 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7743 r = add_signature_entry(hdb, "'NewSignature4', 'FileName4', '', '', '', '', '', '', ''");
7744 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7746 r = add_signature_entry(hdb, "'NewSignature5', 'FileName5', '', '', '', '', '', '', ''");
7747 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7749 r = add_signature_entry(hdb, "'NewSignature10', 'FileName8.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
7750 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7752 r = add_signature_entry(hdb, "'NewSignature11', 'FileName9.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
7753 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7755 r = add_signature_entry(hdb, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
7756 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7758 r = package_from_db(hdb, &hpkg);
7759 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
7761 skip("Not enough rights to perform tests\n");
7764 ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
7766 r = MsiSetPropertyA(hpkg, "SIGPROP8", "october");
7767 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7769 r = MsiDoAction(hpkg, "AppSearch");
7770 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7773 sprintf(path, "%s\\FileName1", CURR_DIR);
7774 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
7775 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7776 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7779 sprintf(path, "%s\\FileName2", CURR_DIR);
7780 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
7781 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7782 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7785 sprintf(path, "%s\\FileName3", CURR_DIR);
7786 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
7787 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7788 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7791 sprintf(path, "%s\\FileName4", CURR_DIR);
7792 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
7793 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7794 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
7797 sprintf(path, "%s\\FileName5", CURR_DIR);
7798 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
7799 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7800 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7803 sprintf(path, "%s\\", CURR_DIR);
7804 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
7805 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7806 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7809 sprintf(path, "%s\\", CURR_DIR);
7810 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
7811 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7812 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7815 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
7816 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7817 ok(!lstrcmpA(prop, "october"), "Expected \"october\", got \"%s\"\n", prop);
7820 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
7821 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7822 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
7825 sprintf(path, "%s\\FileName8.dll", CURR_DIR);
7826 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
7827 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7828 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7831 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
7832 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7833 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
7836 sprintf(path, "%s\\FileName10.dll", CURR_DIR);
7837 r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
7838 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7839 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7841 delete_component_path("{A8AE6692-96BA-4198-8399-145D7D1D0D0E}",
7842 MSIINSTALLCONTEXT_MACHINE, NULL);
7843 delete_component_path("{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}",
7844 MSIINSTALLCONTEXT_USERUNMANAGED, usersid);
7845 delete_component_path("{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}",
7846 MSIINSTALLCONTEXT_USERMANAGED, usersid);
7847 delete_component_path("{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}",
7848 MSIINSTALLCONTEXT_MACHINE, NULL);
7849 delete_component_path("{C0ECD96F-7898-4410-9667-194BD8C1B648}",
7850 MSIINSTALLCONTEXT_MACHINE, NULL);
7851 delete_component_path("{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}",
7852 MSIINSTALLCONTEXT_MACHINE, NULL);
7853 delete_component_path("{91B7359B-07F2-4221-AA8D-DE102BB87A5F}",
7854 MSIINSTALLCONTEXT_MACHINE, NULL);
7855 delete_component_path("{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}",
7856 MSIINSTALLCONTEXT_MACHINE, NULL);
7857 delete_component_path("{A204DF48-7346-4635-BA2E-66247DBAC9DF}",
7858 MSIINSTALLCONTEXT_MACHINE, NULL);
7859 delete_component_path("{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}",
7860 MSIINSTALLCONTEXT_MACHINE, NULL);
7862 MsiCloseHandle(hpkg);
7865 DeleteFileA("FileName1");
7866 DeleteFileA("FileName2");
7867 DeleteFileA("FileName3");
7868 DeleteFileA("FileName4");
7869 DeleteFileA("FileName5");
7870 DeleteFileA("FileName6");
7871 DeleteFileA("FileName7");
7872 DeleteFileA("FileName8.dll");
7873 DeleteFileA("FileName9.dll");
7874 DeleteFileA("FileName10.dll");
7875 DeleteFileA(msifile);
7879 static void test_appsearch_reglocator(void)
7881 MSIHANDLE hpkg, hdb;
7882 CHAR path[MAX_PATH], prop[MAX_PATH];
7883 DWORD binary[2], size, val;
7884 BOOL space, version;
7885 HKEY hklm, classes, hkcu, users;
7886 LPSTR pathdata, pathvar, ptr;
7892 if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
7895 DeleteFileA("test.dll");
7897 res = RegCreateKeyA(HKEY_CLASSES_ROOT, "Software\\Wine", &classes);
7898 if (res == ERROR_ACCESS_DENIED)
7900 skip("Not enough rights to perform tests\n");
7903 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7905 res = RegSetValueExA(classes, "Value1", 0, REG_SZ,
7906 (const BYTE *)"regszdata", 10);
7907 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7909 res = RegCreateKeyA(HKEY_CURRENT_USER, "Software\\Wine", &hkcu);
7910 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7912 res = RegSetValueExA(hkcu, "Value1", 0, REG_SZ,
7913 (const BYTE *)"regszdata", 10);
7914 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7917 res = RegCreateKeyA(HKEY_USERS, "S-1-5-18\\Software\\Wine", &users);
7918 ok(res == ERROR_SUCCESS ||
7919 broken(res == ERROR_INVALID_PARAMETER),
7920 "Expected ERROR_SUCCESS, got %d\n", res);
7922 if (res == ERROR_SUCCESS)
7924 res = RegSetValueExA(users, "Value1", 0, REG_SZ,
7925 (const BYTE *)"regszdata", 10);
7926 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7929 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine", &hklm);
7930 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7932 res = RegSetValueA(hklm, NULL, REG_SZ, "defvalue", 8);
7933 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7935 res = RegSetValueExA(hklm, "Value1", 0, REG_SZ,
7936 (const BYTE *)"regszdata", 10);
7937 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7940 res = RegSetValueExA(hklm, "Value2", 0, REG_DWORD,
7941 (const BYTE *)&val, sizeof(DWORD));
7942 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7945 res = RegSetValueExA(hklm, "Value3", 0, REG_DWORD,
7946 (const BYTE *)&val, sizeof(DWORD));
7947 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7949 res = RegSetValueExA(hklm, "Value4", 0, REG_EXPAND_SZ,
7950 (const BYTE *)"%PATH%", 7);
7951 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7953 res = RegSetValueExA(hklm, "Value5", 0, REG_EXPAND_SZ,
7954 (const BYTE *)"my%NOVAR%", 10);
7955 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7957 res = RegSetValueExA(hklm, "Value6", 0, REG_MULTI_SZ,
7958 (const BYTE *)"one\0two\0", 9);
7959 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7961 binary[0] = 0x1234abcd;
7962 binary[1] = 0x567890ef;
7963 res = RegSetValueExA(hklm, "Value7", 0, REG_BINARY,
7964 (const BYTE *)binary, sizeof(binary));
7965 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7967 res = RegSetValueExA(hklm, "Value8", 0, REG_SZ,
7968 (const BYTE *)"#regszdata", 11);
7969 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7971 create_test_file("FileName1");
7972 sprintf(path, "%s\\FileName1", CURR_DIR);
7973 res = RegSetValueExA(hklm, "Value9", 0, REG_SZ,
7974 (const BYTE *)path, lstrlenA(path) + 1);
7975 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7977 sprintf(path, "%s\\FileName2", CURR_DIR);
7978 res = RegSetValueExA(hklm, "Value10", 0, REG_SZ,
7979 (const BYTE *)path, lstrlenA(path) + 1);
7980 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7982 lstrcpyA(path, CURR_DIR);
7983 res = RegSetValueExA(hklm, "Value11", 0, REG_SZ,
7984 (const BYTE *)path, lstrlenA(path) + 1);
7985 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7987 res = RegSetValueExA(hklm, "Value12", 0, REG_SZ,
7988 (const BYTE *)"", 1);
7989 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7991 create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
7992 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
7993 res = RegSetValueExA(hklm, "Value13", 0, REG_SZ,
7994 (const BYTE *)path, lstrlenA(path) + 1);
7995 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7997 create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
7998 sprintf(path, "%s\\FileName4.dll", CURR_DIR);
7999 res = RegSetValueExA(hklm, "Value14", 0, REG_SZ,
8000 (const BYTE *)path, lstrlenA(path) + 1);
8001 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8003 create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8004 sprintf(path, "%s\\FileName5.dll", CURR_DIR);
8005 res = RegSetValueExA(hklm, "Value15", 0, REG_SZ,
8006 (const BYTE *)path, lstrlenA(path) + 1);
8007 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
8009 sprintf(path, "\"%s\\FileName1\" -option", CURR_DIR);
8010 res = RegSetValueExA(hklm, "value16", 0, REG_SZ,
8011 (const BYTE *)path, lstrlenA(path) + 1);
8013 space = (strchr(CURR_DIR, ' ')) ? TRUE : FALSE;
8014 sprintf(path, "%s\\FileName1 -option", CURR_DIR);
8015 res = RegSetValueExA(hklm, "value17", 0, REG_SZ,
8016 (const BYTE *)path, lstrlenA(path) + 1);
8018 hdb = create_package_db();
8019 ok(hdb, "Expected a valid database handle\n");
8021 r = create_appsearch_table(hdb);
8022 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8024 r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
8025 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8027 r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
8028 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8030 r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
8031 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8033 r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
8034 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8036 r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
8037 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8039 r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
8040 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8042 r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
8043 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8045 r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
8046 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8048 r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
8049 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8051 r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
8052 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8054 r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
8055 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8057 r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
8058 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8060 r = add_appsearch_entry(hdb, "'SIGPROP13', 'NewSignature13'");
8061 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8063 r = add_appsearch_entry(hdb, "'SIGPROP14', 'NewSignature14'");
8064 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8066 r = add_appsearch_entry(hdb, "'SIGPROP15', 'NewSignature15'");
8067 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8069 r = add_appsearch_entry(hdb, "'SIGPROP16', 'NewSignature16'");
8070 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8072 r = add_appsearch_entry(hdb, "'SIGPROP17', 'NewSignature17'");
8073 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8075 r = add_appsearch_entry(hdb, "'SIGPROP18', 'NewSignature18'");
8076 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8078 r = add_appsearch_entry(hdb, "'SIGPROP19', 'NewSignature19'");
8079 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8081 r = add_appsearch_entry(hdb, "'SIGPROP20', 'NewSignature20'");
8082 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8084 r = add_appsearch_entry(hdb, "'SIGPROP21', 'NewSignature21'");
8085 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8087 r = add_appsearch_entry(hdb, "'SIGPROP22', 'NewSignature22'");
8088 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8090 r = add_appsearch_entry(hdb, "'SIGPROP23', 'NewSignature23'");
8091 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8093 r = add_appsearch_entry(hdb, "'SIGPROP24', 'NewSignature24'");
8094 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8096 r = add_appsearch_entry(hdb, "'SIGPROP25', 'NewSignature25'");
8097 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8099 r = add_appsearch_entry(hdb, "'SIGPROP26', 'NewSignature26'");
8100 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8102 r = add_appsearch_entry(hdb, "'SIGPROP27', 'NewSignature27'");
8103 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8105 r = add_appsearch_entry(hdb, "'SIGPROP28', 'NewSignature28'");
8106 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8108 r = add_appsearch_entry(hdb, "'SIGPROP29', 'NewSignature29'");
8109 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8111 r = add_appsearch_entry(hdb, "'SIGPROP30', 'NewSignature30'");
8112 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8114 r = create_reglocator_table(hdb);
8115 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8117 /* HKLM, msidbLocatorTypeRawValue, REG_SZ */
8118 str = "'NewSignature1', 2, 'Software\\Wine', 'Value1', 2";
8119 r = add_reglocator_entry(hdb, str);
8120 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8122 /* HKLM, msidbLocatorTypeRawValue, positive DWORD */
8123 str = "'NewSignature2', 2, 'Software\\Wine', 'Value2', 2";
8124 r = add_reglocator_entry(hdb, str);
8125 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8127 /* HKLM, msidbLocatorTypeRawValue, negative DWORD */
8128 str = "'NewSignature3', 2, 'Software\\Wine', 'Value3', 2";
8129 r = add_reglocator_entry(hdb, str);
8130 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8132 /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
8133 str = "'NewSignature4', 2, 'Software\\Wine', 'Value4', 2";
8134 r = add_reglocator_entry(hdb, str);
8135 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8137 /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
8138 str = "'NewSignature5', 2, 'Software\\Wine', 'Value5', 2";
8139 r = add_reglocator_entry(hdb, str);
8140 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8142 /* HKLM, msidbLocatorTypeRawValue, REG_MULTI_SZ */
8143 str = "'NewSignature6', 2, 'Software\\Wine', 'Value6', 2";
8144 r = add_reglocator_entry(hdb, str);
8145 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8147 /* HKLM, msidbLocatorTypeRawValue, REG_BINARY */
8148 str = "'NewSignature7', 2, 'Software\\Wine', 'Value7', 2";
8149 r = add_reglocator_entry(hdb, str);
8150 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8152 /* HKLM, msidbLocatorTypeRawValue, REG_SZ first char is # */
8153 str = "'NewSignature8', 2, 'Software\\Wine', 'Value8', 2";
8154 r = add_reglocator_entry(hdb, str);
8155 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8157 /* HKLM, msidbLocatorTypeFileName, signature, file exists */
8158 str = "'NewSignature9', 2, 'Software\\Wine', 'Value9', 1";
8159 r = add_reglocator_entry(hdb, str);
8160 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8162 /* HKLM, msidbLocatorTypeFileName, signature, file does not exist */
8163 str = "'NewSignature10', 2, 'Software\\Wine', 'Value10', 1";
8164 r = add_reglocator_entry(hdb, str);
8165 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8167 /* HKLM, msidbLocatorTypeFileName, no signature */
8168 str = "'NewSignature11', 2, 'Software\\Wine', 'Value9', 1";
8169 r = add_reglocator_entry(hdb, str);
8170 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8172 /* HKLM, msidbLocatorTypeDirectory, no signature, file exists */
8173 str = "'NewSignature12', 2, 'Software\\Wine', 'Value9', 0";
8174 r = add_reglocator_entry(hdb, str);
8175 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8177 /* HKLM, msidbLocatorTypeDirectory, no signature, directory exists */
8178 str = "'NewSignature13', 2, 'Software\\Wine', 'Value11', 0";
8179 r = add_reglocator_entry(hdb, str);
8180 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8182 /* HKLM, msidbLocatorTypeDirectory, signature, file exists */
8183 str = "'NewSignature14', 2, 'Software\\Wine', 'Value9', 0";
8184 r = add_reglocator_entry(hdb, str);
8185 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8187 /* HKCR, msidbLocatorTypeRawValue, REG_SZ */
8188 str = "'NewSignature15', 0, 'Software\\Wine', 'Value1', 2";
8189 r = add_reglocator_entry(hdb, str);
8190 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8192 /* HKCU, msidbLocatorTypeRawValue, REG_SZ */
8193 str = "'NewSignature16', 1, 'Software\\Wine', 'Value1', 2";
8194 r = add_reglocator_entry(hdb, str);
8195 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8197 /* HKU, msidbLocatorTypeRawValue, REG_SZ */
8198 str = "'NewSignature17', 3, 'S-1-5-18\\Software\\Wine', 'Value1', 2";
8199 r = add_reglocator_entry(hdb, str);
8200 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8202 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, NULL Name */
8203 str = "'NewSignature18', 2, 'Software\\Wine', '', 2";
8204 r = add_reglocator_entry(hdb, str);
8205 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8207 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, key does not exist */
8208 str = "'NewSignature19', 2, 'Software\\IDontExist', '', 2";
8209 r = add_reglocator_entry(hdb, str);
8210 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8212 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, value is empty */
8213 str = "'NewSignature20', 2, 'Software\\Wine', 'Value12', 2";
8214 r = add_reglocator_entry(hdb, str);
8215 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8217 /* HKLM, msidbLocatorTypeFileName, signature, file exists w/ version */
8218 str = "'NewSignature21', 2, 'Software\\Wine', 'Value13', 1";
8219 r = add_reglocator_entry(hdb, str);
8220 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8222 /* HKLM, msidbLocatorTypeFileName, file exists w/ version, version > max */
8223 str = "'NewSignature22', 2, 'Software\\Wine', 'Value14', 1";
8224 r = add_reglocator_entry(hdb, str);
8225 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8227 /* HKLM, msidbLocatorTypeFileName, file exists w/ version, sig->name ignored */
8228 str = "'NewSignature23', 2, 'Software\\Wine', 'Value15', 1";
8229 r = add_reglocator_entry(hdb, str);
8230 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8232 /* HKLM, msidbLocatorTypeFileName, no signature, directory exists */
8233 str = "'NewSignature24', 2, 'Software\\Wine', 'Value11', 1";
8234 r = add_reglocator_entry(hdb, str);
8235 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8237 /* HKLM, msidbLocatorTypeFileName, no signature, file does not exist */
8238 str = "'NewSignature25', 2, 'Software\\Wine', 'Value10', 1";
8239 r = add_reglocator_entry(hdb, str);
8240 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8242 /* HKLM, msidbLocatorTypeDirectory, signature, directory exists */
8243 str = "'NewSignature26', 2, 'Software\\Wine', 'Value11', 0";
8244 r = add_reglocator_entry(hdb, str);
8245 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8247 /* HKLM, msidbLocatorTypeDirectory, signature, file does not exist */
8248 str = "'NewSignature27', 2, 'Software\\Wine', 'Value10', 0";
8249 r = add_reglocator_entry(hdb, str);
8250 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8252 /* HKLM, msidbLocatorTypeDirectory, no signature, file does not exist */
8253 str = "'NewSignature28', 2, 'Software\\Wine', 'Value10', 0";
8254 r = add_reglocator_entry(hdb, str);
8255 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8257 /* HKLM, msidbLocatorTypeFile, file exists, in quotes */
8258 str = "'NewSignature29', 2, 'Software\\Wine', 'Value16', 1";
8259 r = add_reglocator_entry(hdb, str);
8260 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8262 /* HKLM, msidbLocatorTypeFile, file exists, no quotes */
8263 str = "'NewSignature30', 2, 'Software\\Wine', 'Value17', 1";
8264 r = add_reglocator_entry(hdb, str);
8265 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8267 r = create_signature_table(hdb);
8268 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8270 str = "'NewSignature9', 'FileName1', '', '', '', '', '', '', ''";
8271 r = add_signature_entry(hdb, str);
8272 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8274 str = "'NewSignature10', 'FileName2', '', '', '', '', '', '', ''";
8275 r = add_signature_entry(hdb, str);
8276 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8278 str = "'NewSignature14', 'FileName1', '', '', '', '', '', '', ''";
8279 r = add_signature_entry(hdb, str);
8280 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8282 str = "'NewSignature21', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
8283 r = add_signature_entry(hdb, str);
8284 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8286 str = "'NewSignature22', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
8287 r = add_signature_entry(hdb, str);
8288 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8290 str = "'NewSignature23', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
8291 r = add_signature_entry(hdb, str);
8292 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8294 ptr = strrchr(CURR_DIR, '\\') + 1;
8295 sprintf(path, "'NewSignature26', '%s', '', '', '', '', '', '', ''", ptr);
8296 r = add_signature_entry(hdb, path);
8297 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8299 str = "'NewSignature27', 'FileName2', '', '', '', '', '', '', ''";
8300 r = add_signature_entry(hdb, str);
8301 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8303 str = "'NewSignature29', 'FileName1', '', '', '', '', '', '', ''";
8304 r = add_signature_entry(hdb, str);
8305 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8307 str = "'NewSignature30', 'FileName1', '', '', '', '', '', '', ''";
8308 r = add_signature_entry(hdb, str);
8309 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8311 r = package_from_db(hdb, &hpkg);
8312 ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
8314 r = MsiDoAction(hpkg, "AppSearch");
8315 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8318 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
8319 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8320 ok(!lstrcmpA(prop, "regszdata"),
8321 "Expected \"regszdata\", got \"%s\"\n", prop);
8324 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
8325 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8326 ok(!lstrcmpA(prop, "#42"), "Expected \"#42\", got \"%s\"\n", prop);
8329 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
8330 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8331 ok(!lstrcmpA(prop, "#-42"), "Expected \"#-42\", got \"%s\"\n", prop);
8333 size = ExpandEnvironmentStringsA("%PATH%", NULL, 0);
8334 if (size == 0 && GetLastError() == ERROR_INVALID_PARAMETER)
8336 /* Workaround for Win95 */
8338 size = ExpandEnvironmentStringsA("%PATH%", tempbuf, 0);
8340 pathvar = HeapAlloc(GetProcessHeap(), 0, size);
8341 ExpandEnvironmentStringsA("%PATH%", pathvar, size);
8344 r = MsiGetPropertyA(hpkg, "SIGPROP4", NULL, &size);
8345 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8347 pathdata = HeapAlloc(GetProcessHeap(), 0, ++size);
8348 r = MsiGetPropertyA(hpkg, "SIGPROP4", pathdata, &size);
8349 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8350 ok(!lstrcmpA(pathdata, pathvar),
8351 "Expected \"%s\", got \"%s\"\n", pathvar, pathdata);
8353 HeapFree(GetProcessHeap(), 0, pathvar);
8354 HeapFree(GetProcessHeap(), 0, pathdata);
8357 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
8358 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8360 "my%NOVAR%"), "Expected \"my%%NOVAR%%\", got \"%s\"\n", prop);
8363 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
8364 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8367 ok(!memcmp(prop, "\0one\0two\0\0", 10),
8368 "Expected \"\\0one\\0two\\0\\0\"\n");
8372 lstrcpyA(path, "#xCDAB3412EF907856");
8373 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
8374 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8375 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8378 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
8379 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8380 ok(!lstrcmpA(prop, "##regszdata"),
8381 "Expected \"##regszdata\", got \"%s\"\n", prop);
8384 sprintf(path, "%s\\FileName1", CURR_DIR);
8385 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
8386 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8387 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8390 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
8391 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8392 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8395 sprintf(path, "%s\\", CURR_DIR);
8396 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
8397 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8398 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8401 r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
8402 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8403 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8406 sprintf(path, "%s\\", CURR_DIR);
8407 r = MsiGetPropertyA(hpkg, "SIGPROP13", prop, &size);
8408 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8409 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8412 r = MsiGetPropertyA(hpkg, "SIGPROP14", prop, &size);
8413 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8414 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8417 r = MsiGetPropertyA(hpkg, "SIGPROP15", prop, &size);
8418 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8419 ok(!lstrcmpA(prop, "regszdata"),
8420 "Expected \"regszdata\", got \"%s\"\n", prop);
8423 r = MsiGetPropertyA(hpkg, "SIGPROP16", prop, &size);
8424 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8425 ok(!lstrcmpA(prop, "regszdata"),
8426 "Expected \"regszdata\", got \"%s\"\n", prop);
8431 r = MsiGetPropertyA(hpkg, "SIGPROP17", prop, &size);
8432 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8433 ok(!lstrcmpA(prop, "regszdata"),
8434 "Expected \"regszdata\", got \"%s\"\n", prop);
8438 r = MsiGetPropertyA(hpkg, "SIGPROP18", prop, &size);
8439 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8440 ok(!lstrcmpA(prop, "defvalue"),
8441 "Expected \"defvalue\", got \"%s\"\n", prop);
8444 r = MsiGetPropertyA(hpkg, "SIGPROP19", prop, &size);
8445 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8446 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8449 r = MsiGetPropertyA(hpkg, "SIGPROP20", prop, &size);
8450 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8451 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8456 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
8457 r = MsiGetPropertyA(hpkg, "SIGPROP21", prop, &size);
8458 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8459 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8462 r = MsiGetPropertyA(hpkg, "SIGPROP22", prop, &size);
8463 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8464 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8467 sprintf(path, "%s\\FileName5.dll", CURR_DIR);
8468 r = MsiGetPropertyA(hpkg, "SIGPROP23", prop, &size);
8469 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8470 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8474 lstrcpyA(path, CURR_DIR);
8475 ptr = strrchr(path, '\\') + 1;
8477 r = MsiGetPropertyA(hpkg, "SIGPROP24", prop, &size);
8478 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8479 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8482 sprintf(path, "%s\\", CURR_DIR);
8483 r = MsiGetPropertyA(hpkg, "SIGPROP25", prop, &size);
8484 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8485 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8488 r = MsiGetPropertyA(hpkg, "SIGPROP26", prop, &size);
8489 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8490 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8493 r = MsiGetPropertyA(hpkg, "SIGPROP27", prop, &size);
8494 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8495 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8498 r = MsiGetPropertyA(hpkg, "SIGPROP28", prop, &size);
8499 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8500 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8503 sprintf(path, "%s\\FileName1", CURR_DIR);
8504 r = MsiGetPropertyA(hpkg, "SIGPROP29", prop, &size);
8505 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8506 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8509 sprintf(path, "%s\\FileName1", CURR_DIR);
8510 r = MsiGetPropertyA(hpkg, "SIGPROP30", prop, &size);
8511 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8513 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8515 todo_wine ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8517 RegSetValueA(hklm, NULL, REG_SZ, "", 0);
8518 RegDeleteValueA(hklm, "Value1");
8519 RegDeleteValueA(hklm, "Value2");
8520 RegDeleteValueA(hklm, "Value3");
8521 RegDeleteValueA(hklm, "Value4");
8522 RegDeleteValueA(hklm, "Value5");
8523 RegDeleteValueA(hklm, "Value6");
8524 RegDeleteValueA(hklm, "Value7");
8525 RegDeleteValueA(hklm, "Value8");
8526 RegDeleteValueA(hklm, "Value9");
8527 RegDeleteValueA(hklm, "Value10");
8528 RegDeleteValueA(hklm, "Value11");
8529 RegDeleteValueA(hklm, "Value12");
8530 RegDeleteValueA(hklm, "Value13");
8531 RegDeleteValueA(hklm, "Value14");
8532 RegDeleteValueA(hklm, "Value15");
8533 RegDeleteValueA(hklm, "Value16");
8534 RegDeleteValueA(hklm, "Value17");
8535 RegDeleteKey(hklm, "");
8538 RegDeleteValueA(classes, "Value1");
8539 RegDeleteKeyA(classes, "");
8540 RegCloseKey(classes);
8542 RegDeleteValueA(hkcu, "Value1");
8543 RegDeleteKeyA(hkcu, "");
8546 RegDeleteValueA(users, "Value1");
8547 RegDeleteKeyA(users, "");
8550 DeleteFileA("FileName1");
8551 DeleteFileA("FileName3.dll");
8552 DeleteFileA("FileName4.dll");
8553 DeleteFileA("FileName5.dll");
8554 MsiCloseHandle(hpkg);
8555 DeleteFileA(msifile);
8558 static void delete_win_ini(LPCSTR file)
8560 CHAR path[MAX_PATH];
8562 GetWindowsDirectoryA(path, MAX_PATH);
8563 lstrcatA(path, "\\");
8564 lstrcatA(path, file);
8569 static void test_appsearch_inilocator(void)
8571 MSIHANDLE hpkg, hdb;
8572 CHAR path[MAX_PATH];
8573 CHAR prop[MAX_PATH];
8581 if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
8584 DeleteFileA("test.dll");
8586 WritePrivateProfileStringA("Section", "Key", "keydata,field2", "IniFile.ini");
8588 create_test_file("FileName1");
8589 sprintf(path, "%s\\FileName1", CURR_DIR);
8590 WritePrivateProfileStringA("Section", "Key2", path, "IniFile.ini");
8592 WritePrivateProfileStringA("Section", "Key3", CURR_DIR, "IniFile.ini");
8594 sprintf(path, "%s\\IDontExist", CURR_DIR);
8595 WritePrivateProfileStringA("Section", "Key4", path, "IniFile.ini");
8597 create_file_with_version("FileName2.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8598 sprintf(path, "%s\\FileName2.dll", CURR_DIR);
8599 WritePrivateProfileStringA("Section", "Key5", path, "IniFile.ini");
8601 create_file_with_version("FileName3.dll", MAKELONG(1, 2), MAKELONG(3, 4));
8602 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
8603 WritePrivateProfileStringA("Section", "Key6", path, "IniFile.ini");
8605 create_file_with_version("FileName4.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8606 sprintf(path, "%s\\FileName4.dll", CURR_DIR);
8607 WritePrivateProfileStringA("Section", "Key7", path, "IniFile.ini");
8609 hdb = create_package_db();
8610 ok(hdb, "Expected a valid database handle\n");
8612 r = create_appsearch_table(hdb);
8613 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8615 r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
8616 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8618 r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
8619 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8621 r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
8622 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8624 r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
8625 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8627 r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
8628 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8630 r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
8631 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8633 r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
8634 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8636 r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
8637 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8639 r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
8640 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8642 r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
8643 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8645 r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
8646 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8648 r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
8649 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8651 r = create_inilocator_table(hdb);
8652 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8654 /* msidbLocatorTypeRawValue, field 1 */
8655 str = "'NewSignature1', 'IniFile.ini', 'Section', 'Key', 1, 2";
8656 r = add_inilocator_entry(hdb, str);
8657 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8659 /* msidbLocatorTypeRawValue, field 2 */
8660 str = "'NewSignature2', 'IniFile.ini', 'Section', 'Key', 2, 2";
8661 r = add_inilocator_entry(hdb, str);
8662 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8664 /* msidbLocatorTypeRawValue, entire field */
8665 str = "'NewSignature3', 'IniFile.ini', 'Section', 'Key', 0, 2";
8666 r = add_inilocator_entry(hdb, str);
8667 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8669 /* msidbLocatorTypeFile */
8670 str = "'NewSignature4', 'IniFile.ini', 'Section', 'Key2', 1, 1";
8671 r = add_inilocator_entry(hdb, str);
8672 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8674 /* msidbLocatorTypeDirectory, file */
8675 str = "'NewSignature5', 'IniFile.ini', 'Section', 'Key2', 1, 0";
8676 r = add_inilocator_entry(hdb, str);
8677 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8679 /* msidbLocatorTypeDirectory, directory */
8680 str = "'NewSignature6', 'IniFile.ini', 'Section', 'Key3', 1, 0";
8681 r = add_inilocator_entry(hdb, str);
8682 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8684 /* msidbLocatorTypeFile, file, no signature */
8685 str = "'NewSignature7', 'IniFile.ini', 'Section', 'Key2', 1, 1";
8686 r = add_inilocator_entry(hdb, str);
8687 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8689 /* msidbLocatorTypeFile, dir, no signature */
8690 str = "'NewSignature8', 'IniFile.ini', 'Section', 'Key3', 1, 1";
8691 r = add_inilocator_entry(hdb, str);
8692 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8694 /* msidbLocatorTypeFile, file does not exist */
8695 str = "'NewSignature9', 'IniFile.ini', 'Section', 'Key4', 1, 1";
8696 r = add_inilocator_entry(hdb, str);
8697 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8699 /* msidbLocatorTypeFile, signature with version */
8700 str = "'NewSignature10', 'IniFile.ini', 'Section', 'Key5', 1, 1";
8701 r = add_inilocator_entry(hdb, str);
8702 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8704 /* msidbLocatorTypeFile, signature with version, ver > max */
8705 str = "'NewSignature11', 'IniFile.ini', 'Section', 'Key6', 1, 1";
8706 r = add_inilocator_entry(hdb, str);
8707 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8709 /* msidbLocatorTypeFile, signature with version, sig->name ignored */
8710 str = "'NewSignature12', 'IniFile.ini', 'Section', 'Key7', 1, 1";
8711 r = add_inilocator_entry(hdb, str);
8712 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8714 r = create_signature_table(hdb);
8715 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8717 r = add_signature_entry(hdb, "'NewSignature4', 'FileName1', '', '', '', '', '', '', ''");
8718 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8720 r = add_signature_entry(hdb, "'NewSignature9', 'IDontExist', '', '', '', '', '', '', ''");
8721 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8723 r = add_signature_entry(hdb, "'NewSignature10', 'FileName2.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
8724 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8726 r = add_signature_entry(hdb, "'NewSignature11', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
8727 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8729 r = add_signature_entry(hdb, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
8730 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8732 r = package_from_db(hdb, &hpkg);
8733 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
8735 skip("Not enough rights to perform tests\n");
8738 ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
8740 r = MsiDoAction(hpkg, "AppSearch");
8741 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8744 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
8745 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8746 ok(!lstrcmpA(prop, "keydata"), "Expected \"keydata\", got \"%s\"\n", prop);
8749 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
8750 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8751 ok(!lstrcmpA(prop, "field2"), "Expected \"field2\", got \"%s\"\n", prop);
8754 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
8755 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8756 ok(!lstrcmpA(prop, "keydata,field2"),
8757 "Expected \"keydata,field2\", got \"%s\"\n", prop);
8760 sprintf(path, "%s\\FileName1", CURR_DIR);
8761 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
8762 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8763 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8766 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
8767 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8768 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8771 sprintf(path, "%s\\", CURR_DIR);
8772 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
8773 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8774 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8777 sprintf(path, "%s\\", CURR_DIR);
8778 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
8779 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8780 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8783 lstrcpyA(path, CURR_DIR);
8784 ptr = strrchr(path, '\\');
8786 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
8787 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8788 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8791 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
8792 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8793 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8798 sprintf(path, "%s\\FileName2.dll", CURR_DIR);
8799 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
8800 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8801 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8804 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
8805 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8806 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
8809 sprintf(path, "%s\\FileName4.dll", CURR_DIR);
8810 r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
8811 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8812 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
8815 MsiCloseHandle(hpkg);
8818 delete_win_ini("IniFile.ini");
8819 DeleteFileA("FileName1");
8820 DeleteFileA("FileName2.dll");
8821 DeleteFileA("FileName3.dll");
8822 DeleteFileA("FileName4.dll");
8823 DeleteFileA(msifile);
8827 * MSI AppSearch action on DrLocator table always returns absolute paths.
8828 * If a relative path was set, it returns the first absolute path that
8829 * matches or an empty string if it didn't find anything.
8830 * This helper function replicates this behaviour.
8832 static void search_absolute_directory(LPSTR absolute, LPCSTR relative)
8837 size = lstrlenA(relative);
8838 drives = GetLogicalDrives();
8839 lstrcpyA(absolute, "A:\\");
8840 for (i = 0; i < 26; absolute[0] = '\0', i++)
8842 if (!(drives & (1 << i)))
8845 absolute[0] = 'A' + i;
8846 if (GetDriveType(absolute) != DRIVE_FIXED)
8849 lstrcpynA(absolute + 3, relative, size + 1);
8850 attr = GetFileAttributesA(absolute);
8851 if (attr != INVALID_FILE_ATTRIBUTES &&
8852 (attr & FILE_ATTRIBUTE_DIRECTORY))
8854 if (absolute[3 + size - 1] != '\\')
8855 lstrcatA(absolute, "\\");
8862 static void test_appsearch_drlocator(void)
8864 MSIHANDLE hpkg, hdb;
8865 CHAR path[MAX_PATH];
8866 CHAR prop[MAX_PATH];
8873 if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
8876 DeleteFileA("test.dll");
8878 create_test_file("FileName1");
8879 CreateDirectoryA("one", NULL);
8880 CreateDirectoryA("one\\two", NULL);
8881 CreateDirectoryA("one\\two\\three", NULL);
8882 create_test_file("one\\two\\three\\FileName2");
8883 CreateDirectoryA("another", NULL);
8884 create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8885 create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
8886 create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
8888 hdb = create_package_db();
8889 ok(hdb, "Expected a valid database handle\n");
8891 r = create_appsearch_table(hdb);
8892 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8894 r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
8895 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8897 r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
8898 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8900 r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
8901 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8903 r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
8904 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8906 r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
8907 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8909 r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
8910 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8912 r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
8913 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8915 r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
8916 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8918 r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
8919 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8921 r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
8922 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8924 r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
8925 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8927 r = add_appsearch_entry(hdb, "'SIGPROP13', 'NewSignature13'");
8928 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8930 r = create_drlocator_table(hdb);
8931 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8933 /* no parent, full path, depth 0, signature */
8934 sprintf(path, "'NewSignature1', '', '%s', 0", CURR_DIR);
8935 r = add_drlocator_entry(hdb, path);
8936 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8938 /* no parent, full path, depth 0, no signature */
8939 sprintf(path, "'NewSignature2', '', '%s', 0", CURR_DIR);
8940 r = add_drlocator_entry(hdb, path);
8941 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8943 /* no parent, relative path, depth 0, no signature */
8944 sprintf(path, "'NewSignature3', '', '%s', 0", CURR_DIR + 3);
8945 r = add_drlocator_entry(hdb, path);
8946 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8948 /* no parent, full path, depth 2, signature */
8949 sprintf(path, "'NewSignature4', '', '%s', 2", CURR_DIR);
8950 r = add_drlocator_entry(hdb, path);
8951 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8953 /* no parent, full path, depth 3, signature */
8954 sprintf(path, "'NewSignature5', '', '%s', 3", CURR_DIR);
8955 r = add_drlocator_entry(hdb, path);
8956 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8958 /* no parent, full path, depth 1, signature is dir */
8959 sprintf(path, "'NewSignature6', '', '%s', 1", CURR_DIR);
8960 r = add_drlocator_entry(hdb, path);
8961 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8963 /* parent is in DrLocator, relative path, depth 0, signature */
8964 sprintf(path, "'NewSignature7', 'NewSignature1', 'one\\two\\three', 1");
8965 r = add_drlocator_entry(hdb, path);
8966 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8968 /* no parent, full path, depth 0, signature w/ version */
8969 sprintf(path, "'NewSignature8', '', '%s', 0", CURR_DIR);
8970 r = add_drlocator_entry(hdb, path);
8971 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8973 /* no parent, full path, depth 0, signature w/ version, ver > max */
8974 sprintf(path, "'NewSignature9', '', '%s', 0", CURR_DIR);
8975 r = add_drlocator_entry(hdb, path);
8976 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8978 /* no parent, full path, depth 0, signature w/ version, sig->name not ignored */
8979 sprintf(path, "'NewSignature10', '', '%s', 0", CURR_DIR);
8980 r = add_drlocator_entry(hdb, path);
8981 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8983 /* no parent, relative empty path, depth 0, no signature */
8984 sprintf(path, "'NewSignature11', '', '', 0");
8985 r = add_drlocator_entry(hdb, path);
8986 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8988 r = create_reglocator_table(hdb);
8989 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8992 r = add_reglocator_entry(hdb, "'NewSignature12', 2, 'htmlfile\\shell\\open\\nonexistent', '', 1");
8993 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8995 /* parent is in RegLocator, no path, depth 0, no signature */
8996 sprintf(path, "'NewSignature13', 'NewSignature12', '', 0");
8997 r = add_drlocator_entry(hdb, path);
8998 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9000 r = create_signature_table(hdb);
9001 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9003 str = "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''";
9004 r = add_signature_entry(hdb, str);
9005 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9007 str = "'NewSignature4', 'FileName2', '', '', '', '', '', '', ''";
9008 r = add_signature_entry(hdb, str);
9009 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9011 str = "'NewSignature5', 'FileName2', '', '', '', '', '', '', ''";
9012 r = add_signature_entry(hdb, str);
9013 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9015 str = "'NewSignature6', 'another', '', '', '', '', '', '', ''";
9016 r = add_signature_entry(hdb, str);
9017 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9019 str = "'NewSignature7', 'FileName2', '', '', '', '', '', '', ''";
9020 r = add_signature_entry(hdb, str);
9021 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9023 str = "'NewSignature8', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
9024 r = add_signature_entry(hdb, str);
9025 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9027 str = "'NewSignature9', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
9028 r = add_signature_entry(hdb, str);
9029 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9031 str = "'NewSignature10', 'necessary', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
9032 r = add_signature_entry(hdb, str);
9033 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9035 r = package_from_db(hdb, &hpkg);
9036 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
9038 skip("Not enough rights to perform tests\n");
9041 ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
9043 r = MsiDoAction(hpkg, "AppSearch");
9044 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9047 sprintf(path, "%s\\FileName1", CURR_DIR);
9048 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
9049 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9050 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9053 sprintf(path, "%s\\", CURR_DIR);
9054 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
9055 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9056 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9059 search_absolute_directory(path, CURR_DIR + 3);
9060 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
9061 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9062 ok(!lstrcmpiA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9065 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
9066 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9067 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
9070 sprintf(path, "%s\\one\\two\\three\\FileName2", CURR_DIR);
9071 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
9072 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9073 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9076 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
9077 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9078 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
9081 sprintf(path, "%s\\one\\two\\three\\FileName2", CURR_DIR);
9082 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
9083 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9084 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9089 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
9090 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
9091 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9092 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9095 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
9096 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9097 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
9100 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
9101 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9102 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
9106 search_absolute_directory(path, "");
9107 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
9108 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9109 ok(!lstrcmpiA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
9112 strcpy(path, "c:\\");
9113 r = MsiGetPropertyA(hpkg, "SIGPROP13", prop, &size);
9114 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9115 ok(!prop[0], "Expected \"\", got \"%s\"\n", prop);
9117 MsiCloseHandle(hpkg);
9120 DeleteFileA("FileName1");
9121 DeleteFileA("FileName3.dll");
9122 DeleteFileA("FileName4.dll");
9123 DeleteFileA("FileName5.dll");
9124 DeleteFileA("one\\two\\three\\FileName2");
9125 RemoveDirectoryA("one\\two\\three");
9126 RemoveDirectoryA("one\\two");
9127 RemoveDirectoryA("one");
9128 RemoveDirectoryA("another");
9129 DeleteFileA(msifile);
9132 static void test_featureparents(void)
9137 INSTALLSTATE state, action;
9139 hdb = create_package_db();
9140 ok ( hdb, "failed to create package database\n" );
9142 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
9143 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
9145 r = create_feature_table( hdb );
9146 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
9148 r = create_component_table( hdb );
9149 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
9151 r = create_feature_components_table( hdb );
9152 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
9154 r = create_file_table( hdb );
9155 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
9157 /* msidbFeatureAttributesFavorLocal */
9158 r = add_feature_entry( hdb, "'zodiac', '', '', '', 2, 1, '', 0" );
9159 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
9161 /* msidbFeatureAttributesFavorSource */
9162 r = add_feature_entry( hdb, "'perseus', '', '', '', 2, 1, '', 1" );
9163 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
9165 /* msidbFeatureAttributesFavorLocal */
9166 r = add_feature_entry( hdb, "'orion', '', '', '', 2, 1, '', 0" );
9167 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
9169 /* disabled because of install level */
9170 r = add_feature_entry( hdb, "'waters', '', '', '', 15, 101, '', 9" );
9171 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
9173 /* child feature of disabled feature */
9174 r = add_feature_entry( hdb, "'bayer', 'waters', '', '', 14, 1, '', 9" );
9175 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
9177 /* component of disabled feature (install level) */
9178 r = add_component_entry( hdb, "'delphinus', '', 'TARGETDIR', 0, '', 'delphinus_file'" );
9179 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9181 /* component of disabled child feature (install level) */
9182 r = add_component_entry( hdb, "'hydrus', '', 'TARGETDIR', 0, '', 'hydrus_file'" );
9183 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9185 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
9186 r = add_component_entry( hdb, "'leo', '', 'TARGETDIR', 0, '', 'leo_file'" );
9187 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9189 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
9190 r = add_component_entry( hdb, "'virgo', '', 'TARGETDIR', 1, '', 'virgo_file'" );
9191 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9193 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
9194 r = add_component_entry( hdb, "'libra', '', 'TARGETDIR', 2, '', 'libra_file'" );
9195 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9197 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
9198 r = add_component_entry( hdb, "'cassiopeia', '', 'TARGETDIR', 0, '', 'cassiopeia_file'" );
9199 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9201 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
9202 r = add_component_entry( hdb, "'cepheus', '', 'TARGETDIR', 1, '', 'cepheus_file'" );
9203 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9205 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
9206 r = add_component_entry( hdb, "'andromeda', '', 'TARGETDIR', 2, '', 'andromeda_file'" );
9207 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9209 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
9210 r = add_component_entry( hdb, "'canis', '', 'TARGETDIR', 0, '', 'canis_file'" );
9211 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9213 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
9214 r = add_component_entry( hdb, "'monoceros', '', 'TARGETDIR', 1, '', 'monoceros_file'" );
9215 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
9217 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
9218 r = add_component_entry( hdb, "'lepus', '', 'TARGETDIR', 2, '', 'lepus_file'" );
9220 r = add_feature_components_entry( hdb, "'zodiac', 'leo'" );
9221 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9223 r = add_feature_components_entry( hdb, "'zodiac', 'virgo'" );
9224 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9226 r = add_feature_components_entry( hdb, "'zodiac', 'libra'" );
9227 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9229 r = add_feature_components_entry( hdb, "'perseus', 'cassiopeia'" );
9230 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9232 r = add_feature_components_entry( hdb, "'perseus', 'cepheus'" );
9233 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9235 r = add_feature_components_entry( hdb, "'perseus', 'andromeda'" );
9236 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9238 r = add_feature_components_entry( hdb, "'orion', 'leo'" );
9239 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9241 r = add_feature_components_entry( hdb, "'orion', 'virgo'" );
9242 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9244 r = add_feature_components_entry( hdb, "'orion', 'libra'" );
9245 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9247 r = add_feature_components_entry( hdb, "'orion', 'cassiopeia'" );
9248 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9250 r = add_feature_components_entry( hdb, "'orion', 'cepheus'" );
9251 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9253 r = add_feature_components_entry( hdb, "'orion', 'andromeda'" );
9254 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9256 r = add_feature_components_entry( hdb, "'orion', 'canis'" );
9257 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9259 r = add_feature_components_entry( hdb, "'orion', 'monoceros'" );
9260 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9262 r = add_feature_components_entry( hdb, "'orion', 'lepus'" );
9263 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9265 r = add_feature_components_entry( hdb, "'waters', 'delphinus'" );
9266 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9268 r = add_feature_components_entry( hdb, "'bayer', 'hydrus'" );
9269 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
9271 r = add_file_entry( hdb, "'leo_file', 'leo', 'leo.txt', 100, '', '1033', 8192, 1" );
9272 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9274 r = add_file_entry( hdb, "'virgo_file', 'virgo', 'virgo.txt', 0, '', '1033', 8192, 1" );
9275 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9277 r = add_file_entry( hdb, "'libra_file', 'libra', 'libra.txt', 0, '', '1033', 8192, 1" );
9278 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9280 r = add_file_entry( hdb, "'cassiopeia_file', 'cassiopeia', 'cassiopeia.txt', 0, '', '1033', 8192, 1" );
9281 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9283 r = add_file_entry( hdb, "'cepheus_file', 'cepheus', 'cepheus.txt', 0, '', '1033', 8192, 1" );
9284 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9286 r = add_file_entry( hdb, "'andromeda_file', 'andromeda', 'andromeda.txt', 0, '', '1033', 8192, 1" );
9287 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9289 r = add_file_entry( hdb, "'canis_file', 'canis', 'canis.txt', 0, '', '1033', 8192, 1" );
9290 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9292 r = add_file_entry( hdb, "'monoceros_file', 'monoceros', 'monoceros.txt', 0, '', '1033', 8192, 1" );
9293 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9295 r = add_file_entry( hdb, "'lepus_file', 'lepus', 'lepus.txt', 0, '', '1033', 8192, 1" );
9296 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9298 r = add_file_entry( hdb, "'delphinus_file', 'delphinus', 'delphinus.txt', 0, '', '1033', 8192, 1" );
9299 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9301 r = add_file_entry( hdb, "'hydrus_file', 'hydrus', 'hydrus.txt', 0, '', '1033', 8192, 1" );
9302 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
9304 r = package_from_db( hdb, &hpkg );
9305 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
9307 skip("Not enough rights to perform tests\n");
9308 DeleteFile(msifile);
9311 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
9313 MsiCloseHandle( hdb );
9315 r = MsiDoAction( hpkg, "CostInitialize");
9316 ok( r == ERROR_SUCCESS, "cost init failed\n");
9318 r = MsiDoAction( hpkg, "FileCost");
9319 ok( r == ERROR_SUCCESS, "file cost failed\n");
9321 r = MsiDoAction( hpkg, "CostFinalize");
9322 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
9326 r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
9327 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9328 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9329 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
9333 r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
9334 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9335 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9336 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
9340 r = MsiGetFeatureState(hpkg, "orion", &state, &action);
9341 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9342 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9343 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
9347 r = MsiGetFeatureState(hpkg, "waters", &state, &action);
9348 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9349 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9350 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
9354 r = MsiGetFeatureState(hpkg, "bayer", &state, &action);
9355 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9356 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
9357 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
9361 r = MsiGetComponentState(hpkg, "leo", &state, &action);
9362 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9363 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
9364 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
9368 r = MsiGetComponentState(hpkg, "virgo", &state, &action);
9369 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9370 ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
9371 ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
9375 r = MsiGetComponentState(hpkg, "libra", &state, &action);
9376 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9377 ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
9378 ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
9382 r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
9383 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9384 ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
9385 ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
9389 r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
9390 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9391 ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
9392 ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
9396 r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
9397 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9398 ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
9399 ok( action == INSTALLSTATE_LOCAL, "Expected andromeda INSTALLSTATE_LOCAL, got %d\n", action);
9403 r = MsiGetComponentState(hpkg, "canis", &state, &action);
9404 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9405 ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
9406 ok( action == INSTALLSTATE_LOCAL, "Expected canis INSTALLSTATE_LOCAL, got %d\n", action);
9410 r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
9411 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9412 ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
9413 ok( action == INSTALLSTATE_SOURCE, "Expected monoceros INSTALLSTATE_SOURCE, got %d\n", action);
9417 r = MsiGetComponentState(hpkg, "lepus", &state, &action);
9418 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9419 ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
9420 ok( action == INSTALLSTATE_LOCAL, "Expected lepus INSTALLSTATE_LOCAL, got %d\n", action);
9424 r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
9425 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9426 ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
9427 ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
9431 r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
9432 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9433 ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
9434 ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
9436 r = MsiSetFeatureState(hpkg, "orion", INSTALLSTATE_ABSENT);
9437 ok( r == ERROR_SUCCESS, "failed to set feature state: %d\n", r);
9439 r = MsiSetFeatureState(hpkg, "nosuchfeature", INSTALLSTATE_ABSENT);
9440 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %u\n", r);
9444 r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
9445 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9446 ok( state == INSTALLSTATE_ABSENT, "Expected zodiac INSTALLSTATE_ABSENT, got %d\n", state);
9447 ok( action == INSTALLSTATE_LOCAL, "Expected zodiac INSTALLSTATE_LOCAL, got %d\n", action);
9451 r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
9452 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9453 ok( state == INSTALLSTATE_ABSENT, "Expected perseus INSTALLSTATE_ABSENT, got %d\n", state);
9454 ok( action == INSTALLSTATE_SOURCE, "Expected perseus INSTALLSTATE_SOURCE, got %d\n", action);
9458 r = MsiGetFeatureState(hpkg, "orion", &state, &action);
9459 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9460 ok( state == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", state);
9461 ok( action == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", action);
9465 r = MsiGetComponentState(hpkg, "leo", &state, &action);
9466 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9467 ok( state == INSTALLSTATE_UNKNOWN, "Expected leo INSTALLSTATE_UNKNOWN, got %d\n", state);
9468 ok( action == INSTALLSTATE_LOCAL, "Expected leo INSTALLSTATE_LOCAL, got %d\n", action);
9472 r = MsiGetComponentState(hpkg, "virgo", &state, &action);
9473 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9474 ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
9475 ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
9479 r = MsiGetComponentState(hpkg, "libra", &state, &action);
9480 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9481 ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
9482 ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
9486 r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
9487 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9488 ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
9489 ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
9493 r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
9494 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9495 ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
9496 ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
9500 r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
9501 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9502 ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
9503 ok( action == INSTALLSTATE_SOURCE, "Expected andromeda INSTALLSTATE_SOURCE, got %d\n", action);
9507 r = MsiGetComponentState(hpkg, "canis", &state, &action);
9508 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9509 ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
9510 ok( action == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", action);
9514 r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
9515 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9516 ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
9517 ok( action == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", action);
9521 r = MsiGetComponentState(hpkg, "lepus", &state, &action);
9522 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9523 ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
9524 ok( action == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", action);
9528 r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
9529 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9530 ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
9531 ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
9535 r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
9536 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
9537 ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
9538 ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
9540 MsiCloseHandle(hpkg);
9541 DeleteFileA(msifile);
9544 static void test_installprops(void)
9546 MSIHANDLE hpkg, hdb;
9547 CHAR path[MAX_PATH], buf[MAX_PATH];
9553 REGSAM access = KEY_ALL_ACCESS;
9557 if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64)
9558 access |= KEY_WOW64_64KEY;
9560 GetCurrentDirectory(MAX_PATH, path);
9561 lstrcat(path, "\\");
9562 lstrcat(path, msifile);
9564 hdb = create_package_db();
9565 ok( hdb, "failed to create database\n");
9567 r = package_from_db(hdb, &hpkg);
9568 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
9570 skip("Not enough rights to perform tests\n");
9571 DeleteFile(msifile);
9574 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
9576 MsiCloseHandle(hdb);
9579 r = MsiGetProperty(hpkg, "DATABASE", buf, &size);
9580 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9581 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
9583 RegOpenKey(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\MS Setup (ACME)\\User Info", &hkey1);
9584 RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", 0, access, &hkey2);
9589 if (RegQueryValueEx(hkey1, "DefName", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
9593 RegQueryValueEx(hkey2, "RegisteredOwner", NULL, &type, (LPBYTE)path, &size);
9596 /* win9x doesn't set this */
9600 r = MsiGetProperty(hpkg, "USERNAME", buf, &size);
9601 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9602 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
9608 if (RegQueryValueEx(hkey1, "DefCompany", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
9612 RegQueryValueEx(hkey2, "RegisteredOrganization", NULL, &type, (LPBYTE)path, &size);
9618 r = MsiGetProperty(hpkg, "COMPANYNAME", buf, &size);
9619 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9620 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
9624 r = MsiGetProperty(hpkg, "VersionDatabase", buf, &size);
9625 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9626 trace("VersionDatabase = %s\n", buf);
9629 r = MsiGetProperty(hpkg, "VersionMsi", buf, &size);
9630 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9631 trace("VersionMsi = %s\n", buf);
9634 r = MsiGetProperty(hpkg, "Date", buf, &size);
9635 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9636 trace("Date = %s\n", buf);
9639 r = MsiGetProperty(hpkg, "Time", buf, &size);
9640 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9641 trace("Time = %s\n", buf);
9644 r = MsiGetProperty(hpkg, "PackageCode", buf, &size);
9645 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9646 trace("PackageCode = %s\n", buf);
9648 langid = GetUserDefaultLangID();
9649 sprintf(path, "%d", langid);
9652 r = MsiGetProperty(hpkg, "UserLanguageID", buf, &size);
9653 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS< got %d\n", r);
9654 ok( !lstrcmpA(buf, path), "Expected \"%s\", got \"%s\"\n", path, buf);
9656 res = GetSystemMetrics(SM_CXSCREEN);
9658 r = MsiGetProperty(hpkg, "ScreenX", buf, &size);
9659 ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
9661 res = GetSystemMetrics(SM_CYSCREEN);
9663 r = MsiGetProperty(hpkg, "ScreenY", buf, &size);
9664 ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
9668 pGetSystemInfo(&si);
9669 if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
9673 r = MsiGetProperty(hpkg, "MsiAMD64", buf, &size);
9674 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9675 ok(buf[0], "property not set\n");
9679 r = MsiGetProperty(hpkg, "Msix64", buf, &size);
9680 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9681 ok(buf[0], "property not set\n");
9685 r = MsiGetProperty(hpkg, "System64Folder", buf, &size);
9686 ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
9687 ok(buf[0], "property not set\n");
9693 MsiCloseHandle(hpkg);
9694 DeleteFile(msifile);
9697 static void test_launchconditions(void)
9703 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
9705 hdb = create_package_db();
9706 ok( hdb, "failed to create package database\n" );
9708 r = create_launchcondition_table( hdb );
9709 ok( r == ERROR_SUCCESS, "cannot create LaunchCondition table: %d\n", r );
9711 r = add_launchcondition_entry( hdb, "'X = \"1\"', 'one'" );
9712 ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
9714 /* invalid condition */
9715 r = add_launchcondition_entry( hdb, "'X != \"1\"', 'one'" );
9716 ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
9718 r = package_from_db( hdb, &hpkg );
9719 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
9721 skip("Not enough rights to perform tests\n");
9722 DeleteFile(msifile);
9725 ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
9727 MsiCloseHandle( hdb );
9729 r = MsiSetProperty( hpkg, "X", "1" );
9730 ok( r == ERROR_SUCCESS, "failed to set property\n" );
9732 /* invalid conditions are ignored */
9733 r = MsiDoAction( hpkg, "LaunchConditions" );
9734 ok( r == ERROR_SUCCESS, "cost init failed\n" );
9736 /* verify LaunchConditions still does some verification */
9737 r = MsiSetProperty( hpkg, "X", "2" );
9738 ok( r == ERROR_SUCCESS, "failed to set property\n" );
9740 r = MsiDoAction( hpkg, "LaunchConditions" );
9741 ok( r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %d\n", r );
9743 MsiCloseHandle( hpkg );
9744 DeleteFile( msifile );
9747 static void test_ccpsearch(void)
9749 MSIHANDLE hdb, hpkg;
9750 CHAR prop[MAX_PATH];
9751 DWORD size = MAX_PATH;
9754 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
9756 hdb = create_package_db();
9757 ok(hdb, "failed to create package database\n");
9759 r = create_ccpsearch_table(hdb);
9760 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9762 r = add_ccpsearch_entry(hdb, "'CCP_random'");
9763 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9765 r = add_ccpsearch_entry(hdb, "'RMCCP_random'");
9766 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9768 r = create_reglocator_table(hdb);
9769 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9771 r = add_reglocator_entry(hdb, "'CCP_random', 0, 'htmlfile\\shell\\open\\nonexistent', '', 1");
9772 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9774 r = create_drlocator_table(hdb);
9775 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9777 r = add_drlocator_entry(hdb, "'RMCCP_random', '', 'C:\\', '0'");
9778 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9780 r = create_signature_table(hdb);
9781 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9783 r = package_from_db(hdb, &hpkg);
9784 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
9786 skip("Not enough rights to perform tests\n");
9787 DeleteFile(msifile);
9790 ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
9792 MsiCloseHandle(hdb);
9794 r = MsiDoAction(hpkg, "CCPSearch");
9795 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9797 r = MsiGetPropertyA(hpkg, "CCP_Success", prop, &size);
9798 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9799 ok(!lstrcmpA(prop, "1"), "Expected 1, got %s\n", prop);
9801 MsiCloseHandle(hpkg);
9802 DeleteFileA(msifile);
9805 static void test_complocator(void)
9807 MSIHANDLE hdb, hpkg;
9809 CHAR prop[MAX_PATH];
9810 CHAR expected[MAX_PATH];
9811 DWORD size = MAX_PATH;
9813 hdb = create_package_db();
9814 ok(hdb, "failed to create package database\n");
9816 r = create_appsearch_table(hdb);
9817 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9819 r = add_appsearch_entry(hdb, "'ABELISAURUS', 'abelisaurus'");
9820 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9822 r = add_appsearch_entry(hdb, "'BACTROSAURUS', 'bactrosaurus'");
9823 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9825 r = add_appsearch_entry(hdb, "'CAMELOTIA', 'camelotia'");
9826 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9828 r = add_appsearch_entry(hdb, "'DICLONIUS', 'diclonius'");
9829 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9831 r = add_appsearch_entry(hdb, "'ECHINODON', 'echinodon'");
9832 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9834 r = add_appsearch_entry(hdb, "'FALCARIUS', 'falcarius'");
9835 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9837 r = add_appsearch_entry(hdb, "'GALLIMIMUS', 'gallimimus'");
9838 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9840 r = add_appsearch_entry(hdb, "'HAGRYPHUS', 'hagryphus'");
9841 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9843 r = add_appsearch_entry(hdb, "'IGUANODON', 'iguanodon'");
9844 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9846 r = add_appsearch_entry(hdb, "'JOBARIA', 'jobaria'");
9847 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9849 r = add_appsearch_entry(hdb, "'KAKURU', 'kakuru'");
9850 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9852 r = add_appsearch_entry(hdb, "'LABOCANIA', 'labocania'");
9853 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9855 r = add_appsearch_entry(hdb, "'MEGARAPTOR', 'megaraptor'");
9856 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9858 r = add_appsearch_entry(hdb, "'NEOSODON', 'neosodon'");
9859 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9861 r = add_appsearch_entry(hdb, "'OLOROTITAN', 'olorotitan'");
9862 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9864 r = add_appsearch_entry(hdb, "'PANTYDRACO', 'pantydraco'");
9865 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9867 r = create_complocator_table(hdb);
9868 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9870 r = add_complocator_entry(hdb, "'abelisaurus', '{E3619EED-305A-418C-B9C7-F7D7377F0934}', 1");
9871 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9873 r = add_complocator_entry(hdb, "'bactrosaurus', '{D56B688D-542F-42Ef-90FD-B6DA76EE8119}', 0");
9874 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9876 r = add_complocator_entry(hdb, "'camelotia', '{8211BE36-2466-47E3-AFB7-6AC72E51AED2}', 1");
9877 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9879 r = add_complocator_entry(hdb, "'diclonius', '{5C767B20-A33C-45A4-B80B-555E512F01AE}', 0");
9880 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9882 r = add_complocator_entry(hdb, "'echinodon', '{A19E16C5-C75D-4699-8111-C4338C40C3CB}', 1");
9883 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9885 r = add_complocator_entry(hdb, "'falcarius', '{17762FA1-A7AE-4CC6-8827-62873C35361D}', 0");
9886 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9888 r = add_complocator_entry(hdb, "'gallimimus', '{75EBF568-C959-41E0-A99E-9050638CF5FB}', 1");
9889 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9891 r = add_complocator_entry(hdb, "'hagrphus', '{D4969B72-17D9-4AB6-BE49-78F2FEE857AC}', 0");
9892 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9894 r = add_complocator_entry(hdb, "'iguanodon', '{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}', 1");
9895 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9897 r = add_complocator_entry(hdb, "'jobaria', '{243C22B1-8C51-4151-B9D1-1AE5265E079E}', 0");
9898 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9900 r = add_complocator_entry(hdb, "'kakuru', '{5D0F03BA-50BC-44F2-ABB1-72C972F4E514}', 1");
9901 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9903 r = add_complocator_entry(hdb, "'labocania', '{C7DDB60C-7828-4046-A6F8-699D5E92F1ED}', 0");
9904 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9906 r = add_complocator_entry(hdb, "'megaraptor', '{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}', 1");
9907 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9909 r = add_complocator_entry(hdb, "'neosodon', '{0B499649-197A-48EF-93D2-AF1C17ED6E90}', 0");
9910 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9912 r = add_complocator_entry(hdb, "'olorotitan', '{54E9E91F-AED2-46D5-A25A-7E50AFA24513}', 1");
9913 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9915 r = add_complocator_entry(hdb, "'pantydraco', '{2A989951-5565-4FA7-93A7-E800A3E67D71}', 0");
9916 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9918 r = create_signature_table(hdb);
9919 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9921 r = add_signature_entry(hdb, "'abelisaurus', 'abelisaurus', '', '', '', '', '', '', ''");
9922 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9924 r = add_signature_entry(hdb, "'bactrosaurus', 'bactrosaurus', '', '', '', '', '', '', ''");
9925 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9927 r = add_signature_entry(hdb, "'camelotia', 'camelotia', '', '', '', '', '', '', ''");
9928 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9930 r = add_signature_entry(hdb, "'diclonius', 'diclonius', '', '', '', '', '', '', ''");
9931 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9933 r = add_signature_entry(hdb, "'iguanodon', 'iguanodon', '', '', '', '', '', '', ''");
9934 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9936 r = add_signature_entry(hdb, "'jobaria', 'jobaria', '', '', '', '', '', '', ''");
9937 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9939 r = add_signature_entry(hdb, "'kakuru', 'kakuru', '', '', '', '', '', '', ''");
9940 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9942 r = add_signature_entry(hdb, "'labocania', 'labocania', '', '', '', '', '', '', ''");
9943 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9945 r = package_from_db(hdb, &hpkg);
9946 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
9948 skip("Not enough rights to perform tests\n");
9949 DeleteFile(msifile);
9952 ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
9954 MsiCloseHandle(hdb);
9956 create_test_file("abelisaurus");
9957 create_test_file("bactrosaurus");
9958 create_test_file("camelotia");
9959 create_test_file("diclonius");
9960 create_test_file("echinodon");
9961 create_test_file("falcarius");
9962 create_test_file("gallimimus");
9963 create_test_file("hagryphus");
9964 CreateDirectoryA("iguanodon", NULL);
9965 CreateDirectoryA("jobaria", NULL);
9966 CreateDirectoryA("kakuru", NULL);
9967 CreateDirectoryA("labocania", NULL);
9968 CreateDirectoryA("megaraptor", NULL);
9969 CreateDirectoryA("neosodon", NULL);
9970 CreateDirectoryA("olorotitan", NULL);
9971 CreateDirectoryA("pantydraco", NULL);
9973 set_component_path("abelisaurus", MSIINSTALLCONTEXT_MACHINE,
9974 "{E3619EED-305A-418C-B9C7-F7D7377F0934}", NULL, FALSE);
9975 set_component_path("bactrosaurus", MSIINSTALLCONTEXT_MACHINE,
9976 "{D56B688D-542F-42Ef-90FD-B6DA76EE8119}", NULL, FALSE);
9977 set_component_path("echinodon", MSIINSTALLCONTEXT_MACHINE,
9978 "{A19E16C5-C75D-4699-8111-C4338C40C3CB}", NULL, FALSE);
9979 set_component_path("falcarius", MSIINSTALLCONTEXT_MACHINE,
9980 "{17762FA1-A7AE-4CC6-8827-62873C35361D}", NULL, FALSE);
9981 set_component_path("iguanodon", MSIINSTALLCONTEXT_MACHINE,
9982 "{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}", NULL, FALSE);
9983 set_component_path("jobaria", MSIINSTALLCONTEXT_MACHINE,
9984 "{243C22B1-8C51-4151-B9D1-1AE5265E079E}", NULL, FALSE);
9985 set_component_path("megaraptor", MSIINSTALLCONTEXT_MACHINE,
9986 "{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}", NULL, FALSE);
9987 set_component_path("neosodon", MSIINSTALLCONTEXT_MACHINE,
9988 "{0B499649-197A-48EF-93D2-AF1C17ED6E90}", NULL, FALSE);
9990 r = MsiDoAction(hpkg, "AppSearch");
9991 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9994 r = MsiGetPropertyA(hpkg, "ABELISAURUS", prop, &size);
9995 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9997 lstrcpyA(expected, CURR_DIR);
9998 lstrcatA(expected, "\\abelisaurus");
9999 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
10000 "Expected %s or empty string, got %s\n", expected, prop);
10003 r = MsiGetPropertyA(hpkg, "BACTROSAURUS", prop, &size);
10004 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10005 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10008 r = MsiGetPropertyA(hpkg, "CAMELOTIA", prop, &size);
10009 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10010 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10013 r = MsiGetPropertyA(hpkg, "DICLONIUS", prop, &size);
10014 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10015 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10018 r = MsiGetPropertyA(hpkg, "ECHINODON", prop, &size);
10019 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10021 lstrcpyA(expected, CURR_DIR);
10022 lstrcatA(expected, "\\");
10023 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
10024 "Expected %s or empty string, got %s\n", expected, prop);
10027 r = MsiGetPropertyA(hpkg, "FALCARIUS", prop, &size);
10028 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10029 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10032 r = MsiGetPropertyA(hpkg, "GALLIMIMUS", prop, &size);
10033 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10034 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10037 r = MsiGetPropertyA(hpkg, "HAGRYPHUS", prop, &size);
10038 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10039 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10042 r = MsiGetPropertyA(hpkg, "IGUANODON", prop, &size);
10043 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10044 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10047 r = MsiGetPropertyA(hpkg, "JOBARIA", prop, &size);
10048 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10049 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10052 r = MsiGetPropertyA(hpkg, "KAKURU", prop, &size);
10053 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10054 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10057 r = MsiGetPropertyA(hpkg, "LABOCANIA", prop, &size);
10058 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10059 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10062 r = MsiGetPropertyA(hpkg, "MEGARAPTOR", prop, &size);
10063 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10065 lstrcpyA(expected, CURR_DIR);
10066 lstrcatA(expected, "\\");
10067 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
10068 "Expected %s or empty string, got %s\n", expected, prop);
10071 r = MsiGetPropertyA(hpkg, "NEOSODON", prop, &size);
10072 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10074 lstrcpyA(expected, CURR_DIR);
10075 lstrcatA(expected, "\\neosodon\\");
10076 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
10077 "Expected %s or empty string, got %s\n", expected, prop);
10080 r = MsiGetPropertyA(hpkg, "OLOROTITAN", prop, &size);
10081 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10082 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10085 r = MsiGetPropertyA(hpkg, "PANTYDRACO", prop, &size);
10086 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10087 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
10089 MsiCloseHandle(hpkg);
10090 DeleteFileA("abelisaurus");
10091 DeleteFileA("bactrosaurus");
10092 DeleteFileA("camelotia");
10093 DeleteFileA("diclonius");
10094 DeleteFileA("echinodon");
10095 DeleteFileA("falcarius");
10096 DeleteFileA("gallimimus");
10097 DeleteFileA("hagryphus");
10098 RemoveDirectoryA("iguanodon");
10099 RemoveDirectoryA("jobaria");
10100 RemoveDirectoryA("kakuru");
10101 RemoveDirectoryA("labocania");
10102 RemoveDirectoryA("megaraptor");
10103 RemoveDirectoryA("neosodon");
10104 RemoveDirectoryA("olorotitan");
10105 RemoveDirectoryA("pantydraco");
10106 delete_component_path("{E3619EED-305A-418C-B9C7-F7D7377F0934}",
10107 MSIINSTALLCONTEXT_MACHINE, NULL);
10108 delete_component_path("{D56B688D-542F-42Ef-90FD-B6DA76EE8119}",
10109 MSIINSTALLCONTEXT_MACHINE, NULL);
10110 delete_component_path("{A19E16C5-C75D-4699-8111-C4338C40C3CB}",
10111 MSIINSTALLCONTEXT_MACHINE, NULL);
10112 delete_component_path("{17762FA1-A7AE-4CC6-8827-62873C35361D}",
10113 MSIINSTALLCONTEXT_MACHINE, NULL);
10114 delete_component_path("{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}",
10115 MSIINSTALLCONTEXT_MACHINE, NULL);
10116 delete_component_path("{243C22B1-8C51-4151-B9D1-1AE5265E079E}",
10117 MSIINSTALLCONTEXT_MACHINE, NULL);
10118 delete_component_path("{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}",
10119 MSIINSTALLCONTEXT_MACHINE, NULL);
10120 delete_component_path("{0B499649-197A-48EF-93D2-AF1C17ED6E90}",
10121 MSIINSTALLCONTEXT_MACHINE, NULL);
10122 DeleteFileA(msifile);
10125 static void set_suminfo_prop(MSIHANDLE db, DWORD prop, DWORD val)
10130 r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
10131 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10133 r = MsiSummaryInfoSetPropertyA(summary, prop, VT_I4, val, NULL, NULL);
10134 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10136 r = MsiSummaryInfoPersist(summary);
10137 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
10139 MsiCloseHandle(summary);
10142 static void test_MsiGetSourcePath(void)
10144 MSIHANDLE hdb, hpkg;
10145 CHAR path[MAX_PATH];
10146 CHAR cwd[MAX_PATH];
10147 CHAR subsrc[MAX_PATH];
10148 CHAR sub2[MAX_PATH];
10152 lstrcpyA(cwd, CURR_DIR);
10153 lstrcatA(cwd, "\\");
10155 lstrcpyA(subsrc, cwd);
10156 lstrcatA(subsrc, "subsource");
10157 lstrcatA(subsrc, "\\");
10159 lstrcpyA(sub2, subsrc);
10160 lstrcatA(sub2, "sub2");
10161 lstrcatA(sub2, "\\");
10163 /* uncompressed source */
10165 hdb = create_package_db();
10166 ok( hdb, "failed to create database\n");
10168 set_suminfo_prop(hdb, PID_WORDCOUNT, 0);
10170 r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
10171 ok(r == S_OK, "failed\n");
10173 r = add_directory_entry(hdb, "'SubDir', 'TARGETDIR', 'subtarget:subsource'");
10174 ok(r == S_OK, "failed\n");
10176 r = add_directory_entry(hdb, "'SubDir2', 'SubDir', 'sub2'");
10177 ok(r == S_OK, "failed\n");
10179 r = MsiDatabaseCommit(hdb);
10180 ok(r == ERROR_SUCCESS , "Failed to commit database\n");
10182 r = package_from_db(hdb, &hpkg);
10183 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
10185 skip("Not enough rights to perform tests\n");
10186 DeleteFile(msifile);
10189 ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
10191 MsiCloseHandle(hdb);
10193 /* invalid database handle */
10195 lstrcpyA(path, "kiwi");
10196 r = MsiGetSourcePath(-1, "TARGETDIR", path, &size);
10197 ok(r == ERROR_INVALID_HANDLE,
10198 "Expected ERROR_INVALID_HANDLE, got %d\n", r);
10199 ok(!lstrcmpA(path, "kiwi"),
10200 "Expected path to be unchanged, got \"%s\"\n", path);
10201 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10203 /* NULL szFolder */
10205 lstrcpyA(path, "kiwi");
10206 r = MsiGetSourcePath(hpkg, NULL, path, &size);
10207 ok(r == ERROR_INVALID_PARAMETER,
10208 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
10209 ok(!lstrcmpA(path, "kiwi"),
10210 "Expected path to be unchanged, got \"%s\"\n", path);
10211 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10213 /* empty szFolder */
10215 lstrcpyA(path, "kiwi");
10216 r = MsiGetSourcePath(hpkg, "", path, &size);
10217 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10218 ok(!lstrcmpA(path, "kiwi"),
10219 "Expected path to be unchanged, got \"%s\"\n", path);
10220 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10222 /* try TARGETDIR */
10224 lstrcpyA(path, "kiwi");
10225 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10226 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10227 ok(!lstrcmpA(path, "kiwi"),
10228 "Expected path to be unchanged, got \"%s\"\n", path);
10229 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10232 lstrcpyA(path, "kiwi");
10233 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
10234 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10235 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10236 ok(size == 0, "Expected 0, got %d\n", size);
10239 lstrcpyA(path, "kiwi");
10240 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10241 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10242 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10243 ok(size == 0, "Expected 0, got %d\n", size);
10245 /* try SourceDir */
10247 lstrcpyA(path, "kiwi");
10248 r = MsiGetSourcePath(hpkg, "SourceDir", 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 /* try SOURCEDIR */
10256 lstrcpyA(path, "kiwi");
10257 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10258 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10259 ok(!lstrcmpA(path, "kiwi"),
10260 "Expected path to be unchanged, got \"%s\"\n", path);
10261 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10263 /* source path does not exist, but the property exists */
10265 lstrcpyA(path, "kiwi");
10266 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
10267 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10268 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10269 ok(size == 0, "Expected 0, got %d\n", size);
10272 lstrcpyA(path, "kiwi");
10273 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10274 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10275 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10276 ok(size == 0, "Expected 0, got %d\n", size);
10280 lstrcpyA(path, "kiwi");
10281 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10282 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10283 ok(!lstrcmpA(path, "kiwi"),
10284 "Expected path to be unchanged, got \"%s\"\n", path);
10285 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10289 lstrcpyA(path, "kiwi");
10290 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10291 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10292 ok(!lstrcmpA(path, "kiwi"),
10293 "Expected path to be unchanged, got \"%s\"\n", path);
10294 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10296 r = MsiDoAction(hpkg, "CostInitialize");
10297 ok(r == ERROR_SUCCESS, "cost init failed\n");
10299 /* try TARGETDIR after CostInitialize */
10301 lstrcpyA(path, "kiwi");
10302 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10303 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10304 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10305 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10307 /* try SourceDir after CostInitialize */
10309 lstrcpyA(path, "kiwi");
10310 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10311 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10312 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10313 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10315 /* try SOURCEDIR after CostInitialize */
10317 lstrcpyA(path, "kiwi");
10318 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10319 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10320 ok(!lstrcmpA(path, "kiwi"),
10321 "Expected path to be unchanged, got \"%s\"\n", path);
10322 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10324 /* source path does not exist, but the property exists */
10326 lstrcpyA(path, "kiwi");
10327 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10328 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10331 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10332 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10335 /* try SubDir after CostInitialize */
10337 lstrcpyA(path, "kiwi");
10338 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10339 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10340 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10341 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10343 /* try SubDir2 after CostInitialize */
10345 lstrcpyA(path, "kiwi");
10346 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10347 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10348 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
10349 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
10351 r = MsiDoAction(hpkg, "ResolveSource");
10352 ok(r == ERROR_SUCCESS, "file cost failed\n");
10354 /* try TARGETDIR after ResolveSource */
10356 lstrcpyA(path, "kiwi");
10357 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10358 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10359 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10360 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10362 /* try SourceDir after ResolveSource */
10364 lstrcpyA(path, "kiwi");
10365 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10366 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10367 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10368 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10370 /* try SOURCEDIR after ResolveSource */
10372 lstrcpyA(path, "kiwi");
10373 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10374 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10375 ok(!lstrcmpA(path, "kiwi"),
10376 "Expected path to be unchanged, got \"%s\"\n", path);
10377 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10379 /* source path does not exist, but the property exists */
10381 lstrcpyA(path, "kiwi");
10382 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10383 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10384 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10385 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10387 /* try SubDir after ResolveSource */
10389 lstrcpyA(path, "kiwi");
10390 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10391 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10392 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10393 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10395 /* try SubDir2 after ResolveSource */
10397 lstrcpyA(path, "kiwi");
10398 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10399 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10400 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
10401 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
10403 r = MsiDoAction(hpkg, "FileCost");
10404 ok(r == ERROR_SUCCESS, "file cost failed\n");
10406 /* try TARGETDIR after FileCost */
10408 lstrcpyA(path, "kiwi");
10409 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10410 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10411 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10412 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10414 /* try SourceDir after FileCost */
10416 lstrcpyA(path, "kiwi");
10417 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10418 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10419 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10420 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10422 /* try SOURCEDIR after FileCost */
10424 lstrcpyA(path, "kiwi");
10425 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10426 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10427 ok(!lstrcmpA(path, "kiwi"),
10428 "Expected path to be unchanged, got \"%s\"\n", path);
10429 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10431 /* source path does not exist, but the property exists */
10433 lstrcpyA(path, "kiwi");
10434 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10435 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10436 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10437 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10439 /* try SubDir after FileCost */
10441 lstrcpyA(path, "kiwi");
10442 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10443 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10444 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10445 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10447 /* try SubDir2 after FileCost */
10449 lstrcpyA(path, "kiwi");
10450 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10451 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10452 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
10453 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
10455 r = MsiDoAction(hpkg, "CostFinalize");
10456 ok(r == ERROR_SUCCESS, "file cost failed\n");
10458 /* try TARGETDIR after CostFinalize */
10460 lstrcpyA(path, "kiwi");
10461 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10462 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10463 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10464 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10466 /* try SourceDir after CostFinalize */
10468 lstrcpyA(path, "kiwi");
10469 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10470 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10471 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10472 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10474 /* try SOURCEDIR after CostFinalize */
10476 lstrcpyA(path, "kiwi");
10477 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10478 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10479 ok(!lstrcmpA(path, "kiwi"),
10480 "Expected path to be unchanged, got \"%s\"\n", path);
10481 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10483 /* source path does not exist, but the property exists */
10485 lstrcpyA(path, "kiwi");
10486 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10487 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10488 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10489 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10491 /* try SubDir after CostFinalize */
10493 lstrcpyA(path, "kiwi");
10494 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10495 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10496 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10497 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10499 /* try SubDir2 after CostFinalize */
10501 lstrcpyA(path, "kiwi");
10502 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10503 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10504 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
10505 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
10507 /* nonexistent directory */
10509 lstrcpyA(path, "kiwi");
10510 r = MsiGetSourcePath(hpkg, "IDontExist", path, &size);
10511 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10512 ok(!lstrcmpA(path, "kiwi"),
10513 "Expected path to be unchanged, got \"%s\"\n", path);
10514 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10516 /* NULL szPathBuf */
10518 r = MsiGetSourcePath(hpkg, "SourceDir", NULL, &size);
10519 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10520 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10522 /* NULL pcchPathBuf */
10523 lstrcpyA(path, "kiwi");
10524 r = MsiGetSourcePath(hpkg, "SourceDir", path, NULL);
10525 ok(r == ERROR_INVALID_PARAMETER,
10526 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
10527 ok(!lstrcmpA(path, "kiwi"),
10528 "Expected path to be unchanged, got \"%s\"\n", path);
10530 /* pcchPathBuf is 0 */
10532 lstrcpyA(path, "kiwi");
10533 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10534 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
10535 ok(!lstrcmpA(path, "kiwi"),
10536 "Expected path to be unchanged, got \"%s\"\n", path);
10537 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10539 /* pcchPathBuf does not have room for NULL terminator */
10540 size = lstrlenA(cwd);
10541 lstrcpyA(path, "kiwi");
10542 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10543 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
10544 ok(!strncmp(path, cwd, lstrlenA(cwd) - 1),
10545 "Expected path with no backslash, got \"%s\"\n", path);
10546 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10548 /* pcchPathBuf has room for NULL terminator */
10549 size = lstrlenA(cwd) + 1;
10550 lstrcpyA(path, "kiwi");
10551 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10552 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10553 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10554 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10556 /* remove property */
10557 r = MsiSetProperty(hpkg, "SourceDir", NULL);
10558 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10560 /* try SourceDir again */
10562 lstrcpyA(path, "kiwi");
10563 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10564 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10565 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10566 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10568 /* set property to a valid directory */
10569 r = MsiSetProperty(hpkg, "SOURCEDIR", cwd);
10570 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10572 /* try SOURCEDIR again */
10574 lstrcpyA(path, "kiwi");
10575 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10576 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10577 ok(!lstrcmpA(path, "kiwi"),
10578 "Expected path to be unchanged, got \"%s\"\n", path);
10579 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10581 MsiCloseHandle(hpkg);
10583 /* compressed source */
10585 r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
10586 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10588 set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeCompressed);
10590 r = package_from_db(hdb, &hpkg);
10591 ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
10593 /* try TARGETDIR */
10595 lstrcpyA(path, "kiwi");
10596 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10597 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10598 ok(!lstrcmpA(path, "kiwi"),
10599 "Expected path to be unchanged, got \"%s\"\n", path);
10600 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10602 /* try SourceDir */
10604 lstrcpyA(path, "kiwi");
10605 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10606 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10607 ok(!lstrcmpA(path, "kiwi"),
10608 "Expected path to be unchanged, got \"%s\"\n", path);
10609 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10611 /* try SOURCEDIR */
10613 lstrcpyA(path, "kiwi");
10614 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10615 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10616 ok(!lstrcmpA(path, "kiwi"),
10617 "Expected path to be unchanged, got \"%s\"\n", path);
10618 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10620 /* source path nor the property exist */
10622 lstrcpyA(path, "kiwi");
10623 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10624 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10625 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
10626 ok(size == 0, "Expected 0, got %d\n", size);
10630 lstrcpyA(path, "kiwi");
10631 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10632 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10633 ok(!lstrcmpA(path, "kiwi"),
10634 "Expected path to be unchanged, got \"%s\"\n", path);
10635 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10639 lstrcpyA(path, "kiwi");
10640 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10641 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
10642 ok(!lstrcmpA(path, "kiwi"),
10643 "Expected path to be unchanged, got \"%s\"\n", path);
10644 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
10646 r = MsiDoAction(hpkg, "CostInitialize");
10647 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10649 /* try TARGETDIR after CostInitialize */
10651 lstrcpyA(path, "kiwi");
10652 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10653 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10654 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10655 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10657 /* try SourceDir after CostInitialize */
10659 lstrcpyA(path, "kiwi");
10660 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10661 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10662 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10663 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10665 /* try SOURCEDIR after CostInitialize */
10667 lstrcpyA(path, "kiwi");
10668 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10671 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10672 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10673 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10676 /* source path does not exist, but the property exists */
10678 lstrcpyA(path, "kiwi");
10679 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10680 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10683 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10684 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10687 /* try SubDir after CostInitialize */
10689 lstrcpyA(path, "kiwi");
10690 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10691 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10692 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10693 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10695 /* try SubDir2 after CostInitialize */
10697 lstrcpyA(path, "kiwi");
10698 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10699 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10700 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10701 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10703 r = MsiDoAction(hpkg, "ResolveSource");
10704 ok(r == ERROR_SUCCESS, "file cost failed\n");
10706 /* try TARGETDIR after ResolveSource */
10708 lstrcpyA(path, "kiwi");
10709 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10710 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10711 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10712 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10714 /* try SourceDir after ResolveSource */
10716 lstrcpyA(path, "kiwi");
10717 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10718 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10719 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10720 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10722 /* try SOURCEDIR after ResolveSource */
10724 lstrcpyA(path, "kiwi");
10725 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10728 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10729 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10730 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10733 /* source path and the property exist */
10735 lstrcpyA(path, "kiwi");
10736 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10737 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10738 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10739 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10741 /* try SubDir after ResolveSource */
10743 lstrcpyA(path, "kiwi");
10744 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10745 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10746 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10747 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10749 /* try SubDir2 after ResolveSource */
10751 lstrcpyA(path, "kiwi");
10752 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10753 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10754 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10755 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10757 r = MsiDoAction(hpkg, "FileCost");
10758 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10760 /* try TARGETDIR after CostFinalize */
10762 lstrcpyA(path, "kiwi");
10763 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10764 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10765 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10766 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10768 /* try SourceDir after CostFinalize */
10770 lstrcpyA(path, "kiwi");
10771 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10772 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10773 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10774 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10776 /* try SOURCEDIR after CostFinalize */
10778 lstrcpyA(path, "kiwi");
10779 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10782 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10783 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10784 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10787 /* source path and the property exist */
10789 lstrcpyA(path, "kiwi");
10790 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10791 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10792 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10793 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10795 /* try SubDir after CostFinalize */
10797 lstrcpyA(path, "kiwi");
10798 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10799 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10800 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10801 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10803 /* try SubDir2 after CostFinalize */
10805 lstrcpyA(path, "kiwi");
10806 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10807 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10808 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10809 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10811 r = MsiDoAction(hpkg, "CostFinalize");
10812 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10814 /* try TARGETDIR after CostFinalize */
10816 lstrcpyA(path, "kiwi");
10817 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
10818 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10819 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10820 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10822 /* try SourceDir after CostFinalize */
10824 lstrcpyA(path, "kiwi");
10825 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
10826 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10827 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10828 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10830 /* try SOURCEDIR after CostFinalize */
10832 lstrcpyA(path, "kiwi");
10833 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
10836 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10837 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10838 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10841 /* source path and the property exist */
10843 lstrcpyA(path, "kiwi");
10844 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
10845 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10846 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10847 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10849 /* try SubDir after CostFinalize */
10851 lstrcpyA(path, "kiwi");
10852 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10853 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10854 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10855 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10857 /* try SubDir2 after CostFinalize */
10859 lstrcpyA(path, "kiwi");
10860 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10861 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10862 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
10863 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
10865 MsiCloseHandle(hpkg);
10866 DeleteFile(msifile);
10869 static void test_shortlongsource(void)
10871 MSIHANDLE hdb, hpkg;
10872 CHAR path[MAX_PATH];
10873 CHAR cwd[MAX_PATH];
10874 CHAR subsrc[MAX_PATH];
10878 lstrcpyA(cwd, CURR_DIR);
10879 lstrcatA(cwd, "\\");
10881 lstrcpyA(subsrc, cwd);
10882 lstrcatA(subsrc, "long");
10883 lstrcatA(subsrc, "\\");
10885 /* long file names */
10887 hdb = create_package_db();
10888 ok( hdb, "failed to create database\n");
10890 set_suminfo_prop(hdb, PID_WORDCOUNT, 0);
10892 r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
10893 ok(r == S_OK, "failed\n");
10895 r = add_directory_entry(hdb, "'SubDir', 'TARGETDIR', 'short|long'");
10896 ok(r == S_OK, "failed\n");
10898 /* CostInitialize:short */
10899 r = add_directory_entry(hdb, "'SubDir2', 'TARGETDIR', 'one|two'");
10900 ok(r == S_OK, "failed\n");
10902 /* CostInitialize:long */
10903 r = add_directory_entry(hdb, "'SubDir3', 'TARGETDIR', 'three|four'");
10904 ok(r == S_OK, "failed\n");
10906 /* FileCost:short */
10907 r = add_directory_entry(hdb, "'SubDir4', 'TARGETDIR', 'five|six'");
10908 ok(r == S_OK, "failed\n");
10910 /* FileCost:long */
10911 r = add_directory_entry(hdb, "'SubDir5', 'TARGETDIR', 'seven|eight'");
10912 ok(r == S_OK, "failed\n");
10914 /* CostFinalize:short */
10915 r = add_directory_entry(hdb, "'SubDir6', 'TARGETDIR', 'nine|ten'");
10916 ok(r == S_OK, "failed\n");
10918 /* CostFinalize:long */
10919 r = add_directory_entry(hdb, "'SubDir7', 'TARGETDIR', 'eleven|twelve'");
10920 ok(r == S_OK, "failed\n");
10922 MsiDatabaseCommit(hdb);
10924 r = package_from_db(hdb, &hpkg);
10925 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
10927 skip("Not enough rights to perform tests\n");
10928 DeleteFile(msifile);
10931 ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
10933 MsiCloseHandle(hdb);
10935 CreateDirectoryA("one", NULL);
10936 CreateDirectoryA("four", NULL);
10938 r = MsiDoAction(hpkg, "CostInitialize");
10939 ok(r == ERROR_SUCCESS, "file cost failed\n");
10941 CreateDirectory("five", NULL);
10942 CreateDirectory("eight", NULL);
10944 r = MsiDoAction(hpkg, "FileCost");
10945 ok(r == ERROR_SUCCESS, "file cost failed\n");
10947 CreateDirectory("nine", NULL);
10948 CreateDirectory("twelve", NULL);
10950 r = MsiDoAction(hpkg, "CostFinalize");
10951 ok(r == ERROR_SUCCESS, "file cost failed\n");
10953 /* neither short nor long source directories exist */
10955 lstrcpyA(path, "kiwi");
10956 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10957 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10958 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10959 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10961 CreateDirectoryA("short", NULL);
10963 /* short source directory exists */
10965 lstrcpyA(path, "kiwi");
10966 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10967 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10968 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10969 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10971 CreateDirectoryA("long", NULL);
10973 /* both short and long source directories exist */
10975 lstrcpyA(path, "kiwi");
10976 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
10977 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10978 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10979 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10981 lstrcpyA(subsrc, cwd);
10982 lstrcatA(subsrc, "two");
10983 lstrcatA(subsrc, "\\");
10985 /* short dir exists before CostInitialize */
10987 lstrcpyA(path, "kiwi");
10988 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
10989 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
10990 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
10991 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
10993 lstrcpyA(subsrc, cwd);
10994 lstrcatA(subsrc, "four");
10995 lstrcatA(subsrc, "\\");
10997 /* long dir exists before CostInitialize */
10999 lstrcpyA(path, "kiwi");
11000 r = MsiGetSourcePath(hpkg, "SubDir3", path, &size);
11001 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11002 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11003 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11005 lstrcpyA(subsrc, cwd);
11006 lstrcatA(subsrc, "six");
11007 lstrcatA(subsrc, "\\");
11009 /* short dir exists before FileCost */
11011 lstrcpyA(path, "kiwi");
11012 r = MsiGetSourcePath(hpkg, "SubDir4", path, &size);
11013 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11014 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11015 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11017 lstrcpyA(subsrc, cwd);
11018 lstrcatA(subsrc, "eight");
11019 lstrcatA(subsrc, "\\");
11021 /* long dir exists before FileCost */
11023 lstrcpyA(path, "kiwi");
11024 r = MsiGetSourcePath(hpkg, "SubDir5", path, &size);
11025 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11026 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11027 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11029 lstrcpyA(subsrc, cwd);
11030 lstrcatA(subsrc, "ten");
11031 lstrcatA(subsrc, "\\");
11033 /* short dir exists before CostFinalize */
11035 lstrcpyA(path, "kiwi");
11036 r = MsiGetSourcePath(hpkg, "SubDir6", path, &size);
11037 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11038 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11039 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11041 lstrcpyA(subsrc, cwd);
11042 lstrcatA(subsrc, "twelve");
11043 lstrcatA(subsrc, "\\");
11045 /* long dir exists before CostFinalize */
11047 lstrcpyA(path, "kiwi");
11048 r = MsiGetSourcePath(hpkg, "SubDir7", path, &size);
11049 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11050 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11051 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11053 MsiCloseHandle(hpkg);
11054 RemoveDirectoryA("short");
11055 RemoveDirectoryA("long");
11056 RemoveDirectoryA("one");
11057 RemoveDirectoryA("four");
11058 RemoveDirectoryA("five");
11059 RemoveDirectoryA("eight");
11060 RemoveDirectoryA("nine");
11061 RemoveDirectoryA("twelve");
11063 /* short file names */
11065 r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
11066 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11068 set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeSFN);
11070 r = package_from_db(hdb, &hpkg);
11071 ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
11073 MsiCloseHandle(hdb);
11075 CreateDirectoryA("one", NULL);
11076 CreateDirectoryA("four", NULL);
11078 r = MsiDoAction(hpkg, "CostInitialize");
11079 ok(r == ERROR_SUCCESS, "file cost failed\n");
11081 CreateDirectory("five", NULL);
11082 CreateDirectory("eight", NULL);
11084 r = MsiDoAction(hpkg, "FileCost");
11085 ok(r == ERROR_SUCCESS, "file cost failed\n");
11087 CreateDirectory("nine", NULL);
11088 CreateDirectory("twelve", NULL);
11090 r = MsiDoAction(hpkg, "CostFinalize");
11091 ok(r == ERROR_SUCCESS, "file cost failed\n");
11093 lstrcpyA(subsrc, cwd);
11094 lstrcatA(subsrc, "short");
11095 lstrcatA(subsrc, "\\");
11097 /* neither short nor long source directories exist */
11099 lstrcpyA(path, "kiwi");
11100 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11101 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11102 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11103 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11105 CreateDirectoryA("short", NULL);
11107 /* short source directory exists */
11109 lstrcpyA(path, "kiwi");
11110 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11111 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11112 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11113 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11115 CreateDirectoryA("long", NULL);
11117 /* both short and long source directories exist */
11119 lstrcpyA(path, "kiwi");
11120 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
11121 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11122 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11123 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11125 lstrcpyA(subsrc, cwd);
11126 lstrcatA(subsrc, "one");
11127 lstrcatA(subsrc, "\\");
11129 /* short dir exists before CostInitialize */
11131 lstrcpyA(path, "kiwi");
11132 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
11133 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11134 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11135 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11137 lstrcpyA(subsrc, cwd);
11138 lstrcatA(subsrc, "three");
11139 lstrcatA(subsrc, "\\");
11141 /* long dir exists before CostInitialize */
11143 lstrcpyA(path, "kiwi");
11144 r = MsiGetSourcePath(hpkg, "SubDir3", path, &size);
11145 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11146 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11147 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11149 lstrcpyA(subsrc, cwd);
11150 lstrcatA(subsrc, "five");
11151 lstrcatA(subsrc, "\\");
11153 /* short dir exists before FileCost */
11155 lstrcpyA(path, "kiwi");
11156 r = MsiGetSourcePath(hpkg, "SubDir4", path, &size);
11157 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11158 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11159 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11161 lstrcpyA(subsrc, cwd);
11162 lstrcatA(subsrc, "seven");
11163 lstrcatA(subsrc, "\\");
11165 /* long dir exists before FileCost */
11167 lstrcpyA(path, "kiwi");
11168 r = MsiGetSourcePath(hpkg, "SubDir5", path, &size);
11169 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11170 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11171 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11173 lstrcpyA(subsrc, cwd);
11174 lstrcatA(subsrc, "nine");
11175 lstrcatA(subsrc, "\\");
11177 /* short dir exists before CostFinalize */
11179 lstrcpyA(path, "kiwi");
11180 r = MsiGetSourcePath(hpkg, "SubDir6", path, &size);
11181 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11182 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11183 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11185 lstrcpyA(subsrc, cwd);
11186 lstrcatA(subsrc, "eleven");
11187 lstrcatA(subsrc, "\\");
11189 /* long dir exists before CostFinalize */
11191 lstrcpyA(path, "kiwi");
11192 r = MsiGetSourcePath(hpkg, "SubDir7", path, &size);
11193 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11194 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
11195 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
11197 MsiCloseHandle(hpkg);
11198 RemoveDirectoryA("short");
11199 RemoveDirectoryA("long");
11200 RemoveDirectoryA("one");
11201 RemoveDirectoryA("four");
11202 RemoveDirectoryA("five");
11203 RemoveDirectoryA("eight");
11204 RemoveDirectoryA("nine");
11205 RemoveDirectoryA("twelve");
11206 DeleteFileA(msifile);
11209 static void test_sourcedir(void)
11211 MSIHANDLE hdb, hpkg;
11213 CHAR path[MAX_PATH];
11214 CHAR cwd[MAX_PATH];
11215 CHAR subsrc[MAX_PATH];
11219 lstrcpyA(cwd, CURR_DIR);
11220 lstrcatA(cwd, "\\");
11222 lstrcpyA(subsrc, cwd);
11223 lstrcatA(subsrc, "long");
11224 lstrcatA(subsrc, "\\");
11226 hdb = create_package_db();
11227 ok( hdb, "failed to create database\n");
11229 r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
11230 ok(r == S_OK, "failed\n");
11232 sprintf(package, "#%u", hdb);
11233 r = MsiOpenPackage(package, &hpkg);
11234 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
11236 skip("Not enough rights to perform tests\n");
11239 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11241 /* properties only */
11243 /* SourceDir prop */
11245 lstrcpyA(path, "kiwi");
11246 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11247 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11248 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11249 ok(size == 0, "Expected 0, got %d\n", size);
11251 /* SOURCEDIR prop */
11253 lstrcpyA(path, "kiwi");
11254 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11255 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11256 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11257 ok(size == 0, "Expected 0, got %d\n", size);
11259 r = MsiDoAction(hpkg, "CostInitialize");
11260 ok(r == ERROR_SUCCESS, "file cost failed\n");
11262 /* SourceDir after CostInitialize */
11264 lstrcpyA(path, "kiwi");
11265 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11266 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11267 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11268 ok(size == 0, "Expected 0, got %d\n", size);
11270 /* SOURCEDIR after CostInitialize */
11272 lstrcpyA(path, "kiwi");
11273 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11274 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11275 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11276 ok(size == 0, "Expected 0, got %d\n", size);
11278 r = MsiDoAction(hpkg, "FileCost");
11279 ok(r == ERROR_SUCCESS, "file cost failed\n");
11281 /* SourceDir after FileCost */
11283 lstrcpyA(path, "kiwi");
11284 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11285 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11286 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11287 ok(size == 0, "Expected 0, got %d\n", size);
11289 /* SOURCEDIR after FileCost */
11291 lstrcpyA(path, "kiwi");
11292 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11293 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11294 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11295 ok(size == 0, "Expected 0, got %d\n", size);
11297 r = MsiDoAction(hpkg, "CostFinalize");
11298 ok(r == ERROR_SUCCESS, "file cost failed\n");
11300 /* SourceDir after CostFinalize */
11302 lstrcpyA(path, "kiwi");
11303 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11304 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11305 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11306 ok(size == 0, "Expected 0, got %d\n", size);
11308 /* SOURCEDIR after CostFinalize */
11310 lstrcpyA(path, "kiwi");
11311 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11312 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11313 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11314 ok(size == 0, "Expected 0, got %d\n", size);
11316 r = MsiDoAction(hpkg, "ResolveSource");
11317 ok(r == ERROR_SUCCESS, "file cost failed\n");
11319 /* SourceDir after ResolveSource */
11321 lstrcpyA(path, "kiwi");
11322 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11323 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11324 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11325 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11327 /* SOURCEDIR after ResolveSource */
11329 lstrcpyA(path, "kiwi");
11330 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11331 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11332 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11333 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11335 /* random casing */
11337 lstrcpyA(path, "kiwi");
11338 r = MsiGetProperty(hpkg, "SoUrCeDiR", path, &size);
11339 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11340 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11341 ok(size == 0, "Expected 0, got %d\n", size);
11343 MsiCloseHandle(hpkg);
11345 /* reset the package state */
11346 sprintf(package, "#%i", hdb);
11347 r = MsiOpenPackage(package, &hpkg);
11348 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11350 /* test how MsiGetSourcePath affects the properties */
11352 /* SourceDir prop */
11354 lstrcpyA(path, "kiwi");
11355 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11356 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11359 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11360 ok(size == 0, "Expected 0, got %d\n", size);
11364 lstrcpyA(path, "kiwi");
11365 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11366 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11367 ok(!lstrcmpA(path, "kiwi"),
11368 "Expected path to be unchanged, got \"%s\"\n", path);
11369 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11371 /* SourceDir after MsiGetSourcePath */
11373 lstrcpyA(path, "kiwi");
11374 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11375 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11378 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11379 ok(size == 0, "Expected 0, got %d\n", size);
11382 /* SOURCEDIR prop */
11384 lstrcpyA(path, "kiwi");
11385 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11386 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11389 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11390 ok(size == 0, "Expected 0, got %d\n", size);
11394 lstrcpyA(path, "kiwi");
11395 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11396 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11397 ok(!lstrcmpA(path, "kiwi"),
11398 "Expected path to be unchanged, got \"%s\"\n", path);
11399 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11401 /* SOURCEDIR prop after MsiGetSourcePath */
11403 lstrcpyA(path, "kiwi");
11404 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11405 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11408 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11409 ok(size == 0, "Expected 0, got %d\n", size);
11412 r = MsiDoAction(hpkg, "CostInitialize");
11413 ok(r == ERROR_SUCCESS, "file cost failed\n");
11415 /* SourceDir after CostInitialize */
11417 lstrcpyA(path, "kiwi");
11418 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11419 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11422 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
11423 ok(size == 0, "Expected 0, got %d\n", size);
11427 lstrcpyA(path, "kiwi");
11428 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
11429 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11430 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11431 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11433 /* SourceDir after MsiGetSourcePath */
11435 lstrcpyA(path, "kiwi");
11436 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11437 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11438 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11439 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11441 /* SOURCEDIR after CostInitialize */
11443 lstrcpyA(path, "kiwi");
11444 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11445 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11446 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11447 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11449 /* SOURCEDIR source path still does not exist */
11451 lstrcpyA(path, "kiwi");
11452 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11453 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11454 ok(!lstrcmpA(path, "kiwi"),
11455 "Expected path to be unchanged, got \"%s\"\n", path);
11456 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11458 r = MsiDoAction(hpkg, "FileCost");
11459 ok(r == ERROR_SUCCESS, "file cost failed\n");
11461 /* SourceDir after FileCost */
11463 lstrcpyA(path, "kiwi");
11464 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11465 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11466 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11467 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11469 /* SOURCEDIR after FileCost */
11471 lstrcpyA(path, "kiwi");
11472 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11473 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11474 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11475 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11477 /* SOURCEDIR source path still does not exist */
11479 lstrcpyA(path, "kiwi");
11480 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11481 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11482 ok(!lstrcmpA(path, "kiwi"),
11483 "Expected path to be unchanged, got \"%s\"\n", path);
11484 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11486 r = MsiDoAction(hpkg, "CostFinalize");
11487 ok(r == ERROR_SUCCESS, "file cost failed\n");
11489 /* SourceDir after CostFinalize */
11491 lstrcpyA(path, "kiwi");
11492 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11493 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11494 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11495 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11497 /* SOURCEDIR after CostFinalize */
11499 lstrcpyA(path, "kiwi");
11500 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11501 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11502 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11503 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11505 /* SOURCEDIR source path still does not exist */
11507 lstrcpyA(path, "kiwi");
11508 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11509 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11510 ok(!lstrcmpA(path, "kiwi"),
11511 "Expected path to be unchanged, got \"%s\"\n", path);
11512 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11514 r = MsiDoAction(hpkg, "ResolveSource");
11515 ok(r == ERROR_SUCCESS, "file cost failed\n");
11517 /* SourceDir after ResolveSource */
11519 lstrcpyA(path, "kiwi");
11520 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
11521 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11522 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11523 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11525 /* SOURCEDIR after ResolveSource */
11527 lstrcpyA(path, "kiwi");
11528 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
11529 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11530 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
11531 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
11533 /* SOURCEDIR source path still does not exist */
11535 lstrcpyA(path, "kiwi");
11536 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
11537 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
11538 ok(!lstrcmpA(path, "kiwi"),
11539 "Expected path to be unchanged, got \"%s\"\n", path);
11540 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11542 MsiCloseHandle(hpkg);
11545 MsiCloseHandle(hdb);
11546 DeleteFileA(msifile);
11556 static const struct access_res create[16] =
11558 { TRUE, ERROR_SUCCESS, TRUE },
11559 { TRUE, ERROR_SUCCESS, TRUE },
11560 { TRUE, ERROR_SUCCESS, FALSE },
11561 { TRUE, ERROR_SUCCESS, FALSE },
11562 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11563 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11564 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11565 { TRUE, ERROR_SUCCESS, FALSE },
11566 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11567 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11568 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11569 { TRUE, ERROR_SUCCESS, TRUE },
11570 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11571 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11572 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11573 { TRUE, ERROR_SUCCESS, TRUE }
11576 static const struct access_res create_commit[16] =
11578 { TRUE, ERROR_SUCCESS, TRUE },
11579 { TRUE, ERROR_SUCCESS, TRUE },
11580 { TRUE, ERROR_SUCCESS, FALSE },
11581 { TRUE, ERROR_SUCCESS, FALSE },
11582 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11583 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11584 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11585 { TRUE, ERROR_SUCCESS, FALSE },
11586 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11587 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11588 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11589 { TRUE, ERROR_SUCCESS, TRUE },
11590 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11591 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11592 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
11593 { TRUE, ERROR_SUCCESS, TRUE }
11596 static const struct access_res create_close[16] =
11598 { TRUE, ERROR_SUCCESS, FALSE },
11599 { TRUE, ERROR_SUCCESS, FALSE },
11600 { TRUE, ERROR_SUCCESS, FALSE },
11601 { TRUE, ERROR_SUCCESS, FALSE },
11602 { TRUE, ERROR_SUCCESS, FALSE },
11603 { TRUE, ERROR_SUCCESS, FALSE },
11604 { TRUE, ERROR_SUCCESS, FALSE },
11605 { TRUE, ERROR_SUCCESS, FALSE },
11606 { TRUE, ERROR_SUCCESS, FALSE },
11607 { TRUE, ERROR_SUCCESS, FALSE },
11608 { TRUE, ERROR_SUCCESS, FALSE },
11609 { TRUE, ERROR_SUCCESS, FALSE },
11610 { TRUE, ERROR_SUCCESS, FALSE },
11611 { TRUE, ERROR_SUCCESS, FALSE },
11612 { TRUE, ERROR_SUCCESS, FALSE },
11613 { TRUE, ERROR_SUCCESS }
11616 static void _test_file_access(LPCSTR file, const struct access_res *ares, DWORD line)
11618 DWORD access = 0, share = 0;
11623 for (i = 0; i < 4; i++)
11625 if (i == 0) access = 0;
11626 if (i == 1) access = GENERIC_READ;
11627 if (i == 2) access = GENERIC_WRITE;
11628 if (i == 3) access = GENERIC_READ | GENERIC_WRITE;
11630 for (j = 0; j < 4; j++)
11632 if (ares[idx].ignore)
11635 if (j == 0) share = 0;
11636 if (j == 1) share = FILE_SHARE_READ;
11637 if (j == 2) share = FILE_SHARE_WRITE;
11638 if (j == 3) share = FILE_SHARE_READ | FILE_SHARE_WRITE;
11640 SetLastError(0xdeadbeef);
11641 hfile = CreateFileA(file, access, share, NULL, OPEN_EXISTING,
11642 FILE_ATTRIBUTE_NORMAL, 0);
11643 lasterr = GetLastError();
11645 ok((hfile != INVALID_HANDLE_VALUE) == ares[idx].gothandle,
11646 "(%d, handle, %d): Expected %d, got %d\n",
11647 line, idx, ares[idx].gothandle,
11648 (hfile != INVALID_HANDLE_VALUE));
11650 ok(lasterr == ares[idx].lasterr ||
11651 lasterr == 0xdeadbeef, /* win9x */
11652 "(%d, lasterr, %d): Expected %d, got %d\n",
11653 line, idx, ares[idx].lasterr, lasterr);
11655 CloseHandle(hfile);
11661 #define test_file_access(file, ares) _test_file_access(file, ares, __LINE__)
11663 static void test_access(void)
11668 r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
11669 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11671 test_file_access(msifile, create);
11673 r = MsiDatabaseCommit(hdb);
11674 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11676 test_file_access(msifile, create_commit);
11678 MsiCloseHandle(hdb);
11680 test_file_access(msifile, create_close);
11682 DeleteFileA(msifile);
11684 r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATEDIRECT, &hdb);
11685 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11687 test_file_access(msifile, create);
11689 r = MsiDatabaseCommit(hdb);
11690 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11692 test_file_access(msifile, create_commit);
11694 MsiCloseHandle(hdb);
11696 test_file_access(msifile, create_close);
11698 DeleteFileA(msifile);
11701 static void test_emptypackage(void)
11703 MSIHANDLE hpkg = 0, hdb = 0, hsuminfo = 0;
11704 MSIHANDLE hview = 0, hrec = 0;
11705 MSICONDITION condition;
11706 CHAR buffer[MAX_PATH];
11710 r = MsiOpenPackageA("", &hpkg);
11711 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
11713 skip("Not enough rights to perform tests\n");
11718 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11721 hdb = MsiGetActiveDatabase(hpkg);
11724 ok(hdb != 0, "Expected a valid database handle\n");
11727 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Tables`", &hview);
11730 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11732 r = MsiViewExecute(hview, 0);
11735 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11738 r = MsiViewFetch(hview, &hrec);
11741 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11746 r = MsiRecordGetString(hrec, 1, buffer, &size);
11749 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11750 ok(!lstrcmpA(buffer, "_Property"),
11751 "Expected \"_Property\", got \"%s\"\n", buffer);
11754 MsiCloseHandle(hrec);
11756 r = MsiViewFetch(hview, &hrec);
11759 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11763 r = MsiRecordGetString(hrec, 1, buffer, &size);
11766 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11767 ok(!lstrcmpA(buffer, "#_FolderCache"),
11768 "Expected \"_Property\", got \"%s\"\n", buffer);
11771 MsiCloseHandle(hrec);
11772 MsiViewClose(hview);
11773 MsiCloseHandle(hview);
11775 condition = MsiDatabaseIsTablePersistentA(hdb, "_Property");
11778 ok(condition == MSICONDITION_FALSE,
11779 "Expected MSICONDITION_FALSE, got %d\n", condition);
11782 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Property`", &hview);
11785 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11787 r = MsiViewExecute(hview, 0);
11790 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11793 /* _Property table is not empty */
11794 r = MsiViewFetch(hview, &hrec);
11797 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11800 MsiCloseHandle(hrec);
11801 MsiViewClose(hview);
11802 MsiCloseHandle(hview);
11804 condition = MsiDatabaseIsTablePersistentA(hdb, "#_FolderCache");
11807 ok(condition == MSICONDITION_FALSE,
11808 "Expected MSICONDITION_FALSE, got %d\n", condition);
11811 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `#_FolderCache`", &hview);
11814 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11816 r = MsiViewExecute(hview, 0);
11819 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11822 /* #_FolderCache is not empty */
11823 r = MsiViewFetch(hview, &hrec);
11826 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11829 MsiCloseHandle(hrec);
11830 MsiViewClose(hview);
11831 MsiCloseHandle(hview);
11833 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Streams`", &hview);
11836 ok(r == ERROR_BAD_QUERY_SYNTAX,
11837 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
11840 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Storages`", &hview);
11843 ok(r == ERROR_BAD_QUERY_SYNTAX,
11844 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
11847 r = MsiGetSummaryInformationA(hdb, NULL, 0, &hsuminfo);
11850 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
11851 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
11854 MsiCloseHandle(hsuminfo);
11856 r = MsiDatabaseCommit(hdb);
11859 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11862 MsiCloseHandle(hdb);
11863 MsiCloseHandle(hpkg);
11866 static void test_MsiGetProductProperty(void)
11868 MSIHANDLE hprod, hdb;
11869 CHAR val[MAX_PATH];
11870 CHAR path[MAX_PATH];
11871 CHAR query[MAX_PATH];
11872 CHAR keypath[MAX_PATH*2];
11873 CHAR prodcode[MAX_PATH];
11874 CHAR prod_squashed[MAX_PATH];
11875 HKEY prodkey, userkey, props;
11880 REGSAM access = KEY_ALL_ACCESS;
11883 scm = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT);
11884 if (!scm && (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED))
11886 win_skip("Different registry keys on Win9x and WinMe\n");
11889 CloseServiceHandle(scm);
11891 GetCurrentDirectoryA(MAX_PATH, path);
11892 lstrcatA(path, "\\");
11894 create_test_guid(prodcode, prod_squashed);
11896 if (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &wow64) && wow64)
11897 access |= KEY_WOW64_64KEY;
11899 r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
11900 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11902 r = MsiDatabaseCommit(hdb);
11903 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11905 r = set_summary_info(hdb);
11906 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11909 "CREATE TABLE `Directory` ( "
11910 "`Directory` CHAR(255) NOT NULL, "
11911 "`Directory_Parent` CHAR(255), "
11912 "`DefaultDir` CHAR(255) NOT NULL "
11913 "PRIMARY KEY `Directory`)");
11914 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11917 "CREATE TABLE `Property` ( "
11918 "`Property` CHAR(72) NOT NULL, "
11919 "`Value` CHAR(255) "
11920 "PRIMARY KEY `Property`)");
11921 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11923 sprintf(query, "INSERT INTO `Property` "
11924 "(`Property`, `Value`) "
11925 "VALUES( 'ProductCode', '%s' )", prodcode);
11926 r = run_query(hdb, query);
11927 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11929 r = MsiDatabaseCommit(hdb);
11930 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11932 MsiCloseHandle(hdb);
11934 lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
11935 lstrcatA(keypath, prod_squashed);
11937 res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
11938 if (res == ERROR_ACCESS_DENIED)
11940 skip("Not enough rights to perform tests\n");
11941 DeleteFile(msifile);
11944 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
11946 lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
11947 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
11948 lstrcatA(keypath, prod_squashed);
11950 res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userkey, NULL);
11951 if (res == ERROR_ACCESS_DENIED)
11953 skip("Not enough rights to perform tests\n");
11954 RegDeleteKeyA(prodkey, "");
11955 RegCloseKey(prodkey);
11958 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
11960 res = RegCreateKeyExA(userkey, "InstallProperties", 0, NULL, 0, access, NULL, &props, NULL);
11961 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
11963 lstrcpyA(val, path);
11964 lstrcatA(val, "\\");
11965 lstrcatA(val, msifile);
11966 res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ,
11967 (const BYTE *)val, lstrlenA(val) + 1);
11968 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
11970 hprod = 0xdeadbeef;
11971 r = MsiOpenProductA(prodcode, &hprod);
11972 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
11973 ok(hprod != 0 && hprod != 0xdeadbeef, "Expected a valid product handle\n");
11975 /* hProduct is invalid */
11977 lstrcpyA(val, "apple");
11978 r = MsiGetProductPropertyA(0xdeadbeef, "ProductCode", val, &size);
11979 ok(r == ERROR_INVALID_HANDLE,
11980 "Expected ERROR_INVALID_HANDLE, got %d\n", r);
11981 ok(!lstrcmpA(val, "apple"),
11982 "Expected val to be unchanged, got \"%s\"\n", val);
11983 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11985 /* szProperty is NULL */
11987 lstrcpyA(val, "apple");
11988 r = MsiGetProductPropertyA(hprod, NULL, val, &size);
11989 ok(r == ERROR_INVALID_PARAMETER,
11990 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
11991 ok(!lstrcmpA(val, "apple"),
11992 "Expected val to be unchanged, got \"%s\"\n", val);
11993 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
11995 /* szProperty is empty */
11997 lstrcpyA(val, "apple");
11998 r = MsiGetProductPropertyA(hprod, "", val, &size);
11999 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12000 ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val);
12001 ok(size == 0, "Expected 0, got %d\n", size);
12003 /* get the property */
12005 lstrcpyA(val, "apple");
12006 r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
12007 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12008 ok(!lstrcmpA(val, prodcode),
12009 "Expected \"%s\", got \"%s\"\n", prodcode, val);
12010 ok(size == lstrlenA(prodcode),
12011 "Expected %d, got %d\n", lstrlenA(prodcode), size);
12013 /* lpValueBuf is NULL */
12015 r = MsiGetProductPropertyA(hprod, "ProductCode", NULL, &size);
12016 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12017 ok(size == lstrlenA(prodcode),
12018 "Expected %d, got %d\n", lstrlenA(prodcode), size);
12020 /* pcchValueBuf is NULL */
12021 lstrcpyA(val, "apple");
12022 r = MsiGetProductPropertyA(hprod, "ProductCode", val, NULL);
12023 ok(r == ERROR_INVALID_PARAMETER,
12024 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
12025 ok(!lstrcmpA(val, "apple"),
12026 "Expected val to be unchanged, got \"%s\"\n", val);
12027 ok(size == lstrlenA(prodcode),
12028 "Expected %d, got %d\n", lstrlenA(prodcode), size);
12030 /* pcchValueBuf is too small */
12032 lstrcpyA(val, "apple");
12033 r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
12034 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
12035 ok(!strncmp(val, prodcode, 3),
12036 "Expected first 3 chars of \"%s\", got \"%s\"\n", prodcode, val);
12037 ok(size == lstrlenA(prodcode),
12038 "Expected %d, got %d\n", lstrlenA(prodcode), size);
12040 /* pcchValueBuf does not leave room for NULL terminator */
12041 size = lstrlenA(prodcode);
12042 lstrcpyA(val, "apple");
12043 r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
12044 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
12045 ok(!strncmp(val, prodcode, lstrlenA(prodcode) - 1),
12046 "Expected first 37 chars of \"%s\", got \"%s\"\n", prodcode, val);
12047 ok(size == lstrlenA(prodcode),
12048 "Expected %d, got %d\n", lstrlenA(prodcode), size);
12050 /* pcchValueBuf has enough room for NULL terminator */
12051 size = lstrlenA(prodcode) + 1;
12052 lstrcpyA(val, "apple");
12053 r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
12054 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12055 ok(!lstrcmpA(val, prodcode),
12056 "Expected \"%s\", got \"%s\"\n", prodcode, val);
12057 ok(size == lstrlenA(prodcode),
12058 "Expected %d, got %d\n", lstrlenA(prodcode), size);
12060 /* nonexistent property */
12062 lstrcpyA(val, "apple");
12063 r = MsiGetProductPropertyA(hprod, "IDontExist", val, &size);
12064 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12065 ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val);
12066 ok(size == 0, "Expected 0, got %d\n", size);
12068 r = MsiSetPropertyA(hprod, "NewProperty", "value");
12069 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12071 /* non-product property set */
12073 lstrcpyA(val, "apple");
12074 r = MsiGetProductPropertyA(hprod, "NewProperty", val, &size);
12075 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12076 ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val);
12077 ok(size == 0, "Expected 0, got %d\n", size);
12079 r = MsiSetPropertyA(hprod, "ProductCode", "value");
12080 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12082 /* non-product property that is also a product property set */
12084 lstrcpyA(val, "apple");
12085 r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
12086 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12087 ok(!lstrcmpA(val, prodcode),
12088 "Expected \"%s\", got \"%s\"\n", prodcode, val);
12089 ok(size == lstrlenA(prodcode),
12090 "Expected %d, got %d\n", lstrlenA(prodcode), size);
12092 MsiCloseHandle(hprod);
12094 RegDeleteValueA(props, "LocalPackage");
12095 delete_key(props, "", access);
12096 RegCloseKey(props);
12097 delete_key(userkey, "", access);
12098 RegCloseKey(userkey);
12099 delete_key(prodkey, "", access);
12100 RegCloseKey(prodkey);
12101 DeleteFileA(msifile);
12104 static void test_MsiSetProperty(void)
12106 MSIHANDLE hpkg, hdb, hrec;
12107 CHAR buf[MAX_PATH];
12112 r = package_from_db(create_package_db(), &hpkg);
12113 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
12115 skip("Not enough rights to perform tests\n");
12116 DeleteFile(msifile);
12119 ok(r == ERROR_SUCCESS, "Expected a valid package %u\n", r);
12121 /* invalid hInstall */
12122 r = MsiSetPropertyA(0, "Prop", "Val");
12123 ok(r == ERROR_INVALID_HANDLE,
12124 "Expected ERROR_INVALID_HANDLE, got %d\n", r);
12126 /* invalid hInstall */
12127 r = MsiSetPropertyA(0xdeadbeef, "Prop", "Val");
12128 ok(r == ERROR_INVALID_HANDLE,
12129 "Expected ERROR_INVALID_HANDLE, got %d\n", r);
12131 /* szName is NULL */
12132 r = MsiSetPropertyA(hpkg, NULL, "Val");
12133 ok(r == ERROR_INVALID_PARAMETER,
12134 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
12136 /* both szName and szValue are NULL */
12137 r = MsiSetPropertyA(hpkg, NULL, NULL);
12138 ok(r == ERROR_INVALID_PARAMETER,
12139 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
12141 /* szName is empty */
12142 r = MsiSetPropertyA(hpkg, "", "Val");
12143 ok(r == ERROR_FUNCTION_FAILED,
12144 "Expected ERROR_FUNCTION_FAILED, got %d\n", r);
12146 /* szName is empty and szValue is NULL */
12147 r = MsiSetPropertyA(hpkg, "", NULL);
12148 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12150 /* set a property */
12151 r = MsiSetPropertyA(hpkg, "Prop", "Val");
12152 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12154 /* get the property */
12156 r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
12157 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12158 ok(!lstrcmpA(buf, "Val"), "Expected \"Val\", got \"%s\"\n", buf);
12159 ok(size == 3, "Expected 3, got %d\n", size);
12161 /* update the property */
12162 r = MsiSetPropertyA(hpkg, "Prop", "Nuvo");
12163 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12165 /* get the property */
12167 r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
12168 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12169 ok(!lstrcmpA(buf, "Nuvo"), "Expected \"Nuvo\", got \"%s\"\n", buf);
12170 ok(size == 4, "Expected 4, got %d\n", size);
12172 hdb = MsiGetActiveDatabase(hpkg);
12173 ok(hdb != 0, "Expected a valid database handle\n");
12175 /* set prop is not in the _Property table */
12176 query = "SELECT * FROM `_Property` WHERE `Property` = 'Prop'";
12177 r = do_query(hdb, query, &hrec);
12178 ok(r == ERROR_BAD_QUERY_SYNTAX,
12179 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
12181 /* set prop is not in the Property table */
12182 query = "SELECT * FROM `Property` WHERE `Property` = 'Prop'";
12183 r = do_query(hdb, query, &hrec);
12184 ok(r == ERROR_BAD_QUERY_SYNTAX,
12185 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
12187 MsiCloseHandle(hdb);
12189 /* szValue is an empty string */
12190 r = MsiSetPropertyA(hpkg, "Prop", "");
12191 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12193 /* try to get the property */
12195 r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
12196 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12197 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
12198 ok(size == 0, "Expected 0, got %d\n", size);
12200 /* reset the property */
12201 r = MsiSetPropertyA(hpkg, "Prop", "BlueTap");
12202 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12204 /* delete the property */
12205 r = MsiSetPropertyA(hpkg, "Prop", NULL);
12206 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12208 /* try to get the property */
12210 r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
12211 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
12212 ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
12213 ok(size == 0, "Expected 0, got %d\n", size);
12215 MsiCloseHandle(hpkg);
12216 DeleteFileA(msifile);
12219 static void test_MsiApplyMultiplePatches(void)
12221 UINT r, type = GetDriveType(NULL);
12223 if (!pMsiApplyMultiplePatchesA) {
12224 win_skip("MsiApplyMultiplePatchesA not found\n");
12228 r = pMsiApplyMultiplePatchesA(NULL, NULL, NULL);
12229 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
12231 r = pMsiApplyMultiplePatchesA("", NULL, NULL);
12232 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
12234 r = pMsiApplyMultiplePatchesA(";", NULL, NULL);
12237 if (type == DRIVE_FIXED)
12238 ok(r == ERROR_PATH_NOT_FOUND,
12239 "Expected ERROR_PATH_NOT_FOUND, got %u\n", r);
12241 ok(r == ERROR_INVALID_NAME,
12242 "Expected ERROR_INVALID_NAME, got %u\n", r);
12245 r = pMsiApplyMultiplePatchesA(" ;", NULL, NULL);
12248 if (type == DRIVE_FIXED)
12249 ok(r == ERROR_PATCH_PACKAGE_OPEN_FAILED,
12250 "Expected ERROR_PATCH_PACKAGE_OPEN_FAILED, got %u\n", r);
12252 ok(r == ERROR_INVALID_NAME,
12253 "Expected ERROR_INVALID_NAME, got %u\n", r);
12256 r = pMsiApplyMultiplePatchesA(";;", NULL, NULL);
12259 if (type == DRIVE_FIXED)
12260 ok(r == ERROR_PATH_NOT_FOUND,
12261 "Expected ERROR_PATH_NOT_FOUND, got %u\n", r);
12263 ok(r == ERROR_INVALID_NAME,
12264 "Expected ERROR_INVALID_NAME, got %u\n", r);
12267 r = pMsiApplyMultiplePatchesA("nosuchpatchpackage;", NULL, NULL);
12268 todo_wine ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
12270 r = pMsiApplyMultiplePatchesA(";nosuchpatchpackage", NULL, NULL);
12273 if (type == DRIVE_FIXED)
12274 ok(r == ERROR_PATH_NOT_FOUND,
12275 "Expected ERROR_PATH_NOT_FOUND, got %u\n", r);
12277 ok(r == ERROR_INVALID_NAME,
12278 "Expected ERROR_INVALID_NAME, got %u\n", r);
12281 r = pMsiApplyMultiplePatchesA("nosuchpatchpackage;nosuchpatchpackage", NULL, NULL);
12282 todo_wine ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
12284 r = pMsiApplyMultiplePatchesA(" nosuchpatchpackage ; nosuchpatchpackage ", NULL, NULL);
12285 todo_wine ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
12288 static void test_MsiApplyPatch(void)
12292 r = MsiApplyPatch(NULL, NULL, INSTALLTYPE_DEFAULT, NULL);
12293 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
12295 r = MsiApplyPatch("", NULL, INSTALLTYPE_DEFAULT, NULL);
12296 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
12299 START_TEST(package)
12301 STATEMGRSTATUS status;
12304 init_functionpointers();
12306 GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
12308 /* Create a restore point ourselves so we circumvent the multitude of restore points
12309 * that would have been created by all the installation and removal tests.
12311 if (pSRSetRestorePointA)
12313 memset(&status, 0, sizeof(status));
12314 ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status);
12317 test_createpackage();
12319 test_gettargetpath_bad();
12320 test_settargetpath();
12322 test_property_table();
12325 test_formatrecord2();
12327 test_getproperty();
12328 test_removefiles();
12330 test_appsearch_complocator();
12331 test_appsearch_reglocator();
12332 test_appsearch_inilocator();
12333 test_appsearch_drlocator();
12334 test_featureparents();
12335 test_installprops();
12336 test_launchconditions();
12338 test_complocator();
12339 test_MsiGetSourcePath();
12340 test_shortlongsource();
12343 test_emptypackage();
12344 test_MsiGetProductProperty();
12345 test_MsiSetProperty();
12346 test_MsiApplyMultiplePatches();
12347 test_MsiApplyPatch();
12349 if (pSRSetRestorePointA && ret)
12351 ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status);
12353 remove_restore_point(status.llSequenceNumber);