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
30 #include "wine/test.h"
32 static const char msifile[] = "winetest.msi";
33 char CURR_DIR[MAX_PATH];
35 static void get_user_sid(LPSTR *usersid)
41 HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
42 static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
45 pConvertSidToStringSidA = (void *)GetProcAddress(hadvapi32, "ConvertSidToStringSidA");
46 if (!pConvertSidToStringSidA)
49 OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
51 GetTokenInformation(token, TokenUser, (void *)buf, size, &size);
52 user = (PTOKEN_USER)buf;
53 pConvertSidToStringSidA(user->User.Sid, usersid);
56 /* RegDeleteTreeW from dlls/advapi32/registry.c */
57 LSTATUS WINAPI package_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey)
60 DWORD dwMaxSubkeyLen, dwMaxValueLen;
61 DWORD dwMaxLen, dwSize;
62 WCHAR szNameBuf[MAX_PATH], *lpszName = szNameBuf;
67 ret = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_READ, &hSubKey);
71 ret = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL,
72 &dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL);
73 if (ret) goto cleanup;
77 dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen);
78 if (dwMaxLen > sizeof(szNameBuf)/sizeof(WCHAR))
80 /* Name too big: alloc a buffer for it */
81 if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen*sizeof(WCHAR))))
83 ret = ERROR_NOT_ENOUGH_MEMORY;
88 /* Recursively delete all the subkeys */
92 if (RegEnumKeyExW(hSubKey, 0, lpszName, &dwSize, NULL,
93 NULL, NULL, NULL)) break;
95 ret = package_RegDeleteTreeW(hSubKey, lpszName);
96 if (ret) goto cleanup;
100 ret = RegDeleteKeyW(hKey, lpszSubKey);
105 if (RegEnumValueW(hKey, 0, lpszName, &dwSize,
106 NULL, NULL, NULL, NULL)) break;
108 ret = RegDeleteValueW(hKey, lpszName);
109 if (ret) goto cleanup;
113 if (lpszName != szNameBuf)
114 HeapFree(GetProcessHeap(), 0, lpszName);
116 RegCloseKey(hSubKey);
120 static BOOL squash_guid(LPCWSTR in, LPWSTR out)
125 if (FAILED(CLSIDFromString((LPOLESTR)in, &guid)))
139 out[17+i*2] = in[n++];
140 out[16+i*2] = in[n++];
145 out[17+i*2] = in[n++];
146 out[16+i*2] = in[n++];
152 static void set_component_path(LPCSTR filename, MSIINSTALLCONTEXT context,
153 LPCSTR guid, LPSTR usersid, BOOL dir)
155 WCHAR guidW[MAX_PATH];
156 WCHAR squashedW[MAX_PATH];
157 CHAR squashed[MAX_PATH];
158 CHAR comppath[MAX_PATH];
159 CHAR prodpath[MAX_PATH];
164 MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
165 squash_guid(guidW, squashedW);
166 WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
168 if (context == MSIINSTALLCONTEXT_MACHINE)
170 prod = "3D0DAE300FACA1300AD792060BCDAA92";
172 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
173 "Installer\\UserData\\S-1-5-18\\Components\\%s", squashed);
175 "SOFTWARE\\Classes\\Installer\\"
176 "Products\\3D0DAE300FACA1300AD792060BCDAA92");
178 else if (context == MSIINSTALLCONTEXT_USERUNMANAGED)
180 prod = "7D2F387510109040002000060BECB6AB";
182 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
183 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
185 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
186 "Installer\\%s\\Installer\\Products\\"
187 "7D2F387510109040002000060BECB6AB", usersid);
189 else if (context == MSIINSTALLCONTEXT_USERMANAGED)
191 prod = "7D2F387510109040002000060BECB6AB";
193 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
194 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
196 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
197 "Installer\\Managed\\%s\\Installer\\Products\\"
198 "7D2F387510109040002000060BECB6AB", usersid);
201 RegCreateKeyA(HKEY_LOCAL_MACHINE, comppath, &hkey);
203 lstrcpyA(path, CURR_DIR);
204 lstrcatA(path, "\\");
205 if (!dir) lstrcatA(path, filename);
207 RegSetValueExA(hkey, prod, 0, REG_SZ, (LPBYTE)path, lstrlenA(path));
210 RegCreateKeyA(HKEY_LOCAL_MACHINE, prodpath, &hkey);
214 static void delete_component_path(LPCSTR guid, MSIINSTALLCONTEXT context, LPSTR usersid)
216 WCHAR guidW[MAX_PATH];
217 WCHAR squashedW[MAX_PATH];
218 WCHAR substrW[MAX_PATH];
219 CHAR squashed[MAX_PATH];
220 CHAR comppath[MAX_PATH];
221 CHAR prodpath[MAX_PATH];
223 MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
224 squash_guid(guidW, squashedW);
225 WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
227 if (context == MSIINSTALLCONTEXT_MACHINE)
230 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
231 "Installer\\UserData\\S-1-5-18\\Components\\%s", squashed);
233 "SOFTWARE\\Classes\\Installer\\"
234 "Products\\3D0DAE300FACA1300AD792060BCDAA92");
236 else if (context == MSIINSTALLCONTEXT_USERUNMANAGED)
239 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
240 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
242 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
243 "Installer\\%s\\Installer\\Products\\"
244 "7D2F387510109040002000060BECB6AB", usersid);
246 else if (context == MSIINSTALLCONTEXT_USERMANAGED)
249 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
250 "Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
252 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
253 "Installer\\Managed\\%s\\Installer\\Products\\"
254 "7D2F387510109040002000060BECB6AB", usersid);
257 MultiByteToWideChar(CP_ACP, 0, comppath, -1, substrW, MAX_PATH);
258 package_RegDeleteTreeW(HKEY_LOCAL_MACHINE, substrW);
260 MultiByteToWideChar(CP_ACP, 0, prodpath, -1, substrW, MAX_PATH);
261 package_RegDeleteTreeW(HKEY_LOCAL_MACHINE, substrW);
264 static UINT do_query(MSIHANDLE hdb, const char *query, MSIHANDLE *phrec)
269 /* open a select query */
270 r = MsiDatabaseOpenView(hdb, query, &hview);
271 if (r != ERROR_SUCCESS)
273 r = MsiViewExecute(hview, 0);
274 if (r != ERROR_SUCCESS)
276 ret = MsiViewFetch(hview, phrec);
277 r = MsiViewClose(hview);
278 if (r != ERROR_SUCCESS)
280 r = MsiCloseHandle(hview);
281 if (r != ERROR_SUCCESS)
286 static UINT run_query( MSIHANDLE hdb, const char *query )
291 r = MsiDatabaseOpenView(hdb, query, &hview);
292 if( r != ERROR_SUCCESS )
295 r = MsiViewExecute(hview, 0);
296 if( r == ERROR_SUCCESS )
297 r = MsiViewClose(hview);
298 MsiCloseHandle(hview);
302 static UINT create_component_table( MSIHANDLE hdb )
304 return run_query( hdb,
305 "CREATE TABLE `Component` ( "
306 "`Component` CHAR(72) NOT NULL, "
307 "`ComponentId` CHAR(38), "
308 "`Directory_` CHAR(72) NOT NULL, "
309 "`Attributes` SHORT NOT NULL, "
310 "`Condition` CHAR(255), "
311 "`KeyPath` CHAR(72) "
312 "PRIMARY KEY `Component`)" );
315 static UINT create_feature_table( MSIHANDLE hdb )
317 return run_query( hdb,
318 "CREATE TABLE `Feature` ( "
319 "`Feature` CHAR(38) NOT NULL, "
320 "`Feature_Parent` CHAR(38), "
322 "`Description` CHAR(255), "
323 "`Display` SHORT NOT NULL, "
324 "`Level` SHORT NOT NULL, "
325 "`Directory_` CHAR(72), "
326 "`Attributes` SHORT NOT NULL "
327 "PRIMARY KEY `Feature`)" );
330 static UINT create_feature_components_table( MSIHANDLE hdb )
332 return run_query( hdb,
333 "CREATE TABLE `FeatureComponents` ( "
334 "`Feature_` CHAR(38) NOT NULL, "
335 "`Component_` CHAR(72) NOT NULL "
336 "PRIMARY KEY `Feature_`, `Component_` )" );
339 static UINT create_file_table( MSIHANDLE hdb )
341 return run_query( hdb,
342 "CREATE TABLE `File` ("
343 "`File` CHAR(72) NOT NULL, "
344 "`Component_` CHAR(72) NOT NULL, "
345 "`FileName` CHAR(255) NOT NULL, "
346 "`FileSize` LONG NOT NULL, "
347 "`Version` CHAR(72), "
348 "`Language` CHAR(20), "
349 "`Attributes` SHORT, "
350 "`Sequence` SHORT NOT NULL "
351 "PRIMARY KEY `File`)" );
354 static UINT create_remove_file_table( MSIHANDLE hdb )
356 return run_query( hdb,
357 "CREATE TABLE `RemoveFile` ("
358 "`FileKey` CHAR(72) NOT NULL, "
359 "`Component_` CHAR(72) NOT NULL, "
360 "`FileName` CHAR(255) LOCALIZABLE, "
361 "`DirProperty` CHAR(72) NOT NULL, "
362 "`InstallMode` SHORT NOT NULL "
363 "PRIMARY KEY `FileKey`)" );
366 static UINT create_appsearch_table( MSIHANDLE hdb )
368 return run_query( hdb,
369 "CREATE TABLE `AppSearch` ("
370 "`Property` CHAR(72) NOT NULL, "
371 "`Signature_` CHAR(72) NOT NULL "
372 "PRIMARY KEY `Property`, `Signature_`)" );
375 static UINT create_reglocator_table( MSIHANDLE hdb )
377 return run_query( hdb,
378 "CREATE TABLE `RegLocator` ("
379 "`Signature_` CHAR(72) NOT NULL, "
380 "`Root` SHORT NOT NULL, "
381 "`Key` CHAR(255) NOT NULL, "
384 "PRIMARY KEY `Signature_`)" );
387 static UINT create_signature_table( MSIHANDLE hdb )
389 return run_query( hdb,
390 "CREATE TABLE `Signature` ("
391 "`Signature` CHAR(72) NOT NULL, "
392 "`FileName` CHAR(255) NOT NULL, "
393 "`MinVersion` CHAR(20), "
394 "`MaxVersion` CHAR(20), "
399 "`Languages` CHAR(255) "
400 "PRIMARY KEY `Signature`)" );
403 static UINT create_launchcondition_table( MSIHANDLE hdb )
405 return run_query( hdb,
406 "CREATE TABLE `LaunchCondition` ("
407 "`Condition` CHAR(255) NOT NULL, "
408 "`Description` CHAR(255) NOT NULL "
409 "PRIMARY KEY `Condition`)" );
412 static UINT create_property_table( MSIHANDLE hdb )
414 return run_query( hdb,
415 "CREATE TABLE `Property` ("
416 "`Property` CHAR(72) NOT NULL, "
418 "PRIMARY KEY `Property`)" );
421 static UINT create_install_execute_sequence_table( MSIHANDLE hdb )
423 return run_query( hdb,
424 "CREATE TABLE `InstallExecuteSequence` ("
425 "`Action` CHAR(72) NOT NULL, "
426 "`Condition` CHAR(255), "
428 "PRIMARY KEY `Action`)" );
431 static UINT create_media_table( MSIHANDLE hdb )
433 return run_query( hdb,
434 "CREATE TABLE `Media` ("
435 "`DiskId` SHORT NOT NULL, "
436 "`LastSequence` SHORT NOT NULL, "
437 "`DiskPrompt` CHAR(64), "
438 "`Cabinet` CHAR(255), "
439 "`VolumeLabel` CHAR(32), "
441 "PRIMARY KEY `DiskId`)" );
444 static UINT create_ccpsearch_table( MSIHANDLE hdb )
446 return run_query( hdb,
447 "CREATE TABLE `CCPSearch` ("
448 "`Signature_` CHAR(72) NOT NULL "
449 "PRIMARY KEY `Signature_`)" );
452 static UINT create_drlocator_table( MSIHANDLE hdb )
454 return run_query( hdb,
455 "CREATE TABLE `DrLocator` ("
456 "`Signature_` CHAR(72) NOT NULL, "
457 "`Parent` CHAR(72), "
460 "PRIMARY KEY `Signature_`, `Parent`, `Path`)" );
463 static UINT create_complocator_table( MSIHANDLE hdb )
465 return run_query( hdb,
466 "CREATE TABLE `CompLocator` ("
467 "`Signature_` CHAR(72) NOT NULL, "
468 "`ComponentId` CHAR(38) NOT NULL, "
470 "PRIMARY KEY `Signature_`)" );
473 static UINT create_inilocator_table( MSIHANDLE hdb )
475 return run_query( hdb,
476 "CREATE TABLE `IniLocator` ("
477 "`Signature_` CHAR(72) NOT NULL, "
478 "`FileName` CHAR(255) NOT NULL, "
479 "`Section` CHAR(96)NOT NULL, "
480 "`Key` CHAR(128)NOT NULL, "
483 "PRIMARY KEY `Signature_`)" );
486 static UINT add_component_entry( MSIHANDLE hdb, const char *values )
488 char insert[] = "INSERT INTO `Component` "
489 "(`Component`, `ComponentId`, `Directory_`, `Attributes`, `Condition`, `KeyPath`) "
494 sz = strlen(values) + sizeof insert;
495 query = HeapAlloc(GetProcessHeap(),0,sz);
496 sprintf(query,insert,values);
497 r = run_query( hdb, query );
498 HeapFree(GetProcessHeap(), 0, query);
502 static UINT add_directory_entry( MSIHANDLE hdb, const char *values )
504 char insert[] = "INSERT INTO `Directory` (`Directory`,`Directory_Parent`,`DefaultDir`) VALUES( %s )";
508 sz = strlen(values) + sizeof insert;
509 query = HeapAlloc(GetProcessHeap(),0,sz);
510 sprintf(query,insert,values);
511 r = run_query( hdb, query );
512 HeapFree(GetProcessHeap(), 0, query);
516 static UINT add_feature_entry( MSIHANDLE hdb, const char *values )
518 char insert[] = "INSERT INTO `Feature` (`Feature`, `Feature_Parent`, "
519 "`Title`, `Description`, `Display`, `Level`, `Directory_`, `Attributes`) VALUES( %s )";
523 sz = strlen(values) + sizeof insert;
524 query = HeapAlloc(GetProcessHeap(),0,sz);
525 sprintf(query,insert,values);
526 r = run_query( hdb, query );
527 HeapFree(GetProcessHeap(), 0, query);
531 static UINT add_feature_components_entry( MSIHANDLE hdb, const char *values )
533 char insert[] = "INSERT INTO `FeatureComponents` "
534 "(`Feature_`, `Component_`) "
539 sz = strlen(values) + sizeof insert;
540 query = HeapAlloc(GetProcessHeap(),0,sz);
541 sprintf(query,insert,values);
542 r = run_query( hdb, query );
543 HeapFree(GetProcessHeap(), 0, query);
547 static UINT add_file_entry( MSIHANDLE hdb, const char *values )
549 char insert[] = "INSERT INTO `File` "
550 "(`File`, `Component_`, `FileName`, `FileSize`, `Version`, `Language`, `Attributes`, `Sequence`) "
555 sz = strlen(values) + sizeof insert;
556 query = HeapAlloc(GetProcessHeap(),0,sz);
557 sprintf(query,insert,values);
558 r = run_query( hdb, query );
559 HeapFree(GetProcessHeap(), 0, query);
563 static UINT add_appsearch_entry( MSIHANDLE hdb, const char *values )
565 char insert[] = "INSERT INTO `AppSearch` "
566 "(`Property`, `Signature_`) "
571 sz = strlen(values) + sizeof insert;
572 query = HeapAlloc(GetProcessHeap(),0,sz);
573 sprintf(query,insert,values);
574 r = run_query( hdb, query );
575 HeapFree(GetProcessHeap(), 0, query);
579 static UINT add_reglocator_entry( MSIHANDLE hdb, const char *values )
581 char insert[] = "INSERT INTO `RegLocator` "
582 "(`Signature_`, `Root`, `Key`, `Name`, `Type`) "
587 sz = strlen(values) + sizeof insert;
588 query = HeapAlloc(GetProcessHeap(),0,sz);
589 sprintf(query,insert,values);
590 r = run_query( hdb, query );
591 HeapFree(GetProcessHeap(), 0, query);
595 static UINT add_signature_entry( MSIHANDLE hdb, const char *values )
597 char insert[] = "INSERT INTO `Signature` "
598 "(`Signature`, `FileName`, `MinVersion`, `MaxVersion`,"
599 " `MinSize`, `MaxSize`, `MinDate`, `MaxDate`, `Languages`) "
604 sz = strlen(values) + sizeof insert;
605 query = HeapAlloc(GetProcessHeap(),0,sz);
606 sprintf(query,insert,values);
607 r = run_query( hdb, query );
608 HeapFree(GetProcessHeap(), 0, query);
612 static UINT add_launchcondition_entry( MSIHANDLE hdb, const char *values )
614 char insert[] = "INSERT INTO `LaunchCondition` "
615 "(`Condition`, `Description`) "
620 sz = strlen(values) + sizeof insert;
621 query = HeapAlloc(GetProcessHeap(),0,sz);
622 sprintf(query,insert,values);
623 r = run_query( hdb, query );
624 HeapFree(GetProcessHeap(), 0, query);
628 static UINT add_property_entry( MSIHANDLE hdb, const char *values )
630 char insert[] = "INSERT INTO `Property` "
631 "(`Property`, `Value`) "
636 sz = strlen(values) + sizeof insert;
637 query = HeapAlloc(GetProcessHeap(),0,sz);
638 sprintf(query,insert,values);
639 r = run_query( hdb, query );
640 HeapFree(GetProcessHeap(), 0, query);
644 static UINT add_install_execute_sequence_entry( MSIHANDLE hdb, const char *values )
646 char insert[] = "INSERT INTO `InstallExecuteSequence` "
647 "(`Action`, `Condition`, `Sequence`) "
652 sz = strlen(values) + sizeof insert;
653 query = HeapAlloc(GetProcessHeap(),0,sz);
654 sprintf(query,insert,values);
655 r = run_query( hdb, query );
656 HeapFree(GetProcessHeap(), 0, query);
660 static UINT add_media_entry( MSIHANDLE hdb, const char *values )
662 char insert[] = "INSERT INTO `Media` "
663 "(`DiskId`, `LastSequence`, `DiskPrompt`, `Cabinet`, `VolumeLabel`, `Source`) "
668 sz = strlen(values) + sizeof insert;
669 query = HeapAlloc(GetProcessHeap(),0,sz);
670 sprintf(query,insert,values);
671 r = run_query( hdb, query );
672 HeapFree(GetProcessHeap(), 0, query);
676 static UINT add_ccpsearch_entry( MSIHANDLE hdb, const char *values )
678 char insert[] = "INSERT INTO `CCPSearch` (`Signature_`) VALUES( %s )";
682 sz = strlen(values) + sizeof insert;
683 query = HeapAlloc(GetProcessHeap(),0,sz);
684 sprintf(query,insert,values);
685 r = run_query( hdb, query );
686 HeapFree(GetProcessHeap(), 0, query);
690 static UINT add_drlocator_entry( MSIHANDLE hdb, const char *values )
692 char insert[] = "INSERT INTO `DrLocator` "
693 "(`Signature_`, `Parent`, `Path`, `Depth`) "
698 sz = strlen(values) + sizeof insert;
699 query = HeapAlloc(GetProcessHeap(),0,sz);
700 sprintf(query,insert,values);
701 r = run_query( hdb, query );
702 HeapFree(GetProcessHeap(), 0, query);
706 static UINT add_complocator_entry( MSIHANDLE hdb, const char *values )
708 char insert[] = "INSERT INTO `CompLocator` "
709 "(`Signature_`, `ComponentId`, `Type`) "
714 sz = strlen(values) + sizeof insert;
715 query = HeapAlloc(GetProcessHeap(),0,sz);
716 sprintf(query,insert,values);
717 r = run_query( hdb, query );
718 HeapFree(GetProcessHeap(), 0, query);
722 static UINT add_inilocator_entry( MSIHANDLE hdb, const char *values )
724 char insert[] = "INSERT INTO `IniLocator` "
725 "(`Signature_`, `FileName`, `Section`, `Key`, `Field`, `Type`) "
730 sz = strlen(values) + sizeof insert;
731 query = HeapAlloc(GetProcessHeap(),0,sz);
732 sprintf(query,insert,values);
733 r = run_query( hdb, query );
734 HeapFree(GetProcessHeap(), 0, query);
738 static UINT set_summary_info(MSIHANDLE hdb)
743 /* build summary info */
744 res = MsiGetSummaryInformation(hdb, NULL, 7, &suminfo);
745 ok( res == ERROR_SUCCESS , "Failed to open summaryinfo\n" );
747 res = MsiSummaryInfoSetProperty(suminfo,2, VT_LPSTR, 0,NULL,
748 "Installation Database");
749 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
751 res = MsiSummaryInfoSetProperty(suminfo,3, VT_LPSTR, 0,NULL,
752 "Installation Database");
753 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
755 res = MsiSummaryInfoSetProperty(suminfo,4, VT_LPSTR, 0,NULL,
757 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
759 res = MsiSummaryInfoSetProperty(suminfo,7, VT_LPSTR, 0,NULL,
761 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
763 res = MsiSummaryInfoSetProperty(suminfo,9, VT_LPSTR, 0,NULL,
764 "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}");
765 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
767 res = MsiSummaryInfoSetProperty(suminfo, 14, VT_I4, 100, NULL, NULL);
768 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
770 res = MsiSummaryInfoSetProperty(suminfo, 15, VT_I4, 0, NULL, NULL);
771 ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
773 res = MsiSummaryInfoPersist(suminfo);
774 ok( res == ERROR_SUCCESS , "Failed to make summary info persist\n" );
776 res = MsiCloseHandle( suminfo);
777 ok( res == ERROR_SUCCESS , "Failed to close suminfo\n" );
783 static MSIHANDLE create_package_db(void)
790 /* create an empty database */
791 res = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb );
792 ok( res == ERROR_SUCCESS , "Failed to create database\n" );
793 if( res != ERROR_SUCCESS )
796 res = MsiDatabaseCommit( hdb );
797 ok( res == ERROR_SUCCESS , "Failed to commit database\n" );
799 res = set_summary_info(hdb);
801 res = run_query( hdb,
802 "CREATE TABLE `Directory` ( "
803 "`Directory` CHAR(255) NOT NULL, "
804 "`Directory_Parent` CHAR(255), "
805 "`DefaultDir` CHAR(255) NOT NULL "
806 "PRIMARY KEY `Directory`)" );
807 ok( res == ERROR_SUCCESS , "Failed to create directory table\n" );
812 static MSIHANDLE package_from_db(MSIHANDLE hdb)
818 sprintf(szPackage,"#%li",hdb);
819 res = MsiOpenPackage(szPackage,&hPackage);
820 if (res != ERROR_SUCCESS)
823 res = MsiCloseHandle(hdb);
824 if (res != ERROR_SUCCESS)
830 static void create_test_file(const CHAR *name)
835 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
836 ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
837 WriteFile(file, name, strlen(name), &written, NULL);
838 WriteFile(file, "\n", strlen("\n"), &written, NULL);
842 typedef struct _tagVS_VERSIONINFO
849 VS_FIXEDFILEINFO Value;
854 #define roundoffs(a, b, r) (((BYTE *)(b) - (BYTE *)(a) + ((r) - 1)) & ~((r) - 1))
855 #define roundpos(a, b, r) (((BYTE *)(a)) + roundoffs(a, b, r))
857 static void create_file_with_version(const CHAR *name, LONG ms, LONG ls)
859 VS_VERSIONINFO *pVerInfo;
860 VS_FIXEDFILEINFO *pFixedInfo;
866 GetSystemDirectory(path, MAX_PATH);
867 lstrcatA(path, "\\kernel32.dll");
869 CopyFileA(path, name, FALSE);
871 size = GetFileVersionInfoSize(path, &handle);
872 buffer = HeapAlloc(GetProcessHeap(), 0, size);
874 GetFileVersionInfoA(path, 0, size, buffer);
876 pVerInfo = (VS_VERSIONINFO *)buffer;
877 ofs = (BYTE *)&pVerInfo->szKey[lstrlenW(pVerInfo->szKey) + 1];
878 pFixedInfo = (VS_FIXEDFILEINFO *)roundpos(pVerInfo, ofs, 4);
880 pFixedInfo->dwFileVersionMS = ms;
881 pFixedInfo->dwFileVersionLS = ls;
882 pFixedInfo->dwProductVersionMS = ms;
883 pFixedInfo->dwProductVersionLS = ls;
885 resource = BeginUpdateResource(name, FALSE);
889 UpdateResource(resource, RT_VERSION, MAKEINTRESOURCE(VS_VERSION_INFO),
890 MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), buffer, size);
891 EndUpdateResource(resource, FALSE);
894 HeapFree(GetProcessHeap(), 0, buffer);
897 static void test_createpackage(void)
899 MSIHANDLE hPackage = 0;
902 hPackage = package_from_db(create_package_db());
903 ok( hPackage != 0, " Failed to create package\n");
905 res = MsiCloseHandle( hPackage);
906 ok( res == ERROR_SUCCESS , "Failed to close package\n" );
910 static void test_doaction( void )
915 r = MsiDoAction( -1, NULL );
916 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
918 hpkg = package_from_db(create_package_db());
919 ok( hpkg, "failed to create package\n");
921 r = MsiDoAction(hpkg, NULL);
922 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
924 r = MsiDoAction(0, "boo");
925 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
927 r = MsiDoAction(hpkg, "boo");
928 ok( r == ERROR_FUNCTION_NOT_CALLED, "wrong return val\n");
930 MsiCloseHandle( hpkg );
934 static void test_gettargetpath_bad(void)
941 hpkg = package_from_db(create_package_db());
942 ok( hpkg, "failed to create package\n");
944 r = MsiGetTargetPath( 0, NULL, NULL, NULL );
945 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
947 r = MsiGetTargetPath( 0, NULL, NULL, &sz );
948 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
950 r = MsiGetTargetPath( 0, "boo", NULL, NULL );
951 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
953 r = MsiGetTargetPath( 0, "boo", NULL, NULL );
954 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
956 r = MsiGetTargetPath( hpkg, "boo", NULL, NULL );
957 ok( r == ERROR_DIRECTORY, "wrong return val\n");
959 r = MsiGetTargetPath( hpkg, "boo", buffer, NULL );
960 ok( r == ERROR_DIRECTORY, "wrong return val\n");
962 MsiCloseHandle( hpkg );
966 static void query_file_path(MSIHANDLE hpkg, LPCSTR file, LPSTR buff)
972 rec = MsiCreateRecord( 1 );
973 ok(rec, "MsiCreate record failed\n");
975 r = MsiRecordSetString( rec, 0, file );
976 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
979 r = MsiFormatRecord( hpkg, rec, buff, &size );
980 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
982 MsiCloseHandle( rec );
985 static void test_settargetpath(void)
987 char tempdir[MAX_PATH+8], buffer[MAX_PATH], file[MAX_PATH];
993 hdb = create_package_db();
994 ok ( hdb, "failed to create package database\n" );
996 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'" );
997 ok( r == S_OK, "failed to add directory entry: %d\n" , r );
999 r = create_component_table( hdb );
1000 ok( r == S_OK, "cannot create Component table: %d\n", r );
1002 r = add_component_entry( hdb, "'RootComp', '{83e2694d-0864-4124-9323-6d37630912a1}', 'TARGETDIR', 8, '', 'RootFile'" );
1003 ok( r == S_OK, "cannot add dummy component: %d\n", r );
1005 r = add_component_entry( hdb, "'TestComp', '{A3FB59C8-C293-4F7E-B8C5-F0E1D8EEE4E5}', 'TestDir', 0, '', 'TestFile'" );
1006 ok( r == S_OK, "cannot add test component: %d\n", r );
1008 r = create_feature_table( hdb );
1009 ok( r == S_OK, "cannot create Feature table: %d\n", r );
1011 r = add_feature_entry( hdb, "'TestFeature', '', '', '', 0, 1, '', 0" );
1012 ok( r == ERROR_SUCCESS, "cannot add TestFeature to Feature table: %d\n", r );
1014 r = create_feature_components_table( hdb );
1015 ok( r == S_OK, "cannot create FeatureComponents table: %d\n", r );
1017 r = add_feature_components_entry( hdb, "'TestFeature', 'RootComp'" );
1018 ok( r == S_OK, "cannot insert component into FeatureComponents table: %d\n", r );
1020 r = add_feature_components_entry( hdb, "'TestFeature', 'TestComp'" );
1021 ok( r == S_OK, "cannot insert component into FeatureComponents table: %d\n", r );
1023 add_directory_entry( hdb, "'TestParent', 'TARGETDIR', 'TestParent'" );
1024 add_directory_entry( hdb, "'TestDir', 'TestParent', 'TestDir'" );
1026 r = create_file_table( hdb );
1027 ok( r == S_OK, "cannot create File table: %d\n", r );
1029 r = add_file_entry( hdb, "'RootFile', 'RootComp', 'rootfile.txt', 0, '', '1033', 8192, 1" );
1030 ok( r == S_OK, "cannot add file to the File table: %d\n", r );
1032 r = add_file_entry( hdb, "'TestFile', 'TestComp', 'testfile.txt', 0, '', '1033', 8192, 1" );
1033 ok( r == S_OK, "cannot add file to the File table: %d\n", r );
1035 hpkg = package_from_db( hdb );
1036 ok( hpkg, "failed to create package\n");
1038 r = MsiDoAction( hpkg, "CostInitialize");
1039 ok( r == ERROR_SUCCESS, "cost init failed\n");
1041 r = MsiDoAction( hpkg, "FileCost");
1042 ok( r == ERROR_SUCCESS, "file cost failed\n");
1044 r = MsiDoAction( hpkg, "CostFinalize");
1045 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
1047 r = MsiSetTargetPath( 0, NULL, NULL );
1048 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1050 r = MsiSetTargetPath( 0, "boo", "C:\\bogusx" );
1051 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
1053 r = MsiSetTargetPath( hpkg, "boo", NULL );
1054 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1056 r = MsiSetTargetPath( hpkg, "boo", "c:\\bogusx" );
1057 ok( r == ERROR_DIRECTORY, "wrong return val\n");
1059 sz = sizeof tempdir - 1;
1060 r = MsiGetTargetPath( hpkg, "TARGETDIR", tempdir, &sz );
1061 sprintf( file, "%srootfile.txt", tempdir );
1062 query_file_path( hpkg, "[#RootFile]", buffer );
1063 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
1064 ok( !lstrcmp(buffer, file), "Expected %s, got %s\n", file, buffer );
1066 GetTempFileName( tempdir, "_wt", 0, buffer );
1067 sprintf( tempdir, "%s\\subdir", buffer );
1069 r = MsiSetTargetPath( hpkg, "TARGETDIR", buffer );
1070 ok( r == ERROR_SUCCESS || r == ERROR_DIRECTORY,
1071 "MsiSetTargetPath on file returned %d\n", r );
1073 r = MsiSetTargetPath( hpkg, "TARGETDIR", tempdir );
1074 ok( r == ERROR_SUCCESS || r == ERROR_DIRECTORY,
1075 "MsiSetTargetPath on 'subdir' of file returned %d\n", r );
1077 DeleteFile( buffer );
1079 r = MsiSetTargetPath( hpkg, "TARGETDIR", buffer );
1080 ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
1082 r = GetFileAttributes( buffer );
1083 ok ( r == INVALID_FILE_ATTRIBUTES, "file/directory exists after MsiSetTargetPath. Attributes: %08X\n", r );
1085 r = MsiSetTargetPath( hpkg, "TARGETDIR", tempdir );
1086 ok( r == ERROR_SUCCESS, "MsiSetTargetPath on subsubdir returned %d\n", r );
1088 sz = sizeof buffer - 1;
1089 lstrcat( tempdir, "\\" );
1090 r = MsiGetTargetPath( hpkg, "TARGETDIR", buffer, &sz );
1091 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
1092 ok( !lstrcmp(buffer, tempdir), "Expected %s, got %s\n", tempdir, buffer);
1094 sprintf( file, "%srootfile.txt", tempdir );
1095 query_file_path( hpkg, "[#RootFile]", buffer );
1096 ok( !lstrcmp(buffer, file), "Expected %s, got %s\n", file, buffer);
1098 r = MsiSetTargetPath( hpkg, "TestParent", "C:\\one\\two" );
1099 ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
1101 query_file_path( hpkg, "[#TestFile]", buffer );
1102 ok( !lstrcmp(buffer, "C:\\one\\two\\TestDir\\testfile.txt"),
1103 "Expected C:\\one\\two\\TestDir\\testfile.txt, got %s\n", buffer );
1105 sz = sizeof buffer - 1;
1106 r = MsiGetTargetPath( hpkg, "TestParent", buffer, &sz );
1107 ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
1108 ok( !lstrcmp(buffer, "C:\\one\\two\\"), "Expected C:\\one\\two\\, got %s\n", buffer);
1110 MsiCloseHandle( hpkg );
1113 static void test_condition(void)
1118 hpkg = package_from_db(create_package_db());
1119 ok( hpkg, "failed to create package\n");
1121 r = MsiEvaluateCondition(0, NULL);
1122 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1124 r = MsiEvaluateCondition(hpkg, NULL);
1125 ok( r == MSICONDITION_NONE, "wrong return val\n");
1127 r = MsiEvaluateCondition(hpkg, "");
1128 ok( r == MSICONDITION_NONE, "wrong return val\n");
1130 r = MsiEvaluateCondition(hpkg, "1");
1131 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1133 r = MsiEvaluateCondition(hpkg, "0");
1134 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1136 r = MsiEvaluateCondition(hpkg, "-1");
1137 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1139 r = MsiEvaluateCondition(hpkg, "0 = 0");
1140 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1142 r = MsiEvaluateCondition(hpkg, "0 <> 0");
1143 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1145 r = MsiEvaluateCondition(hpkg, "0 = 1");
1146 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1148 r = MsiEvaluateCondition(hpkg, "0 > 1");
1149 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1151 r = MsiEvaluateCondition(hpkg, "0 ~> 1");
1152 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1154 r = MsiEvaluateCondition(hpkg, "1 > 1");
1155 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1157 r = MsiEvaluateCondition(hpkg, "1 ~> 1");
1158 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1160 r = MsiEvaluateCondition(hpkg, "0 >= 1");
1161 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1163 r = MsiEvaluateCondition(hpkg, "0 ~>= 1");
1164 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1166 r = MsiEvaluateCondition(hpkg, "1 >= 1");
1167 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1169 r = MsiEvaluateCondition(hpkg, "1 ~>= 1");
1170 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1172 r = MsiEvaluateCondition(hpkg, "0 < 1");
1173 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1175 r = MsiEvaluateCondition(hpkg, "0 ~< 1");
1176 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1178 r = MsiEvaluateCondition(hpkg, "1 < 1");
1179 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1181 r = MsiEvaluateCondition(hpkg, "1 ~< 1");
1182 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1184 r = MsiEvaluateCondition(hpkg, "0 <= 1");
1185 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1187 r = MsiEvaluateCondition(hpkg, "0 ~<= 1");
1188 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1190 r = MsiEvaluateCondition(hpkg, "1 <= 1");
1191 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1193 r = MsiEvaluateCondition(hpkg, "1 ~<= 1");
1194 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1196 r = MsiEvaluateCondition(hpkg, "0 >=");
1197 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1199 r = MsiEvaluateCondition(hpkg, " ");
1200 ok( r == MSICONDITION_NONE, "wrong return val\n");
1202 r = MsiEvaluateCondition(hpkg, "LicView <> \"1\"");
1203 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1205 r = MsiEvaluateCondition(hpkg, "LicView <> \"0\"");
1206 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1208 r = MsiEvaluateCondition(hpkg, "LicView <> LicView");
1209 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1211 r = MsiEvaluateCondition(hpkg, "not 0");
1212 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1214 r = MsiEvaluateCondition(hpkg, "not LicView");
1215 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1217 r = MsiEvaluateCondition(hpkg, "not \"A\"");
1218 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1220 r = MsiEvaluateCondition(hpkg, "~not \"A\"");
1221 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1223 r = MsiEvaluateCondition(hpkg, "\"0\"");
1224 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1226 r = MsiEvaluateCondition(hpkg, "1 and 2");
1227 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1229 r = MsiEvaluateCondition(hpkg, "not 0 and 3");
1230 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1232 r = MsiEvaluateCondition(hpkg, "not 0 and 0");
1233 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1235 r = MsiEvaluateCondition(hpkg, "not 0 or 1");
1236 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1238 r = MsiEvaluateCondition(hpkg, "(0)");
1239 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1241 r = MsiEvaluateCondition(hpkg, "(((((1))))))");
1242 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1244 r = MsiEvaluateCondition(hpkg, "(((((1)))))");
1245 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1247 r = MsiEvaluateCondition(hpkg, " \"A\" < \"B\" ");
1248 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1250 r = MsiEvaluateCondition(hpkg, " \"A\" > \"B\" ");
1251 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1253 r = MsiEvaluateCondition(hpkg, " \"1\" > \"12\" ");
1254 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1256 r = MsiEvaluateCondition(hpkg, " \"100\" < \"21\" ");
1257 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1259 r = MsiEvaluateCondition(hpkg, "0 < > 0");
1260 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1262 r = MsiEvaluateCondition(hpkg, "(1<<1) == 2");
1263 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1265 r = MsiEvaluateCondition(hpkg, " \"A\" = \"a\" ");
1266 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1268 r = MsiEvaluateCondition(hpkg, " \"A\" ~ = \"a\" ");
1269 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1271 r = MsiEvaluateCondition(hpkg, " \"A\" ~= \"a\" ");
1272 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1274 r = MsiEvaluateCondition(hpkg, " \"A\" ~= 1 ");
1275 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1277 r = MsiEvaluateCondition(hpkg, " \"A\" = 1 ");
1278 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1280 r = MsiEvaluateCondition(hpkg, " 1 ~= 1 ");
1281 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1283 r = MsiEvaluateCondition(hpkg, " 1 ~= \"1\" ");
1284 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1286 r = MsiEvaluateCondition(hpkg, " 1 = \"1\" ");
1287 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1289 r = MsiEvaluateCondition(hpkg, " 0 = \"1\" ");
1290 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1292 r = MsiEvaluateCondition(hpkg, " 0 < \"100\" ");
1293 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1295 r = MsiEvaluateCondition(hpkg, " 100 > \"0\" ");
1296 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1298 r = MsiEvaluateCondition(hpkg, "1 XOR 1");
1299 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1301 r = MsiEvaluateCondition(hpkg, "1 IMP 1");
1302 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1304 r = MsiEvaluateCondition(hpkg, "1 IMP 0");
1305 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1307 r = MsiEvaluateCondition(hpkg, "0 IMP 0");
1308 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1310 r = MsiEvaluateCondition(hpkg, "0 EQV 0");
1311 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1313 r = MsiEvaluateCondition(hpkg, "0 EQV 1");
1314 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1316 r = MsiEvaluateCondition(hpkg, "1 IMP 1 OR 0");
1317 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1319 r = MsiEvaluateCondition(hpkg, "1 IMPL 1");
1320 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1322 r = MsiEvaluateCondition(hpkg, "\"ASFD\" >< \"S\" ");
1323 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1325 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"s\" ");
1326 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1328 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"\" ");
1329 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1331 r = MsiEvaluateCondition(hpkg, "\"ASFD\" ~>< \"sss\" ");
1332 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1334 MsiSetProperty(hpkg, "mm", "5" );
1336 r = MsiEvaluateCondition(hpkg, "mm = 5");
1337 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1339 r = MsiEvaluateCondition(hpkg, "mm < 6");
1340 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1342 r = MsiEvaluateCondition(hpkg, "mm <= 5");
1343 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1345 r = MsiEvaluateCondition(hpkg, "mm > 4");
1346 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1348 r = MsiEvaluateCondition(hpkg, "mm < 12");
1349 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1351 r = MsiEvaluateCondition(hpkg, "mm = \"5\"");
1352 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1354 r = MsiEvaluateCondition(hpkg, "0 = \"\"");
1355 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1357 r = MsiEvaluateCondition(hpkg, "0 AND \"\"");
1358 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1360 r = MsiEvaluateCondition(hpkg, "1 AND \"\"");
1361 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1363 r = MsiEvaluateCondition(hpkg, "1 AND \"1\"");
1364 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1366 r = MsiEvaluateCondition(hpkg, "3 >< 1");
1367 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1369 r = MsiEvaluateCondition(hpkg, "3 >< 4");
1370 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1372 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 0");
1373 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1375 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 1");
1376 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1378 r = MsiEvaluateCondition(hpkg, "NOT 1 OR 0");
1379 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1381 r = MsiEvaluateCondition(hpkg, "0 AND 1 OR 1");
1382 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1384 r = MsiEvaluateCondition(hpkg, "0 AND 0 OR 1");
1385 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1387 r = MsiEvaluateCondition(hpkg, "NOT 0 AND 1 OR 0");
1388 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1390 r = MsiEvaluateCondition(hpkg, "_1 = _1");
1391 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1393 r = MsiEvaluateCondition(hpkg, "( 1 AND 1 ) = 2");
1394 ok( r == MSICONDITION_ERROR, "wrong return val\n");
1396 r = MsiEvaluateCondition(hpkg, "NOT ( 1 AND 1 )");
1397 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1399 r = MsiEvaluateCondition(hpkg, "NOT A AND (BBBBBBBBBB=2 OR CCC=1) AND Ddddddddd");
1400 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1402 r = MsiEvaluateCondition(hpkg, "Installed<>\"\"");
1403 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1405 r = MsiEvaluateCondition(hpkg, "NOT 1 AND 0");
1406 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1408 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1409 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1411 r = MsiEvaluateCondition(hpkg, "bandalmael<>0");
1412 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1414 r = MsiEvaluateCondition(hpkg, "bandalmael<0");
1415 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1417 r = MsiEvaluateCondition(hpkg, "bandalmael>0");
1418 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1420 r = MsiEvaluateCondition(hpkg, "bandalmael>=0");
1421 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1423 r = MsiEvaluateCondition(hpkg, "bandalmael<=0");
1424 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1426 r = MsiEvaluateCondition(hpkg, "bandalmael~<>0");
1427 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1429 MsiSetProperty(hpkg, "bandalmael", "0" );
1430 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1431 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1433 MsiSetProperty(hpkg, "bandalmael", "" );
1434 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1435 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1437 MsiSetProperty(hpkg, "bandalmael", "asdf" );
1438 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1439 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1441 MsiSetProperty(hpkg, "bandalmael", "0asdf" );
1442 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1443 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1445 MsiSetProperty(hpkg, "bandalmael", "0 " );
1446 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1447 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1449 MsiSetProperty(hpkg, "bandalmael", "-0" );
1450 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1451 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1453 MsiSetProperty(hpkg, "bandalmael", "0000000000000" );
1454 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1455 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1457 MsiSetProperty(hpkg, "bandalmael", "--0" );
1458 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1459 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1461 MsiSetProperty(hpkg, "bandalmael", "0x00" );
1462 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1463 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1465 MsiSetProperty(hpkg, "bandalmael", "-" );
1466 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1467 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1469 MsiSetProperty(hpkg, "bandalmael", "+0" );
1470 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1471 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1473 MsiSetProperty(hpkg, "bandalmael", "0.0" );
1474 r = MsiEvaluateCondition(hpkg, "bandalmael=0");
1475 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1476 r = MsiEvaluateCondition(hpkg, "bandalmael<>0");
1477 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1479 MsiSetProperty(hpkg, "one", "hi");
1480 MsiSetProperty(hpkg, "two", "hithere");
1481 r = MsiEvaluateCondition(hpkg, "one >< two");
1482 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1484 MsiSetProperty(hpkg, "one", "hithere");
1485 MsiSetProperty(hpkg, "two", "hi");
1486 r = MsiEvaluateCondition(hpkg, "one >< two");
1487 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1489 MsiSetProperty(hpkg, "one", "hello");
1490 MsiSetProperty(hpkg, "two", "hi");
1491 r = MsiEvaluateCondition(hpkg, "one >< two");
1492 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1494 MsiSetProperty(hpkg, "one", "hellohithere");
1495 MsiSetProperty(hpkg, "two", "hi");
1496 r = MsiEvaluateCondition(hpkg, "one >< two");
1497 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1499 MsiSetProperty(hpkg, "one", "");
1500 MsiSetProperty(hpkg, "two", "hi");
1501 r = MsiEvaluateCondition(hpkg, "one >< two");
1502 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1504 MsiSetProperty(hpkg, "one", "hi");
1505 MsiSetProperty(hpkg, "two", "");
1506 r = MsiEvaluateCondition(hpkg, "one >< two");
1507 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1509 MsiSetProperty(hpkg, "one", "");
1510 MsiSetProperty(hpkg, "two", "");
1511 r = MsiEvaluateCondition(hpkg, "one >< two");
1512 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1514 MsiSetProperty(hpkg, "one", "1234");
1515 MsiSetProperty(hpkg, "two", "1");
1516 r = MsiEvaluateCondition(hpkg, "one >< two");
1517 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1519 MsiSetProperty(hpkg, "one", "one 1234");
1520 MsiSetProperty(hpkg, "two", "1");
1521 r = MsiEvaluateCondition(hpkg, "one >< two");
1522 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1524 MsiSetProperty(hpkg, "one", "hithere");
1525 MsiSetProperty(hpkg, "two", "hi");
1526 r = MsiEvaluateCondition(hpkg, "one << two");
1527 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1529 MsiSetProperty(hpkg, "one", "hi");
1530 MsiSetProperty(hpkg, "two", "hithere");
1531 r = MsiEvaluateCondition(hpkg, "one << two");
1532 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1534 MsiSetProperty(hpkg, "one", "hi");
1535 MsiSetProperty(hpkg, "two", "hi");
1536 r = MsiEvaluateCondition(hpkg, "one << two");
1537 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1539 MsiSetProperty(hpkg, "one", "abcdhithere");
1540 MsiSetProperty(hpkg, "two", "hi");
1541 r = MsiEvaluateCondition(hpkg, "one << two");
1542 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1544 MsiSetProperty(hpkg, "one", "");
1545 MsiSetProperty(hpkg, "two", "hi");
1546 r = MsiEvaluateCondition(hpkg, "one << two");
1547 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1549 MsiSetProperty(hpkg, "one", "hithere");
1550 MsiSetProperty(hpkg, "two", "");
1551 r = MsiEvaluateCondition(hpkg, "one << two");
1552 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1554 MsiSetProperty(hpkg, "one", "");
1555 MsiSetProperty(hpkg, "two", "");
1556 r = MsiEvaluateCondition(hpkg, "one << two");
1557 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1559 MsiSetProperty(hpkg, "one", "1234");
1560 MsiSetProperty(hpkg, "two", "1");
1561 r = MsiEvaluateCondition(hpkg, "one << two");
1562 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1564 MsiSetProperty(hpkg, "one", "1234 one");
1565 MsiSetProperty(hpkg, "two", "1");
1566 r = MsiEvaluateCondition(hpkg, "one << two");
1567 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1569 MsiSetProperty(hpkg, "one", "hithere");
1570 MsiSetProperty(hpkg, "two", "there");
1571 r = MsiEvaluateCondition(hpkg, "one >> two");
1572 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1574 MsiSetProperty(hpkg, "one", "hithere");
1575 MsiSetProperty(hpkg, "two", "hi");
1576 r = MsiEvaluateCondition(hpkg, "one >> two");
1577 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1579 MsiSetProperty(hpkg, "one", "there");
1580 MsiSetProperty(hpkg, "two", "hithere");
1581 r = MsiEvaluateCondition(hpkg, "one >> two");
1582 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1584 MsiSetProperty(hpkg, "one", "there");
1585 MsiSetProperty(hpkg, "two", "there");
1586 r = MsiEvaluateCondition(hpkg, "one >> two");
1587 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1589 MsiSetProperty(hpkg, "one", "abcdhithere");
1590 MsiSetProperty(hpkg, "two", "hi");
1591 r = MsiEvaluateCondition(hpkg, "one >> two");
1592 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1594 MsiSetProperty(hpkg, "one", "");
1595 MsiSetProperty(hpkg, "two", "there");
1596 r = MsiEvaluateCondition(hpkg, "one >> two");
1597 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1599 MsiSetProperty(hpkg, "one", "there");
1600 MsiSetProperty(hpkg, "two", "");
1601 r = MsiEvaluateCondition(hpkg, "one >> two");
1602 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1604 MsiSetProperty(hpkg, "one", "");
1605 MsiSetProperty(hpkg, "two", "");
1606 r = MsiEvaluateCondition(hpkg, "one >> two");
1607 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1609 MsiSetProperty(hpkg, "one", "1234");
1610 MsiSetProperty(hpkg, "two", "4");
1611 r = MsiEvaluateCondition(hpkg, "one >> two");
1612 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1614 MsiSetProperty(hpkg, "one", "one 1234");
1615 MsiSetProperty(hpkg, "two", "4");
1616 r = MsiEvaluateCondition(hpkg, "one >> two");
1617 ok( r == MSICONDITION_TRUE, "wrong return val\n");
1619 MsiSetProperty(hpkg, "MsiNetAssemblySupport", NULL); /* make sure it's empty */
1621 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322\"");
1622 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1624 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport > \"1.1.4322\"");
1625 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1627 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport >= \"1.1.4322\"");
1628 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1630 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport <= \"1.1.4322\"");
1631 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1633 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport <> \"1.1.4322\"");
1634 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1636 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport ~< \"1.1.4322\"");
1637 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1639 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"abcd\"");
1640 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1642 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a1.1.4322\"");
1643 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1645 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322a\"");
1646 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1648 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"0000001.1.4322\"");
1649 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1651 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322.1\"");
1652 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1654 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322.1.1\"");
1655 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1657 r = MsiEvaluateCondition(hpkg, "\"2\" < \"1.1");
1658 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1660 r = MsiEvaluateCondition(hpkg, "\"2\" < \"1.1\"");
1661 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1663 r = MsiEvaluateCondition(hpkg, "\"2\" < \"12.1\"");
1664 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1666 r = MsiEvaluateCondition(hpkg, "\"02.1\" < \"2.11\"");
1667 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1669 r = MsiEvaluateCondition(hpkg, "\"02.1.1\" < \"2.1\"");
1670 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1672 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1\"");
1673 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1675 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1\"");
1676 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1678 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"0\"");
1679 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1681 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"-1\"");
1682 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1684 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a\"");
1685 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1687 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"!\"");
1688 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1690 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"!\"");
1691 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1693 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"/\"");
1694 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1696 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \" \"");
1697 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1699 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"azAZ_\"");
1700 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1702 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a[a]\"");
1703 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1705 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a[a]a\"");
1706 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1708 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a]\"");
1709 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1711 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a]a\"");
1712 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1714 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"{a}\"");
1715 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1717 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"{a\"");
1718 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1720 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"[a\"");
1721 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1723 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a{\"");
1724 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1726 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"a]\"");
1727 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1729 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"A\"");
1730 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1732 MsiSetProperty(hpkg, "MsiNetAssemblySupport", "1.1.4322");
1733 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.4322\"");
1734 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1736 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.14322\"");
1737 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1739 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1.5\"");
1740 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1742 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1.1\"");
1743 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1745 r = MsiEvaluateCondition(hpkg, "MsiNetAssemblySupport < \"1\"");
1746 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1748 MsiSetProperty(hpkg, "one", "1");
1749 r = MsiEvaluateCondition(hpkg, "one < \"1\"");
1750 ok( r == MSICONDITION_FALSE, "wrong return val\n");
1752 MsiSetProperty(hpkg, "X", "5.0");
1754 r = MsiEvaluateCondition(hpkg, "X != \"\"");
1755 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1757 r = MsiEvaluateCondition(hpkg, "X =\"5.0\"");
1758 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1760 r = MsiEvaluateCondition(hpkg, "X =\"5.1\"");
1761 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1763 r = MsiEvaluateCondition(hpkg, "X =\"6.0\"");
1764 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1766 r = MsiEvaluateCondition(hpkg, "X =\"5.0\" or X =\"5.1\" or X =\"6.0\"");
1767 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1769 r = MsiEvaluateCondition(hpkg, "(X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1770 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1772 r = MsiEvaluateCondition(hpkg, "X !=\"\" and (X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1773 ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
1775 /* feature doesn't exist */
1776 r = MsiEvaluateCondition(hpkg, "&nofeature");
1777 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1779 MsiSetProperty(hpkg, "A", "2");
1780 MsiSetProperty(hpkg, "X", "50");
1782 r = MsiEvaluateCondition(hpkg, "2 <= X");
1783 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1785 r = MsiEvaluateCondition(hpkg, "A <= X");
1786 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1788 r = MsiEvaluateCondition(hpkg, "A <= 50");
1789 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1791 MsiSetProperty(hpkg, "X", "50val");
1793 r = MsiEvaluateCondition(hpkg, "2 <= X");
1794 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1796 r = MsiEvaluateCondition(hpkg, "A <= X");
1797 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1799 MsiSetProperty(hpkg, "A", "7");
1800 MsiSetProperty(hpkg, "X", "50");
1802 r = MsiEvaluateCondition(hpkg, "7 <= X");
1803 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1805 r = MsiEvaluateCondition(hpkg, "A <= X");
1806 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1808 r = MsiEvaluateCondition(hpkg, "A <= 50");
1809 ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
1811 MsiSetProperty(hpkg, "X", "50val");
1813 r = MsiEvaluateCondition(hpkg, "2 <= X");
1814 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1816 r = MsiEvaluateCondition(hpkg, "A <= X");
1817 ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
1819 MsiCloseHandle( hpkg );
1820 DeleteFile(msifile);
1823 static BOOL check_prop_empty( MSIHANDLE hpkg, const char * prop)
1831 r = MsiGetProperty( hpkg, prop, buffer, &sz );
1832 return r == ERROR_SUCCESS && buffer[0] == 0 && sz == 0;
1835 static void test_props(void)
1837 MSIHANDLE hpkg, hdb;
1842 hdb = create_package_db();
1844 "CREATE TABLE `Property` ( "
1845 "`Property` CHAR(255) NOT NULL, "
1846 "`Value` CHAR(255) "
1847 "PRIMARY KEY `Property`)" );
1848 ok( r == ERROR_SUCCESS , "Failed\n" );
1851 "INSERT INTO `Property` "
1852 "(`Property`, `Value`) "
1853 "VALUES( 'MetadataCompName', 'Photoshop.dll' )");
1854 ok( r == ERROR_SUCCESS , "Failed\n" );
1856 hpkg = package_from_db( hdb );
1857 ok( hpkg, "failed to create package\n");
1859 /* test invalid values */
1860 r = MsiGetProperty( 0, NULL, NULL, NULL );
1861 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1863 r = MsiGetProperty( hpkg, NULL, NULL, NULL );
1864 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1866 r = MsiGetProperty( hpkg, "boo", NULL, NULL );
1867 ok( r == ERROR_SUCCESS, "wrong return val\n");
1869 r = MsiGetProperty( hpkg, "boo", buffer, NULL );
1870 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1872 /* test retrieving an empty/nonexistent property */
1874 r = MsiGetProperty( hpkg, "boo", NULL, &sz );
1875 ok( r == ERROR_SUCCESS, "wrong return val\n");
1876 ok( sz == 0, "wrong size returned\n");
1878 check_prop_empty( hpkg, "boo");
1881 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1882 ok( r == ERROR_MORE_DATA, "wrong return val\n");
1883 ok( !strcmp(buffer,"x"), "buffer was changed\n");
1884 ok( sz == 0, "wrong size returned\n");
1888 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1889 ok( r == ERROR_SUCCESS, "wrong return val\n");
1890 ok( buffer[0] == 0, "buffer was not changed\n");
1891 ok( sz == 0, "wrong size returned\n");
1893 /* set the property to something */
1894 r = MsiSetProperty( 0, NULL, NULL );
1895 ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
1897 r = MsiSetProperty( hpkg, NULL, NULL );
1898 ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
1900 r = MsiSetProperty( hpkg, "", NULL );
1901 ok( r == ERROR_SUCCESS, "wrong return val\n");
1903 /* try set and get some illegal property identifiers */
1904 r = MsiSetProperty( hpkg, "", "asdf" );
1905 ok( r == ERROR_FUNCTION_FAILED, "wrong return val\n");
1907 r = MsiSetProperty( hpkg, "=", "asdf" );
1908 ok( r == ERROR_SUCCESS, "wrong return val\n");
1910 r = MsiSetProperty( hpkg, " ", "asdf" );
1911 ok( r == ERROR_SUCCESS, "wrong return val\n");
1913 r = MsiSetProperty( hpkg, "'", "asdf" );
1914 ok( r == ERROR_SUCCESS, "wrong return val\n");
1918 r = MsiGetProperty( hpkg, "'", buffer, &sz );
1919 ok( r == ERROR_SUCCESS, "wrong return val\n");
1920 ok( !strcmp(buffer,"asdf"), "buffer was not changed\n");
1922 /* set empty values */
1923 r = MsiSetProperty( hpkg, "boo", NULL );
1924 ok( r == ERROR_SUCCESS, "wrong return val\n");
1925 ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
1927 r = MsiSetProperty( hpkg, "boo", "" );
1928 ok( r == ERROR_SUCCESS, "wrong return val\n");
1929 ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
1931 /* set a non-empty value */
1932 r = MsiSetProperty( hpkg, "boo", "xyz" );
1933 ok( r == ERROR_SUCCESS, "wrong return val\n");
1937 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1938 ok( r == ERROR_MORE_DATA, "wrong return val\n");
1939 ok( buffer[0] == 0, "buffer was not changed\n");
1940 ok( sz == 3, "wrong size returned\n");
1944 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1945 ok( r == ERROR_SUCCESS, "wrong return val\n");
1946 ok( !strcmp(buffer,"xyz"), "buffer was not changed\n");
1947 ok( sz == 3, "wrong size returned\n");
1951 r = MsiGetProperty( hpkg, "boo", buffer, &sz );
1952 ok( r == ERROR_MORE_DATA, "wrong return val\n");
1953 ok( !strcmp(buffer,"xy"), "buffer was not changed\n");
1954 ok( sz == 3, "wrong size returned\n");
1956 r = MsiSetProperty(hpkg, "SourceDir", "foo");
1957 ok( r == ERROR_SUCCESS, "wrong return val\n");
1960 r = MsiGetProperty(hpkg, "SOURCEDIR", buffer, &sz);
1961 ok( r == ERROR_SUCCESS, "wrong return val\n");
1962 ok( !strcmp(buffer,""), "buffer wrong\n");
1963 ok( sz == 0, "wrong size returned\n");
1966 r = MsiGetProperty(hpkg, "SOMERANDOMNAME", buffer, &sz);
1967 ok( r == ERROR_SUCCESS, "wrong return val\n");
1968 ok( !strcmp(buffer,""), "buffer wrong\n");
1969 ok( sz == 0, "wrong size returned\n");
1972 r = MsiGetProperty(hpkg, "SourceDir", buffer, &sz);
1973 ok( r == ERROR_SUCCESS, "wrong return val\n");
1974 ok( !strcmp(buffer,"foo"), "buffer wrong\n");
1975 ok( sz == 3, "wrong size returned\n");
1977 r = MsiSetProperty(hpkg, "MetadataCompName", "Photoshop.dll");
1978 ok( r == ERROR_SUCCESS, "wrong return val\n");
1981 r = MsiGetProperty(hpkg, "MetadataCompName", NULL, &sz );
1982 ok( r == ERROR_SUCCESS, "return wrong\n");
1983 ok( sz == 13, "size wrong (%d)\n", sz);
1986 r = MsiGetProperty(hpkg, "MetadataCompName", buffer, &sz );
1987 ok( r == ERROR_MORE_DATA, "return wrong\n");
1988 ok( !strcmp(buffer,"Photoshop.dl"), "buffer wrong\n");
1990 r = MsiSetProperty(hpkg, "property", "value");
1991 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1994 r = MsiGetProperty(hpkg, "property", buffer, &sz);
1995 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1996 ok( !strcmp(buffer, "value"), "Expected value, got %s\n", buffer);
1998 r = MsiSetProperty(hpkg, "property", NULL);
1999 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2002 r = MsiGetProperty(hpkg, "property", buffer, &sz);
2003 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2004 ok( !strlen(buffer), "Expected empty string, got %s\n", buffer);
2006 MsiCloseHandle( hpkg );
2007 DeleteFile(msifile);
2010 static BOOL find_prop_in_property(MSIHANDLE hdb, LPCSTR prop, LPCSTR val)
2012 MSIHANDLE hview, hrec;
2014 CHAR buffer[MAX_PATH];
2018 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Property`", &hview);
2019 ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
2020 r = MsiViewExecute(hview, 0);
2021 ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n");
2024 while (r == ERROR_SUCCESS && !found)
2026 r = MsiViewFetch(hview, &hrec);
2027 if (r != ERROR_SUCCESS) break;
2030 r = MsiRecordGetString(hrec, 1, buffer, &sz);
2031 if (r == ERROR_SUCCESS && !lstrcmpA(buffer, prop))
2034 r = MsiRecordGetString(hrec, 2, buffer, &sz);
2035 if (r == ERROR_SUCCESS && !lstrcmpA(buffer, val))
2039 MsiCloseHandle(hrec);
2042 MsiViewClose(hview);
2043 MsiCloseHandle(hview);
2048 static void test_property_table(void)
2052 MSIHANDLE hpkg, hdb, hrec;
2053 char buffer[MAX_PATH];
2057 hdb = create_package_db();
2058 ok( hdb, "failed to create package\n");
2060 hpkg = package_from_db(hdb);
2061 ok( hpkg, "failed to create package\n");
2063 MsiCloseHandle(hdb);
2065 hdb = MsiGetActiveDatabase(hpkg);
2067 query = "CREATE TABLE `_Property` ( "
2068 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
2069 r = run_query(hdb, query);
2070 ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
2072 MsiCloseHandle(hdb);
2073 MsiCloseHandle(hpkg);
2074 DeleteFile(msifile);
2076 hdb = create_package_db();
2077 ok( hdb, "failed to create package\n");
2079 query = "CREATE TABLE `_Property` ( "
2080 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
2081 r = run_query(hdb, query);
2082 ok(r == ERROR_SUCCESS, "failed to create table\n");
2084 query = "ALTER `_Property` ADD `foo` INTEGER";
2085 r = run_query(hdb, query);
2086 ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n");
2088 query = "ALTER TABLE `_Property` ADD `foo` INTEGER";
2089 r = run_query(hdb, query);
2090 ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n");
2092 query = "ALTER TABLE `_Property` ADD `extra` INTEGER";
2093 r = run_query(hdb, query);
2094 ok(r == ERROR_SUCCESS, "failed to add column\n");
2096 hpkg = package_from_db(hdb);
2099 ok(!hpkg, "package should not be created\n");
2102 MsiCloseHandle(hdb);
2103 MsiCloseHandle(hpkg);
2104 DeleteFile(msifile);
2106 hdb = create_package_db();
2107 ok (hdb, "failed to create package database\n");
2109 r = create_property_table(hdb);
2110 ok(r == ERROR_SUCCESS, "cannot create Property table: %d\n", r);
2112 r = add_property_entry(hdb, "'prop', 'val'");
2113 ok(r == ERROR_SUCCESS, "cannot add property: %d\n", r);
2115 hpkg = package_from_db(hdb);
2116 ok(hpkg, "failed to create package\n");
2118 MsiCloseHandle(hdb);
2121 r = MsiGetProperty(hpkg, "prop", buffer, &sz);
2122 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2123 ok(!lstrcmp(buffer, "val"), "Expected val, got %s\n", buffer);
2125 hdb = MsiGetActiveDatabase(hpkg);
2127 found = find_prop_in_property(hdb, "prop", "val");
2128 ok(found, "prop should be in the _Property table\n");
2130 r = add_property_entry(hdb, "'dantes', 'mercedes'");
2131 ok(r == ERROR_SUCCESS, "cannot add property: %d\n", r);
2133 query = "SELECT * FROM `_Property` WHERE `Property` = 'dantes'";
2134 r = do_query(hdb, query, &hrec);
2135 ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
2137 found = find_prop_in_property(hdb, "dantes", "mercedes");
2138 ok(found == FALSE, "dantes should not be in the _Property table\n");
2141 lstrcpy(buffer, "aaa");
2142 r = MsiGetProperty(hpkg, "dantes", buffer, &sz);
2143 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2144 ok(lstrlenA(buffer) == 0, "Expected empty string, got %s\n", buffer);
2146 r = MsiSetProperty(hpkg, "dantes", "mercedes");
2147 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2149 found = find_prop_in_property(hdb, "dantes", "mercedes");
2150 ok(found == TRUE, "dantes should be in the _Property table\n");
2152 MsiCloseHandle(hdb);
2153 MsiCloseHandle(hpkg);
2154 DeleteFile(msifile);
2157 static UINT try_query_param( MSIHANDLE hdb, LPCSTR szQuery, MSIHANDLE hrec )
2162 res = MsiDatabaseOpenView( hdb, szQuery, &htab );
2163 if( res == ERROR_SUCCESS )
2167 r = MsiViewExecute( htab, hrec );
2168 if( r != ERROR_SUCCESS )
2171 fprintf(stderr,"MsiViewExecute failed %08x\n", res);
2174 r = MsiViewClose( htab );
2175 if( r != ERROR_SUCCESS )
2178 r = MsiCloseHandle( htab );
2179 if( r != ERROR_SUCCESS )
2185 static UINT try_query( MSIHANDLE hdb, LPCSTR szQuery )
2187 return try_query_param( hdb, szQuery, 0 );
2190 static void set_summary_str(MSIHANDLE hdb, DWORD pid, LPCSTR value)
2195 r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2196 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2198 r = MsiSummaryInfoSetPropertyA(summary, pid, VT_LPSTR, 0, NULL, value);
2199 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2201 r = MsiSummaryInfoPersist(summary);
2202 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2204 MsiCloseHandle(summary);
2207 static void set_summary_dword(MSIHANDLE hdb, DWORD pid, DWORD value)
2212 r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
2213 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2215 r = MsiSummaryInfoSetPropertyA(summary, pid, VT_I4, value, NULL, NULL);
2216 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2218 r = MsiSummaryInfoPersist(summary);
2219 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2221 MsiCloseHandle(summary);
2224 static void test_msipackage(void)
2226 MSIHANDLE hdb = 0, hpack = 100;
2231 /* NULL szPackagePath */
2232 r = MsiOpenPackage(NULL, &hpack);
2233 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2235 /* empty szPackagePath */
2236 r = MsiOpenPackage("", &hpack);
2239 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2242 if (r == ERROR_SUCCESS)
2243 MsiCloseHandle(hpack);
2245 /* nonexistent szPackagePath */
2246 r = MsiOpenPackage("nonexistent", &hpack);
2247 ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
2250 r = MsiOpenPackage(msifile, NULL);
2251 ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2255 r = MsiOpenPackage(name, &hpack);
2256 ok(r == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", r);
2258 r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
2259 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2261 /* database exists, but is emtpy */
2262 sprintf(name, "#%ld", hdb);
2263 r = MsiOpenPackage(name, &hpack);
2264 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2265 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2267 query = "CREATE TABLE `Property` ( "
2268 "`Property` CHAR(72), `Value` CHAR(0) "
2269 "PRIMARY KEY `Property`)";
2270 r = try_query(hdb, query);
2271 ok(r == ERROR_SUCCESS, "failed to create Properties table\n");
2273 query = "CREATE TABLE `InstallExecuteSequence` ("
2274 "`Action` CHAR(72), `Condition` CHAR(0), `Sequence` INTEGER "
2275 "PRIMARY KEY `Action`)";
2276 r = try_query(hdb, query);
2277 ok(r == ERROR_SUCCESS, "failed to create InstallExecuteSequence table\n");
2279 /* a few key tables exist */
2280 sprintf(name, "#%ld", hdb);
2281 r = MsiOpenPackage(name, &hpack);
2282 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2283 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2285 MsiCloseHandle(hdb);
2286 DeleteFile(msifile);
2288 /* start with a clean database to show what constitutes a valid package */
2289 r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
2290 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2292 sprintf(name, "#%ld", hdb);
2294 /* The following summary information props must exist:
2299 set_summary_dword(hdb, PID_PAGECOUNT, 100);
2300 r = MsiOpenPackage(name, &hpack);
2301 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
2302 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
2304 set_summary_str(hdb, PID_REVNUMBER, "{004757CD-5092-49c2-AD20-28E1CE0DF5F2}");
2305 r = MsiOpenPackage(name, &hpack);
2306 ok(r == ERROR_SUCCESS,
2307 "Expected ERROR_SUCCESS, got %d\n", r);
2309 MsiCloseHandle(hpack);
2310 MsiCloseHandle(hdb);
2311 DeleteFile(msifile);
2314 static void test_formatrecord2(void)
2316 MSIHANDLE hpkg, hrec ;
2321 hpkg = package_from_db(create_package_db());
2322 ok( hpkg, "failed to create package\n");
2324 r = MsiSetProperty(hpkg, "Manufacturer", " " );
2325 ok( r == ERROR_SUCCESS, "set property failed\n");
2327 hrec = MsiCreateRecord(2);
2328 ok(hrec, "create record failed\n");
2330 r = MsiRecordSetString( hrec, 0, "[ProgramFilesFolder][Manufacturer]\\asdf");
2331 ok( r == ERROR_SUCCESS, "format record failed\n");
2335 r = MsiFormatRecord( hpkg, hrec, buffer, &sz );
2337 r = MsiRecordSetString(hrec, 0, "[foo][1]");
2338 r = MsiRecordSetString(hrec, 1, "hoo");
2340 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2341 ok( sz == 3, "size wrong\n");
2342 ok( 0 == strcmp(buffer,"hoo"), "wrong output %s\n",buffer);
2343 ok( r == ERROR_SUCCESS, "format failed\n");
2345 r = MsiRecordSetString(hrec, 0, "x[~]x");
2347 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2348 ok( sz == 3, "size wrong\n");
2349 ok( 0 == strcmp(buffer,"x"), "wrong output %s\n",buffer);
2350 ok( r == ERROR_SUCCESS, "format failed\n");
2352 r = MsiRecordSetString(hrec, 0, "[foo.$%}][1]");
2353 r = MsiRecordSetString(hrec, 1, "hoo");
2355 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2356 ok( sz == 3, "size wrong\n");
2357 ok( 0 == strcmp(buffer,"hoo"), "wrong output %s\n",buffer);
2358 ok( r == ERROR_SUCCESS, "format failed\n");
2360 r = MsiRecordSetString(hrec, 0, "[\\[]");
2362 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2363 ok( sz == 1, "size wrong\n");
2364 ok( 0 == strcmp(buffer,"["), "wrong output %s\n",buffer);
2365 ok( r == ERROR_SUCCESS, "format failed\n");
2367 SetEnvironmentVariable("FOO", "BAR");
2368 r = MsiRecordSetString(hrec, 0, "[%FOO]");
2370 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2371 ok( sz == 3, "size wrong\n");
2372 ok( 0 == strcmp(buffer,"BAR"), "wrong output %s\n",buffer);
2373 ok( r == ERROR_SUCCESS, "format failed\n");
2375 r = MsiRecordSetString(hrec, 0, "[[1]]");
2376 r = MsiRecordSetString(hrec, 1, "%FOO");
2378 r = MsiFormatRecord(hpkg, hrec, buffer, &sz);
2379 ok( sz == 3, "size wrong\n");
2380 ok( 0 == strcmp(buffer,"BAR"), "wrong output %s\n",buffer);
2381 ok( r == ERROR_SUCCESS, "format failed\n");
2383 MsiCloseHandle( hrec );
2384 MsiCloseHandle( hpkg );
2385 DeleteFile(msifile);
2388 static void test_states(void)
2393 INSTALLSTATE state, action;
2395 static const CHAR msifile2[] = "winetest2.msi";
2396 static const CHAR msifile3[] = "winetest3.msi";
2398 hdb = create_package_db();
2399 ok ( hdb, "failed to create package database\n" );
2401 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
2402 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
2404 r = create_property_table( hdb );
2405 ok( r == ERROR_SUCCESS, "cannot create Property table: %d\n", r );
2407 r = add_property_entry( hdb, "'ProductCode', '{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}'" );
2408 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2410 r = add_property_entry( hdb, "'ProductLanguage', '1033'" );
2411 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2413 r = add_property_entry( hdb, "'ProductName', 'MSITEST'" );
2414 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2416 r = add_property_entry( hdb, "'ProductVersion', '1.1.1'" );
2417 ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r );
2419 r = create_install_execute_sequence_table( hdb );
2420 ok( r == ERROR_SUCCESS, "cannot create InstallExecuteSequence table: %d\n", r );
2422 r = add_install_execute_sequence_entry( hdb, "'CostInitialize', '', '800'" );
2423 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2425 r = add_install_execute_sequence_entry( hdb, "'FileCost', '', '900'" );
2426 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2428 r = add_install_execute_sequence_entry( hdb, "'CostFinalize', '', '1000'" );
2429 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2431 r = add_install_execute_sequence_entry( hdb, "'InstallValidate', '', '1400'" );
2432 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2434 r = add_install_execute_sequence_entry( hdb, "'InstallInitialize', '', '1500'" );
2435 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2437 r = add_install_execute_sequence_entry( hdb, "'ProcessComponents', '', '1600'" );
2438 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2440 r = add_install_execute_sequence_entry( hdb, "'UnpublishFeatures', '', '1800'" );
2441 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2443 r = add_install_execute_sequence_entry( hdb, "'RegisterProduct', '', '6100'" );
2444 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2446 r = add_install_execute_sequence_entry( hdb, "'PublishFeatures', '', '6300'" );
2447 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2449 r = add_install_execute_sequence_entry( hdb, "'PublishProduct', '', '6400'" );
2450 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2452 r = add_install_execute_sequence_entry( hdb, "'InstallFinalize', '', '6600'" );
2453 ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r );
2455 r = create_media_table( hdb );
2456 ok( r == ERROR_SUCCESS, "cannot create media table: %d\n", r );
2458 r = add_media_entry( hdb, "'1', '3', '', '', 'DISK1', ''");
2459 ok( r == ERROR_SUCCESS, "cannot add media entry: %d\n", r );
2461 r = create_feature_table( hdb );
2462 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
2464 r = create_component_table( hdb );
2465 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
2467 /* msidbFeatureAttributesFavorLocal */
2468 r = add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
2469 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2471 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
2472 r = add_component_entry( hdb, "'alpha', '{467EC132-739D-4784-A37B-677AA43DBC94}', 'TARGETDIR', 0, '', 'alpha_file'" );
2473 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2475 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
2476 r = add_component_entry( hdb, "'beta', '{2C1F189C-24A6-4C34-B26B-994A6C026506}', 'TARGETDIR', 1, '', 'beta_file'" );
2477 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2479 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
2480 r = add_component_entry( hdb, "'gamma', '{C271E2A4-DE2E-4F70-86D1-6984AF7DE2CA}', 'TARGETDIR', 2, '', 'gamma_file'" );
2481 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2483 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSharedDllRefCount */
2484 r = add_component_entry( hdb, "'theta', '{4EB3129D-81A8-48D5-9801-75600FED3DD9}', 'TARGETDIR', 8, '', 'theta_file'" );
2485 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2487 /* msidbFeatureAttributesFavorSource */
2488 r = add_feature_entry( hdb, "'two', '', '', '', 2, 1, '', 1" );
2489 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2491 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
2492 r = add_component_entry( hdb, "'delta', '{938FD4F2-C648-4259-A03C-7AA3B45643F3}', 'TARGETDIR', 0, '', 'delta_file'" );
2493 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2495 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2496 r = add_component_entry( hdb, "'epsilon', '{D59713B6-C11D-47F2-A395-1E5321781190}', 'TARGETDIR', 1, '', 'epsilon_file'" );
2497 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2499 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
2500 r = add_component_entry( hdb, "'zeta', '{377D33AB-2FAA-42B9-A629-0C0DAE9B9C7A}', 'TARGETDIR', 2, '', 'zeta_file'" );
2501 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2503 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSharedDllRefCount */
2504 r = add_component_entry( hdb, "'iota', '{5D36F871-B5ED-4801-9E0F-C46B9E5C9669}', 'TARGETDIR', 8, '', 'iota_file'" );
2505 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2507 /* msidbFeatureAttributesFavorSource */
2508 r = add_feature_entry( hdb, "'three', '', '', '', 2, 1, '', 1" );
2509 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2511 /* msidbFeatureAttributesFavorLocal */
2512 r = add_feature_entry( hdb, "'four', '', '', '', 2, 1, '', 0" );
2513 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2516 r = add_feature_entry( hdb, "'five', '', '', '', 2, 0, '', 1" );
2517 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2519 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2520 r = add_component_entry( hdb, "'eta', '{DD89003F-0DD4-41B8-81C0-3411A7DA2695}', 'TARGETDIR', 1, '', 'eta_file'" );
2521 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2523 /* no feature parent:msidbComponentAttributesLocalOnly */
2524 r = add_component_entry( hdb, "'kappa', '{D6B93DC3-8DA5-4769-9888-42BFE156BB8B}', 'TARGETDIR', 1, '', 'kappa_file'" );
2525 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2527 /* msidbFeatureAttributesFavorLocal:removed */
2528 r = add_feature_entry( hdb, "'six', '', '', '', 2, 1, '', 0" );
2529 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2531 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesLocalOnly */
2532 r = add_component_entry( hdb, "'lambda', '{6528C5E4-02A4-4636-A214-7A66A6C35B64}', 'TARGETDIR', 0, '', 'lambda_file'" );
2533 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2535 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSourceOnly */
2536 r = add_component_entry( hdb, "'mu', '{97014BAB-6C56-4013-9A63-2BF913B42519}', 'TARGETDIR', 1, '', 'mu_file'" );
2537 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2539 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesOptional */
2540 r = add_component_entry( hdb, "'nu', '{943DD0D8-5808-4954-8526-3B8493FEDDCD}', 'TARGETDIR', 2, '', 'nu_file'" );
2541 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2543 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSharedDllRefCount */
2544 r = add_component_entry( hdb, "'xi', '{D6CF9EF7-6FCF-4930-B34B-F938AEFF9BDB}', 'TARGETDIR', 8, '', 'xi_file'" );
2545 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2547 /* msidbFeatureAttributesFavorSource:removed */
2548 r = add_feature_entry( hdb, "'seven', '', '', '', 2, 1, '', 1" );
2549 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
2551 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesLocalOnly */
2552 r = add_component_entry( hdb, "'omicron', '{7B57521D-15DB-4141-9AA6-01D934A4433F}', 'TARGETDIR', 0, '', 'omicron_file'" );
2553 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2555 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSourceOnly */
2556 r = add_component_entry( hdb, "'pi', '{FB85346B-378E-4492-8769-792305471C81}', 'TARGETDIR', 1, '', 'pi_file'" );
2557 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2559 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesOptional */
2560 r = add_component_entry( hdb, "'rho', '{798F2047-7B0C-4783-8BB0-D703E554114B}', 'TARGETDIR', 2, '', 'rho_file'" );
2561 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2563 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSharedDllRefCount */
2564 r = add_component_entry( hdb, "'sigma', '{5CE9DDA8-B67B-4736-9D93-99D61C5B93E7}', 'TARGETDIR', 8, '', 'sigma_file'" );
2565 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
2567 r = create_feature_components_table( hdb );
2568 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
2570 r = add_feature_components_entry( hdb, "'one', 'alpha'" );
2571 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2573 r = add_feature_components_entry( hdb, "'one', 'beta'" );
2574 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2576 r = add_feature_components_entry( hdb, "'one', 'gamma'" );
2577 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2579 r = add_feature_components_entry( hdb, "'one', 'theta'" );
2580 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2582 r = add_feature_components_entry( hdb, "'two', 'delta'" );
2583 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2585 r = add_feature_components_entry( hdb, "'two', 'epsilon'" );
2586 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2588 r = add_feature_components_entry( hdb, "'two', 'zeta'" );
2589 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2591 r = add_feature_components_entry( hdb, "'two', 'iota'" );
2592 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2594 r = add_feature_components_entry( hdb, "'three', 'eta'" );
2595 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2597 r = add_feature_components_entry( hdb, "'four', 'eta'" );
2598 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2600 r = add_feature_components_entry( hdb, "'five', 'eta'" );
2601 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2603 r = add_feature_components_entry( hdb, "'six', 'lambda'" );
2604 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2606 r = add_feature_components_entry( hdb, "'six', 'mu'" );
2607 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2609 r = add_feature_components_entry( hdb, "'six', 'nu'" );
2610 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2612 r = add_feature_components_entry( hdb, "'six', 'xi'" );
2613 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2615 r = add_feature_components_entry( hdb, "'seven', 'omicron'" );
2616 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2618 r = add_feature_components_entry( hdb, "'seven', 'pi'" );
2619 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2621 r = add_feature_components_entry( hdb, "'seven', 'rho'" );
2622 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2624 r = add_feature_components_entry( hdb, "'seven', 'sigma'" );
2625 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
2627 r = create_file_table( hdb );
2628 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
2630 r = add_file_entry( hdb, "'alpha_file', 'alpha', 'alpha.txt', 100, '', '1033', 8192, 1" );
2631 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2633 r = add_file_entry( hdb, "'beta_file', 'beta', 'beta.txt', 0, '', '1033', 8192, 1" );
2634 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2636 r = add_file_entry( hdb, "'gamma_file', 'gamma', 'gamma.txt', 0, '', '1033', 8192, 1" );
2637 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2639 r = add_file_entry( hdb, "'theta_file', 'theta', 'theta.txt', 0, '', '1033', 8192, 1" );
2640 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2642 r = add_file_entry( hdb, "'delta_file', 'delta', 'delta.txt', 0, '', '1033', 8192, 1" );
2643 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2645 r = add_file_entry( hdb, "'epsilon_file', 'epsilon', 'epsilon.txt', 0, '', '1033', 8192, 1" );
2646 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2648 r = add_file_entry( hdb, "'zeta_file', 'zeta', 'zeta.txt', 0, '', '1033', 8192, 1" );
2649 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2651 r = add_file_entry( hdb, "'iota_file', 'iota', 'iota.txt', 0, '', '1033', 8192, 1" );
2652 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2654 /* compressed file */
2655 r = add_file_entry( hdb, "'eta_file', 'eta', 'eta.txt', 0, '', '1033', 16384, 1" );
2656 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2658 r = add_file_entry( hdb, "'kappa_file', 'kappa', 'kappa.txt', 0, '', '1033', 8192, 1" );
2659 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2661 r = add_file_entry( hdb, "'lambda_file', 'lambda', 'lambda.txt', 100, '', '1033', 8192, 1" );
2662 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2664 r = add_file_entry( hdb, "'mu_file', 'mu', 'mu.txt', 100, '', '1033', 8192, 1" );
2665 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2667 r = add_file_entry( hdb, "'nu_file', 'nu', 'nu.txt', 100, '', '1033', 8192, 1" );
2668 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2670 r = add_file_entry( hdb, "'xi_file', 'xi', 'xi.txt', 100, '', '1033', 8192, 1" );
2671 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2673 r = add_file_entry( hdb, "'omicron_file', 'omicron', 'omicron.txt', 100, '', '1033', 8192, 1" );
2674 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2676 r = add_file_entry( hdb, "'pi_file', 'pi', 'pi.txt', 100, '', '1033', 8192, 1" );
2677 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2679 r = add_file_entry( hdb, "'rho_file', 'rho', 'rho.txt', 100, '', '1033', 8192, 1" );
2680 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2682 r = add_file_entry( hdb, "'sigma_file', 'sigma', 'sigma.txt', 100, '', '1033', 8192, 1" );
2683 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
2685 MsiDatabaseCommit(hdb);
2687 /* these properties must not be in the saved msi file */
2688 r = add_property_entry( hdb, "'ADDLOCAL', 'one,four'");
2689 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2691 r = add_property_entry( hdb, "'ADDSOURCE', 'two,three'");
2692 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2694 r = add_property_entry( hdb, "'REMOVE', 'six,seven'");
2695 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
2697 hpkg = package_from_db( hdb );
2698 ok( hpkg, "failed to create package\n");
2700 MsiCloseHandle(hdb);
2702 CopyFileA(msifile, msifile2, FALSE);
2703 CopyFileA(msifile, msifile3, FALSE);
2707 r = MsiGetFeatureState(hpkg, "one", &state, &action);
2708 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2709 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2710 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2714 r = MsiGetFeatureState(hpkg, "two", &state, &action);
2715 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2716 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2717 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2721 r = MsiGetFeatureState(hpkg, "three", &state, &action);
2722 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2723 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2724 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2728 r = MsiGetFeatureState(hpkg, "four", &state, &action);
2729 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2730 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2731 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2735 r = MsiGetFeatureState(hpkg, "five", &state, &action);
2736 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2737 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2738 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2742 r = MsiGetFeatureState(hpkg, "six", &state, &action);
2743 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2744 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2745 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2749 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
2750 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
2751 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2752 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2756 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
2757 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2758 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2759 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2763 r = MsiGetComponentState(hpkg, "beta", &state, &action);
2764 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2765 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2766 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2770 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
2771 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2772 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2773 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2777 r = MsiGetComponentState(hpkg, "theta", &state, &action);
2778 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2779 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2780 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2784 r = MsiGetComponentState(hpkg, "delta", &state, &action);
2785 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2786 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2787 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2791 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
2792 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2793 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2794 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2798 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
2799 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2800 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2801 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2805 r = MsiGetComponentState(hpkg, "iota", &state, &action);
2806 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2807 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2808 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2812 r = MsiGetComponentState(hpkg, "eta", &state, &action);
2813 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2814 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2815 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2819 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
2820 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2821 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2822 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2826 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
2827 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2828 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2829 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2833 r = MsiGetComponentState(hpkg, "mu", &state, &action);
2834 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2835 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2836 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2840 r = MsiGetComponentState(hpkg, "nu", &state, &action);
2841 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2842 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2843 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2847 r = MsiGetComponentState(hpkg, "xi", &state, &action);
2848 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2849 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2850 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2854 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
2855 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2856 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2857 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2861 r = MsiGetComponentState(hpkg, "pi", &state, &action);
2862 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2863 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2864 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2868 r = MsiGetComponentState(hpkg, "rho", &state, &action);
2869 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2870 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2871 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2875 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
2876 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
2877 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
2878 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
2880 r = MsiDoAction( hpkg, "CostInitialize");
2881 ok( r == ERROR_SUCCESS, "cost init failed\n");
2885 r = MsiGetFeatureState(hpkg, "one", &state, &action);
2886 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2887 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2888 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2892 r = MsiGetFeatureState(hpkg, "two", &state, &action);
2893 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2894 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2895 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2899 r = MsiGetFeatureState(hpkg, "three", &state, &action);
2900 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2901 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2902 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2906 r = MsiGetFeatureState(hpkg, "four", &state, &action);
2907 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2908 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2909 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2913 r = MsiGetFeatureState(hpkg, "five", &state, &action);
2914 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2915 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2916 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2920 r = MsiGetFeatureState(hpkg, "six", &state, &action);
2921 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2922 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2923 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2927 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
2928 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2929 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2930 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2934 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
2935 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2936 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2937 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2941 r = MsiGetComponentState(hpkg, "beta", &state, &action);
2942 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2943 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2944 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2948 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
2949 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2950 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2951 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2955 r = MsiGetComponentState(hpkg, "theta", &state, &action);
2956 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2957 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2958 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2962 r = MsiGetComponentState(hpkg, "delta", &state, &action);
2963 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2964 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2965 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2969 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
2970 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2971 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2972 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2976 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
2977 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2978 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2979 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2983 r = MsiGetComponentState(hpkg, "iota", &state, &action);
2984 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2985 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2986 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2990 r = MsiGetComponentState(hpkg, "eta", &state, &action);
2991 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2992 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2993 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2997 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
2998 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
2999 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3000 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3004 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3005 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3006 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3007 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3011 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3012 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3013 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3014 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3018 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3019 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3020 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3021 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3025 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3026 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3027 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3028 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3032 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3033 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3034 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3035 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3039 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3040 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3041 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3042 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3046 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3047 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3048 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3049 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3053 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3054 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3055 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3056 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3058 r = MsiDoAction( hpkg, "FileCost");
3059 ok( r == ERROR_SUCCESS, "file cost failed\n");
3063 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3064 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3065 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3066 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3070 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3071 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3072 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3073 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3077 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3078 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3079 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3080 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3084 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3085 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3086 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3087 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3091 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3092 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3093 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3094 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3098 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3099 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3100 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3101 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3105 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3106 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3107 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3108 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3112 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3113 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3114 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3115 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3119 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3120 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3121 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3122 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3126 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3127 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3128 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3129 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3133 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3134 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3135 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3136 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3140 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3141 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3142 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3143 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3147 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3148 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3149 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3150 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3154 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3155 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3156 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3157 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3161 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3162 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3163 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3164 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3168 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3169 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3170 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3171 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3175 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3176 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3177 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3178 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3182 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3183 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3184 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3185 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3189 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3190 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3191 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3192 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3196 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3197 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3198 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3199 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3203 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3204 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3205 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3206 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3210 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3211 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3212 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3213 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3217 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3218 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3219 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3220 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3224 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3225 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3226 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3227 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3231 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3232 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3233 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3234 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3236 r = MsiDoAction( hpkg, "CostFinalize");
3237 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
3241 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3242 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3243 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3244 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3248 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3249 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3250 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3251 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3255 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3256 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3257 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3258 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3262 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3263 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3264 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3265 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3269 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3270 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3271 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3272 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3276 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3277 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3278 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3279 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3283 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3284 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3285 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3286 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3290 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3291 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3292 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3293 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3297 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3298 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3299 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3300 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3304 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3305 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3306 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3307 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3311 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3312 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3313 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3314 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3318 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3319 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3320 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3321 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3325 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3326 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3327 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3328 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3332 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3333 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3334 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3335 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3339 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3340 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3341 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3342 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3346 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3347 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3348 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3349 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3353 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3354 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3355 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3356 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3360 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3361 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3362 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3363 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3367 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3368 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3369 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3370 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3374 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3375 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3376 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3377 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3381 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3382 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3383 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3384 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3388 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3389 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3390 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3391 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3395 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3396 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3397 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3398 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3402 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3403 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3404 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3405 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3409 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3410 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3411 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
3412 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3414 MsiCloseHandle( hpkg );
3416 /* publish the features and components */
3417 r = MsiInstallProduct(msifile, "ADDLOCAL=one,four ADDSOURCE=two,three REMOVE=six,seven");
3418 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3420 r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
3421 ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
3423 /* these properties must not be in the saved msi file */
3424 r = add_property_entry( hdb, "'ADDLOCAL', 'one,four'");
3425 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3427 r = add_property_entry( hdb, "'ADDSOURCE', 'two,three'");
3428 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3430 r = add_property_entry( hdb, "'REMOVE', 'six,seven'");
3431 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
3433 hpkg = package_from_db( hdb );
3434 ok( hpkg, "failed to create package\n");
3436 MsiCloseHandle(hdb);
3440 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3441 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3442 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3443 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3447 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3448 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3449 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3450 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3454 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3455 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3456 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3457 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3461 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3462 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3463 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3464 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3468 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3469 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3470 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3471 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3475 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3476 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3477 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3478 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3482 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3483 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
3484 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3485 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3489 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3490 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3491 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3492 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3496 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3497 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3498 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3499 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3503 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3504 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3505 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3506 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3510 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3511 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3512 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3513 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3517 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3518 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3519 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3520 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3524 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3525 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3526 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3527 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3531 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3532 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3533 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3534 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3538 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3539 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3540 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3541 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3545 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3546 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3547 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3548 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3552 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3553 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3554 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3555 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3559 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3560 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3561 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3562 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3566 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3567 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3568 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3569 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3573 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3574 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3575 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3576 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3580 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3581 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3582 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3583 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3587 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3588 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3589 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3590 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3594 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3595 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3596 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3597 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3601 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3602 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3603 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3604 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3608 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3609 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
3610 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
3611 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
3613 r = MsiDoAction( hpkg, "CostInitialize");
3614 ok( r == ERROR_SUCCESS, "cost init failed\n");
3618 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3619 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3620 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3621 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3625 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3626 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3627 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3628 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3632 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3633 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3634 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3635 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3639 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3640 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3641 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3642 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3646 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3647 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3648 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3649 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3653 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3654 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3655 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3656 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3660 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3661 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3662 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3663 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3667 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3668 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3669 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3670 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3674 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3675 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3676 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3677 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3681 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3682 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3683 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3684 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3688 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3689 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3690 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3691 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3695 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3696 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3697 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3698 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3702 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3703 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3704 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3705 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3709 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3710 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3711 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3712 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3716 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3717 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3718 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3719 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3723 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3724 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3725 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3726 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3730 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3731 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3732 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3733 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3737 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3738 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3739 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3740 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3744 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3745 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3746 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3747 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3751 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3752 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3753 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3754 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3758 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3759 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3760 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3761 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3765 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3766 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3767 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3768 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3772 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3773 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3774 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3775 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3779 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3780 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3781 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3782 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3786 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3787 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3788 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3789 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3791 r = MsiDoAction( hpkg, "FileCost");
3792 ok( r == ERROR_SUCCESS, "file cost failed\n");
3796 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3797 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3798 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3799 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3803 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3804 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3805 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3806 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3810 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3811 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3812 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3813 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3817 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3818 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3819 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3820 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3824 r = MsiGetFeatureState(hpkg, "five", &state, &action);
3825 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3826 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3827 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3831 r = MsiGetFeatureState(hpkg, "six", &state, &action);
3832 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3833 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3834 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3838 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
3839 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3840 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3841 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3845 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
3846 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3847 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3848 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3852 r = MsiGetComponentState(hpkg, "beta", &state, &action);
3853 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3854 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3855 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3859 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
3860 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3861 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3862 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3866 r = MsiGetComponentState(hpkg, "theta", &state, &action);
3867 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3868 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3869 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3873 r = MsiGetComponentState(hpkg, "delta", &state, &action);
3874 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3875 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3876 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3880 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
3881 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3882 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3883 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3887 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
3888 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3889 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3890 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3894 r = MsiGetComponentState(hpkg, "iota", &state, &action);
3895 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3896 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3897 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3901 r = MsiGetComponentState(hpkg, "eta", &state, &action);
3902 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3903 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3904 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3908 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
3909 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3910 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3911 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3915 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
3916 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3917 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3918 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3922 r = MsiGetComponentState(hpkg, "mu", &state, &action);
3923 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3924 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3925 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3929 r = MsiGetComponentState(hpkg, "nu", &state, &action);
3930 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3931 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3932 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3936 r = MsiGetComponentState(hpkg, "xi", &state, &action);
3937 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3938 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3939 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3943 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
3944 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3945 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3946 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3950 r = MsiGetComponentState(hpkg, "pi", &state, &action);
3951 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3952 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3953 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3957 r = MsiGetComponentState(hpkg, "rho", &state, &action);
3958 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3959 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3960 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3964 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
3965 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3966 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3967 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3969 r = MsiDoAction( hpkg, "CostFinalize");
3970 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
3974 r = MsiGetFeatureState(hpkg, "one", &state, &action);
3975 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3976 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
3977 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3981 r = MsiGetFeatureState(hpkg, "two", &state, &action);
3982 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3983 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
3984 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
3988 r = MsiGetFeatureState(hpkg, "three", &state, &action);
3989 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3990 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3991 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
3995 r = MsiGetFeatureState(hpkg, "four", &state, &action);
3996 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
3997 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3998 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4002 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4003 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4004 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4005 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4009 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4010 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4011 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4012 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4016 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4017 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4018 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4019 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4023 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4024 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4025 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4026 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4030 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4031 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4032 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4033 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
4037 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4038 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4039 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4040 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4044 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4045 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4046 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4047 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4051 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4052 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4053 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4054 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4058 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4059 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4060 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4061 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4065 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4066 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4067 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4068 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4072 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4073 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4074 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4075 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4079 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4080 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4081 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4082 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4086 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4087 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4088 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4089 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4093 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4094 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4095 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4096 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4100 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4101 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4102 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4103 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4107 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4108 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4109 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4110 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4114 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4115 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4116 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4117 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4121 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4122 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4123 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4124 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4128 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4129 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4130 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4131 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4135 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4136 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4137 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4138 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4142 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4143 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4144 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4145 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4147 MsiCloseHandle(hpkg);
4149 /* uninstall the product */
4150 r = MsiInstallProduct(msifile, "REMOVE=ALL");
4151 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4153 /* all features installed locally */
4154 r = MsiInstallProduct(msifile2, "ADDLOCAL=ALL");
4155 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4157 r = MsiOpenDatabase(msifile2, MSIDBOPEN_DIRECT, &hdb);
4158 ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
4160 /* these properties must not be in the saved msi file */
4161 r = add_property_entry( hdb, "'ADDLOCAL', 'one,two,three,four,five,six,seven'");
4162 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
4164 hpkg = package_from_db( hdb );
4165 ok( hpkg, "failed to create package\n");
4169 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4170 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4171 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4172 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4176 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4177 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4178 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4179 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4183 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4184 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4185 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4186 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4190 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4191 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4192 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4193 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4197 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4198 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4199 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4200 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4204 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4205 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4206 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4207 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4211 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4212 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4213 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4214 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4218 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4219 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4220 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4221 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4225 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4226 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4227 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4228 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4232 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4233 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4234 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4235 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4239 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4240 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4241 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4242 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4246 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4247 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4248 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4249 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4253 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4254 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4255 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4256 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4260 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4261 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4262 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4263 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4267 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4268 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4269 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4270 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4274 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4275 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4276 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4277 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4281 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4282 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4283 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4284 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4288 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4289 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4290 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4291 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4295 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4296 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4297 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4298 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4302 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4303 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4304 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4305 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4309 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4310 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4311 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4312 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4316 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4317 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4318 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4319 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4323 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4324 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4325 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4326 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4330 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4331 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4332 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4333 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4337 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4338 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4339 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4340 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4342 r = MsiDoAction( hpkg, "CostInitialize");
4343 ok( r == ERROR_SUCCESS, "cost init failed\n");
4347 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4348 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4349 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4350 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4354 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4355 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4356 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4357 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4361 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4362 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4363 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4364 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4368 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4369 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4370 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4371 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4375 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4376 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4377 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4378 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4382 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4383 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4384 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4385 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4389 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4390 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4391 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4392 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4396 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4397 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4398 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4399 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4403 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4404 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4405 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4406 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4410 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4411 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4412 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4413 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4417 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4418 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4419 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4420 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4424 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4425 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4426 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4427 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4431 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4432 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4433 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4434 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4438 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4439 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4440 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4441 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4445 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4446 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4447 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4448 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4452 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4453 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4454 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4455 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4459 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4460 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4461 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4462 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4466 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4467 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4468 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4469 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4473 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4474 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4475 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4476 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4480 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4481 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4482 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4483 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4487 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4488 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4489 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4490 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4494 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4495 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4496 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4497 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4501 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4502 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4503 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4504 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4508 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4509 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4510 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4511 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4515 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4516 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4517 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4518 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4520 r = MsiDoAction( hpkg, "FileCost");
4521 ok( r == ERROR_SUCCESS, "file cost failed\n");
4525 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4526 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4527 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4528 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4532 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4533 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4534 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4535 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4539 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4540 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4541 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4542 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4546 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4547 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4548 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4549 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4553 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4554 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4555 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4556 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4560 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4561 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4562 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4563 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4567 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4568 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4569 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4570 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4574 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4575 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4576 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4577 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4581 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4582 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4583 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4584 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4588 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4589 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4590 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4591 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4595 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4596 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4597 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4598 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4602 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4603 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4604 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4605 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4609 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4610 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4611 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4612 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4616 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4617 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4618 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4619 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4623 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4624 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4625 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4626 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4630 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4631 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4632 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4633 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4637 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4638 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4639 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4640 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4644 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4645 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4646 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4647 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4651 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4652 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4653 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4654 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4658 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4659 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4660 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4661 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4665 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4666 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4667 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4668 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4672 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4673 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4674 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4675 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4679 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4680 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4681 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4682 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4686 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4687 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4688 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4689 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4693 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4694 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4695 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4696 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4698 r = MsiDoAction( hpkg, "CostFinalize");
4699 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
4703 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4704 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4705 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4706 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4710 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4711 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4712 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4713 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4717 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4718 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4719 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4720 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4724 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4725 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4726 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4727 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4731 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4732 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4733 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4734 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4738 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4739 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4740 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4741 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4745 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4746 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4747 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4748 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4752 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4753 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4754 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4755 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4759 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4760 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4761 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4762 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4766 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4767 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4768 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4769 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4773 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4774 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4775 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4776 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4780 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4781 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4782 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4783 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4787 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4788 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4789 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4790 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
4794 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4795 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4796 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4797 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4801 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4802 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4803 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4804 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4808 r = MsiGetComponentState(hpkg, "eta", &state, &action);
4809 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4810 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4811 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
4815 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
4816 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4817 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
4818 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
4822 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
4823 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4824 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4825 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4829 r = MsiGetComponentState(hpkg, "mu", &state, &action);
4830 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4831 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4832 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4836 r = MsiGetComponentState(hpkg, "nu", &state, &action);
4837 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4838 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4839 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4843 r = MsiGetComponentState(hpkg, "xi", &state, &action);
4844 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4845 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4846 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4850 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
4851 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4852 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4853 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4857 r = MsiGetComponentState(hpkg, "pi", &state, &action);
4858 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4859 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
4860 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
4864 r = MsiGetComponentState(hpkg, "rho", &state, &action);
4865 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4866 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4867 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4871 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
4872 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
4873 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4874 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4876 MsiCloseHandle(hpkg);
4878 /* uninstall the product */
4879 r = MsiInstallProduct(msifile2, "REMOVE=ALL");
4880 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4882 /* all features installed from source */
4883 r = MsiInstallProduct(msifile3, "ADDSOURCE=ALL");
4884 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4886 r = MsiOpenDatabase(msifile3, MSIDBOPEN_DIRECT, &hdb);
4887 ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
4889 /* this property must not be in the saved msi file */
4890 r = add_property_entry( hdb, "'ADDSOURCE', 'one,two,three,four,five,six,seven'");
4891 ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r );
4893 hpkg = package_from_db( hdb );
4894 ok( hpkg, "failed to create package\n");
4898 r = MsiGetFeatureState(hpkg, "one", &state, &action);
4899 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4900 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4901 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4905 r = MsiGetFeatureState(hpkg, "two", &state, &action);
4906 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4907 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4908 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4912 r = MsiGetFeatureState(hpkg, "three", &state, &action);
4913 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4914 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4915 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4919 r = MsiGetFeatureState(hpkg, "four", &state, &action);
4920 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4921 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4922 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4926 r = MsiGetFeatureState(hpkg, "five", &state, &action);
4927 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4928 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4929 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4933 r = MsiGetFeatureState(hpkg, "six", &state, &action);
4934 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4935 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4936 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4940 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
4941 ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r );
4942 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4943 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4947 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
4948 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4949 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4950 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4954 r = MsiGetComponentState(hpkg, "beta", &state, &action);
4955 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4956 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4957 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4961 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
4962 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4963 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4964 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4968 r = MsiGetComponentState(hpkg, "theta", &state, &action);
4969 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4970 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4971 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4975 r = MsiGetComponentState(hpkg, "delta", &state, &action);
4976 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4977 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4978 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4982 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
4983 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4984 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4985 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4989 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
4990 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4991 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4992 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
4996 r = MsiGetComponentState(hpkg, "iota", &state, &action);
4997 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
4998 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
4999 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5003 r = MsiGetComponentState(hpkg, "eta", &state, &action);
5004 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5005 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5006 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5010 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5011 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5012 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5013 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5017 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5018 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5019 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5020 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5024 r = MsiGetComponentState(hpkg, "mu", &state, &action);
5025 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5026 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5027 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5031 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5032 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5033 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5034 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5038 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5039 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5040 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5041 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5045 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5046 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5047 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5048 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5052 r = MsiGetComponentState(hpkg, "pi", &state, &action);
5053 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5054 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5055 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5059 r = MsiGetComponentState(hpkg, "rho", &state, &action);
5060 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5061 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5062 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5066 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5067 ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r );
5068 ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state);
5069 ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action);
5071 r = MsiDoAction( hpkg, "CostInitialize");
5072 ok( r == ERROR_SUCCESS, "cost init failed\n");
5076 r = MsiGetFeatureState(hpkg, "one", &state, &action);
5077 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5078 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5079 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5083 r = MsiGetFeatureState(hpkg, "two", &state, &action);
5084 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5085 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5086 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5090 r = MsiGetFeatureState(hpkg, "three", &state, &action);
5091 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5092 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5093 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5097 r = MsiGetFeatureState(hpkg, "four", &state, &action);
5098 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5099 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5100 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5104 r = MsiGetFeatureState(hpkg, "five", &state, &action);
5105 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5106 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5107 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5111 r = MsiGetFeatureState(hpkg, "six", &state, &action);
5112 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5113 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5114 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5118 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5119 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5120 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5121 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5125 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5126 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5127 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5128 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5132 r = MsiGetComponentState(hpkg, "beta", &state, &action);
5133 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5134 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5135 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5139 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5140 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5141 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5142 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5146 r = MsiGetComponentState(hpkg, "theta", &state, &action);
5147 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5148 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5149 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5153 r = MsiGetComponentState(hpkg, "delta", &state, &action);
5154 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5155 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5156 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5160 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5161 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5162 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5163 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5167 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5168 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5169 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5170 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5174 r = MsiGetComponentState(hpkg, "iota", &state, &action);
5175 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5176 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5177 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5181 r = MsiGetComponentState(hpkg, "eta", &state, &action);
5182 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5183 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5184 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5188 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5189 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5190 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5191 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5195 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5196 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5197 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5198 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5202 r = MsiGetComponentState(hpkg, "mu", &state, &action);
5203 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5204 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5205 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5209 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5210 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5211 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5212 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5216 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5217 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5218 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5219 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5223 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5224 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5225 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5226 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5230 r = MsiGetComponentState(hpkg, "pi", &state, &action);
5231 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5232 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5233 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5237 r = MsiGetComponentState(hpkg, "rho", &state, &action);
5238 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5239 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5240 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5244 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5245 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5246 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5247 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5249 r = MsiDoAction( hpkg, "FileCost");
5250 ok( r == ERROR_SUCCESS, "file cost failed\n");
5254 r = MsiGetFeatureState(hpkg, "one", &state, &action);
5255 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5256 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5257 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5261 r = MsiGetFeatureState(hpkg, "two", &state, &action);
5262 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5263 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5264 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5268 r = MsiGetFeatureState(hpkg, "three", &state, &action);
5269 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5270 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5271 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5275 r = MsiGetFeatureState(hpkg, "four", &state, &action);
5276 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5277 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5278 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5282 r = MsiGetFeatureState(hpkg, "five", &state, &action);
5283 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5284 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5285 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5289 r = MsiGetFeatureState(hpkg, "six", &state, &action);
5290 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5291 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5292 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5296 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5297 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5298 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5299 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5303 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5304 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5305 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5306 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5310 r = MsiGetComponentState(hpkg, "beta", &state, &action);
5311 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5312 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5313 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5317 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5318 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5319 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5320 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5324 r = MsiGetComponentState(hpkg, "theta", &state, &action);
5325 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5326 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5327 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5331 r = MsiGetComponentState(hpkg, "delta", &state, &action);
5332 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5333 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5334 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5338 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5339 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5340 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5341 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5345 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5346 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5347 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5348 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5352 r = MsiGetComponentState(hpkg, "iota", &state, &action);
5353 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5354 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5355 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5359 r = MsiGetComponentState(hpkg, "eta", &state, &action);
5360 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5361 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5362 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5366 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5367 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5368 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5369 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5373 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5374 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5375 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5376 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5380 r = MsiGetComponentState(hpkg, "mu", &state, &action);
5381 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5382 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5383 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5387 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5388 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5389 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5390 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5394 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5395 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5396 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5397 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5401 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5402 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5403 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5404 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5408 r = MsiGetComponentState(hpkg, "pi", &state, &action);
5409 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5410 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5411 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5415 r = MsiGetComponentState(hpkg, "rho", &state, &action);
5416 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5417 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5418 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5422 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5423 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5424 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5425 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5427 r = MsiDoAction( hpkg, "CostFinalize");
5428 ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
5432 r = MsiGetFeatureState(hpkg, "one", &state, &action);
5433 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5434 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5435 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5439 r = MsiGetFeatureState(hpkg, "two", &state, &action);
5440 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5441 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5442 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5446 r = MsiGetFeatureState(hpkg, "three", &state, &action);
5447 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5448 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5449 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5453 r = MsiGetFeatureState(hpkg, "four", &state, &action);
5454 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5455 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5456 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5460 r = MsiGetFeatureState(hpkg, "five", &state, &action);
5461 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5462 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
5463 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5467 r = MsiGetFeatureState(hpkg, "six", &state, &action);
5468 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5469 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5470 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5474 r = MsiGetFeatureState(hpkg, "seven", &state, &action);
5475 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5476 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5477 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5481 r = MsiGetComponentState(hpkg, "alpha", &state, &action);
5482 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5483 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5484 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5488 r = MsiGetComponentState(hpkg, "beta", &state, &action);
5489 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5490 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5491 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5495 r = MsiGetComponentState(hpkg, "gamma", &state, &action);
5496 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5497 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5498 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5502 r = MsiGetComponentState(hpkg, "theta", &state, &action);
5503 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5504 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5505 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5509 r = MsiGetComponentState(hpkg, "delta", &state, &action);
5510 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5511 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5512 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5516 r = MsiGetComponentState(hpkg, "epsilon", &state, &action);
5517 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5518 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5519 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5523 r = MsiGetComponentState(hpkg, "zeta", &state, &action);
5524 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5525 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5526 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5530 r = MsiGetComponentState(hpkg, "iota", &state, &action);
5531 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5532 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5533 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5537 r = MsiGetComponentState(hpkg, "eta", &state, &action);
5538 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5539 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5540 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
5544 r = MsiGetComponentState(hpkg, "kappa", &state, &action);
5545 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5546 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
5547 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5551 r = MsiGetComponentState(hpkg, "lambda", &state, &action);
5552 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5553 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5554 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5558 r = MsiGetComponentState(hpkg, "mu", &state, &action);
5559 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5560 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5561 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5565 r = MsiGetComponentState(hpkg, "nu", &state, &action);
5566 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5567 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5568 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5572 r = MsiGetComponentState(hpkg, "xi", &state, &action);
5573 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5574 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5575 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5579 r = MsiGetComponentState(hpkg, "omicron", &state, &action);
5580 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5581 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5582 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5586 r = MsiGetComponentState(hpkg, "pi", &state, &action);
5587 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5588 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5589 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5593 r = MsiGetComponentState(hpkg, "rho", &state, &action);
5594 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5595 ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state);
5596 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
5600 r = MsiGetComponentState(hpkg, "sigma", &state, &action);
5601 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
5602 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5603 ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5605 MsiCloseHandle(hpkg);
5607 /* uninstall the product */
5608 r = MsiInstallProduct(msifile3, "REMOVE=ALL");
5609 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5611 DeleteFileA(msifile);
5612 DeleteFileA(msifile2);
5613 DeleteFileA(msifile3);
5616 static void test_getproperty(void)
5618 MSIHANDLE hPackage = 0;
5620 static CHAR empty[] = "";
5624 hPackage = package_from_db(create_package_db());
5625 ok( hPackage != 0, " Failed to create package\n");
5627 /* set the property */
5628 r = MsiSetProperty(hPackage, "Name", "Value");
5629 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5631 /* retrieve the size, NULL pointer */
5633 r = MsiGetProperty(hPackage, "Name", NULL, &size);
5634 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5635 ok( size == 5, "Expected 5, got %d\n", size);
5637 /* retrieve the size, empty string */
5639 r = MsiGetProperty(hPackage, "Name", empty, &size);
5640 ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
5641 ok( size == 5, "Expected 5, got %d\n", size);
5643 /* don't change size */
5644 r = MsiGetProperty(hPackage, "Name", prop, &size);
5645 ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
5646 ok( size == 5, "Expected 5, got %d\n", size);
5647 ok( !lstrcmp(prop, "Valu"), "Expected Valu, got %s\n", prop);
5649 /* increase the size by 1 */
5651 r = MsiGetProperty(hPackage, "Name", prop, &size);
5652 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5653 ok( size == 5, "Expected 5, got %d\n", size);
5654 ok( !lstrcmp(prop, "Value"), "Expected Value, got %s\n", prop);
5656 r = MsiCloseHandle( hPackage);
5657 ok( r == ERROR_SUCCESS , "Failed to close package\n" );
5658 DeleteFile(msifile);
5661 static void test_removefiles(void)
5667 hdb = create_package_db();
5668 ok ( hdb, "failed to create package database\n" );
5670 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
5671 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
5673 r = create_feature_table( hdb );
5674 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
5676 r = create_component_table( hdb );
5677 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
5679 r = add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
5680 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
5682 r = add_component_entry( hdb, "'hydrogen', '', 'TARGETDIR', 0, '', 'hydrogen_file'" );
5683 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
5685 r = add_component_entry( hdb, "'helium', '', 'TARGETDIR', 0, '', 'helium_file'" );
5686 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
5688 r = add_component_entry( hdb, "'lithium', '', 'TARGETDIR', 0, '', 'lithium_file'" );
5689 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
5691 r = add_component_entry( hdb, "'beryllium', '', 'TARGETDIR', 0, '', 'beryllium_file'" );
5692 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
5694 r = add_component_entry( hdb, "'boron', '', 'TARGETDIR', 0, '', 'boron_file'" );
5695 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
5697 r = add_component_entry( hdb, "'carbon', '', 'TARGETDIR', 0, '', 'carbon_file'" );
5698 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
5700 r = create_feature_components_table( hdb );
5701 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
5703 r = add_feature_components_entry( hdb, "'one', 'hydrogen'" );
5704 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
5706 r = add_feature_components_entry( hdb, "'one', 'helium'" );
5707 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
5709 r = add_feature_components_entry( hdb, "'one', 'lithium'" );
5710 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
5712 r = add_feature_components_entry( hdb, "'one', 'beryllium'" );
5713 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
5715 r = add_feature_components_entry( hdb, "'one', 'boron'" );
5716 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
5718 r = add_feature_components_entry( hdb, "'one', 'carbon'" );
5719 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
5721 r = create_file_table( hdb );
5722 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
5724 r = add_file_entry( hdb, "'hydrogen_file', 'hydrogen', 'hydrogen.txt', 0, '', '1033', 8192, 1" );
5725 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
5727 r = add_file_entry( hdb, "'helium_file', 'helium', 'helium.txt', 0, '', '1033', 8192, 1" );
5728 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
5730 r = add_file_entry( hdb, "'lithium_file', 'lithium', 'lithium.txt', 0, '', '1033', 8192, 1" );
5731 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
5733 r = add_file_entry( hdb, "'beryllium_file', 'beryllium', 'beryllium.txt', 0, '', '1033', 16384, 1" );
5734 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
5736 r = add_file_entry( hdb, "'boron_file', 'boron', 'boron.txt', 0, '', '1033', 16384, 1" );
5737 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
5739 r = add_file_entry( hdb, "'carbon_file', 'carbon', 'carbon.txt', 0, '', '1033', 16384, 1" );
5740 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
5742 r = create_remove_file_table( hdb );
5743 ok( r == ERROR_SUCCESS, "cannot create Remove File table: %d\n", r);
5745 hpkg = package_from_db( hdb );
5746 ok( hpkg, "failed to create package\n");
5748 MsiCloseHandle( hdb );
5750 create_test_file( "hydrogen.txt" );
5751 create_test_file( "helium.txt" );
5752 create_test_file( "lithium.txt" );
5753 create_test_file( "beryllium.txt" );
5754 create_test_file( "boron.txt" );
5755 create_test_file( "carbon.txt" );
5757 r = MsiSetProperty( hpkg, "TARGETDIR", CURR_DIR );
5758 ok( r == ERROR_SUCCESS, "set property failed\n");
5760 r = MsiDoAction( hpkg, "CostInitialize");
5761 ok( r == ERROR_SUCCESS, "cost init failed\n");
5763 r = MsiDoAction( hpkg, "FileCost");
5764 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
5766 r = MsiDoAction( hpkg, "CostFinalize");
5767 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
5769 r = MsiDoAction( hpkg, "InstallValidate");
5770 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
5772 r = MsiSetComponentState( hpkg, "hydrogen", INSTALLSTATE_ABSENT );
5773 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
5775 r = MsiSetComponentState( hpkg, "helium", INSTALLSTATE_LOCAL );
5776 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
5778 r = MsiSetComponentState( hpkg, "lithium", INSTALLSTATE_SOURCE );
5779 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
5781 r = MsiSetComponentState( hpkg, "beryllium", INSTALLSTATE_ABSENT );
5782 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
5784 r = MsiSetComponentState( hpkg, "boron", INSTALLSTATE_LOCAL );
5785 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
5787 r = MsiSetComponentState( hpkg, "carbon", INSTALLSTATE_SOURCE );
5788 ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
5790 r = MsiDoAction( hpkg, "RemoveFiles");
5791 ok( r == ERROR_SUCCESS, "remove files failed\n");
5793 ok(DeleteFileA("hydrogen.txt"), "Expected hydrogen.txt to exist\n");
5794 ok(DeleteFileA("lithium.txt"), "Expected lithium.txt to exist\n");
5795 ok(DeleteFileA("beryllium.txt"), "Expected beryllium.txt to exist\n");
5796 ok(DeleteFileA("carbon.txt"), "Expected carbon.txt to exist\n");
5797 ok(DeleteFileA("helium.txt"), "Expected helium.txt to exist\n");
5798 ok(DeleteFileA("boron.txt"), "Expected boron.txt to exist\n");
5800 MsiCloseHandle( hpkg );
5801 DeleteFileA(msifile);
5804 static void test_appsearch(void)
5809 CHAR prop[MAX_PATH];
5810 DWORD size = MAX_PATH;
5812 hdb = create_package_db();
5813 ok ( hdb, "failed to create package database\n" );
5815 r = create_appsearch_table( hdb );
5816 ok( r == ERROR_SUCCESS, "cannot create AppSearch table: %d\n", r );
5818 r = add_appsearch_entry( hdb, "'WEBBROWSERPROG', 'NewSignature1'" );
5819 ok( r == ERROR_SUCCESS, "cannot add entry: %d\n", r );
5821 r = create_reglocator_table( hdb );
5822 ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
5824 r = add_reglocator_entry( hdb, "'NewSignature1', 0, 'htmlfile\\shell\\open\\command', '', 1" );
5825 ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
5827 r = create_signature_table( hdb );
5828 ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r );
5830 r = add_signature_entry( hdb, "'NewSignature1', 'FileName', '', '', '', '', '', '', ''" );
5831 ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r );
5833 hpkg = package_from_db( hdb );
5834 ok( hpkg, "failed to create package\n");
5836 MsiCloseHandle( hdb );
5838 r = MsiDoAction( hpkg, "AppSearch" );
5839 ok( r == ERROR_SUCCESS, "AppSearch failed: %d\n", r);
5841 r = MsiGetPropertyA( hpkg, "WEBBROWSERPROG", prop, &size );
5842 ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
5845 ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
5848 MsiCloseHandle( hpkg );
5849 DeleteFileA(msifile);
5852 static void test_appsearch_complocator(void)
5854 MSIHANDLE hpkg, hdb;
5855 CHAR path[MAX_PATH];
5856 CHAR prop[MAX_PATH];
5861 get_user_sid(&usersid);
5864 skip("ConvertSidToStringSidA is not available\n");
5868 create_test_file("FileName1");
5869 create_test_file("FileName4");
5870 set_component_path("FileName1", MSIINSTALLCONTEXT_MACHINE,
5871 "{A8AE6692-96BA-4198-8399-145D7D1D0D0E}", NULL, FALSE);
5873 create_test_file("FileName2");
5874 set_component_path("FileName2", MSIINSTALLCONTEXT_USERUNMANAGED,
5875 "{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}", usersid, FALSE);
5877 create_test_file("FileName3");
5878 set_component_path("FileName3", MSIINSTALLCONTEXT_USERMANAGED,
5879 "{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}", usersid, FALSE);
5881 create_test_file("FileName5");
5882 set_component_path("FileName5", MSIINSTALLCONTEXT_MACHINE,
5883 "{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}", NULL, TRUE);
5885 create_test_file("FileName6");
5886 set_component_path("FileName6", MSIINSTALLCONTEXT_MACHINE,
5887 "{C0ECD96F-7898-4410-9667-194BD8C1B648}", NULL, TRUE);
5889 create_test_file("FileName7");
5890 set_component_path("FileName7", MSIINSTALLCONTEXT_MACHINE,
5891 "{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}", NULL, FALSE);
5893 /* dir is FALSE, but we're pretending it's a directory */
5894 set_component_path("IDontExist\\", MSIINSTALLCONTEXT_MACHINE,
5895 "{91B7359B-07F2-4221-AA8D-DE102BB87A5F}", NULL, FALSE);
5897 create_file_with_version("FileName8.dll", MAKELONG(2, 1), MAKELONG(4, 3));
5898 set_component_path("FileName8.dll", MSIINSTALLCONTEXT_MACHINE,
5899 "{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}", NULL, FALSE);
5901 create_file_with_version("FileName9.dll", MAKELONG(1, 2), MAKELONG(3, 4));
5902 set_component_path("FileName9.dll", MSIINSTALLCONTEXT_MACHINE,
5903 "{A204DF48-7346-4635-BA2E-66247DBAC9DF}", NULL, FALSE);
5905 create_file_with_version("FileName10.dll", MAKELONG(2, 1), MAKELONG(4, 3));
5906 set_component_path("FileName10.dll", MSIINSTALLCONTEXT_MACHINE,
5907 "{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}", NULL, FALSE);
5909 hdb = create_package_db();
5910 ok(hdb, "Expected a valid database handle\n");
5912 r = create_appsearch_table(hdb);
5913 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5915 r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
5916 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5918 r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
5919 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5921 r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
5922 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5924 r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
5925 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5927 r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
5928 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5930 r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
5931 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5933 r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
5934 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5936 r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
5937 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5939 r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
5940 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5942 r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
5943 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5945 r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
5946 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5948 r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
5949 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5951 r = create_complocator_table(hdb);
5952 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5954 /* published component, machine, file, signature, misdbLocatorTypeFile */
5955 r = add_complocator_entry(hdb, "'NewSignature1', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 1");
5956 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5958 /* published component, user-unmanaged, file, signature, misdbLocatorTypeFile */
5959 r = add_complocator_entry(hdb, "'NewSignature2', '{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}', 1");
5960 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5962 /* published component, user-managed, file, signature, misdbLocatorTypeFile */
5963 r = add_complocator_entry(hdb, "'NewSignature3', '{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}', 1");
5964 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5966 /* published component, machine, file, signature, misdbLocatorTypeDirectory */
5967 r = add_complocator_entry(hdb, "'NewSignature4', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 0");
5968 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5970 /* published component, machine, dir, signature, misdbLocatorTypeDirectory */
5971 r = add_complocator_entry(hdb, "'NewSignature5', '{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}', 0");
5972 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5974 /* published component, machine, dir, no signature, misdbLocatorTypeDirectory */
5975 r = add_complocator_entry(hdb, "'NewSignature6', '{C0ECD96F-7898-4410-9667-194BD8C1B648}', 0");
5976 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5978 /* published component, machine, file, no signature, misdbLocatorTypeFile */
5979 r = add_complocator_entry(hdb, "'NewSignature7', '{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}', 1");
5980 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5982 /* unpublished component, no signature, misdbLocatorTypeDir */
5983 r = add_complocator_entry(hdb, "'NewSignature8', '{FB671D5B-5083-4048-90E0-481C48D8F3A5}', 0");
5984 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5986 /* published component, no signature, dir does not exist misdbLocatorTypeDir */
5987 r = add_complocator_entry(hdb, "'NewSignature9', '{91B7359B-07F2-4221-AA8D-DE102BB87A5F}', 0");
5988 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5990 /* published component, signature w/ ver, misdbLocatorTypeFile */
5991 r = add_complocator_entry(hdb, "'NewSignature10', '{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}', 1");
5992 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5994 /* published component, signature w/ ver, ver > max, misdbLocatorTypeFile */
5995 r = add_complocator_entry(hdb, "'NewSignature11', '{A204DF48-7346-4635-BA2E-66247DBAC9DF}', 1");
5996 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5998 /* published component, signature w/ ver, sig->name ignored, misdbLocatorTypeFile */
5999 r = add_complocator_entry(hdb, "'NewSignature12', '{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}', 1");
6000 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6002 r = create_signature_table(hdb);
6003 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6005 r = add_signature_entry(hdb, "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''");
6006 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6008 r = add_signature_entry(hdb, "'NewSignature2', 'FileName2', '', '', '', '', '', '', ''");
6009 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6011 r = add_signature_entry(hdb, "'NewSignature3', 'FileName3', '', '', '', '', '', '', ''");
6012 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6014 r = add_signature_entry(hdb, "'NewSignature4', 'FileName4', '', '', '', '', '', '', ''");
6015 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6017 r = add_signature_entry(hdb, "'NewSignature5', 'FileName5', '', '', '', '', '', '', ''");
6018 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6020 r = add_signature_entry(hdb, "'NewSignature10', 'FileName8.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
6021 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6023 r = add_signature_entry(hdb, "'NewSignature11', 'FileName9.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
6024 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6026 r = add_signature_entry(hdb, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
6027 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6029 hpkg = package_from_db(hdb);
6030 ok(hpkg, "Expected a valid package handle\n");
6032 r = MsiSetPropertyA(hpkg, "SIGPROP8", "october");
6033 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6035 r = MsiDoAction(hpkg, "AppSearch");
6036 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6039 sprintf(path, "%s\\FileName1", CURR_DIR);
6040 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
6041 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6042 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6045 sprintf(path, "%s\\FileName2", CURR_DIR);
6046 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
6047 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6048 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6051 sprintf(path, "%s\\FileName3", CURR_DIR);
6052 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
6053 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6054 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6057 sprintf(path, "%s\\FileName4", CURR_DIR);
6058 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
6059 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6060 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6063 sprintf(path, "%s\\FileName5", CURR_DIR);
6064 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
6065 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6066 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6069 sprintf(path, "%s\\", CURR_DIR);
6070 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
6071 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6072 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6075 sprintf(path, "%s\\", CURR_DIR);
6076 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
6077 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6078 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6081 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
6082 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6083 ok(!lstrcmpA(prop, "october"), "Expected \"october\", got \"%s\"\n", prop);
6086 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
6087 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6088 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6091 sprintf(path, "%s\\FileName8.dll", CURR_DIR);
6092 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
6093 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6094 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6097 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
6098 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6099 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6102 sprintf(path, "%s\\FileName10.dll", CURR_DIR);
6103 r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
6104 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6105 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6107 delete_component_path("{A8AE6692-96BA-4198-8399-145D7D1D0D0E}",
6108 MSIINSTALLCONTEXT_MACHINE, NULL);
6109 delete_component_path("{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}",
6110 MSIINSTALLCONTEXT_USERUNMANAGED, usersid);
6111 delete_component_path("{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}",
6112 MSIINSTALLCONTEXT_USERMANAGED, usersid);
6113 delete_component_path("{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}",
6114 MSIINSTALLCONTEXT_MACHINE, NULL);
6115 delete_component_path("{C0ECD96F-7898-4410-9667-194BD8C1B648}",
6116 MSIINSTALLCONTEXT_MACHINE, NULL);
6117 delete_component_path("{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}",
6118 MSIINSTALLCONTEXT_MACHINE, NULL);
6119 delete_component_path("{91B7359B-07F2-4221-AA8D-DE102BB87A5F}",
6120 MSIINSTALLCONTEXT_MACHINE, NULL);
6121 delete_component_path("{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}",
6122 MSIINSTALLCONTEXT_MACHINE, NULL);
6123 delete_component_path("{A204DF48-7346-4635-BA2E-66247DBAC9DF}",
6124 MSIINSTALLCONTEXT_MACHINE, NULL);
6125 delete_component_path("{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}",
6126 MSIINSTALLCONTEXT_MACHINE, NULL);
6128 DeleteFileA("FileName1");
6129 DeleteFileA("FileName2");
6130 DeleteFileA("FileName3");
6131 DeleteFileA("FileName4");
6132 DeleteFileA("FileName5");
6133 DeleteFileA("FileName6");
6134 DeleteFileA("FileName7");
6135 DeleteFileA("FileName8.dll");
6136 DeleteFileA("FileName9.dll");
6137 DeleteFileA("FileName10.dll");
6138 MsiCloseHandle(hpkg);
6139 DeleteFileA(msifile);
6142 static void test_appsearch_reglocator(void)
6144 MSIHANDLE hpkg, hdb;
6145 CHAR path[MAX_PATH];
6146 CHAR prop[MAX_PATH];
6156 res = RegCreateKeyA(HKEY_CLASSES_ROOT, "Software\\Wine", &classes);
6157 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6159 res = RegSetValueExA(classes, "Value1", 0, REG_SZ,
6160 (const BYTE *)"regszdata", 10);
6161 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6163 res = RegCreateKeyA(HKEY_CURRENT_USER, "Software\\Wine", &hkcu);
6164 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6166 res = RegSetValueExA(hkcu, "Value1", 0, REG_SZ,
6167 (const BYTE *)"regszdata", 10);
6168 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6170 res = RegCreateKeyA(HKEY_USERS, "S-1-5-18\\Software\\Wine", &users);
6171 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6173 res = RegSetValueExA(users, "Value1", 0, REG_SZ,
6174 (const BYTE *)"regszdata", 10);
6175 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6177 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine", &hklm);
6178 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6180 res = RegSetValueA(hklm, NULL, REG_SZ, "defvalue", 8);
6181 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6183 res = RegSetValueExA(hklm, "Value1", 0, REG_SZ,
6184 (const BYTE *)"regszdata", 10);
6185 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6188 res = RegSetValueExA(hklm, "Value2", 0, REG_DWORD,
6189 (const BYTE *)&val, sizeof(DWORD));
6190 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6193 res = RegSetValueExA(hklm, "Value3", 0, REG_DWORD,
6194 (const BYTE *)&val, sizeof(DWORD));
6195 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6197 res = RegSetValueExA(hklm, "Value4", 0, REG_EXPAND_SZ,
6198 (const BYTE *)"%PATH%", 7);
6199 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6201 res = RegSetValueExA(hklm, "Value5", 0, REG_EXPAND_SZ,
6202 (const BYTE *)"my%NOVAR%", 10);
6203 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6205 res = RegSetValueExA(hklm, "Value6", 0, REG_MULTI_SZ,
6206 (const BYTE *)"one\0two\0", 9);
6207 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6209 binary[0] = 0x1234abcd;
6210 binary[1] = 0x567890ef;
6211 res = RegSetValueExA(hklm, "Value7", 0, REG_BINARY,
6212 (const BYTE *)binary, sizeof(binary));
6213 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6215 res = RegSetValueExA(hklm, "Value8", 0, REG_SZ,
6216 (const BYTE *)"#regszdata", 11);
6217 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6219 create_test_file("FileName1");
6220 sprintf(path, "%s\\FileName1", CURR_DIR);
6221 res = RegSetValueExA(hklm, "Value9", 0, REG_SZ,
6222 (const BYTE *)path, lstrlenA(path) + 1);
6223 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6225 sprintf(path, "%s\\FileName2", CURR_DIR);
6226 res = RegSetValueExA(hklm, "Value10", 0, REG_SZ,
6227 (const BYTE *)path, lstrlenA(path) + 1);
6228 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6230 lstrcpyA(path, CURR_DIR);
6231 res = RegSetValueExA(hklm, "Value11", 0, REG_SZ,
6232 (const BYTE *)path, lstrlenA(path) + 1);
6233 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6235 res = RegSetValueExA(hklm, "Value12", 0, REG_SZ,
6236 (const BYTE *)"", 1);
6237 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6239 create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6240 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
6241 res = RegSetValueExA(hklm, "Value13", 0, REG_SZ,
6242 (const BYTE *)path, lstrlenA(path) + 1);
6243 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6245 create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
6246 sprintf(path, "%s\\FileName4.dll", CURR_DIR);
6247 res = RegSetValueExA(hklm, "Value14", 0, REG_SZ,
6248 (const BYTE *)path, lstrlenA(path) + 1);
6249 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6251 create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6252 sprintf(path, "%s\\FileName5.dll", CURR_DIR);
6253 res = RegSetValueExA(hklm, "Value15", 0, REG_SZ,
6254 (const BYTE *)path, lstrlenA(path) + 1);
6255 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6257 hdb = create_package_db();
6258 ok(hdb, "Expected a valid database handle\n");
6260 r = create_appsearch_table(hdb);
6261 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6263 r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
6264 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6266 r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
6267 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6269 r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
6270 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6272 r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
6273 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6275 r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
6276 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6278 r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
6279 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6281 r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
6282 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6284 r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
6285 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6287 r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
6288 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6290 r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
6291 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6293 r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
6294 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6296 r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
6297 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6299 r = add_appsearch_entry(hdb, "'SIGPROP13', 'NewSignature13'");
6300 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6302 r = add_appsearch_entry(hdb, "'SIGPROP14', 'NewSignature14'");
6303 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6305 r = add_appsearch_entry(hdb, "'SIGPROP15', 'NewSignature15'");
6306 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6308 r = add_appsearch_entry(hdb, "'SIGPROP16', 'NewSignature16'");
6309 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6311 r = add_appsearch_entry(hdb, "'SIGPROP17', 'NewSignature17'");
6312 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6314 r = add_appsearch_entry(hdb, "'SIGPROP18', 'NewSignature18'");
6315 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6317 r = add_appsearch_entry(hdb, "'SIGPROP19', 'NewSignature19'");
6318 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6320 r = add_appsearch_entry(hdb, "'SIGPROP20', 'NewSignature20'");
6321 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6323 r = add_appsearch_entry(hdb, "'SIGPROP21', 'NewSignature21'");
6324 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6326 r = add_appsearch_entry(hdb, "'SIGPROP22', 'NewSignature22'");
6327 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6329 r = add_appsearch_entry(hdb, "'SIGPROP23', 'NewSignature23'");
6330 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6332 r = add_appsearch_entry(hdb, "'SIGPROP24', 'NewSignature24'");
6333 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6335 r = add_appsearch_entry(hdb, "'SIGPROP25', 'NewSignature25'");
6336 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6338 r = add_appsearch_entry(hdb, "'SIGPROP26', 'NewSignature26'");
6339 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6341 r = add_appsearch_entry(hdb, "'SIGPROP27', 'NewSignature27'");
6342 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6344 r = add_appsearch_entry(hdb, "'SIGPROP28', 'NewSignature28'");
6345 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6347 r = create_reglocator_table(hdb);
6348 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6350 /* HKLM, msidbLocatorTypeRawValue, REG_SZ */
6351 str = "'NewSignature1', 2, 'Software\\Wine', 'Value1', 2";
6352 r = add_reglocator_entry(hdb, str);
6353 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6355 /* HKLM, msidbLocatorTypeRawValue, positive DWORD */
6356 str = "'NewSignature2', 2, 'Software\\Wine', 'Value2', 2";
6357 r = add_reglocator_entry(hdb, str);
6358 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6360 /* HKLM, msidbLocatorTypeRawValue, negative DWORD */
6361 str = "'NewSignature3', 2, 'Software\\Wine', 'Value3', 2";
6362 r = add_reglocator_entry(hdb, str);
6363 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6365 /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
6366 str = "'NewSignature4', 2, 'Software\\Wine', 'Value4', 2";
6367 r = add_reglocator_entry(hdb, str);
6368 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6370 /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
6371 str = "'NewSignature5', 2, 'Software\\Wine', 'Value5', 2";
6372 r = add_reglocator_entry(hdb, str);
6373 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6375 /* HKLM, msidbLocatorTypeRawValue, REG_MULTI_SZ */
6376 str = "'NewSignature6', 2, 'Software\\Wine', 'Value6', 2";
6377 r = add_reglocator_entry(hdb, str);
6378 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6380 /* HKLM, msidbLocatorTypeRawValue, REG_BINARY */
6381 str = "'NewSignature7', 2, 'Software\\Wine', 'Value7', 2";
6382 r = add_reglocator_entry(hdb, str);
6383 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6385 /* HKLM, msidbLocatorTypeRawValue, REG_SZ first char is # */
6386 str = "'NewSignature8', 2, 'Software\\Wine', 'Value8', 2";
6387 r = add_reglocator_entry(hdb, str);
6388 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6390 /* HKLM, msidbLocatorTypeFileName, signature, file exists */
6391 str = "'NewSignature9', 2, 'Software\\Wine', 'Value9', 1";
6392 r = add_reglocator_entry(hdb, str);
6393 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6395 /* HKLM, msidbLocatorTypeFileName, signature, file does not exist */
6396 str = "'NewSignature10', 2, 'Software\\Wine', 'Value10', 1";
6397 r = add_reglocator_entry(hdb, str);
6398 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6400 /* HKLM, msidbLocatorTypeFileName, no signature */
6401 str = "'NewSignature11', 2, 'Software\\Wine', 'Value9', 1";
6402 r = add_reglocator_entry(hdb, str);
6403 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6405 /* HKLM, msidbLocatorTypeDirectory, no signature, file exists */
6406 str = "'NewSignature12', 2, 'Software\\Wine', 'Value9', 0";
6407 r = add_reglocator_entry(hdb, str);
6408 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6410 /* HKLM, msidbLocatorTypeDirectory, no signature, directory exists */
6411 str = "'NewSignature13', 2, 'Software\\Wine', 'Value11', 0";
6412 r = add_reglocator_entry(hdb, str);
6413 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6415 /* HKLM, msidbLocatorTypeDirectory, signature, file exists */
6416 str = "'NewSignature14', 2, 'Software\\Wine', 'Value9', 0";
6417 r = add_reglocator_entry(hdb, str);
6418 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6420 /* HKCR, msidbLocatorTypeRawValue, REG_SZ */
6421 str = "'NewSignature15', 0, 'Software\\Wine', 'Value1', 2";
6422 r = add_reglocator_entry(hdb, str);
6423 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6425 /* HKCU, msidbLocatorTypeRawValue, REG_SZ */
6426 str = "'NewSignature16', 1, 'Software\\Wine', 'Value1', 2";
6427 r = add_reglocator_entry(hdb, str);
6428 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6430 /* HKU, msidbLocatorTypeRawValue, REG_SZ */
6431 str = "'NewSignature17', 3, 'S-1-5-18\\Software\\Wine', 'Value1', 2";
6432 r = add_reglocator_entry(hdb, str);
6433 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6435 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, NULL Name */
6436 str = "'NewSignature18', 2, 'Software\\Wine', '', 2";
6437 r = add_reglocator_entry(hdb, str);
6438 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6440 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, key does not exist */
6441 str = "'NewSignature19', 2, 'Software\\IDontExist', '', 2";
6442 r = add_reglocator_entry(hdb, str);
6443 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6445 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, value is empty */
6446 str = "'NewSignature20', 2, 'Software\\Wine', 'Value12', 2";
6447 r = add_reglocator_entry(hdb, str);
6448 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6450 /* HKLM, msidbLocatorTypeFileName, signature, file exists w/ version */
6451 str = "'NewSignature21', 2, 'Software\\Wine', 'Value13', 1";
6452 r = add_reglocator_entry(hdb, str);
6453 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6455 /* HKLM, msidbLocatorTypeFileName, file exists w/ version, version > max */
6456 str = "'NewSignature22', 2, 'Software\\Wine', 'Value14', 1";
6457 r = add_reglocator_entry(hdb, str);
6458 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6460 /* HKLM, msidbLocatorTypeFileName, file exists w/ version, sig->name ignored */
6461 str = "'NewSignature23', 2, 'Software\\Wine', 'Value15', 1";
6462 r = add_reglocator_entry(hdb, str);
6463 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6465 /* HKLM, msidbLocatorTypeFileName, no signature, directory exists */
6466 str = "'NewSignature24', 2, 'Software\\Wine', 'Value11', 1";
6467 r = add_reglocator_entry(hdb, str);
6468 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6470 /* HKLM, msidbLocatorTypeFileName, no signature, file does not exist */
6471 str = "'NewSignature25', 2, 'Software\\Wine', 'Value10', 1";
6472 r = add_reglocator_entry(hdb, str);
6473 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6475 /* HKLM, msidbLocatorTypeDirectory, signature, directory exists */
6476 str = "'NewSignature26', 2, 'Software\\Wine', 'Value11', 0";
6477 r = add_reglocator_entry(hdb, str);
6478 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6480 /* HKLM, msidbLocatorTypeDirectory, signature, file does not exist */
6481 str = "'NewSignature27', 2, 'Software\\Wine', 'Value10', 0";
6482 r = add_reglocator_entry(hdb, str);
6483 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6485 /* HKLM, msidbLocatorTypeDirectory, no signature, file does not exist */
6486 str = "'NewSignature28', 2, 'Software\\Wine', 'Value10', 0";
6487 r = add_reglocator_entry(hdb, str);
6488 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6490 r = create_signature_table(hdb);
6491 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6493 str = "'NewSignature9', 'FileName1', '', '', '', '', '', '', ''";
6494 r = add_signature_entry(hdb, str);
6495 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6497 str = "'NewSignature10', 'FileName2', '', '', '', '', '', '', ''";
6498 r = add_signature_entry(hdb, str);
6499 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6501 str = "'NewSignature14', 'FileName1', '', '', '', '', '', '', ''";
6502 r = add_signature_entry(hdb, str);
6503 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6505 str = "'NewSignature21', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
6506 r = add_signature_entry(hdb, str);
6507 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6509 str = "'NewSignature22', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
6510 r = add_signature_entry(hdb, str);
6511 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6513 str = "'NewSignature23', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
6514 r = add_signature_entry(hdb, str);
6515 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6517 ptr = strrchr(CURR_DIR, '\\') + 1;
6518 sprintf(path, "'NewSignature26', '%s', '', '', '', '', '', '', ''", ptr);
6519 r = add_signature_entry(hdb, path);
6520 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6522 str = "'NewSignature27', 'FileName2', '', '', '', '', '', '', ''";
6523 r = add_signature_entry(hdb, str);
6524 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6526 hpkg = package_from_db(hdb);
6527 ok(hpkg, "Expected a valid package handle\n");
6529 r = MsiDoAction(hpkg, "AppSearch");
6530 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6533 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
6534 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6535 ok(!lstrcmpA(prop, "regszdata"),
6536 "Expected \"regszdata\", got \"%s\"\n", prop);
6539 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
6540 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6541 ok(!lstrcmpA(prop, "#42"), "Expected \"#42\", got \"%s\"\n", prop);
6544 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
6545 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6546 ok(!lstrcmpA(prop, "#-42"), "Expected \"#-42\", got \"%s\"\n", prop);
6548 ExpandEnvironmentStringsA("%PATH%", path, MAX_PATH);
6551 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
6552 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6553 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6556 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
6557 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6559 "my%NOVAR%"), "Expected \"my%%NOVAR%%\", got \"%s\"\n", prop);
6562 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
6563 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6566 ok(!memcmp(prop, "\0one\0two\0\0", 10),
6567 "Expected \"\\0one\\0two\\0\\0\"\n");
6571 lstrcpyA(path, "#xCDAB3412EF907856");
6572 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
6573 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6574 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6577 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
6578 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6579 ok(!lstrcmpA(prop, "##regszdata"),
6580 "Expected \"##regszdata\", got \"%s\"\n", prop);
6583 sprintf(path, "%s\\FileName1", CURR_DIR);
6584 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
6585 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6586 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6589 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
6590 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6591 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6594 sprintf(path, "%s\\", CURR_DIR);
6595 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
6596 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6599 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6603 r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
6604 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6605 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6608 sprintf(path, "%s\\", CURR_DIR);
6609 r = MsiGetPropertyA(hpkg, "SIGPROP13", prop, &size);
6610 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6611 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6614 r = MsiGetPropertyA(hpkg, "SIGPROP14", prop, &size);
6615 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6616 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6619 r = MsiGetPropertyA(hpkg, "SIGPROP15", prop, &size);
6620 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6621 ok(!lstrcmpA(prop, "regszdata"),
6622 "Expected \"regszdata\", got \"%s\"\n", prop);
6625 r = MsiGetPropertyA(hpkg, "SIGPROP16", prop, &size);
6626 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6627 ok(!lstrcmpA(prop, "regszdata"),
6628 "Expected \"regszdata\", got \"%s\"\n", prop);
6631 r = MsiGetPropertyA(hpkg, "SIGPROP17", prop, &size);
6632 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6633 ok(!lstrcmpA(prop, "regszdata"),
6634 "Expected \"regszdata\", got \"%s\"\n", prop);
6637 r = MsiGetPropertyA(hpkg, "SIGPROP18", prop, &size);
6638 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6639 ok(!lstrcmpA(prop, "defvalue"),
6640 "Expected \"defvalue\", got \"%s\"\n", prop);
6643 r = MsiGetPropertyA(hpkg, "SIGPROP19", prop, &size);
6644 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6645 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6648 r = MsiGetPropertyA(hpkg, "SIGPROP20", prop, &size);
6649 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6650 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6653 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
6654 r = MsiGetPropertyA(hpkg, "SIGPROP21", prop, &size);
6655 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6656 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6659 r = MsiGetPropertyA(hpkg, "SIGPROP22", prop, &size);
6660 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6661 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6664 sprintf(path, "%s\\FileName5.dll", CURR_DIR);
6665 r = MsiGetPropertyA(hpkg, "SIGPROP23", prop, &size);
6666 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6667 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6670 lstrcpyA(path, CURR_DIR);
6671 ptr = strrchr(path, '\\') + 1;
6673 r = MsiGetPropertyA(hpkg, "SIGPROP24", prop, &size);
6674 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6677 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6681 sprintf(path, "%s\\", CURR_DIR);
6682 r = MsiGetPropertyA(hpkg, "SIGPROP25", prop, &size);
6683 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6686 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6690 r = MsiGetPropertyA(hpkg, "SIGPROP26", prop, &size);
6691 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6692 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6695 r = MsiGetPropertyA(hpkg, "SIGPROP27", prop, &size);
6696 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6697 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6700 r = MsiGetPropertyA(hpkg, "SIGPROP28", prop, &size);
6701 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6702 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6704 RegSetValueA(hklm, NULL, REG_SZ, "", 0);
6705 RegDeleteValueA(hklm, "Value1");
6706 RegDeleteValueA(hklm, "Value2");
6707 RegDeleteValueA(hklm, "Value3");
6708 RegDeleteValueA(hklm, "Value4");
6709 RegDeleteValueA(hklm, "Value5");
6710 RegDeleteValueA(hklm, "Value6");
6711 RegDeleteValueA(hklm, "Value7");
6712 RegDeleteValueA(hklm, "Value8");
6713 RegDeleteValueA(hklm, "Value9");
6714 RegDeleteValueA(hklm, "Value10");
6715 RegDeleteValueA(hklm, "Value11");
6716 RegDeleteValueA(hklm, "Value12");
6717 RegDeleteValueA(hklm, "Value13");
6718 RegDeleteValueA(hklm, "Value14");
6719 RegDeleteValueA(hklm, "Value15");
6720 RegDeleteKeyA(hklm, "");
6723 RegDeleteValueA(classes, "Value1");
6724 RegDeleteKeyA(classes, "");
6725 RegCloseKey(classes);
6727 RegDeleteValueA(hkcu, "Value1");
6728 RegDeleteKeyA(hkcu, "");
6731 RegDeleteValueA(users, "Value1");
6732 RegDeleteKeyA(users, "");
6735 DeleteFileA("FileName1");
6736 DeleteFileA("FileName3.dll");
6737 DeleteFileA("FileName4.dll");
6738 DeleteFileA("FileName5.dll");
6739 MsiCloseHandle(hpkg);
6740 DeleteFileA(msifile);
6743 static void delete_win_ini(LPCSTR file)
6745 CHAR path[MAX_PATH];
6747 GetWindowsDirectoryA(path, MAX_PATH);
6748 lstrcatA(path, "\\");
6749 lstrcatA(path, file);
6754 static void test_appsearch_inilocator(void)
6756 MSIHANDLE hpkg, hdb;
6757 CHAR path[MAX_PATH];
6758 CHAR prop[MAX_PATH];
6764 WritePrivateProfileStringA("Section", "Key", "keydata,field2", "IniFile.ini");
6766 create_test_file("FileName1");
6767 sprintf(path, "%s\\FileName1", CURR_DIR);
6768 WritePrivateProfileStringA("Section", "Key2", path, "IniFile.ini");
6770 WritePrivateProfileStringA("Section", "Key3", CURR_DIR, "IniFile.ini");
6772 sprintf(path, "%s\\IDontExist", CURR_DIR);
6773 WritePrivateProfileStringA("Section", "Key4", path, "IniFile.ini");
6775 create_file_with_version("FileName2.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6776 sprintf(path, "%s\\FileName2.dll", CURR_DIR);
6777 WritePrivateProfileStringA("Section", "Key5", path, "IniFile.ini");
6779 create_file_with_version("FileName3.dll", MAKELONG(1, 2), MAKELONG(3, 4));
6780 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
6781 WritePrivateProfileStringA("Section", "Key6", path, "IniFile.ini");
6783 create_file_with_version("FileName4.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6784 sprintf(path, "%s\\FileName4.dll", CURR_DIR);
6785 WritePrivateProfileStringA("Section", "Key7", path, "IniFile.ini");
6787 hdb = create_package_db();
6788 ok(hdb, "Expected a valid database handle\n");
6790 r = create_appsearch_table(hdb);
6791 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6793 r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
6794 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6796 r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
6797 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6799 r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
6800 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6802 r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
6803 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6805 r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
6806 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6808 r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
6809 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6811 r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
6812 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6814 r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
6815 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6817 r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
6818 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6820 r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
6821 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6823 r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
6824 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6826 r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
6827 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6829 r = create_inilocator_table(hdb);
6830 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6832 /* msidbLocatorTypeRawValue, field 1 */
6833 str = "'NewSignature1', 'IniFile.ini', 'Section', 'Key', 1, 2";
6834 r = add_inilocator_entry(hdb, str);
6835 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6837 /* msidbLocatorTypeRawValue, field 2 */
6838 str = "'NewSignature2', 'IniFile.ini', 'Section', 'Key', 2, 2";
6839 r = add_inilocator_entry(hdb, str);
6840 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6842 /* msidbLocatorTypeRawValue, entire field */
6843 str = "'NewSignature3', 'IniFile.ini', 'Section', 'Key', 0, 2";
6844 r = add_inilocator_entry(hdb, str);
6845 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6847 /* msidbLocatorTypeFile */
6848 str = "'NewSignature4', 'IniFile.ini', 'Section', 'Key2', 1, 1";
6849 r = add_inilocator_entry(hdb, str);
6850 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6852 /* msidbLocatorTypeDirectory, file */
6853 str = "'NewSignature5', 'IniFile.ini', 'Section', 'Key2', 1, 0";
6854 r = add_inilocator_entry(hdb, str);
6855 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6857 /* msidbLocatorTypeDirectory, directory */
6858 str = "'NewSignature6', 'IniFile.ini', 'Section', 'Key3', 1, 0";
6859 r = add_inilocator_entry(hdb, str);
6860 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6862 /* msidbLocatorTypeFile, file, no signature */
6863 str = "'NewSignature7', 'IniFile.ini', 'Section', 'Key2', 1, 1";
6864 r = add_inilocator_entry(hdb, str);
6865 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6867 /* msidbLocatorTypeFile, dir, no signature */
6868 str = "'NewSignature8', 'IniFile.ini', 'Section', 'Key3', 1, 1";
6869 r = add_inilocator_entry(hdb, str);
6870 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6872 /* msidbLocatorTypeFile, file does not exist */
6873 str = "'NewSignature9', 'IniFile.ini', 'Section', 'Key4', 1, 1";
6874 r = add_inilocator_entry(hdb, str);
6875 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6877 /* msidbLocatorTypeFile, signature with version */
6878 str = "'NewSignature10', 'IniFile.ini', 'Section', 'Key5', 1, 1";
6879 r = add_inilocator_entry(hdb, str);
6880 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6882 /* msidbLocatorTypeFile, signature with version, ver > max */
6883 str = "'NewSignature11', 'IniFile.ini', 'Section', 'Key6', 1, 1";
6884 r = add_inilocator_entry(hdb, str);
6885 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6887 /* msidbLocatorTypeFile, signature with version, sig->name ignored */
6888 str = "'NewSignature12', 'IniFile.ini', 'Section', 'Key7', 1, 1";
6889 r = add_inilocator_entry(hdb, str);
6890 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6892 r = create_signature_table(hdb);
6893 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6895 r = add_signature_entry(hdb, "'NewSignature4', 'FileName1', '', '', '', '', '', '', ''");
6896 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6898 r = add_signature_entry(hdb, "'NewSignature9', 'IDontExist', '', '', '', '', '', '', ''");
6899 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6901 r = add_signature_entry(hdb, "'NewSignature10', 'FileName2.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
6902 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6904 r = add_signature_entry(hdb, "'NewSignature11', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
6905 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6907 r = add_signature_entry(hdb, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
6908 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6910 hpkg = package_from_db(hdb);
6911 ok(hpkg, "Expected a valid package handle\n");
6913 r = MsiDoAction(hpkg, "AppSearch");
6914 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6917 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
6918 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6919 ok(!lstrcmpA(prop, "keydata"), "Expected \"keydata\", got \"%s\"\n", prop);
6922 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
6923 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6924 ok(!lstrcmpA(prop, "field2"), "Expected \"field2\", got \"%s\"\n", prop);
6927 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
6928 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6929 ok(!lstrcmpA(prop, "keydata,field2"),
6930 "Expected \"keydata,field2\", got \"%s\"\n", prop);
6933 sprintf(path, "%s\\FileName1", CURR_DIR);
6934 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
6935 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6936 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6939 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
6940 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6941 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6944 sprintf(path, "%s\\", CURR_DIR);
6945 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
6946 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6949 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6953 sprintf(path, "%s\\", CURR_DIR);
6954 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
6955 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6958 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6962 lstrcpyA(path, CURR_DIR);
6963 ptr = strrchr(path, '\\');
6965 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
6966 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6969 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6973 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
6974 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6975 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6978 sprintf(path, "%s\\FileName2.dll", CURR_DIR);
6979 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
6980 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6981 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6984 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
6985 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6986 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6989 sprintf(path, "%s\\FileName4.dll", CURR_DIR);
6990 r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
6991 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6992 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6994 delete_win_ini("IniFile.ini");
6995 DeleteFileA("FileName1");
6996 DeleteFileA("FileName2.dll");
6997 DeleteFileA("FileName3.dll");
6998 DeleteFileA("FileName4.dll");
6999 MsiCloseHandle(hpkg);
7000 DeleteFileA(msifile);
7003 static void test_appsearch_drlocator(void)
7005 MSIHANDLE hpkg, hdb;
7006 CHAR path[MAX_PATH];
7007 CHAR prop[MAX_PATH];
7012 create_test_file("FileName1");
7013 CreateDirectoryA("one", NULL);
7014 CreateDirectoryA("one\\two", NULL);
7015 CreateDirectoryA("one\\two\\three", NULL);
7016 create_test_file("one\\two\\three\\FileName2");
7017 CreateDirectoryA("another", NULL);
7018 create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
7019 create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
7020 create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
7022 hdb = create_package_db();
7023 ok(hdb, "Expected a valid database handle\n");
7025 r = create_appsearch_table(hdb);
7026 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7028 r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
7029 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7031 r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
7032 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7034 r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
7035 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7037 r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
7038 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7040 r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
7041 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7043 r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
7044 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7046 r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
7047 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7049 r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
7050 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7052 r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
7053 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7055 r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
7056 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7058 r = create_drlocator_table(hdb);
7059 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7061 /* no parent, full path, depth 0, signature */
7062 sprintf(path, "'NewSignature1', '', '%s', 0", CURR_DIR);
7063 r = add_drlocator_entry(hdb, path);
7064 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7066 /* no parent, full path, depth 0, no signature */
7067 sprintf(path, "'NewSignature2', '', '%s', 0", CURR_DIR);
7068 r = add_drlocator_entry(hdb, path);
7069 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7071 /* no parent, relative path, depth 0, no signature */
7072 sprintf(path, "'NewSignature3', '', '%s', 0", CURR_DIR + 3);
7073 r = add_drlocator_entry(hdb, path);
7074 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7076 /* no parent, full path, depth 2, signature */
7077 sprintf(path, "'NewSignature4', '', '%s', 2", CURR_DIR);
7078 r = add_drlocator_entry(hdb, path);
7079 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7081 /* no parent, full path, depth 3, signature */
7082 sprintf(path, "'NewSignature5', '', '%s', 3", CURR_DIR);
7083 r = add_drlocator_entry(hdb, path);
7084 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7086 /* no parent, full path, depth 1, signature is dir */
7087 sprintf(path, "'NewSignature6', '', '%s', 1", CURR_DIR);
7088 r = add_drlocator_entry(hdb, path);
7089 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7091 /* parent is in DrLocator, relative path, depth 0, signature */
7092 sprintf(path, "'NewSignature7', 'NewSignature1', 'one\\two\\three', 1");
7093 r = add_drlocator_entry(hdb, path);
7094 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7096 /* no parent, full path, depth 0, signature w/ version */
7097 sprintf(path, "'NewSignature8', '', '%s', 0", CURR_DIR);
7098 r = add_drlocator_entry(hdb, path);
7099 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7101 /* no parent, full path, depth 0, signature w/ version, ver > max */
7102 sprintf(path, "'NewSignature9', '', '%s', 0", CURR_DIR);
7103 r = add_drlocator_entry(hdb, path);
7104 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7106 /* no parent, full path, depth 0, signature w/ version, sig->name not ignored */
7107 sprintf(path, "'NewSignature10', '', '%s', 0", CURR_DIR);
7108 r = add_drlocator_entry(hdb, path);
7109 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7111 r = create_signature_table(hdb);
7112 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7114 str = "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''";
7115 r = add_signature_entry(hdb, str);
7116 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7118 str = "'NewSignature4', 'FileName2', '', '', '', '', '', '', ''";
7119 r = add_signature_entry(hdb, str);
7120 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7122 str = "'NewSignature5', 'FileName2', '', '', '', '', '', '', ''";
7123 r = add_signature_entry(hdb, str);
7124 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7126 str = "'NewSignature6', 'another', '', '', '', '', '', '', ''";
7127 r = add_signature_entry(hdb, str);
7128 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7130 str = "'NewSignature7', 'FileName2', '', '', '', '', '', '', ''";
7131 r = add_signature_entry(hdb, str);
7132 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7134 str = "'NewSignature8', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
7135 r = add_signature_entry(hdb, str);
7136 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7138 str = "'NewSignature9', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
7139 r = add_signature_entry(hdb, str);
7140 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7142 str = "'NewSignature10', 'necessary', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
7143 r = add_signature_entry(hdb, str);
7144 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7146 hpkg = package_from_db(hdb);
7147 ok(hpkg, "Expected a valid package handle\n");
7149 r = MsiDoAction(hpkg, "AppSearch");
7150 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7153 sprintf(path, "%s\\FileName1", CURR_DIR);
7154 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
7155 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7158 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7162 sprintf(path, "%s\\", CURR_DIR);
7163 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
7164 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7165 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7168 sprintf(path, "%s\\", CURR_DIR);
7169 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
7170 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7171 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7174 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
7175 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7178 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
7182 sprintf(path, "%s\\one\\two\\three\\FileName2", CURR_DIR);
7183 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
7184 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7187 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7191 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
7192 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7195 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
7199 sprintf(path, "%s\\one\\two\\three\\FileName2", CURR_DIR);
7200 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
7201 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7204 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7208 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
7209 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
7210 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7213 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7217 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
7218 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7221 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
7225 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
7226 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7229 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
7232 DeleteFileA("FileName1");
7233 DeleteFileA("FileName3.dll");
7234 DeleteFileA("FileName4.dll");
7235 DeleteFileA("FileName5.dll");
7236 DeleteFileA("one\\two\\three\\FileName2");
7237 RemoveDirectoryA("one\\two\\three");
7238 RemoveDirectoryA("one\\two");
7239 RemoveDirectoryA("one");
7240 RemoveDirectoryA("another");
7241 MsiCloseHandle(hpkg);
7242 DeleteFileA(msifile);
7245 static void test_featureparents(void)
7250 INSTALLSTATE state, action;
7252 hdb = create_package_db();
7253 ok ( hdb, "failed to create package database\n" );
7255 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
7256 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
7258 r = create_feature_table( hdb );
7259 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
7261 r = create_component_table( hdb );
7262 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
7264 r = create_feature_components_table( hdb );
7265 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
7267 r = create_file_table( hdb );
7268 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
7270 /* msidbFeatureAttributesFavorLocal */
7271 r = add_feature_entry( hdb, "'zodiac', '', '', '', 2, 1, '', 0" );
7272 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
7274 /* msidbFeatureAttributesFavorSource */
7275 r = add_feature_entry( hdb, "'perseus', '', '', '', 2, 1, '', 1" );
7276 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
7278 /* msidbFeatureAttributesFavorLocal */
7279 r = add_feature_entry( hdb, "'orion', '', '', '', 2, 1, '', 0" );
7280 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
7282 /* disabled because of install level */
7283 r = add_feature_entry( hdb, "'waters', '', '', '', 15, 101, '', 9" );
7284 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
7286 /* child feature of disabled feature */
7287 r = add_feature_entry( hdb, "'bayer', 'waters', '', '', 14, 1, '', 9" );
7288 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
7290 /* component of disabled feature (install level) */
7291 r = add_component_entry( hdb, "'delphinus', '', 'TARGETDIR', 0, '', 'delphinus_file'" );
7292 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7294 /* component of disabled child feature (install level) */
7295 r = add_component_entry( hdb, "'hydrus', '', 'TARGETDIR', 0, '', 'hydrus_file'" );
7296 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7298 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
7299 r = add_component_entry( hdb, "'leo', '', 'TARGETDIR', 0, '', 'leo_file'" );
7300 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7302 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
7303 r = add_component_entry( hdb, "'virgo', '', 'TARGETDIR', 1, '', 'virgo_file'" );
7304 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7306 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
7307 r = add_component_entry( hdb, "'libra', '', 'TARGETDIR', 2, '', 'libra_file'" );
7308 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7310 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
7311 r = add_component_entry( hdb, "'cassiopeia', '', 'TARGETDIR', 0, '', 'cassiopeia_file'" );
7312 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7314 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
7315 r = add_component_entry( hdb, "'cepheus', '', 'TARGETDIR', 1, '', 'cepheus_file'" );
7316 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7318 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
7319 r = add_component_entry( hdb, "'andromeda', '', 'TARGETDIR', 2, '', 'andromeda_file'" );
7320 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7322 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
7323 r = add_component_entry( hdb, "'canis', '', 'TARGETDIR', 0, '', 'canis_file'" );
7324 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7326 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
7327 r = add_component_entry( hdb, "'monoceros', '', 'TARGETDIR', 1, '', 'monoceros_file'" );
7328 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7330 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
7331 r = add_component_entry( hdb, "'lepus', '', 'TARGETDIR', 2, '', 'lepus_file'" );
7333 r = add_feature_components_entry( hdb, "'zodiac', 'leo'" );
7334 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7336 r = add_feature_components_entry( hdb, "'zodiac', 'virgo'" );
7337 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7339 r = add_feature_components_entry( hdb, "'zodiac', 'libra'" );
7340 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7342 r = add_feature_components_entry( hdb, "'perseus', 'cassiopeia'" );
7343 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7345 r = add_feature_components_entry( hdb, "'perseus', 'cepheus'" );
7346 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7348 r = add_feature_components_entry( hdb, "'perseus', 'andromeda'" );
7349 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7351 r = add_feature_components_entry( hdb, "'orion', 'leo'" );
7352 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7354 r = add_feature_components_entry( hdb, "'orion', 'virgo'" );
7355 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7357 r = add_feature_components_entry( hdb, "'orion', 'libra'" );
7358 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7360 r = add_feature_components_entry( hdb, "'orion', 'cassiopeia'" );
7361 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7363 r = add_feature_components_entry( hdb, "'orion', 'cepheus'" );
7364 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7366 r = add_feature_components_entry( hdb, "'orion', 'andromeda'" );
7367 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7369 r = add_feature_components_entry( hdb, "'orion', 'canis'" );
7370 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7372 r = add_feature_components_entry( hdb, "'orion', 'monoceros'" );
7373 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7375 r = add_feature_components_entry( hdb, "'orion', 'lepus'" );
7376 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7378 r = add_feature_components_entry( hdb, "'waters', 'delphinus'" );
7379 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7381 r = add_feature_components_entry( hdb, "'bayer', 'hydrus'" );
7382 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7384 r = add_file_entry( hdb, "'leo_file', 'leo', 'leo.txt', 100, '', '1033', 8192, 1" );
7385 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7387 r = add_file_entry( hdb, "'virgo_file', 'virgo', 'virgo.txt', 0, '', '1033', 8192, 1" );
7388 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7390 r = add_file_entry( hdb, "'libra_file', 'libra', 'libra.txt', 0, '', '1033', 8192, 1" );
7391 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7393 r = add_file_entry( hdb, "'cassiopeia_file', 'cassiopeia', 'cassiopeia.txt', 0, '', '1033', 8192, 1" );
7394 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7396 r = add_file_entry( hdb, "'cepheus_file', 'cepheus', 'cepheus.txt', 0, '', '1033', 8192, 1" );
7397 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7399 r = add_file_entry( hdb, "'andromeda_file', 'andromeda', 'andromeda.txt', 0, '', '1033', 8192, 1" );
7400 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7402 r = add_file_entry( hdb, "'canis_file', 'canis', 'canis.txt', 0, '', '1033', 8192, 1" );
7403 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7405 r = add_file_entry( hdb, "'monoceros_file', 'monoceros', 'monoceros.txt', 0, '', '1033', 8192, 1" );
7406 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7408 r = add_file_entry( hdb, "'lepus_file', 'lepus', 'lepus.txt', 0, '', '1033', 8192, 1" );
7409 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7411 r = add_file_entry( hdb, "'delphinus_file', 'delphinus', 'delphinus.txt', 0, '', '1033', 8192, 1" );
7412 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7414 r = add_file_entry( hdb, "'hydrus_file', 'hydrus', 'hydrus.txt', 0, '', '1033', 8192, 1" );
7415 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7417 hpkg = package_from_db( hdb );
7418 ok( hpkg, "failed to create package\n");
7420 MsiCloseHandle( hdb );
7422 r = MsiDoAction( hpkg, "CostInitialize");
7423 ok( r == ERROR_SUCCESS, "cost init failed\n");
7425 r = MsiDoAction( hpkg, "FileCost");
7426 ok( r == ERROR_SUCCESS, "file cost failed\n");
7428 r = MsiDoAction( hpkg, "CostFinalize");
7429 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
7433 r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
7434 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7435 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
7436 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7440 r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
7441 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7442 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
7443 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7447 r = MsiGetFeatureState(hpkg, "orion", &state, &action);
7448 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7449 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
7450 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7454 r = MsiGetFeatureState(hpkg, "waters", &state, &action);
7455 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7456 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
7457 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7461 r = MsiGetFeatureState(hpkg, "bayer", &state, &action);
7462 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7463 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
7464 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7468 r = MsiGetComponentState(hpkg, "leo", &state, &action);
7469 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7470 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7471 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7475 r = MsiGetComponentState(hpkg, "virgo", &state, &action);
7476 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7477 ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
7478 ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
7482 r = MsiGetComponentState(hpkg, "libra", &state, &action);
7483 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7484 ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
7485 ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
7489 r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
7490 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7491 ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
7492 ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
7496 r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
7497 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7498 ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
7499 ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
7503 r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
7504 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7505 ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
7506 ok( action == INSTALLSTATE_LOCAL, "Expected andromeda INSTALLSTATE_LOCAL, got %d\n", action);
7510 r = MsiGetComponentState(hpkg, "canis", &state, &action);
7511 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7512 ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
7513 ok( action == INSTALLSTATE_LOCAL, "Expected canis INSTALLSTATE_LOCAL, got %d\n", action);
7517 r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
7518 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7519 ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
7520 ok( action == INSTALLSTATE_SOURCE, "Expected monoceros INSTALLSTATE_SOURCE, got %d\n", action);
7524 r = MsiGetComponentState(hpkg, "lepus", &state, &action);
7525 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7526 ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
7527 ok( action == INSTALLSTATE_LOCAL, "Expected lepus INSTALLSTATE_LOCAL, got %d\n", action);
7531 r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
7532 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7533 ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
7534 ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
7538 r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
7539 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7540 ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
7541 ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
7543 r = MsiSetFeatureState(hpkg, "orion", INSTALLSTATE_ABSENT);
7544 ok( r == ERROR_SUCCESS, "failed to set feature state: %d\n", r);
7548 r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
7549 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7550 ok( state == INSTALLSTATE_ABSENT, "Expected zodiac INSTALLSTATE_ABSENT, got %d\n", state);
7551 ok( action == INSTALLSTATE_LOCAL, "Expected zodiac INSTALLSTATE_LOCAL, got %d\n", action);
7555 r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
7556 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7557 ok( state == INSTALLSTATE_ABSENT, "Expected perseus INSTALLSTATE_ABSENT, got %d\n", state);
7558 ok( action == INSTALLSTATE_SOURCE, "Expected perseus INSTALLSTATE_SOURCE, got %d\n", action);
7562 r = MsiGetFeatureState(hpkg, "orion", &state, &action);
7563 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7564 ok( state == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", state);
7565 ok( action == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", action);
7569 r = MsiGetComponentState(hpkg, "leo", &state, &action);
7570 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7571 ok( state == INSTALLSTATE_UNKNOWN, "Expected leo INSTALLSTATE_UNKNOWN, got %d\n", state);
7572 ok( action == INSTALLSTATE_LOCAL, "Expected leo INSTALLSTATE_LOCAL, got %d\n", action);
7576 r = MsiGetComponentState(hpkg, "virgo", &state, &action);
7577 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7578 ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
7579 ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
7583 r = MsiGetComponentState(hpkg, "libra", &state, &action);
7584 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7585 ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
7586 ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
7590 r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
7591 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7592 ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
7593 ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
7597 r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
7598 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7599 ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
7600 ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
7604 r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
7605 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7606 ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
7607 ok( action == INSTALLSTATE_SOURCE, "Expected andromeda INSTALLSTATE_SOURCE, got %d\n", action);
7611 r = MsiGetComponentState(hpkg, "canis", &state, &action);
7612 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7613 ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
7614 ok( action == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", action);
7618 r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
7619 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7620 ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
7621 ok( action == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", action);
7625 r = MsiGetComponentState(hpkg, "lepus", &state, &action);
7626 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7627 ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
7628 ok( action == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", action);
7632 r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
7633 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7634 ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
7635 ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
7639 r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
7640 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7641 ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
7642 ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
7644 MsiCloseHandle(hpkg);
7645 DeleteFileA(msifile);
7648 static void test_installprops(void)
7650 MSIHANDLE hpkg, hdb;
7651 CHAR path[MAX_PATH];
7659 GetCurrentDirectory(MAX_PATH, path);
7660 lstrcat(path, "\\");
7661 lstrcat(path, msifile);
7663 hdb = create_package_db();
7664 ok( hdb, "failed to create database\n");
7666 hpkg = package_from_db(hdb);
7667 ok( hpkg, "failed to create package\n");
7669 MsiCloseHandle(hdb);
7672 r = MsiGetProperty(hpkg, "DATABASE", buf, &size);
7673 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
7674 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
7676 RegOpenKey(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\MS Setup (ACME)\\User Info", &hkey1);
7678 RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", &hkey2);
7683 if (RegQueryValueEx(hkey1, "DefName", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
7687 RegQueryValueEx(hkey2, "RegisteredOwner", NULL, &type, (LPBYTE)path, &size);
7690 /* win9x doesn't set this */
7694 r = MsiGetProperty(hpkg, "USERNAME", buf, &size);
7695 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
7696 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
7702 if (RegQueryValueEx(hkey1, "DefCompany", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
7706 RegQueryValueEx(hkey2, "RegisteredOrganization", NULL, &type, (LPBYTE)path, &size);
7712 r = MsiGetProperty(hpkg, "COMPANYNAME", buf, &size);
7713 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
7714 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
7718 r = MsiGetProperty(hpkg, "VersionDatabase", buf, &size);
7719 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
7720 trace("VersionDatabase = %s\n", buf);
7723 r = MsiGetProperty(hpkg, "VersionMsi", buf, &size);
7724 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
7725 trace("VersionMsi = %s\n", buf);
7728 r = MsiGetProperty(hpkg, "Date", buf, &size);
7729 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
7730 trace("Date = %s\n", buf);
7733 r = MsiGetProperty(hpkg, "Time", buf, &size);
7734 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
7735 trace("Time = %s\n", buf);
7738 r = MsiGetProperty(hpkg, "PackageCode", buf, &size);
7739 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
7740 trace("PackageCode = %s\n", buf);
7742 langid = GetUserDefaultLangID();
7743 sprintf(path, "%d", langid);
7746 r = MsiGetProperty(hpkg, "UserLanguageID", buf, &size);
7747 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS< got %d\n", r);
7748 ok( !lstrcmpA(buf, path), "Expected \"%s\", got \"%s\"\n", path, buf);
7750 res = GetSystemMetrics(SM_CXSCREEN);
7752 r = MsiGetProperty(hpkg, "ScreenX", buf, &size);
7753 ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
7755 res = GetSystemMetrics(SM_CYSCREEN);
7757 r = MsiGetProperty(hpkg, "ScreenY", buf, &size);
7758 ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
7762 MsiCloseHandle(hpkg);
7763 DeleteFile(msifile);
7766 static void test_launchconditions(void)
7772 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7774 hdb = create_package_db();
7775 ok( hdb, "failed to create package database\n" );
7777 r = create_launchcondition_table( hdb );
7778 ok( r == ERROR_SUCCESS, "cannot create LaunchCondition table: %d\n", r );
7780 r = add_launchcondition_entry( hdb, "'X = \"1\"', 'one'" );
7781 ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
7783 /* invalid condition */
7784 r = add_launchcondition_entry( hdb, "'X != \"1\"', 'one'" );
7785 ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
7787 hpkg = package_from_db( hdb );
7788 ok( hpkg, "failed to create package\n");
7790 MsiCloseHandle( hdb );
7792 r = MsiSetProperty( hpkg, "X", "1" );
7793 ok( r == ERROR_SUCCESS, "failed to set property\n" );
7795 /* invalid conditions are ignored */
7796 r = MsiDoAction( hpkg, "LaunchConditions" );
7797 ok( r == ERROR_SUCCESS, "cost init failed\n" );
7799 /* verify LaunchConditions still does some verification */
7800 r = MsiSetProperty( hpkg, "X", "2" );
7801 ok( r == ERROR_SUCCESS, "failed to set property\n" );
7803 r = MsiDoAction( hpkg, "LaunchConditions" );
7804 ok( r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %d\n", r );
7806 MsiCloseHandle( hpkg );
7807 DeleteFile( msifile );
7810 static void test_ccpsearch(void)
7812 MSIHANDLE hdb, hpkg;
7813 CHAR prop[MAX_PATH];
7814 DWORD size = MAX_PATH;
7817 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7819 hdb = create_package_db();
7820 ok(hdb, "failed to create package database\n");
7822 r = create_ccpsearch_table(hdb);
7823 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7825 r = add_ccpsearch_entry(hdb, "'CCP_random'");
7826 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7828 r = add_ccpsearch_entry(hdb, "'RMCCP_random'");
7829 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7831 r = create_reglocator_table(hdb);
7832 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7834 r = add_reglocator_entry(hdb, "'CCP_random', 0, 'htmlfile\\shell\\open\\nonexistent', '', 1");
7835 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7837 r = create_drlocator_table(hdb);
7838 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7840 r = add_drlocator_entry(hdb, "'RMCCP_random', '', 'C:\\', '0'");
7841 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7843 r = create_signature_table(hdb);
7844 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7846 hpkg = package_from_db(hdb);
7847 ok(hpkg, "failed to create package\n");
7849 MsiCloseHandle(hdb);
7851 r = MsiDoAction(hpkg, "CCPSearch");
7852 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7854 r = MsiGetPropertyA(hpkg, "CCP_Success", prop, &size);
7855 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7856 ok(!lstrcmpA(prop, "1"), "Expected 1, got %s\n", prop);
7858 MsiCloseHandle(hpkg);
7859 DeleteFileA(msifile);
7862 static void test_complocator(void)
7864 MSIHANDLE hdb, hpkg;
7866 CHAR prop[MAX_PATH];
7867 CHAR expected[MAX_PATH];
7868 DWORD size = MAX_PATH;
7870 hdb = create_package_db();
7871 ok(hdb, "failed to create package database\n");
7873 r = create_appsearch_table(hdb);
7874 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7876 r = add_appsearch_entry(hdb, "'ABELISAURUS', 'abelisaurus'");
7877 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7879 r = add_appsearch_entry(hdb, "'BACTROSAURUS', 'bactrosaurus'");
7880 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7882 r = add_appsearch_entry(hdb, "'CAMELOTIA', 'camelotia'");
7883 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7885 r = add_appsearch_entry(hdb, "'DICLONIUS', 'diclonius'");
7886 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7888 r = add_appsearch_entry(hdb, "'ECHINODON', 'echinodon'");
7889 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7891 r = add_appsearch_entry(hdb, "'FALCARIUS', 'falcarius'");
7892 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7894 r = add_appsearch_entry(hdb, "'GALLIMIMUS', 'gallimimus'");
7895 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7897 r = add_appsearch_entry(hdb, "'HAGRYPHUS', 'hagryphus'");
7898 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7900 r = add_appsearch_entry(hdb, "'IGUANODON', 'iguanodon'");
7901 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7903 r = add_appsearch_entry(hdb, "'JOBARIA', 'jobaria'");
7904 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7906 r = add_appsearch_entry(hdb, "'KAKURU', 'kakuru'");
7907 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7909 r = add_appsearch_entry(hdb, "'LABOCANIA', 'labocania'");
7910 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7912 r = add_appsearch_entry(hdb, "'MEGARAPTOR', 'megaraptor'");
7913 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7915 r = add_appsearch_entry(hdb, "'NEOSODON', 'neosodon'");
7916 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7918 r = add_appsearch_entry(hdb, "'OLOROTITAN', 'olorotitan'");
7919 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7921 r = add_appsearch_entry(hdb, "'PANTYDRACO', 'pantydraco'");
7922 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7924 r = create_complocator_table(hdb);
7925 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7927 r = add_complocator_entry(hdb, "'abelisaurus', '{E3619EED-305A-418C-B9C7-F7D7377F0934}', 1");
7928 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7930 r = add_complocator_entry(hdb, "'bactrosaurus', '{D56B688D-542F-42Ef-90FD-B6DA76EE8119}', 0");
7931 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7933 r = add_complocator_entry(hdb, "'camelotia', '{8211BE36-2466-47E3-AFB7-6AC72E51AED2}', 1");
7934 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7936 r = add_complocator_entry(hdb, "'diclonius', '{5C767B20-A33C-45A4-B80B-555E512F01AE}', 0");
7937 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7939 r = add_complocator_entry(hdb, "'echinodon', '{A19E16C5-C75D-4699-8111-C4338C40C3CB}', 1");
7940 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7942 r = add_complocator_entry(hdb, "'falcarius', '{17762FA1-A7AE-4CC6-8827-62873C35361D}', 0");
7943 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7945 r = add_complocator_entry(hdb, "'gallimimus', '{75EBF568-C959-41E0-A99E-9050638CF5FB}', 1");
7946 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7948 r = add_complocator_entry(hdb, "'hagrphus', '{D4969B72-17D9-4AB6-BE49-78F2FEE857AC}', 0");
7949 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7951 r = add_complocator_entry(hdb, "'iguanodon', '{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}', 1");
7952 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7954 r = add_complocator_entry(hdb, "'jobaria', '{243C22B1-8C51-4151-B9D1-1AE5265E079E}', 0");
7955 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7957 r = add_complocator_entry(hdb, "'kakuru', '{5D0F03BA-50BC-44F2-ABB1-72C972F4E514}', 1");
7958 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7960 r = add_complocator_entry(hdb, "'labocania', '{C7DDB60C-7828-4046-A6F8-699D5E92F1ED}', 0");
7961 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7963 r = add_complocator_entry(hdb, "'megaraptor', '{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}', 1");
7964 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7966 r = add_complocator_entry(hdb, "'neosodon', '{0B499649-197A-48EF-93D2-AF1C17ED6E90}', 0");
7967 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7969 r = add_complocator_entry(hdb, "'olorotitan', '{54E9E91F-AED2-46D5-A25A-7E50AFA24513}', 1");
7970 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7972 r = add_complocator_entry(hdb, "'pantydraco', '{2A989951-5565-4FA7-93A7-E800A3E67D71}', 0");
7973 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7975 r = create_signature_table(hdb);
7976 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7978 r = add_signature_entry(hdb, "'abelisaurus', 'abelisaurus', '', '', '', '', '', '', ''");
7979 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7981 r = add_signature_entry(hdb, "'bactrosaurus', 'bactrosaurus', '', '', '', '', '', '', ''");
7982 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7984 r = add_signature_entry(hdb, "'camelotia', 'camelotia', '', '', '', '', '', '', ''");
7985 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7987 r = add_signature_entry(hdb, "'diclonius', 'diclonius', '', '', '', '', '', '', ''");
7988 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7990 r = add_signature_entry(hdb, "'iguanodon', 'iguanodon', '', '', '', '', '', '', ''");
7991 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7993 r = add_signature_entry(hdb, "'jobaria', 'jobaria', '', '', '', '', '', '', ''");
7994 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7996 r = add_signature_entry(hdb, "'kakuru', 'kakuru', '', '', '', '', '', '', ''");
7997 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7999 r = add_signature_entry(hdb, "'labocania', 'labocania', '', '', '', '', '', '', ''");
8000 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8002 hpkg = package_from_db(hdb);
8003 ok(hpkg, "failed to create package\n");
8005 MsiCloseHandle(hdb);
8007 create_test_file("abelisaurus");
8008 create_test_file("bactrosaurus");
8009 create_test_file("camelotia");
8010 create_test_file("diclonius");
8011 create_test_file("echinodon");
8012 create_test_file("falcarius");
8013 create_test_file("gallimimus");
8014 create_test_file("hagryphus");
8015 CreateDirectoryA("iguanodon", NULL);
8016 CreateDirectoryA("jobaria", NULL);
8017 CreateDirectoryA("kakuru", NULL);
8018 CreateDirectoryA("labocania", NULL);
8019 CreateDirectoryA("megaraptor", NULL);
8020 CreateDirectoryA("neosodon", NULL);
8021 CreateDirectoryA("olorotitan", NULL);
8022 CreateDirectoryA("pantydraco", NULL);
8024 set_component_path("abelisaurus", MSIINSTALLCONTEXT_MACHINE,
8025 "{E3619EED-305A-418C-B9C7-F7D7377F0934}", NULL, FALSE);
8026 set_component_path("bactrosaurus", MSIINSTALLCONTEXT_MACHINE,
8027 "{D56B688D-542F-42Ef-90FD-B6DA76EE8119}", NULL, FALSE);
8028 set_component_path("echinodon", MSIINSTALLCONTEXT_MACHINE,
8029 "{A19E16C5-C75D-4699-8111-C4338C40C3CB}", NULL, FALSE);
8030 set_component_path("falcarius", MSIINSTALLCONTEXT_MACHINE,
8031 "{17762FA1-A7AE-4CC6-8827-62873C35361D}", NULL, FALSE);
8032 set_component_path("iguanodon", MSIINSTALLCONTEXT_MACHINE,
8033 "{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}", NULL, FALSE);
8034 set_component_path("jobaria", MSIINSTALLCONTEXT_MACHINE,
8035 "{243C22B1-8C51-4151-B9D1-1AE5265E079E}", NULL, FALSE);
8036 set_component_path("megaraptor", MSIINSTALLCONTEXT_MACHINE,
8037 "{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}", NULL, FALSE);
8038 set_component_path("neosodon", MSIINSTALLCONTEXT_MACHINE,
8039 "{0B499649-197A-48EF-93D2-AF1C17ED6E90}", NULL, FALSE);
8041 r = MsiDoAction(hpkg, "AppSearch");
8042 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8045 r = MsiGetPropertyA(hpkg, "ABELISAURUS", prop, &size);
8046 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8048 lstrcpyA(expected, CURR_DIR);
8049 lstrcatA(expected, "\\abelisaurus");
8050 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
8051 "Expected %s or empty string, got %s\n", expected, prop);
8054 r = MsiGetPropertyA(hpkg, "BACTROSAURUS", prop, &size);
8055 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8056 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
8059 r = MsiGetPropertyA(hpkg, "CAMELOTIA", prop, &size);
8060 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8061 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
8064 r = MsiGetPropertyA(hpkg, "DICLONIUS", prop, &size);
8065 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8066 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
8069 r = MsiGetPropertyA(hpkg, "ECHINODON", prop, &size);
8070 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8072 lstrcpyA(expected, CURR_DIR);
8073 lstrcatA(expected, "\\");
8074 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
8075 "Expected %s or empty string, got %s\n", expected, prop);
8078 r = MsiGetPropertyA(hpkg, "FALCARIUS", prop, &size);
8079 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8080 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
8083 r = MsiGetPropertyA(hpkg, "GALLIMIMUS", prop, &size);
8084 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8085 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
8088 r = MsiGetPropertyA(hpkg, "HAGRYPHUS", prop, &size);
8089 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8090 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
8093 r = MsiGetPropertyA(hpkg, "IGUANODON", prop, &size);
8094 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8095 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
8098 r = MsiGetPropertyA(hpkg, "JOBARIA", prop, &size);
8099 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8100 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
8103 r = MsiGetPropertyA(hpkg, "KAKURU", prop, &size);
8104 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8105 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
8108 r = MsiGetPropertyA(hpkg, "LABOCANIA", prop, &size);
8109 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8110 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
8113 r = MsiGetPropertyA(hpkg, "MEGARAPTOR", prop, &size);
8114 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8116 lstrcpyA(expected, CURR_DIR);
8117 lstrcatA(expected, "\\");
8118 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
8119 "Expected %s or empty string, got %s\n", expected, prop);
8122 r = MsiGetPropertyA(hpkg, "NEOSODON", prop, &size);
8123 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8125 lstrcpyA(expected, CURR_DIR);
8126 lstrcatA(expected, "\\neosodon\\");
8127 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
8128 "Expected %s or empty string, got %s\n", expected, prop);
8131 r = MsiGetPropertyA(hpkg, "OLOROTITAN", prop, &size);
8132 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8133 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
8136 r = MsiGetPropertyA(hpkg, "PANTYDRACO", prop, &size);
8137 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8138 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
8140 MsiCloseHandle(hpkg);
8141 DeleteFileA("abelisaurus");
8142 DeleteFileA("bactrosaurus");
8143 DeleteFileA("camelotia");
8144 DeleteFileA("diclonius");
8145 DeleteFileA("echinodon");
8146 DeleteFileA("falcarius");
8147 DeleteFileA("gallimimus");
8148 DeleteFileA("hagryphus");
8149 RemoveDirectoryA("iguanodon");
8150 RemoveDirectoryA("jobaria");
8151 RemoveDirectoryA("kakuru");
8152 RemoveDirectoryA("labocania");
8153 RemoveDirectoryA("megaraptor");
8154 RemoveDirectoryA("neosodon");
8155 RemoveDirectoryA("olorotitan");
8156 RemoveDirectoryA("pantydraco");
8157 delete_component_path("{E3619EED-305A-418C-B9C7-F7D7377F0934}",
8158 MSIINSTALLCONTEXT_MACHINE, NULL);
8159 delete_component_path("{D56B688D-542F-42Ef-90FD-B6DA76EE8119}",
8160 MSIINSTALLCONTEXT_MACHINE, NULL);
8161 delete_component_path("{A19E16C5-C75D-4699-8111-C4338C40C3CB}",
8162 MSIINSTALLCONTEXT_MACHINE, NULL);
8163 delete_component_path("{17762FA1-A7AE-4CC6-8827-62873C35361D}",
8164 MSIINSTALLCONTEXT_MACHINE, NULL);
8165 delete_component_path("{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}",
8166 MSIINSTALLCONTEXT_MACHINE, NULL);
8167 delete_component_path("{243C22B1-8C51-4151-B9D1-1AE5265E079E}",
8168 MSIINSTALLCONTEXT_MACHINE, NULL);
8169 delete_component_path("{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}",
8170 MSIINSTALLCONTEXT_MACHINE, NULL);
8171 delete_component_path("{0B499649-197A-48EF-93D2-AF1C17ED6E90}",
8172 MSIINSTALLCONTEXT_MACHINE, NULL);
8173 DeleteFileA(msifile);
8176 static void set_suminfo_prop(MSIHANDLE db, DWORD prop, DWORD val)
8181 r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
8182 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8184 r = MsiSummaryInfoSetPropertyA(summary, prop, VT_I4, val, NULL, NULL);
8185 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8187 r = MsiSummaryInfoPersist(summary);
8188 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
8190 MsiCloseHandle(summary);
8193 static void test_MsiGetSourcePath(void)
8195 MSIHANDLE hdb, hpkg;
8196 CHAR path[MAX_PATH];
8198 CHAR subsrc[MAX_PATH];
8199 CHAR sub2[MAX_PATH];
8203 lstrcpyA(cwd, CURR_DIR);
8204 lstrcatA(cwd, "\\");
8206 lstrcpyA(subsrc, cwd);
8207 lstrcatA(subsrc, "subsource");
8208 lstrcatA(subsrc, "\\");
8210 lstrcpyA(sub2, subsrc);
8211 lstrcatA(sub2, "sub2");
8212 lstrcatA(sub2, "\\");
8214 /* uncompressed source */
8216 hdb = create_package_db();
8217 ok( hdb, "failed to create database\n");
8219 set_suminfo_prop(hdb, PID_WORDCOUNT, 0);
8221 r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
8222 ok(r == S_OK, "failed\n");
8224 r = add_directory_entry(hdb, "'SubDir', 'TARGETDIR', 'subtarget:subsource'");
8225 ok(r == S_OK, "failed\n");
8227 r = add_directory_entry(hdb, "'SubDir2', 'SubDir', 'sub2'");
8228 ok(r == S_OK, "failed\n");
8230 r = MsiDatabaseCommit(hdb);
8231 ok(r == ERROR_SUCCESS , "Failed to commit database\n");
8233 hpkg = package_from_db(hdb);
8234 ok(hpkg, "failed to create package\n");
8236 MsiCloseHandle(hdb);
8238 /* invalid database handle */
8240 lstrcpyA(path, "kiwi");
8241 r = MsiGetSourcePath(-1, "TARGETDIR", path, &size);
8242 ok(r == ERROR_INVALID_HANDLE,
8243 "Expected ERROR_INVALID_HANDLE, got %d\n", r);
8244 ok(!lstrcmpA(path, "kiwi"),
8245 "Expected path to be unchanged, got \"%s\"\n", path);
8246 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8250 lstrcpyA(path, "kiwi");
8251 r = MsiGetSourcePath(hpkg, NULL, path, &size);
8252 ok(r == ERROR_INVALID_PARAMETER,
8253 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
8254 ok(!lstrcmpA(path, "kiwi"),
8255 "Expected path to be unchanged, got \"%s\"\n", path);
8256 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8258 /* empty szFolder */
8260 lstrcpyA(path, "kiwi");
8261 r = MsiGetSourcePath(hpkg, "", path, &size);
8262 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8263 ok(!lstrcmpA(path, "kiwi"),
8264 "Expected path to be unchanged, got \"%s\"\n", path);
8265 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8269 lstrcpyA(path, "kiwi");
8270 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
8271 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8272 ok(!lstrcmpA(path, "kiwi"),
8273 "Expected path to be unchanged, got \"%s\"\n", path);
8274 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8278 lstrcpyA(path, "kiwi");
8279 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
8280 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8281 ok(!lstrcmpA(path, "kiwi"),
8282 "Expected path to be unchanged, got \"%s\"\n", path);
8283 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8287 lstrcpyA(path, "kiwi");
8288 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
8289 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8290 ok(!lstrcmpA(path, "kiwi"),
8291 "Expected path to be unchanged, got \"%s\"\n", path);
8292 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8294 /* source path does not exist, but the property exists */
8296 lstrcpyA(path, "kiwi");
8297 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
8298 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8299 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
8300 ok(size == 0, "Expected 0, got %d\n", size);
8304 lstrcpyA(path, "kiwi");
8305 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8306 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8307 ok(!lstrcmpA(path, "kiwi"),
8308 "Expected path to be unchanged, got \"%s\"\n", path);
8309 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8313 lstrcpyA(path, "kiwi");
8314 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
8315 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8316 ok(!lstrcmpA(path, "kiwi"),
8317 "Expected path to be unchanged, got \"%s\"\n", path);
8318 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8320 r = MsiDoAction(hpkg, "CostInitialize");
8321 ok(r == ERROR_SUCCESS, "cost init failed\n");
8323 /* try TARGETDIR after CostInitialize */
8325 lstrcpyA(path, "kiwi");
8326 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
8327 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8328 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8329 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8331 /* try SourceDir after CostInitialize */
8333 lstrcpyA(path, "kiwi");
8334 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
8335 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8336 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8337 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8339 /* try SOURCEDIR after CostInitialize */
8341 lstrcpyA(path, "kiwi");
8342 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
8343 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8344 ok(!lstrcmpA(path, "kiwi"),
8345 "Expected path to be unchanged, got \"%s\"\n", path);
8346 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8348 /* source path does not exist, but the property exists */
8350 lstrcpyA(path, "kiwi");
8351 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
8352 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8355 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8356 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8359 /* try SubDir after CostInitialize */
8361 lstrcpyA(path, "kiwi");
8362 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8363 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8364 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8365 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8367 /* try SubDir2 after CostInitialize */
8369 lstrcpyA(path, "kiwi");
8370 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
8371 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8372 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
8373 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
8375 r = MsiDoAction(hpkg, "ResolveSource");
8376 ok(r == ERROR_SUCCESS, "file cost failed\n");
8378 /* try TARGETDIR after ResolveSource */
8380 lstrcpyA(path, "kiwi");
8381 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
8382 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8383 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8384 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8386 /* try SourceDir after ResolveSource */
8388 lstrcpyA(path, "kiwi");
8389 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
8390 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8391 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8392 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8394 /* try SOURCEDIR after ResolveSource */
8396 lstrcpyA(path, "kiwi");
8397 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
8398 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8399 ok(!lstrcmpA(path, "kiwi"),
8400 "Expected path to be unchanged, got \"%s\"\n", path);
8401 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8403 /* source path does not exist, but the property exists */
8405 lstrcpyA(path, "kiwi");
8406 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
8407 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8408 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8409 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8411 /* try SubDir after ResolveSource */
8413 lstrcpyA(path, "kiwi");
8414 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8415 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8416 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8417 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8419 /* try SubDir2 after ResolveSource */
8421 lstrcpyA(path, "kiwi");
8422 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
8423 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8424 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
8425 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
8427 r = MsiDoAction(hpkg, "FileCost");
8428 ok(r == ERROR_SUCCESS, "file cost failed\n");
8430 /* try TARGETDIR after FileCost */
8432 lstrcpyA(path, "kiwi");
8433 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
8434 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8435 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8436 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8438 /* try SourceDir after FileCost */
8440 lstrcpyA(path, "kiwi");
8441 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
8442 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8443 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8444 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8446 /* try SOURCEDIR after FileCost */
8448 lstrcpyA(path, "kiwi");
8449 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
8450 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8451 ok(!lstrcmpA(path, "kiwi"),
8452 "Expected path to be unchanged, got \"%s\"\n", path);
8453 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8455 /* try SubDir after FileCost */
8457 lstrcpyA(path, "kiwi");
8458 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8459 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8460 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8461 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8463 /* try SubDir2 after FileCost */
8465 lstrcpyA(path, "kiwi");
8466 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
8467 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8468 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
8469 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
8471 r = MsiDoAction(hpkg, "CostFinalize");
8472 ok(r == ERROR_SUCCESS, "file cost failed\n");
8474 /* try TARGETDIR after CostFinalize */
8476 lstrcpyA(path, "kiwi");
8477 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
8478 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8479 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8480 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8482 /* try SourceDir after CostFinalize */
8484 lstrcpyA(path, "kiwi");
8485 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
8486 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8487 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8488 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8490 /* try SOURCEDIR after CostFinalize */
8492 lstrcpyA(path, "kiwi");
8493 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
8494 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8495 ok(!lstrcmpA(path, "kiwi"),
8496 "Expected path to be unchanged, got \"%s\"\n", path);
8497 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8499 /* try SubDir after CostFinalize */
8501 lstrcpyA(path, "kiwi");
8502 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8503 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8504 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8505 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8507 /* try SubDir2 after CostFinalize */
8509 lstrcpyA(path, "kiwi");
8510 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
8511 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8512 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
8513 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
8515 /* nonexistent directory */
8517 lstrcpyA(path, "kiwi");
8518 r = MsiGetSourcePath(hpkg, "IDontExist", path, &size);
8519 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8520 ok(!lstrcmpA(path, "kiwi"),
8521 "Expected path to be unchanged, got \"%s\"\n", path);
8522 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8524 /* NULL szPathBuf */
8526 r = MsiGetSourcePath(hpkg, "SourceDir", NULL, &size);
8527 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8528 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8530 /* NULL pcchPathBuf */
8531 lstrcpyA(path, "kiwi");
8532 r = MsiGetSourcePath(hpkg, "SourceDir", path, NULL);
8533 ok(r == ERROR_INVALID_PARAMETER,
8534 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
8535 ok(!lstrcmpA(path, "kiwi"),
8536 "Expected path to be unchanged, got \"%s\"\n", path);
8538 /* pcchPathBuf is 0 */
8540 lstrcpyA(path, "kiwi");
8541 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
8542 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
8543 ok(!lstrcmpA(path, "kiwi"),
8544 "Expected path to be unchanged, got \"%s\"\n", path);
8545 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8547 /* pcchPathBuf does not have room for NULL terminator */
8548 size = lstrlenA(cwd);
8549 lstrcpyA(path, "kiwi");
8550 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
8551 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
8552 ok(!strncmp(path, cwd, lstrlenA(cwd) - 1),
8553 "Expected path with no backslash, got \"%s\"\n", path);
8554 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8556 /* pcchPathBuf has room for NULL terminator */
8557 size = lstrlenA(cwd) + 1;
8558 lstrcpyA(path, "kiwi");
8559 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
8560 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8561 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8562 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8564 MsiCloseHandle(hpkg);
8566 /* compressed source */
8568 r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
8569 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8571 set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeCompressed);
8573 hpkg = package_from_db(hdb);
8574 ok(hpkg, "failed to create package\n");
8576 r = MsiDoAction(hpkg, "CostInitialize");
8577 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8578 r = MsiDoAction(hpkg, "FileCost");
8579 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8580 r = MsiDoAction(hpkg, "CostFinalize");
8581 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8583 /* try TARGETDIR after CostFinalize */
8585 lstrcpyA(path, "kiwi");
8586 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
8587 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8588 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8589 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8591 /* try SourceDir after CostFinalize */
8593 lstrcpyA(path, "kiwi");
8594 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
8595 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8596 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8597 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8599 /* try SOURCEDIR after CostFinalize */
8601 lstrcpyA(path, "kiwi");
8602 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
8605 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8606 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8607 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8610 /* try SubDir after CostFinalize */
8612 lstrcpyA(path, "kiwi");
8613 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8614 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8615 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8616 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8618 /* try SubDir2 after CostFinalize */
8620 lstrcpyA(path, "kiwi");
8621 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
8622 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8623 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8624 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8626 MsiCloseHandle(hpkg);
8627 DeleteFile(msifile);
8630 static void test_shortlongsource(void)
8632 MSIHANDLE hdb, hpkg;
8633 CHAR path[MAX_PATH];
8635 CHAR subsrc[MAX_PATH];
8639 lstrcpyA(cwd, CURR_DIR);
8640 lstrcatA(cwd, "\\");
8642 lstrcpyA(subsrc, cwd);
8643 lstrcatA(subsrc, "long");
8644 lstrcatA(subsrc, "\\");
8646 /* long file names */
8648 hdb = create_package_db();
8649 ok( hdb, "failed to create database\n");
8651 set_suminfo_prop(hdb, PID_WORDCOUNT, 0);
8653 r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
8654 ok(r == S_OK, "failed\n");
8656 r = add_directory_entry(hdb, "'SubDir', 'TARGETDIR', 'short|long'");
8657 ok(r == S_OK, "failed\n");
8659 /* CostInitialize:short */
8660 r = add_directory_entry(hdb, "'SubDir2', 'TARGETDIR', 'one|two'");
8661 ok(r == S_OK, "failed\n");
8663 /* CostInitialize:long */
8664 r = add_directory_entry(hdb, "'SubDir3', 'TARGETDIR', 'three|four'");
8665 ok(r == S_OK, "failed\n");
8667 /* FileCost:short */
8668 r = add_directory_entry(hdb, "'SubDir4', 'TARGETDIR', 'five|six'");
8669 ok(r == S_OK, "failed\n");
8672 r = add_directory_entry(hdb, "'SubDir5', 'TARGETDIR', 'seven|eight'");
8673 ok(r == S_OK, "failed\n");
8675 /* CostFinalize:short */
8676 r = add_directory_entry(hdb, "'SubDir6', 'TARGETDIR', 'nine|ten'");
8677 ok(r == S_OK, "failed\n");
8679 /* CostFinalize:long */
8680 r = add_directory_entry(hdb, "'SubDir7', 'TARGETDIR', 'eleven|twelve'");
8681 ok(r == S_OK, "failed\n");
8683 MsiDatabaseCommit(hdb);
8685 hpkg = package_from_db(hdb);
8686 ok(hpkg, "failed to create package\n");
8688 MsiCloseHandle(hdb);
8690 CreateDirectoryA("one", NULL);
8691 CreateDirectoryA("four", NULL);
8693 r = MsiDoAction(hpkg, "CostInitialize");
8694 ok(r == ERROR_SUCCESS, "file cost failed\n");
8696 CreateDirectory("five", NULL);
8697 CreateDirectory("eight", NULL);
8699 r = MsiDoAction(hpkg, "FileCost");
8700 ok(r == ERROR_SUCCESS, "file cost failed\n");
8702 CreateDirectory("nine", NULL);
8703 CreateDirectory("twelve", NULL);
8705 r = MsiDoAction(hpkg, "CostFinalize");
8706 ok(r == ERROR_SUCCESS, "file cost failed\n");
8708 /* neither short nor long source directories exist */
8710 lstrcpyA(path, "kiwi");
8711 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8712 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8713 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8714 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8716 CreateDirectoryA("short", NULL);
8718 /* short source directory exists */
8720 lstrcpyA(path, "kiwi");
8721 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8722 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8723 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8724 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8726 CreateDirectoryA("long", NULL);
8728 /* both short and long source directories exist */
8730 lstrcpyA(path, "kiwi");
8731 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8732 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8733 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8734 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8736 lstrcpyA(subsrc, cwd);
8737 lstrcatA(subsrc, "two");
8738 lstrcatA(subsrc, "\\");
8740 /* short dir exists before CostInitialize */
8742 lstrcpyA(path, "kiwi");
8743 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
8744 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8745 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8746 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8748 lstrcpyA(subsrc, cwd);
8749 lstrcatA(subsrc, "four");
8750 lstrcatA(subsrc, "\\");
8752 /* long dir exists before CostInitialize */
8754 lstrcpyA(path, "kiwi");
8755 r = MsiGetSourcePath(hpkg, "SubDir3", path, &size);
8756 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8757 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8758 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8760 lstrcpyA(subsrc, cwd);
8761 lstrcatA(subsrc, "six");
8762 lstrcatA(subsrc, "\\");
8764 /* short dir exists before FileCost */
8766 lstrcpyA(path, "kiwi");
8767 r = MsiGetSourcePath(hpkg, "SubDir4", path, &size);
8768 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8769 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8770 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8772 lstrcpyA(subsrc, cwd);
8773 lstrcatA(subsrc, "eight");
8774 lstrcatA(subsrc, "\\");
8776 /* long dir exists before FileCost */
8778 lstrcpyA(path, "kiwi");
8779 r = MsiGetSourcePath(hpkg, "SubDir5", path, &size);
8780 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8781 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8782 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8784 lstrcpyA(subsrc, cwd);
8785 lstrcatA(subsrc, "ten");
8786 lstrcatA(subsrc, "\\");
8788 /* short dir exists before CostFinalize */
8790 lstrcpyA(path, "kiwi");
8791 r = MsiGetSourcePath(hpkg, "SubDir6", path, &size);
8792 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8793 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8794 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8796 lstrcpyA(subsrc, cwd);
8797 lstrcatA(subsrc, "twelve");
8798 lstrcatA(subsrc, "\\");
8800 /* long dir exists before CostFinalize */
8802 lstrcpyA(path, "kiwi");
8803 r = MsiGetSourcePath(hpkg, "SubDir7", path, &size);
8804 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8805 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8806 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8808 MsiCloseHandle(hpkg);
8809 RemoveDirectoryA("short");
8810 RemoveDirectoryA("long");
8811 RemoveDirectoryA("one");
8812 RemoveDirectoryA("four");
8813 RemoveDirectoryA("five");
8814 RemoveDirectoryA("eight");
8815 RemoveDirectoryA("nine");
8816 RemoveDirectoryA("twelve");
8818 /* short file names */
8820 r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
8821 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8823 set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeSFN);
8825 hpkg = package_from_db(hdb);
8826 ok(hpkg, "failed to create package\n");
8828 MsiCloseHandle(hdb);
8830 CreateDirectoryA("one", NULL);
8831 CreateDirectoryA("four", NULL);
8833 r = MsiDoAction(hpkg, "CostInitialize");
8834 ok(r == ERROR_SUCCESS, "file cost failed\n");
8836 CreateDirectory("five", NULL);
8837 CreateDirectory("eight", NULL);
8839 r = MsiDoAction(hpkg, "FileCost");
8840 ok(r == ERROR_SUCCESS, "file cost failed\n");
8842 CreateDirectory("nine", NULL);
8843 CreateDirectory("twelve", NULL);
8845 r = MsiDoAction(hpkg, "CostFinalize");
8846 ok(r == ERROR_SUCCESS, "file cost failed\n");
8848 lstrcpyA(subsrc, cwd);
8849 lstrcatA(subsrc, "short");
8850 lstrcatA(subsrc, "\\");
8852 /* neither short nor long source directories exist */
8854 lstrcpyA(path, "kiwi");
8855 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8856 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8857 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8858 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8860 CreateDirectoryA("short", NULL);
8862 /* short source directory exists */
8864 lstrcpyA(path, "kiwi");
8865 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8866 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8867 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8868 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8870 CreateDirectoryA("long", NULL);
8872 /* both short and long source directories exist */
8874 lstrcpyA(path, "kiwi");
8875 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8876 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8877 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8878 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8880 lstrcpyA(subsrc, cwd);
8881 lstrcatA(subsrc, "one");
8882 lstrcatA(subsrc, "\\");
8884 /* short dir exists before CostInitialize */
8886 lstrcpyA(path, "kiwi");
8887 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
8888 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8889 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8890 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8892 lstrcpyA(subsrc, cwd);
8893 lstrcatA(subsrc, "three");
8894 lstrcatA(subsrc, "\\");
8896 /* long dir exists before CostInitialize */
8898 lstrcpyA(path, "kiwi");
8899 r = MsiGetSourcePath(hpkg, "SubDir3", path, &size);
8900 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8901 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8902 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8904 lstrcpyA(subsrc, cwd);
8905 lstrcatA(subsrc, "five");
8906 lstrcatA(subsrc, "\\");
8908 /* short dir exists before FileCost */
8910 lstrcpyA(path, "kiwi");
8911 r = MsiGetSourcePath(hpkg, "SubDir4", path, &size);
8912 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8913 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8914 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8916 lstrcpyA(subsrc, cwd);
8917 lstrcatA(subsrc, "seven");
8918 lstrcatA(subsrc, "\\");
8920 /* long dir exists before FileCost */
8922 lstrcpyA(path, "kiwi");
8923 r = MsiGetSourcePath(hpkg, "SubDir5", path, &size);
8924 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8925 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8926 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8928 lstrcpyA(subsrc, cwd);
8929 lstrcatA(subsrc, "nine");
8930 lstrcatA(subsrc, "\\");
8932 /* short dir exists before CostFinalize */
8934 lstrcpyA(path, "kiwi");
8935 r = MsiGetSourcePath(hpkg, "SubDir6", path, &size);
8936 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8937 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8938 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8940 lstrcpyA(subsrc, cwd);
8941 lstrcatA(subsrc, "eleven");
8942 lstrcatA(subsrc, "\\");
8944 /* long dir exists before CostFinalize */
8946 lstrcpyA(path, "kiwi");
8947 r = MsiGetSourcePath(hpkg, "SubDir7", path, &size);
8948 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8949 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8950 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8952 MsiCloseHandle(hpkg);
8953 RemoveDirectoryA("short");
8954 RemoveDirectoryA("long");
8955 RemoveDirectoryA("one");
8956 RemoveDirectoryA("four");
8957 RemoveDirectoryA("five");
8958 RemoveDirectoryA("eight");
8959 RemoveDirectoryA("nine");
8960 RemoveDirectoryA("twelve");
8961 DeleteFileA(msifile);
8964 static void test_sourcedir(void)
8966 MSIHANDLE hdb, hpkg;
8968 CHAR path[MAX_PATH];
8970 CHAR subsrc[MAX_PATH];
8974 lstrcpyA(cwd, CURR_DIR);
8975 lstrcatA(cwd, "\\");
8977 lstrcpyA(subsrc, cwd);
8978 lstrcatA(subsrc, "long");
8979 lstrcatA(subsrc, "\\");
8981 hdb = create_package_db();
8982 ok( hdb, "failed to create database\n");
8984 r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
8985 ok(r == S_OK, "failed\n");
8987 sprintf(package, "#%li", hdb);
8988 r = MsiOpenPackage(package, &hpkg);
8989 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8991 /* properties only */
8993 /* SourceDir prop */
8995 lstrcpyA(path, "kiwi");
8996 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
8997 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8998 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
8999 ok(size == 0, "Expected 0, got %d\n", size);
9001 /* SOURCEDIR prop */
9003 lstrcpyA(path, "kiwi");
9004 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
9005 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9006 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
9007 ok(size == 0, "Expected 0, got %d\n", size);
9009 r = MsiDoAction(hpkg, "CostInitialize");
9010 ok(r == ERROR_SUCCESS, "file cost failed\n");
9012 /* SourceDir after CostInitialize */
9014 lstrcpyA(path, "kiwi");
9015 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
9016 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9017 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
9018 ok(size == 0, "Expected 0, got %d\n", size);
9020 /* SOURCEDIR after CostInitialize */
9022 lstrcpyA(path, "kiwi");
9023 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
9024 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9025 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
9026 ok(size == 0, "Expected 0, got %d\n", size);
9028 r = MsiDoAction(hpkg, "FileCost");
9029 ok(r == ERROR_SUCCESS, "file cost failed\n");
9031 /* SourceDir after FileCost */
9033 lstrcpyA(path, "kiwi");
9034 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
9035 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9036 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
9037 ok(size == 0, "Expected 0, got %d\n", size);
9039 /* SOURCEDIR after FileCost */
9041 lstrcpyA(path, "kiwi");
9042 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
9043 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9044 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
9045 ok(size == 0, "Expected 0, got %d\n", size);
9047 r = MsiDoAction(hpkg, "CostFinalize");
9048 ok(r == ERROR_SUCCESS, "file cost failed\n");
9050 /* SourceDir after CostFinalize */
9052 lstrcpyA(path, "kiwi");
9053 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
9054 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9055 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
9056 ok(size == 0, "Expected 0, got %d\n", size);
9058 /* SOURCEDIR after CostFinalize */
9060 lstrcpyA(path, "kiwi");
9061 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
9062 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9063 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
9064 ok(size == 0, "Expected 0, got %d\n", size);
9066 r = MsiDoAction(hpkg, "ResolveSource");
9067 ok(r == ERROR_SUCCESS, "file cost failed\n");
9069 /* SourceDir after ResolveSource */
9071 lstrcpyA(path, "kiwi");
9072 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
9073 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9074 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9075 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9077 /* SOURCEDIR after ResolveSource */
9079 lstrcpyA(path, "kiwi");
9080 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
9081 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9082 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9083 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9087 lstrcpyA(path, "kiwi");
9088 r = MsiGetProperty(hpkg, "SoUrCeDiR", path, &size);
9089 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9090 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
9091 ok(size == 0, "Expected 0, got %d\n", size);
9093 MsiCloseHandle(hpkg);
9095 /* reset the package state */
9096 sprintf(package, "#%li", hdb);
9097 r = MsiOpenPackage(package, &hpkg);
9098 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9100 /* test how MsiGetSourcePath affects the properties */
9102 /* SourceDir prop */
9104 lstrcpyA(path, "kiwi");
9105 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
9106 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9109 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
9110 ok(size == 0, "Expected 0, got %d\n", size);
9114 lstrcpyA(path, "kiwi");
9115 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
9116 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9117 ok(!lstrcmpA(path, "kiwi"),
9118 "Expected path to be unchanged, got \"%s\"\n", path);
9119 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9121 /* SourceDir after MsiGetSourcePath */
9123 lstrcpyA(path, "kiwi");
9124 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
9125 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9128 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
9129 ok(size == 0, "Expected 0, got %d\n", size);
9132 /* SOURCEDIR prop */
9134 lstrcpyA(path, "kiwi");
9135 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
9136 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9139 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
9140 ok(size == 0, "Expected 0, got %d\n", size);
9144 lstrcpyA(path, "kiwi");
9145 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
9146 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9147 ok(!lstrcmpA(path, "kiwi"),
9148 "Expected path to be unchanged, got \"%s\"\n", path);
9149 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9151 /* SOURCEDIR prop after MsiGetSourcePath */
9153 lstrcpyA(path, "kiwi");
9154 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
9155 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9158 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
9159 ok(size == 0, "Expected 0, got %d\n", size);
9162 r = MsiDoAction(hpkg, "CostInitialize");
9163 ok(r == ERROR_SUCCESS, "file cost failed\n");
9165 /* SourceDir after CostInitialize */
9167 lstrcpyA(path, "kiwi");
9168 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
9169 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9172 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
9173 ok(size == 0, "Expected 0, got %d\n", size);
9177 lstrcpyA(path, "kiwi");
9178 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
9179 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9180 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9181 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9183 /* SourceDir after MsiGetSourcePath */
9185 lstrcpyA(path, "kiwi");
9186 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
9187 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9188 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9189 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9191 /* SOURCEDIR after CostInitialize */
9193 lstrcpyA(path, "kiwi");
9194 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
9195 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9196 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9197 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9199 /* SOURCEDIR source path still does not exist */
9201 lstrcpyA(path, "kiwi");
9202 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
9203 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9204 ok(!lstrcmpA(path, "kiwi"),
9205 "Expected path to be unchanged, got \"%s\"\n", path);
9206 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9208 r = MsiDoAction(hpkg, "FileCost");
9209 ok(r == ERROR_SUCCESS, "file cost failed\n");
9211 /* SourceDir after FileCost */
9213 lstrcpyA(path, "kiwi");
9214 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
9215 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9216 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9217 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9219 /* SOURCEDIR after FileCost */
9221 lstrcpyA(path, "kiwi");
9222 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
9223 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9224 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9225 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9227 /* SOURCEDIR source path still does not exist */
9229 lstrcpyA(path, "kiwi");
9230 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
9231 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9232 ok(!lstrcmpA(path, "kiwi"),
9233 "Expected path to be unchanged, got \"%s\"\n", path);
9234 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9236 r = MsiDoAction(hpkg, "CostFinalize");
9237 ok(r == ERROR_SUCCESS, "file cost failed\n");
9239 /* SourceDir after CostFinalize */
9241 lstrcpyA(path, "kiwi");
9242 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
9243 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9244 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9245 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9247 /* SOURCEDIR after CostFinalize */
9249 lstrcpyA(path, "kiwi");
9250 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
9251 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9252 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9253 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9255 /* SOURCEDIR source path still does not exist */
9257 lstrcpyA(path, "kiwi");
9258 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
9259 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9260 ok(!lstrcmpA(path, "kiwi"),
9261 "Expected path to be unchanged, got \"%s\"\n", path);
9262 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9264 r = MsiDoAction(hpkg, "ResolveSource");
9265 ok(r == ERROR_SUCCESS, "file cost failed\n");
9267 /* SourceDir after ResolveSource */
9269 lstrcpyA(path, "kiwi");
9270 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
9271 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9272 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9273 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9275 /* SOURCEDIR after ResolveSource */
9277 lstrcpyA(path, "kiwi");
9278 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
9279 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9280 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9281 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9283 /* SOURCEDIR source path still does not exist */
9285 lstrcpyA(path, "kiwi");
9286 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
9287 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9288 ok(!lstrcmpA(path, "kiwi"),
9289 "Expected path to be unchanged, got \"%s\"\n", path);
9290 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9292 MsiCloseHandle(hdb);
9293 MsiCloseHandle(hpkg);
9294 DeleteFileA(msifile);
9304 static const struct access_res create[16] =
9306 { TRUE, ERROR_SUCCESS, TRUE },
9307 { TRUE, ERROR_SUCCESS, TRUE },
9308 { TRUE, ERROR_SUCCESS, FALSE },
9309 { TRUE, ERROR_SUCCESS, FALSE },
9310 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9311 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9312 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9313 { TRUE, ERROR_SUCCESS, FALSE },
9314 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9315 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9316 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9317 { TRUE, ERROR_SUCCESS, TRUE },
9318 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9319 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9320 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9321 { TRUE, ERROR_SUCCESS, TRUE }
9324 static const struct access_res create_commit[16] =
9326 { TRUE, ERROR_SUCCESS, TRUE },
9327 { TRUE, ERROR_SUCCESS, TRUE },
9328 { TRUE, ERROR_SUCCESS, FALSE },
9329 { TRUE, ERROR_SUCCESS, FALSE },
9330 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9331 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9332 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9333 { TRUE, ERROR_SUCCESS, FALSE },
9334 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9335 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9336 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9337 { TRUE, ERROR_SUCCESS, TRUE },
9338 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9339 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9340 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9341 { TRUE, ERROR_SUCCESS, TRUE }
9344 static const struct access_res create_close[16] =
9346 { TRUE, ERROR_SUCCESS, FALSE },
9347 { TRUE, ERROR_SUCCESS, FALSE },
9348 { TRUE, ERROR_SUCCESS, FALSE },
9349 { TRUE, ERROR_SUCCESS, FALSE },
9350 { TRUE, ERROR_SUCCESS, FALSE },
9351 { TRUE, ERROR_SUCCESS, FALSE },
9352 { TRUE, ERROR_SUCCESS, FALSE },
9353 { TRUE, ERROR_SUCCESS, FALSE },
9354 { TRUE, ERROR_SUCCESS, FALSE },
9355 { TRUE, ERROR_SUCCESS, FALSE },
9356 { TRUE, ERROR_SUCCESS, FALSE },
9357 { TRUE, ERROR_SUCCESS, FALSE },
9358 { TRUE, ERROR_SUCCESS, FALSE },
9359 { TRUE, ERROR_SUCCESS, FALSE },
9360 { TRUE, ERROR_SUCCESS, FALSE },
9361 { TRUE, ERROR_SUCCESS }
9364 static void _test_file_access(LPCSTR file, const struct access_res *ares, DWORD line)
9366 DWORD access = 0, share = 0;
9371 for (i = 0; i < 4; i++)
9373 if (i == 0) access = 0;
9374 if (i == 1) access = GENERIC_READ;
9375 if (i == 2) access = GENERIC_WRITE;
9376 if (i == 3) access = GENERIC_READ | GENERIC_WRITE;
9378 for (j = 0; j < 4; j++)
9380 if (ares[idx].ignore)
9383 if (j == 0) share = 0;
9384 if (j == 1) share = FILE_SHARE_READ;
9385 if (j == 2) share = FILE_SHARE_WRITE;
9386 if (j == 3) share = FILE_SHARE_READ | FILE_SHARE_WRITE;
9388 SetLastError(0xdeadbeef);
9389 hfile = CreateFileA(file, access, share, NULL, OPEN_EXISTING,
9390 FILE_ATTRIBUTE_NORMAL, 0);
9391 lasterr = GetLastError();
9393 ok((hfile != INVALID_HANDLE_VALUE) == ares[idx].gothandle,
9394 "(%d, handle, %d): Expected %d, got %d\n",
9395 line, idx, ares[idx].gothandle,
9396 (hfile != INVALID_HANDLE_VALUE));
9398 ok(lasterr == ares[idx].lasterr ||
9399 lasterr == 0xdeadbeef, /* win9x */
9400 "(%d, lasterr, %d): Expected %d, got %d\n",
9401 line, idx, ares[idx].lasterr, lasterr);
9409 #define test_file_access(file, ares) _test_file_access(file, ares, __LINE__)
9411 static void test_access(void)
9416 r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
9417 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9419 test_file_access(msifile, create);
9421 r = MsiDatabaseCommit(hdb);
9422 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9424 test_file_access(msifile, create_commit);
9426 MsiCloseHandle(hdb);
9428 test_file_access(msifile, create_close);
9430 DeleteFileA(msifile);
9432 r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATEDIRECT, &hdb);
9433 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9435 test_file_access(msifile, create);
9437 r = MsiDatabaseCommit(hdb);
9438 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9440 test_file_access(msifile, create_commit);
9442 MsiCloseHandle(hdb);
9444 test_file_access(msifile, create_close);
9446 DeleteFileA(msifile);
9449 static void test_emptypackage(void)
9451 MSIHANDLE hpkg, hdb, hsuminfo;
9452 MSIHANDLE hview, hrec;
9453 MSICONDITION condition;
9454 CHAR buffer[MAX_PATH];
9458 r = MsiOpenPackageA("", &hpkg);
9461 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9464 hdb = MsiGetActiveDatabase(hpkg);
9467 ok(hdb != 0, "Expected a valid database handle\n");
9470 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Tables`", &hview);
9473 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9475 r = MsiViewExecute(hview, 0);
9478 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9481 r = MsiViewFetch(hview, &hrec);
9484 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9488 r = MsiRecordGetString(hrec, 1, buffer, &size);
9491 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9492 ok(!lstrcmpA(buffer, "_Property"),
9493 "Expected \"_Property\", got \"%s\"\n", buffer);
9496 MsiCloseHandle(hrec);
9498 r = MsiViewFetch(hview, &hrec);
9501 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9505 r = MsiRecordGetString(hrec, 1, buffer, &size);
9508 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9509 ok(!lstrcmpA(buffer, "#_FolderCache"),
9510 "Expected \"_Property\", got \"%s\"\n", buffer);
9513 MsiCloseHandle(hrec);
9514 MsiViewClose(hview);
9515 MsiCloseHandle(hview);
9517 condition = MsiDatabaseIsTablePersistentA(hdb, "_Property");
9520 ok(condition == MSICONDITION_FALSE,
9521 "Expected MSICONDITION_FALSE, got %d\n", condition);
9524 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Property`", &hview);
9527 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9529 r = MsiViewExecute(hview, 0);
9532 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9535 /* _Property table is not empty */
9536 r = MsiViewFetch(hview, &hrec);
9539 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9542 MsiCloseHandle(hrec);
9543 MsiViewClose(hview);
9544 MsiCloseHandle(hview);
9546 condition = MsiDatabaseIsTablePersistentA(hdb, "#_FolderCache");
9549 ok(condition == MSICONDITION_FALSE,
9550 "Expected MSICONDITION_FALSE, got %d\n", condition);
9553 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `#_FolderCache`", &hview);
9556 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9558 r = MsiViewExecute(hview, 0);
9561 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9564 /* #_FolderCache is not empty */
9565 r = MsiViewFetch(hview, &hrec);
9568 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9571 MsiCloseHandle(hrec);
9572 MsiViewClose(hview);
9573 MsiCloseHandle(hview);
9575 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Streams`", &hview);
9578 ok(r == ERROR_BAD_QUERY_SYNTAX,
9579 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
9582 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Storages`", &hview);
9585 ok(r == ERROR_BAD_QUERY_SYNTAX,
9586 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
9589 r = MsiGetSummaryInformationA(hdb, NULL, 0, &hsuminfo);
9592 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
9593 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
9596 MsiCloseHandle(hsuminfo);
9598 r = MsiDatabaseCommit(hdb);
9601 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9604 MsiCloseHandle(hdb);
9605 MsiCloseHandle(hpkg);
9610 GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
9612 test_createpackage();
9614 test_gettargetpath_bad();
9615 test_settargetpath();
9617 test_property_table();
9620 test_formatrecord2();
9625 test_appsearch_complocator();
9626 test_appsearch_reglocator();
9627 test_appsearch_inilocator();
9628 test_appsearch_drlocator();
9629 test_featureparents();
9630 test_installprops();
9631 test_launchconditions();
9634 test_MsiGetSourcePath();
9635 test_shortlongsource();
9638 test_emptypackage();