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];
6155 res = RegCreateKeyA(HKEY_CLASSES_ROOT, "Software\\Wine", &classes);
6156 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6158 res = RegSetValueExA(classes, "Value1", 0, REG_SZ,
6159 (const BYTE *)"regszdata", 10);
6160 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6162 res = RegCreateKeyA(HKEY_CURRENT_USER, "Software\\Wine", &hkcu);
6163 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6165 res = RegSetValueExA(hkcu, "Value1", 0, REG_SZ,
6166 (const BYTE *)"regszdata", 10);
6167 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6169 res = RegCreateKeyA(HKEY_USERS, "S-1-5-18\\Software\\Wine", &users);
6170 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6172 res = RegSetValueExA(users, "Value1", 0, REG_SZ,
6173 (const BYTE *)"regszdata", 10);
6174 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6176 res = RegCreateKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine", &hklm);
6177 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6179 res = RegSetValueA(hklm, NULL, REG_SZ, "defvalue", 8);
6180 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6182 res = RegSetValueExA(hklm, "Value1", 0, REG_SZ,
6183 (const BYTE *)"regszdata", 10);
6184 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6187 res = RegSetValueExA(hklm, "Value2", 0, REG_DWORD,
6188 (const BYTE *)&val, sizeof(DWORD));
6189 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6192 res = RegSetValueExA(hklm, "Value3", 0, REG_DWORD,
6193 (const BYTE *)&val, sizeof(DWORD));
6194 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6196 res = RegSetValueExA(hklm, "Value4", 0, REG_EXPAND_SZ,
6197 (const BYTE *)"%PATH%", 7);
6198 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6200 res = RegSetValueExA(hklm, "Value5", 0, REG_EXPAND_SZ,
6201 (const BYTE *)"my%NOVAR%", 10);
6202 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6204 res = RegSetValueExA(hklm, "Value6", 0, REG_MULTI_SZ,
6205 (const BYTE *)"one\0two\0", 9);
6206 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6208 binary[0] = 0x1234abcd;
6209 binary[1] = 0x567890ef;
6210 res = RegSetValueExA(hklm, "Value7", 0, REG_BINARY,
6211 (const BYTE *)binary, sizeof(binary));
6212 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6214 res = RegSetValueExA(hklm, "Value8", 0, REG_SZ,
6215 (const BYTE *)"#regszdata", 11);
6216 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6218 create_test_file("FileName1");
6219 sprintf(path, "%s\\FileName1", CURR_DIR);
6220 res = RegSetValueExA(hklm, "Value9", 0, REG_SZ,
6221 (const BYTE *)path, lstrlenA(path) + 1);
6222 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6224 sprintf(path, "%s\\FileName2", CURR_DIR);
6225 res = RegSetValueExA(hklm, "Value10", 0, REG_SZ,
6226 (const BYTE *)path, lstrlenA(path) + 1);
6227 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6229 lstrcpyA(path, CURR_DIR);
6230 res = RegSetValueExA(hklm, "Value11", 0, REG_SZ,
6231 (const BYTE *)path, lstrlenA(path) + 1);
6232 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6234 res = RegSetValueExA(hklm, "Value12", 0, REG_SZ,
6235 (const BYTE *)"", 1);
6236 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6238 create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6239 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
6240 res = RegSetValueExA(hklm, "Value13", 0, REG_SZ,
6241 (const BYTE *)path, lstrlenA(path) + 1);
6242 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6244 create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
6245 sprintf(path, "%s\\FileName4.dll", CURR_DIR);
6246 res = RegSetValueExA(hklm, "Value14", 0, REG_SZ,
6247 (const BYTE *)path, lstrlenA(path) + 1);
6248 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6250 create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6251 sprintf(path, "%s\\FileName5.dll", CURR_DIR);
6252 res = RegSetValueExA(hklm, "Value15", 0, REG_SZ,
6253 (const BYTE *)path, lstrlenA(path) + 1);
6254 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6256 hdb = create_package_db();
6257 ok(hdb, "Expected a valid database handle\n");
6259 r = create_appsearch_table(hdb);
6260 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6262 r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
6263 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6265 r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
6266 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6268 r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
6269 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6271 r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
6272 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6274 r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
6275 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6277 r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
6278 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6280 r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
6281 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6283 r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
6284 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6286 r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
6287 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6289 r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
6290 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6292 r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
6293 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6295 r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
6296 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6298 r = add_appsearch_entry(hdb, "'SIGPROP13', 'NewSignature13'");
6299 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6301 r = add_appsearch_entry(hdb, "'SIGPROP14', 'NewSignature14'");
6302 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6304 r = add_appsearch_entry(hdb, "'SIGPROP15', 'NewSignature15'");
6305 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6307 r = add_appsearch_entry(hdb, "'SIGPROP16', 'NewSignature16'");
6308 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6310 r = add_appsearch_entry(hdb, "'SIGPROP17', 'NewSignature17'");
6311 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6313 r = add_appsearch_entry(hdb, "'SIGPROP18', 'NewSignature18'");
6314 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6316 r = add_appsearch_entry(hdb, "'SIGPROP19', 'NewSignature19'");
6317 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6319 r = add_appsearch_entry(hdb, "'SIGPROP20', 'NewSignature20'");
6320 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6322 r = add_appsearch_entry(hdb, "'SIGPROP21', 'NewSignature21'");
6323 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6325 r = add_appsearch_entry(hdb, "'SIGPROP22', 'NewSignature22'");
6326 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6328 r = add_appsearch_entry(hdb, "'SIGPROP23', 'NewSignature23'");
6329 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6331 r = create_reglocator_table(hdb);
6332 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6334 /* HKLM, msidbLocatorTypeRawValue, REG_SZ */
6335 str = "'NewSignature1', 2, 'Software\\Wine', 'Value1', 2";
6336 r = add_reglocator_entry(hdb, str);
6337 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6339 /* HKLM, msidbLocatorTypeRawValue, positive DWORD */
6340 str = "'NewSignature2', 2, 'Software\\Wine', 'Value2', 2";
6341 r = add_reglocator_entry(hdb, str);
6342 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6344 /* HKLM, msidbLocatorTypeRawValue, negative DWORD */
6345 str = "'NewSignature3', 2, 'Software\\Wine', 'Value3', 2";
6346 r = add_reglocator_entry(hdb, str);
6347 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6349 /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
6350 str = "'NewSignature4', 2, 'Software\\Wine', 'Value4', 2";
6351 r = add_reglocator_entry(hdb, str);
6352 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6354 /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
6355 str = "'NewSignature5', 2, 'Software\\Wine', 'Value5', 2";
6356 r = add_reglocator_entry(hdb, str);
6357 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6359 /* HKLM, msidbLocatorTypeRawValue, REG_MULTI_SZ */
6360 str = "'NewSignature6', 2, 'Software\\Wine', 'Value6', 2";
6361 r = add_reglocator_entry(hdb, str);
6362 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6364 /* HKLM, msidbLocatorTypeRawValue, REG_BINARY */
6365 str = "'NewSignature7', 2, 'Software\\Wine', 'Value7', 2";
6366 r = add_reglocator_entry(hdb, str);
6367 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6369 /* HKLM, msidbLocatorTypeRawValue, REG_SZ first char is # */
6370 str = "'NewSignature8', 2, 'Software\\Wine', 'Value8', 2";
6371 r = add_reglocator_entry(hdb, str);
6372 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6374 /* HKLM, msidbLocatorTypeFileName, file exists */
6375 str = "'NewSignature9', 2, 'Software\\Wine', 'Value9', 1";
6376 r = add_reglocator_entry(hdb, str);
6377 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6379 /* HKLM, msidbLocatorTypeFileName, file does not exist */
6380 str = "'NewSignature10', 2, 'Software\\Wine', 'Value10', 1";
6381 r = add_reglocator_entry(hdb, str);
6382 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6384 /* HKLM, msidbLocatorTypeFileName, no signature */
6385 str = "'NewSignature11', 2, 'Software\\Wine', 'Value9', 1";
6386 r = add_reglocator_entry(hdb, str);
6387 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6389 /* HKLM, msidbLocatorTypeDirectory, file exists */
6390 str = "'NewSignature12', 2, 'Software\\Wine', 'Value9', 0";
6391 r = add_reglocator_entry(hdb, str);
6392 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6394 /* HKLM, msidbLocatorTypeDirectory, directory */
6395 str = "'NewSignature13', 2, 'Software\\Wine', 'Value11', 0";
6396 r = add_reglocator_entry(hdb, str);
6397 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6399 /* HKLM, msidbLocatorTypeDirectory, file exists, with signature */
6400 str = "'NewSignature14', 2, 'Software\\Wine', 'Value9', 0";
6401 r = add_reglocator_entry(hdb, str);
6402 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6404 /* HKCR, msidbLocatorTypeRawValue, REG_SZ */
6405 str = "'NewSignature15', 0, 'Software\\Wine', 'Value1', 2";
6406 r = add_reglocator_entry(hdb, str);
6407 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6409 /* HKCU, msidbLocatorTypeRawValue, REG_SZ */
6410 str = "'NewSignature16', 1, 'Software\\Wine', 'Value1', 2";
6411 r = add_reglocator_entry(hdb, str);
6412 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6414 /* HKU, msidbLocatorTypeRawValue, REG_SZ */
6415 str = "'NewSignature17', 3, 'S-1-5-18\\Software\\Wine', 'Value1', 2";
6416 r = add_reglocator_entry(hdb, str);
6417 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6419 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, NULL Name */
6420 str = "'NewSignature18', 2, 'Software\\Wine', '', 2";
6421 r = add_reglocator_entry(hdb, str);
6422 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6424 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, key does not exist */
6425 str = "'NewSignature19', 2, 'Software\\IDontExist', '', 2";
6426 r = add_reglocator_entry(hdb, str);
6427 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6429 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, value is empty */
6430 str = "'NewSignature20', 2, 'Software\\Wine', 'Value12', 2";
6431 r = add_reglocator_entry(hdb, str);
6432 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6434 /* HKLM, msidbLocatorTypeFileName, file exists w/ version, signature */
6435 str = "'NewSignature21', 2, 'Software\\Wine', 'Value13', 1";
6436 r = add_reglocator_entry(hdb, str);
6437 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6439 /* HKLM, msidbLocatorTypeFileName, file exists w/ version, version > max */
6440 str = "'NewSignature22', 2, 'Software\\Wine', 'Value14', 1";
6441 r = add_reglocator_entry(hdb, str);
6442 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6444 /* HKLM, msidbLocatorTypeFileName, file exists w/ version, sig->name ignored */
6445 str = "'NewSignature23', 2, 'Software\\Wine', 'Value15', 1";
6446 r = add_reglocator_entry(hdb, str);
6447 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6449 r = create_signature_table(hdb);
6450 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6452 str = "'NewSignature9', 'FileName1', '', '', '', '', '', '', ''";
6453 r = add_signature_entry(hdb, str);
6454 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6456 str = "'NewSignature10', 'FileName2', '', '', '', '', '', '', ''";
6457 r = add_signature_entry(hdb, str);
6458 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6460 str = "'NewSignature14', 'FileName1', '', '', '', '', '', '', ''";
6461 r = add_signature_entry(hdb, str);
6462 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6464 str = "'NewSignature21', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
6465 r = add_signature_entry(hdb, str);
6466 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6468 str = "'NewSignature22', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
6469 r = add_signature_entry(hdb, str);
6470 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6472 str = "'NewSignature23', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
6473 r = add_signature_entry(hdb, str);
6474 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6476 hpkg = package_from_db(hdb);
6477 ok(hpkg, "Expected a valid package handle\n");
6479 r = MsiDoAction(hpkg, "AppSearch");
6480 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6483 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
6484 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6485 ok(!lstrcmpA(prop, "regszdata"),
6486 "Expected \"regszdata\", got \"%s\"\n", prop);
6489 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
6490 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6491 ok(!lstrcmpA(prop, "#42"), "Expected \"#42\", got \"%s\"\n", prop);
6494 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
6495 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6496 ok(!lstrcmpA(prop, "#-42"), "Expected \"#-42\", got \"%s\"\n", prop);
6498 ExpandEnvironmentStringsA("%PATH%", path, MAX_PATH);
6501 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
6502 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6503 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6506 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
6507 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6509 "my%NOVAR%"), "Expected \"my%%NOVAR%%\", got \"%s\"\n", prop);
6512 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
6513 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6516 ok(!memcmp(prop, "\0one\0two\0\0", 10),
6517 "Expected \"\\0one\\0two\\0\\0\"\n");
6521 lstrcpyA(path, "#xCDAB3412EF907856");
6522 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
6523 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6524 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6527 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
6528 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6529 ok(!lstrcmpA(prop, "##regszdata"),
6530 "Expected \"##regszdata\", got \"%s\"\n", prop);
6533 sprintf(path, "%s\\FileName1", CURR_DIR);
6534 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
6535 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6536 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6539 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
6540 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6541 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6544 sprintf(path, "%s\\", CURR_DIR);
6545 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
6546 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6549 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6553 r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
6554 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6555 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6558 sprintf(path, "%s\\", CURR_DIR);
6559 r = MsiGetPropertyA(hpkg, "SIGPROP13", prop, &size);
6560 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6561 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6564 r = MsiGetPropertyA(hpkg, "SIGPROP14", prop, &size);
6565 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6566 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6569 r = MsiGetPropertyA(hpkg, "SIGPROP15", prop, &size);
6570 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6571 ok(!lstrcmpA(prop, "regszdata"),
6572 "Expected \"regszdata\", got \"%s\"\n", prop);
6575 r = MsiGetPropertyA(hpkg, "SIGPROP16", prop, &size);
6576 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6577 ok(!lstrcmpA(prop, "regszdata"),
6578 "Expected \"regszdata\", got \"%s\"\n", prop);
6581 r = MsiGetPropertyA(hpkg, "SIGPROP17", prop, &size);
6582 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6583 ok(!lstrcmpA(prop, "regszdata"),
6584 "Expected \"regszdata\", got \"%s\"\n", prop);
6587 r = MsiGetPropertyA(hpkg, "SIGPROP18", prop, &size);
6588 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6589 ok(!lstrcmpA(prop, "defvalue"),
6590 "Expected \"defvalue\", got \"%s\"\n", prop);
6593 r = MsiGetPropertyA(hpkg, "SIGPROP19", prop, &size);
6594 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6595 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6598 r = MsiGetPropertyA(hpkg, "SIGPROP20", prop, &size);
6599 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6600 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6603 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
6604 r = MsiGetPropertyA(hpkg, "SIGPROP21", prop, &size);
6605 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6606 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6609 r = MsiGetPropertyA(hpkg, "SIGPROP22", prop, &size);
6610 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6611 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6614 sprintf(path, "%s\\FileName5.dll", CURR_DIR);
6615 r = MsiGetPropertyA(hpkg, "SIGPROP23", prop, &size);
6616 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6617 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6619 RegSetValueA(hklm, NULL, REG_SZ, "", 0);
6620 RegDeleteValueA(hklm, "Value1");
6621 RegDeleteValueA(hklm, "Value2");
6622 RegDeleteValueA(hklm, "Value3");
6623 RegDeleteValueA(hklm, "Value4");
6624 RegDeleteValueA(hklm, "Value5");
6625 RegDeleteValueA(hklm, "Value6");
6626 RegDeleteValueA(hklm, "Value7");
6627 RegDeleteValueA(hklm, "Value8");
6628 RegDeleteValueA(hklm, "Value9");
6629 RegDeleteValueA(hklm, "Value10");
6630 RegDeleteValueA(hklm, "Value11");
6631 RegDeleteValueA(hklm, "Value12");
6632 RegDeleteValueA(hklm, "Value13");
6633 RegDeleteValueA(hklm, "Value14");
6634 RegDeleteValueA(hklm, "Value15");
6635 RegDeleteKeyA(hklm, "");
6638 RegDeleteValueA(classes, "Value1");
6639 RegDeleteKeyA(classes, "");
6640 RegCloseKey(classes);
6642 RegDeleteValueA(hkcu, "Value1");
6643 RegDeleteKeyA(hkcu, "");
6646 RegDeleteValueA(users, "Value1");
6647 RegDeleteKeyA(users, "");
6650 DeleteFileA("FileName1");
6651 DeleteFileA("FileName3.dll");
6652 DeleteFileA("FileName4.dll");
6653 DeleteFileA("FileName5.dll");
6654 MsiCloseHandle(hpkg);
6655 DeleteFileA(msifile);
6658 static void delete_win_ini(LPCSTR file)
6660 CHAR path[MAX_PATH];
6662 GetWindowsDirectoryA(path, MAX_PATH);
6663 lstrcatA(path, "\\");
6664 lstrcatA(path, file);
6669 static void test_appsearch_inilocator(void)
6671 MSIHANDLE hpkg, hdb;
6672 CHAR path[MAX_PATH];
6673 CHAR prop[MAX_PATH];
6679 WritePrivateProfileStringA("Section", "Key", "keydata,field2", "IniFile.ini");
6681 create_test_file("FileName1");
6682 sprintf(path, "%s\\FileName1", CURR_DIR);
6683 WritePrivateProfileStringA("Section", "Key2", path, "IniFile.ini");
6685 WritePrivateProfileStringA("Section", "Key3", CURR_DIR, "IniFile.ini");
6687 sprintf(path, "%s\\IDontExist", CURR_DIR);
6688 WritePrivateProfileStringA("Section", "Key4", path, "IniFile.ini");
6690 create_file_with_version("FileName2.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6691 sprintf(path, "%s\\FileName2.dll", CURR_DIR);
6692 WritePrivateProfileStringA("Section", "Key5", path, "IniFile.ini");
6694 create_file_with_version("FileName3.dll", MAKELONG(1, 2), MAKELONG(3, 4));
6695 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
6696 WritePrivateProfileStringA("Section", "Key6", path, "IniFile.ini");
6698 create_file_with_version("FileName4.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6699 sprintf(path, "%s\\FileName4.dll", CURR_DIR);
6700 WritePrivateProfileStringA("Section", "Key7", path, "IniFile.ini");
6702 hdb = create_package_db();
6703 ok(hdb, "Expected a valid database handle\n");
6705 r = create_appsearch_table(hdb);
6706 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6708 r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
6709 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6711 r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
6712 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6714 r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
6715 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6717 r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
6718 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6720 r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
6721 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6723 r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
6724 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6726 r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
6727 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6729 r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
6730 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6732 r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
6733 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6735 r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
6736 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6738 r = add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
6739 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6741 r = add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
6742 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6744 r = create_inilocator_table(hdb);
6745 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6747 /* msidbLocatorTypeRawValue, field 1 */
6748 str = "'NewSignature1', 'IniFile.ini', 'Section', 'Key', 1, 2";
6749 r = add_inilocator_entry(hdb, str);
6750 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6752 /* msidbLocatorTypeRawValue, field 2 */
6753 str = "'NewSignature2', 'IniFile.ini', 'Section', 'Key', 2, 2";
6754 r = add_inilocator_entry(hdb, str);
6755 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6757 /* msidbLocatorTypeRawValue, entire field */
6758 str = "'NewSignature3', 'IniFile.ini', 'Section', 'Key', 0, 2";
6759 r = add_inilocator_entry(hdb, str);
6760 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6762 /* msidbLocatorTypeFile */
6763 str = "'NewSignature4', 'IniFile.ini', 'Section', 'Key2', 1, 1";
6764 r = add_inilocator_entry(hdb, str);
6765 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6767 /* msidbLocatorTypeDirectory, file */
6768 str = "'NewSignature5', 'IniFile.ini', 'Section', 'Key2', 1, 0";
6769 r = add_inilocator_entry(hdb, str);
6770 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6772 /* msidbLocatorTypeDirectory, directory */
6773 str = "'NewSignature6', 'IniFile.ini', 'Section', 'Key3', 1, 0";
6774 r = add_inilocator_entry(hdb, str);
6775 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6777 /* msidbLocatorTypeFile, file, no signature */
6778 str = "'NewSignature7', 'IniFile.ini', 'Section', 'Key2', 1, 1";
6779 r = add_inilocator_entry(hdb, str);
6780 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6782 /* msidbLocatorTypeFile, dir, no signature */
6783 str = "'NewSignature8', 'IniFile.ini', 'Section', 'Key3', 1, 1";
6784 r = add_inilocator_entry(hdb, str);
6785 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6787 /* msidbLocatorTypeFile, file does not exist */
6788 str = "'NewSignature9', 'IniFile.ini', 'Section', 'Key4', 1, 1";
6789 r = add_inilocator_entry(hdb, str);
6790 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6792 /* msidbLocatorTypeFile, signature with version */
6793 str = "'NewSignature10', 'IniFile.ini', 'Section', 'Key5', 1, 1";
6794 r = add_inilocator_entry(hdb, str);
6795 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6797 /* msidbLocatorTypeFile, signature with version, ver > max */
6798 str = "'NewSignature11', 'IniFile.ini', 'Section', 'Key6', 1, 1";
6799 r = add_inilocator_entry(hdb, str);
6800 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6802 /* msidbLocatorTypeFile, signature with version, sig->name ignored */
6803 str = "'NewSignature12', 'IniFile.ini', 'Section', 'Key7', 1, 1";
6804 r = add_inilocator_entry(hdb, str);
6805 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6807 r = create_signature_table(hdb);
6808 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6810 r = add_signature_entry(hdb, "'NewSignature4', 'FileName1', '', '', '', '', '', '', ''");
6811 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6813 r = add_signature_entry(hdb, "'NewSignature9', 'IDontExist', '', '', '', '', '', '', ''");
6814 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6816 r = add_signature_entry(hdb, "'NewSignature10', 'FileName2.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
6817 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6819 r = add_signature_entry(hdb, "'NewSignature11', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
6820 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6822 r = add_signature_entry(hdb, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
6823 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6825 hpkg = package_from_db(hdb);
6826 ok(hpkg, "Expected a valid package handle\n");
6828 r = MsiDoAction(hpkg, "AppSearch");
6829 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6832 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
6833 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6834 ok(!lstrcmpA(prop, "keydata"), "Expected \"keydata\", got \"%s\"\n", prop);
6837 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
6838 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6839 ok(!lstrcmpA(prop, "field2"), "Expected \"field2\", got \"%s\"\n", prop);
6842 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
6843 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6844 ok(!lstrcmpA(prop, "keydata,field2"),
6845 "Expected \"keydata,field2\", got \"%s\"\n", prop);
6848 sprintf(path, "%s\\FileName1", CURR_DIR);
6849 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
6850 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6851 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6854 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
6855 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6856 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6859 sprintf(path, "%s\\", CURR_DIR);
6860 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
6861 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6864 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6868 sprintf(path, "%s\\", CURR_DIR);
6869 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
6870 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6873 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6877 lstrcpyA(path, CURR_DIR);
6878 ptr = strrchr(path, '\\');
6880 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
6881 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6884 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6888 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
6889 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6890 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6893 sprintf(path, "%s\\FileName2.dll", CURR_DIR);
6894 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
6895 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6896 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6899 r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
6900 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6901 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
6904 sprintf(path, "%s\\FileName4.dll", CURR_DIR);
6905 r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
6906 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6907 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
6909 delete_win_ini("IniFile.ini");
6910 DeleteFileA("FileName1");
6911 DeleteFileA("FileName2.dll");
6912 DeleteFileA("FileName3.dll");
6913 DeleteFileA("FileName4.dll");
6914 MsiCloseHandle(hpkg);
6915 DeleteFileA(msifile);
6918 static void test_appsearch_drlocator(void)
6920 MSIHANDLE hpkg, hdb;
6921 CHAR path[MAX_PATH];
6922 CHAR prop[MAX_PATH];
6927 create_test_file("FileName1");
6928 CreateDirectoryA("one", NULL);
6929 CreateDirectoryA("one\\two", NULL);
6930 CreateDirectoryA("one\\two\\three", NULL);
6931 create_test_file("one\\two\\three\\FileName2");
6932 CreateDirectoryA("another", NULL);
6933 create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6934 create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
6935 create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6937 hdb = create_package_db();
6938 ok(hdb, "Expected a valid database handle\n");
6940 r = create_appsearch_table(hdb);
6941 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6943 r = add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
6944 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6946 r = add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
6947 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6949 r = add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
6950 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6952 r = add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
6953 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6955 r = add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
6956 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6958 r = add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
6959 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6961 r = add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
6962 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6964 r = add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
6965 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6967 r = add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
6968 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6970 r = add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
6971 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6973 r = create_drlocator_table(hdb);
6974 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6976 /* no parent, full path, depth 0, signature */
6977 sprintf(path, "'NewSignature1', '', '%s', 0", CURR_DIR);
6978 r = add_drlocator_entry(hdb, path);
6979 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6981 /* no parent, full path, depth 0, no signature */
6982 sprintf(path, "'NewSignature2', '', '%s', 0", CURR_DIR);
6983 r = add_drlocator_entry(hdb, path);
6984 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6986 /* no parent, relative path, depth 0, no signature */
6987 sprintf(path, "'NewSignature3', '', '%s', 0", CURR_DIR + 3);
6988 r = add_drlocator_entry(hdb, path);
6989 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6991 /* no parent, full path, depth 2, signature */
6992 sprintf(path, "'NewSignature4', '', '%s', 2", CURR_DIR);
6993 r = add_drlocator_entry(hdb, path);
6994 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6996 /* no parent, full path, depth 3, signature */
6997 sprintf(path, "'NewSignature5', '', '%s', 3", CURR_DIR);
6998 r = add_drlocator_entry(hdb, path);
6999 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7001 /* no parent, full path, depth 1, signature is dir */
7002 sprintf(path, "'NewSignature6', '', '%s', 1", CURR_DIR);
7003 r = add_drlocator_entry(hdb, path);
7004 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7006 /* parent is in DrLocator, relative path, depth 0, signature */
7007 sprintf(path, "'NewSignature7', 'NewSignature1', 'one\\two\\three', 1");
7008 r = add_drlocator_entry(hdb, path);
7009 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7011 /* no parent, full path, depth 0, signature w/ version */
7012 sprintf(path, "'NewSignature8', '', '%s', 0", CURR_DIR);
7013 r = add_drlocator_entry(hdb, path);
7014 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7016 /* no parent, full path, depth 0, signature w/ version, ver > max */
7017 sprintf(path, "'NewSignature9', '', '%s', 0", CURR_DIR);
7018 r = add_drlocator_entry(hdb, path);
7019 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7021 /* no parent, full path, depth 0, signature w/ version, sig->name not ignored */
7022 sprintf(path, "'NewSignature10', '', '%s', 0", CURR_DIR);
7023 r = add_drlocator_entry(hdb, path);
7024 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7026 r = create_signature_table(hdb);
7027 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7029 str = "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''";
7030 r = add_signature_entry(hdb, str);
7031 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7033 str = "'NewSignature4', 'FileName2', '', '', '', '', '', '', ''";
7034 r = add_signature_entry(hdb, str);
7035 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7037 str = "'NewSignature5', 'FileName2', '', '', '', '', '', '', ''";
7038 r = add_signature_entry(hdb, str);
7039 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7041 str = "'NewSignature6', 'another', '', '', '', '', '', '', ''";
7042 r = add_signature_entry(hdb, str);
7043 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7045 str = "'NewSignature7', 'FileName2', '', '', '', '', '', '', ''";
7046 r = add_signature_entry(hdb, str);
7047 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7049 str = "'NewSignature8', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
7050 r = add_signature_entry(hdb, str);
7051 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7053 str = "'NewSignature9', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
7054 r = add_signature_entry(hdb, str);
7055 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7057 str = "'NewSignature10', 'necessary', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
7058 r = add_signature_entry(hdb, str);
7059 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7061 hpkg = package_from_db(hdb);
7062 ok(hpkg, "Expected a valid package handle\n");
7064 r = MsiDoAction(hpkg, "AppSearch");
7065 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7068 sprintf(path, "%s\\FileName1", CURR_DIR);
7069 r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
7070 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7073 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7077 sprintf(path, "%s\\", CURR_DIR);
7078 r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
7079 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7080 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7083 sprintf(path, "%s\\", CURR_DIR);
7084 r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
7085 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7086 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7089 r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
7090 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7093 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
7097 sprintf(path, "%s\\one\\two\\three\\FileName2", CURR_DIR);
7098 r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
7099 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7102 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7106 r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
7107 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7110 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
7114 sprintf(path, "%s\\one\\two\\three\\FileName2", CURR_DIR);
7115 r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
7116 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7119 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7123 sprintf(path, "%s\\FileName3.dll", CURR_DIR);
7124 r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
7125 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7128 ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
7132 r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
7133 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7136 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
7140 r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
7141 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7144 ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
7147 DeleteFileA("FileName1");
7148 DeleteFileA("FileName3.dll");
7149 DeleteFileA("FileName4.dll");
7150 DeleteFileA("FileName5.dll");
7151 DeleteFileA("one\\two\\three\\FileName2");
7152 RemoveDirectoryA("one\\two\\three");
7153 RemoveDirectoryA("one\\two");
7154 RemoveDirectoryA("one");
7155 RemoveDirectoryA("another");
7156 MsiCloseHandle(hpkg);
7157 DeleteFileA(msifile);
7160 static void test_featureparents(void)
7165 INSTALLSTATE state, action;
7167 hdb = create_package_db();
7168 ok ( hdb, "failed to create package database\n" );
7170 r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
7171 ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r );
7173 r = create_feature_table( hdb );
7174 ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r );
7176 r = create_component_table( hdb );
7177 ok( r == ERROR_SUCCESS, "cannot create Component table: %d\n", r );
7179 r = create_feature_components_table( hdb );
7180 ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
7182 r = create_file_table( hdb );
7183 ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
7185 /* msidbFeatureAttributesFavorLocal */
7186 r = add_feature_entry( hdb, "'zodiac', '', '', '', 2, 1, '', 0" );
7187 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
7189 /* msidbFeatureAttributesFavorSource */
7190 r = add_feature_entry( hdb, "'perseus', '', '', '', 2, 1, '', 1" );
7191 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
7193 /* msidbFeatureAttributesFavorLocal */
7194 r = add_feature_entry( hdb, "'orion', '', '', '', 2, 1, '', 0" );
7195 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
7197 /* disabled because of install level */
7198 r = add_feature_entry( hdb, "'waters', '', '', '', 15, 101, '', 9" );
7199 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
7201 /* child feature of disabled feature */
7202 r = add_feature_entry( hdb, "'bayer', 'waters', '', '', 14, 1, '', 9" );
7203 ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
7205 /* component of disabled feature (install level) */
7206 r = add_component_entry( hdb, "'delphinus', '', 'TARGETDIR', 0, '', 'delphinus_file'" );
7207 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7209 /* component of disabled child feature (install level) */
7210 r = add_component_entry( hdb, "'hydrus', '', 'TARGETDIR', 0, '', 'hydrus_file'" );
7211 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7213 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
7214 r = add_component_entry( hdb, "'leo', '', 'TARGETDIR', 0, '', 'leo_file'" );
7215 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7217 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
7218 r = add_component_entry( hdb, "'virgo', '', 'TARGETDIR', 1, '', 'virgo_file'" );
7219 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7221 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
7222 r = add_component_entry( hdb, "'libra', '', 'TARGETDIR', 2, '', 'libra_file'" );
7223 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7225 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
7226 r = add_component_entry( hdb, "'cassiopeia', '', 'TARGETDIR', 0, '', 'cassiopeia_file'" );
7227 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7229 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
7230 r = add_component_entry( hdb, "'cepheus', '', 'TARGETDIR', 1, '', 'cepheus_file'" );
7231 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7233 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
7234 r = add_component_entry( hdb, "'andromeda', '', 'TARGETDIR', 2, '', 'andromeda_file'" );
7235 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7237 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
7238 r = add_component_entry( hdb, "'canis', '', 'TARGETDIR', 0, '', 'canis_file'" );
7239 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7241 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
7242 r = add_component_entry( hdb, "'monoceros', '', 'TARGETDIR', 1, '', 'monoceros_file'" );
7243 ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r );
7245 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
7246 r = add_component_entry( hdb, "'lepus', '', 'TARGETDIR', 2, '', 'lepus_file'" );
7248 r = add_feature_components_entry( hdb, "'zodiac', 'leo'" );
7249 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7251 r = add_feature_components_entry( hdb, "'zodiac', 'virgo'" );
7252 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7254 r = add_feature_components_entry( hdb, "'zodiac', 'libra'" );
7255 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7257 r = add_feature_components_entry( hdb, "'perseus', 'cassiopeia'" );
7258 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7260 r = add_feature_components_entry( hdb, "'perseus', 'cepheus'" );
7261 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7263 r = add_feature_components_entry( hdb, "'perseus', 'andromeda'" );
7264 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7266 r = add_feature_components_entry( hdb, "'orion', 'leo'" );
7267 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7269 r = add_feature_components_entry( hdb, "'orion', 'virgo'" );
7270 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7272 r = add_feature_components_entry( hdb, "'orion', 'libra'" );
7273 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7275 r = add_feature_components_entry( hdb, "'orion', 'cassiopeia'" );
7276 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7278 r = add_feature_components_entry( hdb, "'orion', 'cepheus'" );
7279 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7281 r = add_feature_components_entry( hdb, "'orion', 'andromeda'" );
7282 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7284 r = add_feature_components_entry( hdb, "'orion', 'canis'" );
7285 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7287 r = add_feature_components_entry( hdb, "'orion', 'monoceros'" );
7288 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7290 r = add_feature_components_entry( hdb, "'orion', 'lepus'" );
7291 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7293 r = add_feature_components_entry( hdb, "'waters', 'delphinus'" );
7294 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7296 r = add_feature_components_entry( hdb, "'bayer', 'hydrus'" );
7297 ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
7299 r = add_file_entry( hdb, "'leo_file', 'leo', 'leo.txt', 100, '', '1033', 8192, 1" );
7300 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7302 r = add_file_entry( hdb, "'virgo_file', 'virgo', 'virgo.txt', 0, '', '1033', 8192, 1" );
7303 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7305 r = add_file_entry( hdb, "'libra_file', 'libra', 'libra.txt', 0, '', '1033', 8192, 1" );
7306 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7308 r = add_file_entry( hdb, "'cassiopeia_file', 'cassiopeia', 'cassiopeia.txt', 0, '', '1033', 8192, 1" );
7309 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7311 r = add_file_entry( hdb, "'cepheus_file', 'cepheus', 'cepheus.txt', 0, '', '1033', 8192, 1" );
7312 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7314 r = add_file_entry( hdb, "'andromeda_file', 'andromeda', 'andromeda.txt', 0, '', '1033', 8192, 1" );
7315 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7317 r = add_file_entry( hdb, "'canis_file', 'canis', 'canis.txt', 0, '', '1033', 8192, 1" );
7318 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7320 r = add_file_entry( hdb, "'monoceros_file', 'monoceros', 'monoceros.txt', 0, '', '1033', 8192, 1" );
7321 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7323 r = add_file_entry( hdb, "'lepus_file', 'lepus', 'lepus.txt', 0, '', '1033', 8192, 1" );
7324 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7326 r = add_file_entry( hdb, "'delphinus_file', 'delphinus', 'delphinus.txt', 0, '', '1033', 8192, 1" );
7327 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7329 r = add_file_entry( hdb, "'hydrus_file', 'hydrus', 'hydrus.txt', 0, '', '1033', 8192, 1" );
7330 ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
7332 hpkg = package_from_db( hdb );
7333 ok( hpkg, "failed to create package\n");
7335 MsiCloseHandle( hdb );
7337 r = MsiDoAction( hpkg, "CostInitialize");
7338 ok( r == ERROR_SUCCESS, "cost init failed\n");
7340 r = MsiDoAction( hpkg, "FileCost");
7341 ok( r == ERROR_SUCCESS, "file cost failed\n");
7343 r = MsiDoAction( hpkg, "CostFinalize");
7344 ok( r == ERROR_SUCCESS, "cost finalize failed\n");
7348 r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
7349 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7350 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
7351 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7355 r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
7356 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7357 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
7358 ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action);
7362 r = MsiGetFeatureState(hpkg, "orion", &state, &action);
7363 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7364 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
7365 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7369 r = MsiGetFeatureState(hpkg, "waters", &state, &action);
7370 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7371 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
7372 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7376 r = MsiGetFeatureState(hpkg, "bayer", &state, &action);
7377 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7378 ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
7379 ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
7383 r = MsiGetComponentState(hpkg, "leo", &state, &action);
7384 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7385 ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
7386 ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
7390 r = MsiGetComponentState(hpkg, "virgo", &state, &action);
7391 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7392 ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
7393 ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
7397 r = MsiGetComponentState(hpkg, "libra", &state, &action);
7398 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7399 ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
7400 ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
7404 r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
7405 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7406 ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
7407 ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
7411 r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
7412 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7413 ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
7414 ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
7418 r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
7419 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7420 ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
7421 ok( action == INSTALLSTATE_LOCAL, "Expected andromeda INSTALLSTATE_LOCAL, got %d\n", action);
7425 r = MsiGetComponentState(hpkg, "canis", &state, &action);
7426 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7427 ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
7428 ok( action == INSTALLSTATE_LOCAL, "Expected canis INSTALLSTATE_LOCAL, got %d\n", action);
7432 r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
7433 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7434 ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
7435 ok( action == INSTALLSTATE_SOURCE, "Expected monoceros INSTALLSTATE_SOURCE, got %d\n", action);
7439 r = MsiGetComponentState(hpkg, "lepus", &state, &action);
7440 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7441 ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
7442 ok( action == INSTALLSTATE_LOCAL, "Expected lepus INSTALLSTATE_LOCAL, got %d\n", action);
7446 r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
7447 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7448 ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
7449 ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
7453 r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
7454 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7455 ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
7456 ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
7458 r = MsiSetFeatureState(hpkg, "orion", INSTALLSTATE_ABSENT);
7459 ok( r == ERROR_SUCCESS, "failed to set feature state: %d\n", r);
7463 r = MsiGetFeatureState(hpkg, "zodiac", &state, &action);
7464 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7465 ok( state == INSTALLSTATE_ABSENT, "Expected zodiac INSTALLSTATE_ABSENT, got %d\n", state);
7466 ok( action == INSTALLSTATE_LOCAL, "Expected zodiac INSTALLSTATE_LOCAL, got %d\n", action);
7470 r = MsiGetFeatureState(hpkg, "perseus", &state, &action);
7471 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7472 ok( state == INSTALLSTATE_ABSENT, "Expected perseus INSTALLSTATE_ABSENT, got %d\n", state);
7473 ok( action == INSTALLSTATE_SOURCE, "Expected perseus INSTALLSTATE_SOURCE, got %d\n", action);
7477 r = MsiGetFeatureState(hpkg, "orion", &state, &action);
7478 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7479 ok( state == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", state);
7480 ok( action == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", action);
7484 r = MsiGetComponentState(hpkg, "leo", &state, &action);
7485 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7486 ok( state == INSTALLSTATE_UNKNOWN, "Expected leo INSTALLSTATE_UNKNOWN, got %d\n", state);
7487 ok( action == INSTALLSTATE_LOCAL, "Expected leo INSTALLSTATE_LOCAL, got %d\n", action);
7491 r = MsiGetComponentState(hpkg, "virgo", &state, &action);
7492 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7493 ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
7494 ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
7498 r = MsiGetComponentState(hpkg, "libra", &state, &action);
7499 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7500 ok( state == INSTALLSTATE_UNKNOWN, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state);
7501 ok( action == INSTALLSTATE_LOCAL, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action);
7505 r = MsiGetComponentState(hpkg, "cassiopeia", &state, &action);
7506 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7507 ok( state == INSTALLSTATE_UNKNOWN, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state);
7508 ok( action == INSTALLSTATE_LOCAL, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action);
7512 r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
7513 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7514 ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
7515 ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
7519 r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
7520 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7521 ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
7522 ok( action == INSTALLSTATE_SOURCE, "Expected andromeda INSTALLSTATE_SOURCE, got %d\n", action);
7526 r = MsiGetComponentState(hpkg, "canis", &state, &action);
7527 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7528 ok( state == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state);
7529 ok( action == INSTALLSTATE_UNKNOWN, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", action);
7533 r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
7534 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7535 ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
7536 ok( action == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", action);
7540 r = MsiGetComponentState(hpkg, "lepus", &state, &action);
7541 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7542 ok( state == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state);
7543 ok( action == INSTALLSTATE_UNKNOWN, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", action);
7547 r = MsiGetComponentState(hpkg, "delphinus", &state, &action);
7548 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7549 ok( state == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state);
7550 ok( action == INSTALLSTATE_UNKNOWN, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action);
7554 r = MsiGetComponentState(hpkg, "hydrus", &state, &action);
7555 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
7556 ok( state == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state);
7557 ok( action == INSTALLSTATE_UNKNOWN, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action);
7559 MsiCloseHandle(hpkg);
7560 DeleteFileA(msifile);
7563 static void test_installprops(void)
7565 MSIHANDLE hpkg, hdb;
7566 CHAR path[MAX_PATH];
7574 GetCurrentDirectory(MAX_PATH, path);
7575 lstrcat(path, "\\");
7576 lstrcat(path, msifile);
7578 hdb = create_package_db();
7579 ok( hdb, "failed to create database\n");
7581 hpkg = package_from_db(hdb);
7582 ok( hpkg, "failed to create package\n");
7584 MsiCloseHandle(hdb);
7587 r = MsiGetProperty(hpkg, "DATABASE", buf, &size);
7588 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
7589 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
7591 RegOpenKey(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\MS Setup (ACME)\\User Info", &hkey1);
7593 RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", &hkey2);
7598 if (RegQueryValueEx(hkey1, "DefName", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
7602 RegQueryValueEx(hkey2, "RegisteredOwner", NULL, &type, (LPBYTE)path, &size);
7605 /* win9x doesn't set this */
7609 r = MsiGetProperty(hpkg, "USERNAME", buf, &size);
7610 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
7611 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
7617 if (RegQueryValueEx(hkey1, "DefCompany", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
7621 RegQueryValueEx(hkey2, "RegisteredOrganization", NULL, &type, (LPBYTE)path, &size);
7627 r = MsiGetProperty(hpkg, "COMPANYNAME", buf, &size);
7628 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
7629 ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
7633 r = MsiGetProperty(hpkg, "VersionDatabase", buf, &size);
7634 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
7635 trace("VersionDatabase = %s\n", buf);
7638 r = MsiGetProperty(hpkg, "VersionMsi", buf, &size);
7639 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
7640 trace("VersionMsi = %s\n", buf);
7643 r = MsiGetProperty(hpkg, "Date", buf, &size);
7644 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
7645 trace("Date = %s\n", buf);
7648 r = MsiGetProperty(hpkg, "Time", buf, &size);
7649 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
7650 trace("Time = %s\n", buf);
7653 r = MsiGetProperty(hpkg, "PackageCode", buf, &size);
7654 ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
7655 trace("PackageCode = %s\n", buf);
7657 langid = GetUserDefaultLangID();
7658 sprintf(path, "%d", langid);
7661 r = MsiGetProperty(hpkg, "UserLanguageID", buf, &size);
7662 ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS< got %d\n", r);
7663 ok( !lstrcmpA(buf, path), "Expected \"%s\", got \"%s\"\n", path, buf);
7665 res = GetSystemMetrics(SM_CXSCREEN);
7667 r = MsiGetProperty(hpkg, "ScreenX", buf, &size);
7668 ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
7670 res = GetSystemMetrics(SM_CYSCREEN);
7672 r = MsiGetProperty(hpkg, "ScreenY", buf, &size);
7673 ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
7677 MsiCloseHandle(hpkg);
7678 DeleteFile(msifile);
7681 static void test_launchconditions(void)
7687 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7689 hdb = create_package_db();
7690 ok( hdb, "failed to create package database\n" );
7692 r = create_launchcondition_table( hdb );
7693 ok( r == ERROR_SUCCESS, "cannot create LaunchCondition table: %d\n", r );
7695 r = add_launchcondition_entry( hdb, "'X = \"1\"', 'one'" );
7696 ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
7698 /* invalid condition */
7699 r = add_launchcondition_entry( hdb, "'X != \"1\"', 'one'" );
7700 ok( r == ERROR_SUCCESS, "cannot add launch condition: %d\n", r );
7702 hpkg = package_from_db( hdb );
7703 ok( hpkg, "failed to create package\n");
7705 MsiCloseHandle( hdb );
7707 r = MsiSetProperty( hpkg, "X", "1" );
7708 ok( r == ERROR_SUCCESS, "failed to set property\n" );
7710 /* invalid conditions are ignored */
7711 r = MsiDoAction( hpkg, "LaunchConditions" );
7712 ok( r == ERROR_SUCCESS, "cost init failed\n" );
7714 /* verify LaunchConditions still does some verification */
7715 r = MsiSetProperty( hpkg, "X", "2" );
7716 ok( r == ERROR_SUCCESS, "failed to set property\n" );
7718 r = MsiDoAction( hpkg, "LaunchConditions" );
7719 ok( r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %d\n", r );
7721 MsiCloseHandle( hpkg );
7722 DeleteFile( msifile );
7725 static void test_ccpsearch(void)
7727 MSIHANDLE hdb, hpkg;
7728 CHAR prop[MAX_PATH];
7729 DWORD size = MAX_PATH;
7732 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7734 hdb = create_package_db();
7735 ok(hdb, "failed to create package database\n");
7737 r = create_ccpsearch_table(hdb);
7738 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7740 r = add_ccpsearch_entry(hdb, "'CCP_random'");
7741 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7743 r = add_ccpsearch_entry(hdb, "'RMCCP_random'");
7744 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7746 r = create_reglocator_table(hdb);
7747 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7749 r = add_reglocator_entry(hdb, "'CCP_random', 0, 'htmlfile\\shell\\open\\nonexistent', '', 1");
7750 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7752 r = create_drlocator_table(hdb);
7753 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7755 r = add_drlocator_entry(hdb, "'RMCCP_random', '', 'C:\\', '0'");
7756 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7758 r = create_signature_table(hdb);
7759 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7761 hpkg = package_from_db(hdb);
7762 ok(hpkg, "failed to create package\n");
7764 MsiCloseHandle(hdb);
7766 r = MsiDoAction(hpkg, "CCPSearch");
7767 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7769 r = MsiGetPropertyA(hpkg, "CCP_Success", prop, &size);
7770 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7771 ok(!lstrcmpA(prop, "1"), "Expected 1, got %s\n", prop);
7773 MsiCloseHandle(hpkg);
7774 DeleteFileA(msifile);
7777 static void test_complocator(void)
7779 MSIHANDLE hdb, hpkg;
7781 CHAR prop[MAX_PATH];
7782 CHAR expected[MAX_PATH];
7783 DWORD size = MAX_PATH;
7785 hdb = create_package_db();
7786 ok(hdb, "failed to create package database\n");
7788 r = create_appsearch_table(hdb);
7789 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7791 r = add_appsearch_entry(hdb, "'ABELISAURUS', 'abelisaurus'");
7792 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7794 r = add_appsearch_entry(hdb, "'BACTROSAURUS', 'bactrosaurus'");
7795 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7797 r = add_appsearch_entry(hdb, "'CAMELOTIA', 'camelotia'");
7798 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7800 r = add_appsearch_entry(hdb, "'DICLONIUS', 'diclonius'");
7801 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7803 r = add_appsearch_entry(hdb, "'ECHINODON', 'echinodon'");
7804 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7806 r = add_appsearch_entry(hdb, "'FALCARIUS', 'falcarius'");
7807 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7809 r = add_appsearch_entry(hdb, "'GALLIMIMUS', 'gallimimus'");
7810 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7812 r = add_appsearch_entry(hdb, "'HAGRYPHUS', 'hagryphus'");
7813 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7815 r = add_appsearch_entry(hdb, "'IGUANODON', 'iguanodon'");
7816 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7818 r = add_appsearch_entry(hdb, "'JOBARIA', 'jobaria'");
7819 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7821 r = add_appsearch_entry(hdb, "'KAKURU', 'kakuru'");
7822 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7824 r = add_appsearch_entry(hdb, "'LABOCANIA', 'labocania'");
7825 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7827 r = add_appsearch_entry(hdb, "'MEGARAPTOR', 'megaraptor'");
7828 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7830 r = add_appsearch_entry(hdb, "'NEOSODON', 'neosodon'");
7831 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7833 r = add_appsearch_entry(hdb, "'OLOROTITAN', 'olorotitan'");
7834 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7836 r = add_appsearch_entry(hdb, "'PANTYDRACO', 'pantydraco'");
7837 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7839 r = create_complocator_table(hdb);
7840 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7842 r = add_complocator_entry(hdb, "'abelisaurus', '{E3619EED-305A-418C-B9C7-F7D7377F0934}', 1");
7843 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7845 r = add_complocator_entry(hdb, "'bactrosaurus', '{D56B688D-542F-42Ef-90FD-B6DA76EE8119}', 0");
7846 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7848 r = add_complocator_entry(hdb, "'camelotia', '{8211BE36-2466-47E3-AFB7-6AC72E51AED2}', 1");
7849 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7851 r = add_complocator_entry(hdb, "'diclonius', '{5C767B20-A33C-45A4-B80B-555E512F01AE}', 0");
7852 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7854 r = add_complocator_entry(hdb, "'echinodon', '{A19E16C5-C75D-4699-8111-C4338C40C3CB}', 1");
7855 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7857 r = add_complocator_entry(hdb, "'falcarius', '{17762FA1-A7AE-4CC6-8827-62873C35361D}', 0");
7858 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7860 r = add_complocator_entry(hdb, "'gallimimus', '{75EBF568-C959-41E0-A99E-9050638CF5FB}', 1");
7861 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7863 r = add_complocator_entry(hdb, "'hagrphus', '{D4969B72-17D9-4AB6-BE49-78F2FEE857AC}', 0");
7864 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7866 r = add_complocator_entry(hdb, "'iguanodon', '{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}', 1");
7867 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7869 r = add_complocator_entry(hdb, "'jobaria', '{243C22B1-8C51-4151-B9D1-1AE5265E079E}', 0");
7870 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7872 r = add_complocator_entry(hdb, "'kakuru', '{5D0F03BA-50BC-44F2-ABB1-72C972F4E514}', 1");
7873 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7875 r = add_complocator_entry(hdb, "'labocania', '{C7DDB60C-7828-4046-A6F8-699D5E92F1ED}', 0");
7876 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7878 r = add_complocator_entry(hdb, "'megaraptor', '{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}', 1");
7879 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7881 r = add_complocator_entry(hdb, "'neosodon', '{0B499649-197A-48EF-93D2-AF1C17ED6E90}', 0");
7882 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7884 r = add_complocator_entry(hdb, "'olorotitan', '{54E9E91F-AED2-46D5-A25A-7E50AFA24513}', 1");
7885 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7887 r = add_complocator_entry(hdb, "'pantydraco', '{2A989951-5565-4FA7-93A7-E800A3E67D71}', 0");
7888 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7890 r = create_signature_table(hdb);
7891 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7893 r = add_signature_entry(hdb, "'abelisaurus', 'abelisaurus', '', '', '', '', '', '', ''");
7894 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7896 r = add_signature_entry(hdb, "'bactrosaurus', 'bactrosaurus', '', '', '', '', '', '', ''");
7897 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7899 r = add_signature_entry(hdb, "'camelotia', 'camelotia', '', '', '', '', '', '', ''");
7900 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7902 r = add_signature_entry(hdb, "'diclonius', 'diclonius', '', '', '', '', '', '', ''");
7903 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7905 r = add_signature_entry(hdb, "'iguanodon', 'iguanodon', '', '', '', '', '', '', ''");
7906 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7908 r = add_signature_entry(hdb, "'jobaria', 'jobaria', '', '', '', '', '', '', ''");
7909 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7911 r = add_signature_entry(hdb, "'kakuru', 'kakuru', '', '', '', '', '', '', ''");
7912 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7914 r = add_signature_entry(hdb, "'labocania', 'labocania', '', '', '', '', '', '', ''");
7915 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7917 hpkg = package_from_db(hdb);
7918 ok(hpkg, "failed to create package\n");
7920 MsiCloseHandle(hdb);
7922 create_test_file("abelisaurus");
7923 create_test_file("bactrosaurus");
7924 create_test_file("camelotia");
7925 create_test_file("diclonius");
7926 create_test_file("echinodon");
7927 create_test_file("falcarius");
7928 create_test_file("gallimimus");
7929 create_test_file("hagryphus");
7930 CreateDirectoryA("iguanodon", NULL);
7931 CreateDirectoryA("jobaria", NULL);
7932 CreateDirectoryA("kakuru", NULL);
7933 CreateDirectoryA("labocania", NULL);
7934 CreateDirectoryA("megaraptor", NULL);
7935 CreateDirectoryA("neosodon", NULL);
7936 CreateDirectoryA("olorotitan", NULL);
7937 CreateDirectoryA("pantydraco", NULL);
7939 set_component_path("abelisaurus", MSIINSTALLCONTEXT_MACHINE,
7940 "{E3619EED-305A-418C-B9C7-F7D7377F0934}", NULL, FALSE);
7941 set_component_path("bactrosaurus", MSIINSTALLCONTEXT_MACHINE,
7942 "{D56B688D-542F-42Ef-90FD-B6DA76EE8119}", NULL, FALSE);
7943 set_component_path("echinodon", MSIINSTALLCONTEXT_MACHINE,
7944 "{A19E16C5-C75D-4699-8111-C4338C40C3CB}", NULL, FALSE);
7945 set_component_path("falcarius", MSIINSTALLCONTEXT_MACHINE,
7946 "{17762FA1-A7AE-4CC6-8827-62873C35361D}", NULL, FALSE);
7947 set_component_path("iguanodon", MSIINSTALLCONTEXT_MACHINE,
7948 "{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}", NULL, FALSE);
7949 set_component_path("jobaria", MSIINSTALLCONTEXT_MACHINE,
7950 "{243C22B1-8C51-4151-B9D1-1AE5265E079E}", NULL, FALSE);
7951 set_component_path("megaraptor", MSIINSTALLCONTEXT_MACHINE,
7952 "{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}", NULL, FALSE);
7953 set_component_path("neosodon", MSIINSTALLCONTEXT_MACHINE,
7954 "{0B499649-197A-48EF-93D2-AF1C17ED6E90}", NULL, FALSE);
7956 r = MsiDoAction(hpkg, "AppSearch");
7957 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7960 r = MsiGetPropertyA(hpkg, "ABELISAURUS", prop, &size);
7961 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7963 lstrcpyA(expected, CURR_DIR);
7964 lstrcatA(expected, "\\abelisaurus");
7965 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
7966 "Expected %s or empty string, got %s\n", expected, prop);
7969 r = MsiGetPropertyA(hpkg, "BACTROSAURUS", prop, &size);
7970 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7971 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
7974 r = MsiGetPropertyA(hpkg, "CAMELOTIA", prop, &size);
7975 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7976 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
7979 r = MsiGetPropertyA(hpkg, "DICLONIUS", prop, &size);
7980 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7981 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
7984 r = MsiGetPropertyA(hpkg, "ECHINODON", prop, &size);
7985 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7987 lstrcpyA(expected, CURR_DIR);
7988 lstrcatA(expected, "\\");
7989 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
7990 "Expected %s or empty string, got %s\n", expected, prop);
7993 r = MsiGetPropertyA(hpkg, "FALCARIUS", prop, &size);
7994 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
7995 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
7998 r = MsiGetPropertyA(hpkg, "GALLIMIMUS", prop, &size);
7999 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8000 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
8003 r = MsiGetPropertyA(hpkg, "HAGRYPHUS", prop, &size);
8004 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8005 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
8008 r = MsiGetPropertyA(hpkg, "IGUANODON", prop, &size);
8009 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8010 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
8013 r = MsiGetPropertyA(hpkg, "JOBARIA", prop, &size);
8014 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8015 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
8018 r = MsiGetPropertyA(hpkg, "KAKURU", prop, &size);
8019 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8020 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
8023 r = MsiGetPropertyA(hpkg, "LABOCANIA", prop, &size);
8024 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8025 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
8028 r = MsiGetPropertyA(hpkg, "MEGARAPTOR", prop, &size);
8029 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8031 lstrcpyA(expected, CURR_DIR);
8032 lstrcatA(expected, "\\");
8033 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
8034 "Expected %s or empty string, got %s\n", expected, prop);
8037 r = MsiGetPropertyA(hpkg, "NEOSODON", prop, &size);
8038 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8040 lstrcpyA(expected, CURR_DIR);
8041 lstrcatA(expected, "\\neosodon\\");
8042 ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
8043 "Expected %s or empty string, got %s\n", expected, prop);
8046 r = MsiGetPropertyA(hpkg, "OLOROTITAN", prop, &size);
8047 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8048 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
8051 r = MsiGetPropertyA(hpkg, "PANTYDRACO", prop, &size);
8052 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8053 ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
8055 MsiCloseHandle(hpkg);
8056 DeleteFileA("abelisaurus");
8057 DeleteFileA("bactrosaurus");
8058 DeleteFileA("camelotia");
8059 DeleteFileA("diclonius");
8060 DeleteFileA("echinodon");
8061 DeleteFileA("falcarius");
8062 DeleteFileA("gallimimus");
8063 DeleteFileA("hagryphus");
8064 RemoveDirectoryA("iguanodon");
8065 RemoveDirectoryA("jobaria");
8066 RemoveDirectoryA("kakuru");
8067 RemoveDirectoryA("labocania");
8068 RemoveDirectoryA("megaraptor");
8069 RemoveDirectoryA("neosodon");
8070 RemoveDirectoryA("olorotitan");
8071 RemoveDirectoryA("pantydraco");
8072 delete_component_path("{E3619EED-305A-418C-B9C7-F7D7377F0934}",
8073 MSIINSTALLCONTEXT_MACHINE, NULL);
8074 delete_component_path("{D56B688D-542F-42Ef-90FD-B6DA76EE8119}",
8075 MSIINSTALLCONTEXT_MACHINE, NULL);
8076 delete_component_path("{A19E16C5-C75D-4699-8111-C4338C40C3CB}",
8077 MSIINSTALLCONTEXT_MACHINE, NULL);
8078 delete_component_path("{17762FA1-A7AE-4CC6-8827-62873C35361D}",
8079 MSIINSTALLCONTEXT_MACHINE, NULL);
8080 delete_component_path("{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}",
8081 MSIINSTALLCONTEXT_MACHINE, NULL);
8082 delete_component_path("{243C22B1-8C51-4151-B9D1-1AE5265E079E}",
8083 MSIINSTALLCONTEXT_MACHINE, NULL);
8084 delete_component_path("{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}",
8085 MSIINSTALLCONTEXT_MACHINE, NULL);
8086 delete_component_path("{0B499649-197A-48EF-93D2-AF1C17ED6E90}",
8087 MSIINSTALLCONTEXT_MACHINE, NULL);
8088 DeleteFileA(msifile);
8091 static void set_suminfo_prop(MSIHANDLE db, DWORD prop, DWORD val)
8096 r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
8097 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8099 r = MsiSummaryInfoSetPropertyA(summary, prop, VT_I4, val, NULL, NULL);
8100 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8102 r = MsiSummaryInfoPersist(summary);
8103 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
8105 MsiCloseHandle(summary);
8108 static void test_MsiGetSourcePath(void)
8110 MSIHANDLE hdb, hpkg;
8111 CHAR path[MAX_PATH];
8113 CHAR subsrc[MAX_PATH];
8114 CHAR sub2[MAX_PATH];
8118 lstrcpyA(cwd, CURR_DIR);
8119 lstrcatA(cwd, "\\");
8121 lstrcpyA(subsrc, cwd);
8122 lstrcatA(subsrc, "subsource");
8123 lstrcatA(subsrc, "\\");
8125 lstrcpyA(sub2, subsrc);
8126 lstrcatA(sub2, "sub2");
8127 lstrcatA(sub2, "\\");
8129 /* uncompressed source */
8131 hdb = create_package_db();
8132 ok( hdb, "failed to create database\n");
8134 set_suminfo_prop(hdb, PID_WORDCOUNT, 0);
8136 r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
8137 ok(r == S_OK, "failed\n");
8139 r = add_directory_entry(hdb, "'SubDir', 'TARGETDIR', 'subtarget:subsource'");
8140 ok(r == S_OK, "failed\n");
8142 r = add_directory_entry(hdb, "'SubDir2', 'SubDir', 'sub2'");
8143 ok(r == S_OK, "failed\n");
8145 r = MsiDatabaseCommit(hdb);
8146 ok(r == ERROR_SUCCESS , "Failed to commit database\n");
8148 hpkg = package_from_db(hdb);
8149 ok(hpkg, "failed to create package\n");
8151 MsiCloseHandle(hdb);
8153 /* invalid database handle */
8155 lstrcpyA(path, "kiwi");
8156 r = MsiGetSourcePath(-1, "TARGETDIR", path, &size);
8157 ok(r == ERROR_INVALID_HANDLE,
8158 "Expected ERROR_INVALID_HANDLE, got %d\n", r);
8159 ok(!lstrcmpA(path, "kiwi"),
8160 "Expected path to be unchanged, got \"%s\"\n", path);
8161 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8165 lstrcpyA(path, "kiwi");
8166 r = MsiGetSourcePath(hpkg, NULL, path, &size);
8167 ok(r == ERROR_INVALID_PARAMETER,
8168 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
8169 ok(!lstrcmpA(path, "kiwi"),
8170 "Expected path to be unchanged, got \"%s\"\n", path);
8171 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8173 /* empty szFolder */
8175 lstrcpyA(path, "kiwi");
8176 r = MsiGetSourcePath(hpkg, "", path, &size);
8177 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8178 ok(!lstrcmpA(path, "kiwi"),
8179 "Expected path to be unchanged, got \"%s\"\n", path);
8180 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8184 lstrcpyA(path, "kiwi");
8185 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
8186 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8187 ok(!lstrcmpA(path, "kiwi"),
8188 "Expected path to be unchanged, got \"%s\"\n", path);
8189 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8193 lstrcpyA(path, "kiwi");
8194 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
8195 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8196 ok(!lstrcmpA(path, "kiwi"),
8197 "Expected path to be unchanged, got \"%s\"\n", path);
8198 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8202 lstrcpyA(path, "kiwi");
8203 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
8204 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8205 ok(!lstrcmpA(path, "kiwi"),
8206 "Expected path to be unchanged, got \"%s\"\n", path);
8207 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8209 /* source path does not exist, but the property exists */
8211 lstrcpyA(path, "kiwi");
8212 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
8213 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8214 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
8215 ok(size == 0, "Expected 0, got %d\n", size);
8219 lstrcpyA(path, "kiwi");
8220 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8221 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8222 ok(!lstrcmpA(path, "kiwi"),
8223 "Expected path to be unchanged, got \"%s\"\n", path);
8224 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8228 lstrcpyA(path, "kiwi");
8229 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
8230 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8231 ok(!lstrcmpA(path, "kiwi"),
8232 "Expected path to be unchanged, got \"%s\"\n", path);
8233 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8235 r = MsiDoAction(hpkg, "CostInitialize");
8236 ok(r == ERROR_SUCCESS, "cost init failed\n");
8238 /* try TARGETDIR after CostInitialize */
8240 lstrcpyA(path, "kiwi");
8241 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
8242 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8243 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8244 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8246 /* try SourceDir after CostInitialize */
8248 lstrcpyA(path, "kiwi");
8249 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
8250 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8251 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8252 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8254 /* try SOURCEDIR after CostInitialize */
8256 lstrcpyA(path, "kiwi");
8257 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
8258 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8259 ok(!lstrcmpA(path, "kiwi"),
8260 "Expected path to be unchanged, got \"%s\"\n", path);
8261 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8263 /* source path does not exist, but the property exists */
8265 lstrcpyA(path, "kiwi");
8266 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
8267 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8270 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8271 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8274 /* try SubDir after CostInitialize */
8276 lstrcpyA(path, "kiwi");
8277 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8278 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8279 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8280 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8282 /* try SubDir2 after CostInitialize */
8284 lstrcpyA(path, "kiwi");
8285 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
8286 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8287 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
8288 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
8290 r = MsiDoAction(hpkg, "ResolveSource");
8291 ok(r == ERROR_SUCCESS, "file cost failed\n");
8293 /* try TARGETDIR after ResolveSource */
8295 lstrcpyA(path, "kiwi");
8296 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
8297 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8298 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8299 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8301 /* try SourceDir after ResolveSource */
8303 lstrcpyA(path, "kiwi");
8304 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
8305 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8306 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8307 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8309 /* try SOURCEDIR after ResolveSource */
8311 lstrcpyA(path, "kiwi");
8312 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
8313 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8314 ok(!lstrcmpA(path, "kiwi"),
8315 "Expected path to be unchanged, got \"%s\"\n", path);
8316 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8318 /* source path does not exist, but the property exists */
8320 lstrcpyA(path, "kiwi");
8321 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
8322 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8323 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8324 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8326 /* try SubDir after ResolveSource */
8328 lstrcpyA(path, "kiwi");
8329 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8330 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8331 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8332 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8334 /* try SubDir2 after ResolveSource */
8336 lstrcpyA(path, "kiwi");
8337 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
8338 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8339 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
8340 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
8342 r = MsiDoAction(hpkg, "FileCost");
8343 ok(r == ERROR_SUCCESS, "file cost failed\n");
8345 /* try TARGETDIR after FileCost */
8347 lstrcpyA(path, "kiwi");
8348 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
8349 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8350 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8351 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8353 /* try SourceDir after FileCost */
8355 lstrcpyA(path, "kiwi");
8356 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
8357 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8358 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8359 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8361 /* try SOURCEDIR after FileCost */
8363 lstrcpyA(path, "kiwi");
8364 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
8365 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8366 ok(!lstrcmpA(path, "kiwi"),
8367 "Expected path to be unchanged, got \"%s\"\n", path);
8368 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8370 /* try SubDir after FileCost */
8372 lstrcpyA(path, "kiwi");
8373 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8374 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8375 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8376 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8378 /* try SubDir2 after FileCost */
8380 lstrcpyA(path, "kiwi");
8381 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
8382 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8383 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
8384 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
8386 r = MsiDoAction(hpkg, "CostFinalize");
8387 ok(r == ERROR_SUCCESS, "file cost failed\n");
8389 /* try TARGETDIR after CostFinalize */
8391 lstrcpyA(path, "kiwi");
8392 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
8393 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8394 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8395 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8397 /* try SourceDir after CostFinalize */
8399 lstrcpyA(path, "kiwi");
8400 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
8401 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8402 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8403 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8405 /* try SOURCEDIR after CostFinalize */
8407 lstrcpyA(path, "kiwi");
8408 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
8409 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8410 ok(!lstrcmpA(path, "kiwi"),
8411 "Expected path to be unchanged, got \"%s\"\n", path);
8412 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8414 /* try SubDir after CostFinalize */
8416 lstrcpyA(path, "kiwi");
8417 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8418 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8419 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8420 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8422 /* try SubDir2 after CostFinalize */
8424 lstrcpyA(path, "kiwi");
8425 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
8426 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8427 ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
8428 ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
8430 /* nonexistent directory */
8432 lstrcpyA(path, "kiwi");
8433 r = MsiGetSourcePath(hpkg, "IDontExist", path, &size);
8434 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
8435 ok(!lstrcmpA(path, "kiwi"),
8436 "Expected path to be unchanged, got \"%s\"\n", path);
8437 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
8439 /* NULL szPathBuf */
8441 r = MsiGetSourcePath(hpkg, "SourceDir", NULL, &size);
8442 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8443 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8445 /* NULL pcchPathBuf */
8446 lstrcpyA(path, "kiwi");
8447 r = MsiGetSourcePath(hpkg, "SourceDir", path, NULL);
8448 ok(r == ERROR_INVALID_PARAMETER,
8449 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
8450 ok(!lstrcmpA(path, "kiwi"),
8451 "Expected path to be unchanged, got \"%s\"\n", path);
8453 /* pcchPathBuf is 0 */
8455 lstrcpyA(path, "kiwi");
8456 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
8457 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
8458 ok(!lstrcmpA(path, "kiwi"),
8459 "Expected path to be unchanged, got \"%s\"\n", path);
8460 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8462 /* pcchPathBuf does not have room for NULL terminator */
8463 size = lstrlenA(cwd);
8464 lstrcpyA(path, "kiwi");
8465 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
8466 ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
8467 ok(!strncmp(path, cwd, lstrlenA(cwd) - 1),
8468 "Expected path with no backslash, got \"%s\"\n", path);
8469 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8471 /* pcchPathBuf has room for NULL terminator */
8472 size = lstrlenA(cwd) + 1;
8473 lstrcpyA(path, "kiwi");
8474 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
8475 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8476 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8477 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8479 MsiCloseHandle(hpkg);
8481 /* compressed source */
8483 r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
8484 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8486 set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeCompressed);
8488 hpkg = package_from_db(hdb);
8489 ok(hpkg, "failed to create package\n");
8491 r = MsiDoAction(hpkg, "CostInitialize");
8492 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8493 r = MsiDoAction(hpkg, "FileCost");
8494 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8495 r = MsiDoAction(hpkg, "CostFinalize");
8496 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8498 /* try TARGETDIR after CostFinalize */
8500 lstrcpyA(path, "kiwi");
8501 r = MsiGetSourcePath(hpkg, "TARGETDIR", path, &size);
8502 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8503 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8504 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8506 /* try SourceDir after CostFinalize */
8508 lstrcpyA(path, "kiwi");
8509 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
8510 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8511 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8512 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8514 /* try SOURCEDIR after CostFinalize */
8516 lstrcpyA(path, "kiwi");
8517 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
8520 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8521 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8522 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8525 /* try SubDir after CostFinalize */
8527 lstrcpyA(path, "kiwi");
8528 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8529 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8530 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8531 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8533 /* try SubDir2 after CostFinalize */
8535 lstrcpyA(path, "kiwi");
8536 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
8537 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8538 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8539 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8541 MsiCloseHandle(hpkg);
8542 DeleteFile(msifile);
8545 static void test_shortlongsource(void)
8547 MSIHANDLE hdb, hpkg;
8548 CHAR path[MAX_PATH];
8550 CHAR subsrc[MAX_PATH];
8554 lstrcpyA(cwd, CURR_DIR);
8555 lstrcatA(cwd, "\\");
8557 lstrcpyA(subsrc, cwd);
8558 lstrcatA(subsrc, "long");
8559 lstrcatA(subsrc, "\\");
8561 /* long file names */
8563 hdb = create_package_db();
8564 ok( hdb, "failed to create database\n");
8566 set_suminfo_prop(hdb, PID_WORDCOUNT, 0);
8568 r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
8569 ok(r == S_OK, "failed\n");
8571 r = add_directory_entry(hdb, "'SubDir', 'TARGETDIR', 'short|long'");
8572 ok(r == S_OK, "failed\n");
8574 /* CostInitialize:short */
8575 r = add_directory_entry(hdb, "'SubDir2', 'TARGETDIR', 'one|two'");
8576 ok(r == S_OK, "failed\n");
8578 /* CostInitialize:long */
8579 r = add_directory_entry(hdb, "'SubDir3', 'TARGETDIR', 'three|four'");
8580 ok(r == S_OK, "failed\n");
8582 /* FileCost:short */
8583 r = add_directory_entry(hdb, "'SubDir4', 'TARGETDIR', 'five|six'");
8584 ok(r == S_OK, "failed\n");
8587 r = add_directory_entry(hdb, "'SubDir5', 'TARGETDIR', 'seven|eight'");
8588 ok(r == S_OK, "failed\n");
8590 /* CostFinalize:short */
8591 r = add_directory_entry(hdb, "'SubDir6', 'TARGETDIR', 'nine|ten'");
8592 ok(r == S_OK, "failed\n");
8594 /* CostFinalize:long */
8595 r = add_directory_entry(hdb, "'SubDir7', 'TARGETDIR', 'eleven|twelve'");
8596 ok(r == S_OK, "failed\n");
8598 MsiDatabaseCommit(hdb);
8600 hpkg = package_from_db(hdb);
8601 ok(hpkg, "failed to create package\n");
8603 MsiCloseHandle(hdb);
8605 CreateDirectoryA("one", NULL);
8606 CreateDirectoryA("four", NULL);
8608 r = MsiDoAction(hpkg, "CostInitialize");
8609 ok(r == ERROR_SUCCESS, "file cost failed\n");
8611 CreateDirectory("five", NULL);
8612 CreateDirectory("eight", NULL);
8614 r = MsiDoAction(hpkg, "FileCost");
8615 ok(r == ERROR_SUCCESS, "file cost failed\n");
8617 CreateDirectory("nine", NULL);
8618 CreateDirectory("twelve", NULL);
8620 r = MsiDoAction(hpkg, "CostFinalize");
8621 ok(r == ERROR_SUCCESS, "file cost failed\n");
8623 /* neither short nor long source directories exist */
8625 lstrcpyA(path, "kiwi");
8626 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8627 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8628 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8629 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8631 CreateDirectoryA("short", NULL);
8633 /* short source directory exists */
8635 lstrcpyA(path, "kiwi");
8636 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8637 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8638 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8639 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8641 CreateDirectoryA("long", NULL);
8643 /* both short and long source directories exist */
8645 lstrcpyA(path, "kiwi");
8646 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8647 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8648 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8649 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8651 lstrcpyA(subsrc, cwd);
8652 lstrcatA(subsrc, "two");
8653 lstrcatA(subsrc, "\\");
8655 /* short dir exists before CostInitialize */
8657 lstrcpyA(path, "kiwi");
8658 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
8659 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8660 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8661 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8663 lstrcpyA(subsrc, cwd);
8664 lstrcatA(subsrc, "four");
8665 lstrcatA(subsrc, "\\");
8667 /* long dir exists before CostInitialize */
8669 lstrcpyA(path, "kiwi");
8670 r = MsiGetSourcePath(hpkg, "SubDir3", path, &size);
8671 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8672 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8673 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8675 lstrcpyA(subsrc, cwd);
8676 lstrcatA(subsrc, "six");
8677 lstrcatA(subsrc, "\\");
8679 /* short dir exists before FileCost */
8681 lstrcpyA(path, "kiwi");
8682 r = MsiGetSourcePath(hpkg, "SubDir4", path, &size);
8683 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8684 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8685 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8687 lstrcpyA(subsrc, cwd);
8688 lstrcatA(subsrc, "eight");
8689 lstrcatA(subsrc, "\\");
8691 /* long dir exists before FileCost */
8693 lstrcpyA(path, "kiwi");
8694 r = MsiGetSourcePath(hpkg, "SubDir5", path, &size);
8695 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8696 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8697 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8699 lstrcpyA(subsrc, cwd);
8700 lstrcatA(subsrc, "ten");
8701 lstrcatA(subsrc, "\\");
8703 /* short dir exists before CostFinalize */
8705 lstrcpyA(path, "kiwi");
8706 r = MsiGetSourcePath(hpkg, "SubDir6", path, &size);
8707 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8708 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8709 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8711 lstrcpyA(subsrc, cwd);
8712 lstrcatA(subsrc, "twelve");
8713 lstrcatA(subsrc, "\\");
8715 /* long dir exists before CostFinalize */
8717 lstrcpyA(path, "kiwi");
8718 r = MsiGetSourcePath(hpkg, "SubDir7", path, &size);
8719 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8720 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8721 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8723 MsiCloseHandle(hpkg);
8724 RemoveDirectoryA("short");
8725 RemoveDirectoryA("long");
8726 RemoveDirectoryA("one");
8727 RemoveDirectoryA("four");
8728 RemoveDirectoryA("five");
8729 RemoveDirectoryA("eight");
8730 RemoveDirectoryA("nine");
8731 RemoveDirectoryA("twelve");
8733 /* short file names */
8735 r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
8736 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8738 set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeSFN);
8740 hpkg = package_from_db(hdb);
8741 ok(hpkg, "failed to create package\n");
8743 MsiCloseHandle(hdb);
8745 CreateDirectoryA("one", NULL);
8746 CreateDirectoryA("four", NULL);
8748 r = MsiDoAction(hpkg, "CostInitialize");
8749 ok(r == ERROR_SUCCESS, "file cost failed\n");
8751 CreateDirectory("five", NULL);
8752 CreateDirectory("eight", NULL);
8754 r = MsiDoAction(hpkg, "FileCost");
8755 ok(r == ERROR_SUCCESS, "file cost failed\n");
8757 CreateDirectory("nine", NULL);
8758 CreateDirectory("twelve", NULL);
8760 r = MsiDoAction(hpkg, "CostFinalize");
8761 ok(r == ERROR_SUCCESS, "file cost failed\n");
8763 lstrcpyA(subsrc, cwd);
8764 lstrcatA(subsrc, "short");
8765 lstrcatA(subsrc, "\\");
8767 /* neither short nor long source directories exist */
8769 lstrcpyA(path, "kiwi");
8770 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8771 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8772 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8773 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8775 CreateDirectoryA("short", NULL);
8777 /* short source directory exists */
8779 lstrcpyA(path, "kiwi");
8780 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8781 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8782 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8783 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8785 CreateDirectoryA("long", NULL);
8787 /* both short and long source directories exist */
8789 lstrcpyA(path, "kiwi");
8790 r = MsiGetSourcePath(hpkg, "SubDir", path, &size);
8791 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8792 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8793 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8795 lstrcpyA(subsrc, cwd);
8796 lstrcatA(subsrc, "one");
8797 lstrcatA(subsrc, "\\");
8799 /* short dir exists before CostInitialize */
8801 lstrcpyA(path, "kiwi");
8802 r = MsiGetSourcePath(hpkg, "SubDir2", path, &size);
8803 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8804 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8805 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8807 lstrcpyA(subsrc, cwd);
8808 lstrcatA(subsrc, "three");
8809 lstrcatA(subsrc, "\\");
8811 /* long dir exists before CostInitialize */
8813 lstrcpyA(path, "kiwi");
8814 r = MsiGetSourcePath(hpkg, "SubDir3", path, &size);
8815 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8816 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8817 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8819 lstrcpyA(subsrc, cwd);
8820 lstrcatA(subsrc, "five");
8821 lstrcatA(subsrc, "\\");
8823 /* short dir exists before FileCost */
8825 lstrcpyA(path, "kiwi");
8826 r = MsiGetSourcePath(hpkg, "SubDir4", path, &size);
8827 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8828 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8829 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8831 lstrcpyA(subsrc, cwd);
8832 lstrcatA(subsrc, "seven");
8833 lstrcatA(subsrc, "\\");
8835 /* long dir exists before FileCost */
8837 lstrcpyA(path, "kiwi");
8838 r = MsiGetSourcePath(hpkg, "SubDir5", path, &size);
8839 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8840 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8841 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8843 lstrcpyA(subsrc, cwd);
8844 lstrcatA(subsrc, "nine");
8845 lstrcatA(subsrc, "\\");
8847 /* short dir exists before CostFinalize */
8849 lstrcpyA(path, "kiwi");
8850 r = MsiGetSourcePath(hpkg, "SubDir6", path, &size);
8851 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8852 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8853 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8855 lstrcpyA(subsrc, cwd);
8856 lstrcatA(subsrc, "eleven");
8857 lstrcatA(subsrc, "\\");
8859 /* long dir exists before CostFinalize */
8861 lstrcpyA(path, "kiwi");
8862 r = MsiGetSourcePath(hpkg, "SubDir7", path, &size);
8863 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8864 ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
8865 ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
8867 MsiCloseHandle(hpkg);
8868 RemoveDirectoryA("short");
8869 RemoveDirectoryA("long");
8870 RemoveDirectoryA("one");
8871 RemoveDirectoryA("four");
8872 RemoveDirectoryA("five");
8873 RemoveDirectoryA("eight");
8874 RemoveDirectoryA("nine");
8875 RemoveDirectoryA("twelve");
8876 DeleteFileA(msifile);
8879 static void test_sourcedir(void)
8881 MSIHANDLE hdb, hpkg;
8883 CHAR path[MAX_PATH];
8885 CHAR subsrc[MAX_PATH];
8889 lstrcpyA(cwd, CURR_DIR);
8890 lstrcatA(cwd, "\\");
8892 lstrcpyA(subsrc, cwd);
8893 lstrcatA(subsrc, "long");
8894 lstrcatA(subsrc, "\\");
8896 hdb = create_package_db();
8897 ok( hdb, "failed to create database\n");
8899 r = add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
8900 ok(r == S_OK, "failed\n");
8902 sprintf(package, "#%li", hdb);
8903 r = MsiOpenPackage(package, &hpkg);
8904 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8906 /* properties only */
8908 /* SourceDir prop */
8910 lstrcpyA(path, "kiwi");
8911 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
8912 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8913 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
8914 ok(size == 0, "Expected 0, got %d\n", size);
8916 /* SOURCEDIR prop */
8918 lstrcpyA(path, "kiwi");
8919 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
8920 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8921 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
8922 ok(size == 0, "Expected 0, got %d\n", size);
8924 r = MsiDoAction(hpkg, "CostInitialize");
8925 ok(r == ERROR_SUCCESS, "file cost failed\n");
8927 /* SourceDir after CostInitialize */
8929 lstrcpyA(path, "kiwi");
8930 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
8931 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8932 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
8933 ok(size == 0, "Expected 0, got %d\n", size);
8935 /* SOURCEDIR after CostInitialize */
8937 lstrcpyA(path, "kiwi");
8938 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
8939 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8940 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
8941 ok(size == 0, "Expected 0, got %d\n", size);
8943 r = MsiDoAction(hpkg, "FileCost");
8944 ok(r == ERROR_SUCCESS, "file cost failed\n");
8946 /* SourceDir after FileCost */
8948 lstrcpyA(path, "kiwi");
8949 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
8950 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8951 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
8952 ok(size == 0, "Expected 0, got %d\n", size);
8954 /* SOURCEDIR after FileCost */
8956 lstrcpyA(path, "kiwi");
8957 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
8958 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8959 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
8960 ok(size == 0, "Expected 0, got %d\n", size);
8962 r = MsiDoAction(hpkg, "CostFinalize");
8963 ok(r == ERROR_SUCCESS, "file cost failed\n");
8965 /* SourceDir after CostFinalize */
8967 lstrcpyA(path, "kiwi");
8968 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
8969 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8970 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
8971 ok(size == 0, "Expected 0, got %d\n", size);
8973 /* SOURCEDIR after CostFinalize */
8975 lstrcpyA(path, "kiwi");
8976 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
8977 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8978 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
8979 ok(size == 0, "Expected 0, got %d\n", size);
8981 r = MsiDoAction(hpkg, "ResolveSource");
8982 ok(r == ERROR_SUCCESS, "file cost failed\n");
8984 /* SourceDir after ResolveSource */
8986 lstrcpyA(path, "kiwi");
8987 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
8988 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8989 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8990 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
8992 /* SOURCEDIR after ResolveSource */
8994 lstrcpyA(path, "kiwi");
8995 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
8996 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
8997 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
8998 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9002 lstrcpyA(path, "kiwi");
9003 r = MsiGetProperty(hpkg, "SoUrCeDiR", path, &size);
9004 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9005 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
9006 ok(size == 0, "Expected 0, got %d\n", size);
9008 MsiCloseHandle(hpkg);
9010 /* reset the package state */
9011 sprintf(package, "#%li", hdb);
9012 r = MsiOpenPackage(package, &hpkg);
9013 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9015 /* test how MsiGetSourcePath affects the properties */
9017 /* SourceDir prop */
9019 lstrcpyA(path, "kiwi");
9020 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
9021 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9024 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
9025 ok(size == 0, "Expected 0, got %d\n", size);
9029 lstrcpyA(path, "kiwi");
9030 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
9031 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9032 ok(!lstrcmpA(path, "kiwi"),
9033 "Expected path to be unchanged, got \"%s\"\n", path);
9034 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9036 /* SourceDir after MsiGetSourcePath */
9038 lstrcpyA(path, "kiwi");
9039 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
9040 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9043 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
9044 ok(size == 0, "Expected 0, got %d\n", size);
9047 /* SOURCEDIR prop */
9049 lstrcpyA(path, "kiwi");
9050 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
9051 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9054 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
9055 ok(size == 0, "Expected 0, got %d\n", size);
9059 lstrcpyA(path, "kiwi");
9060 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
9061 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9062 ok(!lstrcmpA(path, "kiwi"),
9063 "Expected path to be unchanged, got \"%s\"\n", path);
9064 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9066 /* SOURCEDIR prop after MsiGetSourcePath */
9068 lstrcpyA(path, "kiwi");
9069 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
9070 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9073 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
9074 ok(size == 0, "Expected 0, got %d\n", size);
9077 r = MsiDoAction(hpkg, "CostInitialize");
9078 ok(r == ERROR_SUCCESS, "file cost failed\n");
9080 /* SourceDir after CostInitialize */
9082 lstrcpyA(path, "kiwi");
9083 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
9084 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9087 ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
9088 ok(size == 0, "Expected 0, got %d\n", size);
9092 lstrcpyA(path, "kiwi");
9093 r = MsiGetSourcePath(hpkg, "SourceDir", path, &size);
9094 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9095 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9096 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9098 /* SourceDir after MsiGetSourcePath */
9100 lstrcpyA(path, "kiwi");
9101 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
9102 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9103 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9104 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9106 /* SOURCEDIR after CostInitialize */
9108 lstrcpyA(path, "kiwi");
9109 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
9110 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9111 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9112 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9114 /* SOURCEDIR source path still does not exist */
9116 lstrcpyA(path, "kiwi");
9117 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
9118 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9119 ok(!lstrcmpA(path, "kiwi"),
9120 "Expected path to be unchanged, got \"%s\"\n", path);
9121 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9123 r = MsiDoAction(hpkg, "FileCost");
9124 ok(r == ERROR_SUCCESS, "file cost failed\n");
9126 /* SourceDir after FileCost */
9128 lstrcpyA(path, "kiwi");
9129 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
9130 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9131 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9132 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9134 /* SOURCEDIR after FileCost */
9136 lstrcpyA(path, "kiwi");
9137 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
9138 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9139 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9140 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9142 /* SOURCEDIR source path still does not exist */
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 r = MsiDoAction(hpkg, "CostFinalize");
9152 ok(r == ERROR_SUCCESS, "file cost failed\n");
9154 /* SourceDir after CostFinalize */
9156 lstrcpyA(path, "kiwi");
9157 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
9158 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9159 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9160 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9162 /* SOURCEDIR after CostFinalize */
9164 lstrcpyA(path, "kiwi");
9165 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
9166 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9167 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9168 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9170 /* SOURCEDIR source path still does not exist */
9172 lstrcpyA(path, "kiwi");
9173 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
9174 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9175 ok(!lstrcmpA(path, "kiwi"),
9176 "Expected path to be unchanged, got \"%s\"\n", path);
9177 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9179 r = MsiDoAction(hpkg, "ResolveSource");
9180 ok(r == ERROR_SUCCESS, "file cost failed\n");
9182 /* SourceDir after ResolveSource */
9184 lstrcpyA(path, "kiwi");
9185 r = MsiGetProperty(hpkg, "SourceDir", path, &size);
9186 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9187 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9188 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9190 /* SOURCEDIR after ResolveSource */
9192 lstrcpyA(path, "kiwi");
9193 r = MsiGetProperty(hpkg, "SOURCEDIR", path, &size);
9194 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9195 ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
9196 ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
9198 /* SOURCEDIR source path still does not exist */
9200 lstrcpyA(path, "kiwi");
9201 r = MsiGetSourcePath(hpkg, "SOURCEDIR", path, &size);
9202 ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
9203 ok(!lstrcmpA(path, "kiwi"),
9204 "Expected path to be unchanged, got \"%s\"\n", path);
9205 ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
9207 MsiCloseHandle(hdb);
9208 MsiCloseHandle(hpkg);
9209 DeleteFileA(msifile);
9219 static const struct access_res create[16] =
9221 { TRUE, ERROR_SUCCESS, TRUE },
9222 { TRUE, ERROR_SUCCESS, TRUE },
9223 { TRUE, ERROR_SUCCESS, FALSE },
9224 { TRUE, ERROR_SUCCESS, FALSE },
9225 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9226 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9227 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9228 { TRUE, ERROR_SUCCESS, FALSE },
9229 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9230 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9231 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9232 { TRUE, ERROR_SUCCESS, TRUE },
9233 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9234 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9235 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9236 { TRUE, ERROR_SUCCESS, TRUE }
9239 static const struct access_res create_commit[16] =
9241 { TRUE, ERROR_SUCCESS, TRUE },
9242 { TRUE, ERROR_SUCCESS, TRUE },
9243 { TRUE, ERROR_SUCCESS, FALSE },
9244 { TRUE, ERROR_SUCCESS, FALSE },
9245 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9246 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9247 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9248 { TRUE, ERROR_SUCCESS, FALSE },
9249 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9250 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9251 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9252 { TRUE, ERROR_SUCCESS, TRUE },
9253 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9254 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9255 { FALSE, ERROR_SHARING_VIOLATION, FALSE },
9256 { TRUE, ERROR_SUCCESS, TRUE }
9259 static const struct access_res create_close[16] =
9261 { TRUE, ERROR_SUCCESS, FALSE },
9262 { TRUE, ERROR_SUCCESS, FALSE },
9263 { TRUE, ERROR_SUCCESS, FALSE },
9264 { TRUE, ERROR_SUCCESS, FALSE },
9265 { TRUE, ERROR_SUCCESS, FALSE },
9266 { TRUE, ERROR_SUCCESS, FALSE },
9267 { TRUE, ERROR_SUCCESS, FALSE },
9268 { TRUE, ERROR_SUCCESS, FALSE },
9269 { TRUE, ERROR_SUCCESS, FALSE },
9270 { TRUE, ERROR_SUCCESS, FALSE },
9271 { TRUE, ERROR_SUCCESS, FALSE },
9272 { TRUE, ERROR_SUCCESS, FALSE },
9273 { TRUE, ERROR_SUCCESS, FALSE },
9274 { TRUE, ERROR_SUCCESS, FALSE },
9275 { TRUE, ERROR_SUCCESS, FALSE },
9276 { TRUE, ERROR_SUCCESS }
9279 static void _test_file_access(LPCSTR file, const struct access_res *ares, DWORD line)
9281 DWORD access = 0, share = 0;
9286 for (i = 0; i < 4; i++)
9288 if (i == 0) access = 0;
9289 if (i == 1) access = GENERIC_READ;
9290 if (i == 2) access = GENERIC_WRITE;
9291 if (i == 3) access = GENERIC_READ | GENERIC_WRITE;
9293 for (j = 0; j < 4; j++)
9295 if (ares[idx].ignore)
9298 if (j == 0) share = 0;
9299 if (j == 1) share = FILE_SHARE_READ;
9300 if (j == 2) share = FILE_SHARE_WRITE;
9301 if (j == 3) share = FILE_SHARE_READ | FILE_SHARE_WRITE;
9303 SetLastError(0xdeadbeef);
9304 hfile = CreateFileA(file, access, share, NULL, OPEN_EXISTING,
9305 FILE_ATTRIBUTE_NORMAL, 0);
9306 lasterr = GetLastError();
9308 ok((hfile != INVALID_HANDLE_VALUE) == ares[idx].gothandle,
9309 "(%d, handle, %d): Expected %d, got %d\n",
9310 line, idx, ares[idx].gothandle,
9311 (hfile != INVALID_HANDLE_VALUE));
9313 ok(lasterr == ares[idx].lasterr ||
9314 lasterr == 0xdeadbeef, /* win9x */
9315 "(%d, lasterr, %d): Expected %d, got %d\n",
9316 line, idx, ares[idx].lasterr, lasterr);
9324 #define test_file_access(file, ares) _test_file_access(file, ares, __LINE__)
9326 static void test_access(void)
9331 r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb);
9332 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9334 test_file_access(msifile, create);
9336 r = MsiDatabaseCommit(hdb);
9337 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9339 test_file_access(msifile, create_commit);
9341 MsiCloseHandle(hdb);
9343 test_file_access(msifile, create_close);
9345 DeleteFileA(msifile);
9347 r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATEDIRECT, &hdb);
9348 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9350 test_file_access(msifile, create);
9352 r = MsiDatabaseCommit(hdb);
9353 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9355 test_file_access(msifile, create_commit);
9357 MsiCloseHandle(hdb);
9359 test_file_access(msifile, create_close);
9361 DeleteFileA(msifile);
9364 static void test_emptypackage(void)
9366 MSIHANDLE hpkg, hdb, hsuminfo;
9367 MSIHANDLE hview, hrec;
9368 MSICONDITION condition;
9369 CHAR buffer[MAX_PATH];
9373 r = MsiOpenPackageA("", &hpkg);
9376 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9379 hdb = MsiGetActiveDatabase(hpkg);
9382 ok(hdb != 0, "Expected a valid database handle\n");
9385 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Tables`", &hview);
9388 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9390 r = MsiViewExecute(hview, 0);
9393 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9396 r = MsiViewFetch(hview, &hrec);
9399 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9403 r = MsiRecordGetString(hrec, 1, buffer, &size);
9406 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9407 ok(!lstrcmpA(buffer, "_Property"),
9408 "Expected \"_Property\", got \"%s\"\n", buffer);
9411 MsiCloseHandle(hrec);
9413 r = MsiViewFetch(hview, &hrec);
9416 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9420 r = MsiRecordGetString(hrec, 1, buffer, &size);
9423 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9424 ok(!lstrcmpA(buffer, "#_FolderCache"),
9425 "Expected \"_Property\", got \"%s\"\n", buffer);
9428 MsiCloseHandle(hrec);
9429 MsiViewClose(hview);
9430 MsiCloseHandle(hview);
9432 condition = MsiDatabaseIsTablePersistentA(hdb, "_Property");
9435 ok(condition == MSICONDITION_FALSE,
9436 "Expected MSICONDITION_FALSE, got %d\n", condition);
9439 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Property`", &hview);
9442 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9444 r = MsiViewExecute(hview, 0);
9447 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9450 /* _Property table is not empty */
9451 r = MsiViewFetch(hview, &hrec);
9454 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9457 MsiCloseHandle(hrec);
9458 MsiViewClose(hview);
9459 MsiCloseHandle(hview);
9461 condition = MsiDatabaseIsTablePersistentA(hdb, "#_FolderCache");
9464 ok(condition == MSICONDITION_FALSE,
9465 "Expected MSICONDITION_FALSE, got %d\n", condition);
9468 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `#_FolderCache`", &hview);
9471 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9473 r = MsiViewExecute(hview, 0);
9476 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9479 /* #_FolderCache is not empty */
9480 r = MsiViewFetch(hview, &hrec);
9483 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9486 MsiCloseHandle(hrec);
9487 MsiViewClose(hview);
9488 MsiCloseHandle(hview);
9490 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Streams`", &hview);
9493 ok(r == ERROR_BAD_QUERY_SYNTAX,
9494 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
9497 r = MsiDatabaseOpenView(hdb, "SELECT * FROM `_Storages`", &hview);
9500 ok(r == ERROR_BAD_QUERY_SYNTAX,
9501 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
9504 r = MsiGetSummaryInformationA(hdb, NULL, 0, &hsuminfo);
9507 ok(r == ERROR_INSTALL_PACKAGE_INVALID,
9508 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
9511 MsiCloseHandle(hsuminfo);
9513 r = MsiDatabaseCommit(hdb);
9516 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
9519 MsiCloseHandle(hdb);
9520 MsiCloseHandle(hpkg);
9525 GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
9527 test_createpackage();
9529 test_gettargetpath_bad();
9530 test_settargetpath();
9532 test_property_table();
9535 test_formatrecord2();
9540 test_appsearch_complocator();
9541 test_appsearch_reglocator();
9542 test_appsearch_inilocator();
9543 test_appsearch_drlocator();
9544 test_featureparents();
9545 test_installprops();
9546 test_launchconditions();
9549 test_MsiGetSourcePath();
9550 test_shortlongsource();
9553 test_emptypackage();