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 static void test_createpackage(void)
844 MSIHANDLE hPackage
= 0;
847 hPackage
= package_from_db(create_package_db());
848 ok( hPackage
!= 0, " Failed to create package\n");
850 res
= MsiCloseHandle( hPackage
);
851 ok( res
== ERROR_SUCCESS
, "Failed to close package\n" );
855 static void test_doaction( void )
860 r
= MsiDoAction( -1, NULL
);
861 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
863 hpkg
= package_from_db(create_package_db());
864 ok( hpkg
, "failed to create package\n");
866 r
= MsiDoAction(hpkg
, NULL
);
867 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
869 r
= MsiDoAction(0, "boo");
870 ok( r
== ERROR_INVALID_HANDLE
, "wrong return val\n");
872 r
= MsiDoAction(hpkg
, "boo");
873 ok( r
== ERROR_FUNCTION_NOT_CALLED
, "wrong return val\n");
875 MsiCloseHandle( hpkg
);
879 static void test_gettargetpath_bad(void)
886 hpkg
= package_from_db(create_package_db());
887 ok( hpkg
, "failed to create package\n");
889 r
= MsiGetTargetPath( 0, NULL
, NULL
, NULL
);
890 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
892 r
= MsiGetTargetPath( 0, NULL
, NULL
, &sz
);
893 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
895 r
= MsiGetTargetPath( 0, "boo", NULL
, NULL
);
896 ok( r
== ERROR_INVALID_HANDLE
, "wrong return val\n");
898 r
= MsiGetTargetPath( 0, "boo", NULL
, NULL
);
899 ok( r
== ERROR_INVALID_HANDLE
, "wrong return val\n");
901 r
= MsiGetTargetPath( hpkg
, "boo", NULL
, NULL
);
902 ok( r
== ERROR_DIRECTORY
, "wrong return val\n");
904 r
= MsiGetTargetPath( hpkg
, "boo", buffer
, NULL
);
905 ok( r
== ERROR_DIRECTORY
, "wrong return val\n");
907 MsiCloseHandle( hpkg
);
911 static void query_file_path(MSIHANDLE hpkg
, LPCSTR file
, LPSTR buff
)
917 rec
= MsiCreateRecord( 1 );
918 ok(rec
, "MsiCreate record failed\n");
920 r
= MsiRecordSetString( rec
, 0, file
);
921 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
924 r
= MsiFormatRecord( hpkg
, rec
, buff
, &size
);
925 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
927 MsiCloseHandle( rec
);
930 static void test_settargetpath(void)
932 char tempdir
[MAX_PATH
+8], buffer
[MAX_PATH
], file
[MAX_PATH
];
938 hdb
= create_package_db();
939 ok ( hdb
, "failed to create package database\n" );
941 r
= add_directory_entry( hdb
, "'TARGETDIR', '', 'SourceDir'" );
942 ok( r
== S_OK
, "failed to add directory entry: %d\n" , r
);
944 r
= create_component_table( hdb
);
945 ok( r
== S_OK
, "cannot create Component table: %d\n", r
);
947 r
= add_component_entry( hdb
, "'RootComp', '{83e2694d-0864-4124-9323-6d37630912a1}', 'TARGETDIR', 8, '', 'RootFile'" );
948 ok( r
== S_OK
, "cannot add dummy component: %d\n", r
);
950 r
= add_component_entry( hdb
, "'TestComp', '{A3FB59C8-C293-4F7E-B8C5-F0E1D8EEE4E5}', 'TestDir', 0, '', 'TestFile'" );
951 ok( r
== S_OK
, "cannot add test component: %d\n", r
);
953 r
= create_feature_table( hdb
);
954 ok( r
== S_OK
, "cannot create Feature table: %d\n", r
);
956 r
= add_feature_entry( hdb
, "'TestFeature', '', '', '', 0, 1, '', 0" );
957 ok( r
== ERROR_SUCCESS
, "cannot add TestFeature to Feature table: %d\n", r
);
959 r
= create_feature_components_table( hdb
);
960 ok( r
== S_OK
, "cannot create FeatureComponents table: %d\n", r
);
962 r
= add_feature_components_entry( hdb
, "'TestFeature', 'RootComp'" );
963 ok( r
== S_OK
, "cannot insert component into FeatureComponents table: %d\n", r
);
965 r
= add_feature_components_entry( hdb
, "'TestFeature', 'TestComp'" );
966 ok( r
== S_OK
, "cannot insert component into FeatureComponents table: %d\n", r
);
968 add_directory_entry( hdb
, "'TestParent', 'TARGETDIR', 'TestParent'" );
969 add_directory_entry( hdb
, "'TestDir', 'TestParent', 'TestDir'" );
971 r
= create_file_table( hdb
);
972 ok( r
== S_OK
, "cannot create File table: %d\n", r
);
974 r
= add_file_entry( hdb
, "'RootFile', 'RootComp', 'rootfile.txt', 0, '', '1033', 8192, 1" );
975 ok( r
== S_OK
, "cannot add file to the File table: %d\n", r
);
977 r
= add_file_entry( hdb
, "'TestFile', 'TestComp', 'testfile.txt', 0, '', '1033', 8192, 1" );
978 ok( r
== S_OK
, "cannot add file to the File table: %d\n", r
);
980 hpkg
= package_from_db( hdb
);
981 ok( hpkg
, "failed to create package\n");
983 r
= MsiDoAction( hpkg
, "CostInitialize");
984 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
986 r
= MsiDoAction( hpkg
, "FileCost");
987 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
989 r
= MsiDoAction( hpkg
, "CostFinalize");
990 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
992 r
= MsiSetTargetPath( 0, NULL
, NULL
);
993 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
995 r
= MsiSetTargetPath( 0, "boo", "C:\\bogusx" );
996 ok( r
== ERROR_INVALID_HANDLE
, "wrong return val\n");
998 r
= MsiSetTargetPath( hpkg
, "boo", NULL
);
999 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
1001 r
= MsiSetTargetPath( hpkg
, "boo", "c:\\bogusx" );
1002 ok( r
== ERROR_DIRECTORY
, "wrong return val\n");
1004 sz
= sizeof tempdir
- 1;
1005 r
= MsiGetTargetPath( hpkg
, "TARGETDIR", tempdir
, &sz
);
1006 sprintf( file
, "%srootfile.txt", tempdir
);
1007 query_file_path( hpkg
, "[#RootFile]", buffer
);
1008 ok( r
== ERROR_SUCCESS
, "failed to get target path: %d\n", r
);
1009 ok( !lstrcmp(buffer
, file
), "Expected %s, got %s\n", file
, buffer
);
1011 GetTempFileName( tempdir
, "_wt", 0, buffer
);
1012 sprintf( tempdir
, "%s\\subdir", buffer
);
1014 r
= MsiSetTargetPath( hpkg
, "TARGETDIR", buffer
);
1015 ok( r
== ERROR_SUCCESS
|| r
== ERROR_DIRECTORY
,
1016 "MsiSetTargetPath on file returned %d\n", r
);
1018 r
= MsiSetTargetPath( hpkg
, "TARGETDIR", tempdir
);
1019 ok( r
== ERROR_SUCCESS
|| r
== ERROR_DIRECTORY
,
1020 "MsiSetTargetPath on 'subdir' of file returned %d\n", r
);
1022 DeleteFile( buffer
);
1024 r
= MsiSetTargetPath( hpkg
, "TARGETDIR", buffer
);
1025 ok( r
== ERROR_SUCCESS
, "MsiSetTargetPath returned %d\n", r
);
1027 r
= GetFileAttributes( buffer
);
1028 ok ( r
== INVALID_FILE_ATTRIBUTES
, "file/directory exists after MsiSetTargetPath. Attributes: %08X\n", r
);
1030 r
= MsiSetTargetPath( hpkg
, "TARGETDIR", tempdir
);
1031 ok( r
== ERROR_SUCCESS
, "MsiSetTargetPath on subsubdir returned %d\n", r
);
1033 sz
= sizeof buffer
- 1;
1034 lstrcat( tempdir
, "\\" );
1035 r
= MsiGetTargetPath( hpkg
, "TARGETDIR", buffer
, &sz
);
1036 ok( r
== ERROR_SUCCESS
, "failed to get target path: %d\n", r
);
1037 ok( !lstrcmp(buffer
, tempdir
), "Expected %s, got %s\n", tempdir
, buffer
);
1039 sprintf( file
, "%srootfile.txt", tempdir
);
1040 query_file_path( hpkg
, "[#RootFile]", buffer
);
1041 ok( !lstrcmp(buffer
, file
), "Expected %s, got %s\n", file
, buffer
);
1043 r
= MsiSetTargetPath( hpkg
, "TestParent", "C:\\one\\two" );
1044 ok( r
== ERROR_SUCCESS
, "MsiSetTargetPath returned %d\n", r
);
1046 query_file_path( hpkg
, "[#TestFile]", buffer
);
1047 ok( !lstrcmp(buffer
, "C:\\one\\two\\TestDir\\testfile.txt"),
1048 "Expected C:\\one\\two\\TestDir\\testfile.txt, got %s\n", buffer
);
1050 sz
= sizeof buffer
- 1;
1051 r
= MsiGetTargetPath( hpkg
, "TestParent", buffer
, &sz
);
1052 ok( r
== ERROR_SUCCESS
, "failed to get target path: %d\n", r
);
1053 ok( !lstrcmp(buffer
, "C:\\one\\two\\"), "Expected C:\\one\\two\\, got %s\n", buffer
);
1055 MsiCloseHandle( hpkg
);
1058 static void test_condition(void)
1063 hpkg
= package_from_db(create_package_db());
1064 ok( hpkg
, "failed to create package\n");
1066 r
= MsiEvaluateCondition(0, NULL
);
1067 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1069 r
= MsiEvaluateCondition(hpkg
, NULL
);
1070 ok( r
== MSICONDITION_NONE
, "wrong return val\n");
1072 r
= MsiEvaluateCondition(hpkg
, "");
1073 ok( r
== MSICONDITION_NONE
, "wrong return val\n");
1075 r
= MsiEvaluateCondition(hpkg
, "1");
1076 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1078 r
= MsiEvaluateCondition(hpkg
, "0");
1079 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1081 r
= MsiEvaluateCondition(hpkg
, "-1");
1082 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1084 r
= MsiEvaluateCondition(hpkg
, "0 = 0");
1085 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1087 r
= MsiEvaluateCondition(hpkg
, "0 <> 0");
1088 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1090 r
= MsiEvaluateCondition(hpkg
, "0 = 1");
1091 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1093 r
= MsiEvaluateCondition(hpkg
, "0 > 1");
1094 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1096 r
= MsiEvaluateCondition(hpkg
, "0 ~> 1");
1097 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1099 r
= MsiEvaluateCondition(hpkg
, "1 > 1");
1100 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1102 r
= MsiEvaluateCondition(hpkg
, "1 ~> 1");
1103 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1105 r
= MsiEvaluateCondition(hpkg
, "0 >= 1");
1106 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1108 r
= MsiEvaluateCondition(hpkg
, "0 ~>= 1");
1109 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1111 r
= MsiEvaluateCondition(hpkg
, "1 >= 1");
1112 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1114 r
= MsiEvaluateCondition(hpkg
, "1 ~>= 1");
1115 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1117 r
= MsiEvaluateCondition(hpkg
, "0 < 1");
1118 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1120 r
= MsiEvaluateCondition(hpkg
, "0 ~< 1");
1121 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1123 r
= MsiEvaluateCondition(hpkg
, "1 < 1");
1124 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1126 r
= MsiEvaluateCondition(hpkg
, "1 ~< 1");
1127 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1129 r
= MsiEvaluateCondition(hpkg
, "0 <= 1");
1130 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1132 r
= MsiEvaluateCondition(hpkg
, "0 ~<= 1");
1133 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1135 r
= MsiEvaluateCondition(hpkg
, "1 <= 1");
1136 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1138 r
= MsiEvaluateCondition(hpkg
, "1 ~<= 1");
1139 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1141 r
= MsiEvaluateCondition(hpkg
, "0 >=");
1142 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1144 r
= MsiEvaluateCondition(hpkg
, " ");
1145 ok( r
== MSICONDITION_NONE
, "wrong return val\n");
1147 r
= MsiEvaluateCondition(hpkg
, "LicView <> \"1\"");
1148 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1150 r
= MsiEvaluateCondition(hpkg
, "LicView <> \"0\"");
1151 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1153 r
= MsiEvaluateCondition(hpkg
, "LicView <> LicView");
1154 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1156 r
= MsiEvaluateCondition(hpkg
, "not 0");
1157 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1159 r
= MsiEvaluateCondition(hpkg
, "not LicView");
1160 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1162 r
= MsiEvaluateCondition(hpkg
, "not \"A\"");
1163 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1165 r
= MsiEvaluateCondition(hpkg
, "~not \"A\"");
1166 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1168 r
= MsiEvaluateCondition(hpkg
, "\"0\"");
1169 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1171 r
= MsiEvaluateCondition(hpkg
, "1 and 2");
1172 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1174 r
= MsiEvaluateCondition(hpkg
, "not 0 and 3");
1175 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1177 r
= MsiEvaluateCondition(hpkg
, "not 0 and 0");
1178 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1180 r
= MsiEvaluateCondition(hpkg
, "not 0 or 1");
1181 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1183 r
= MsiEvaluateCondition(hpkg
, "(0)");
1184 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1186 r
= MsiEvaluateCondition(hpkg
, "(((((1))))))");
1187 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1189 r
= MsiEvaluateCondition(hpkg
, "(((((1)))))");
1190 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1192 r
= MsiEvaluateCondition(hpkg
, " \"A\" < \"B\" ");
1193 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1195 r
= MsiEvaluateCondition(hpkg
, " \"A\" > \"B\" ");
1196 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1198 r
= MsiEvaluateCondition(hpkg
, " \"1\" > \"12\" ");
1199 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1201 r
= MsiEvaluateCondition(hpkg
, " \"100\" < \"21\" ");
1202 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1204 r
= MsiEvaluateCondition(hpkg
, "0 < > 0");
1205 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1207 r
= MsiEvaluateCondition(hpkg
, "(1<<1) == 2");
1208 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1210 r
= MsiEvaluateCondition(hpkg
, " \"A\" = \"a\" ");
1211 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1213 r
= MsiEvaluateCondition(hpkg
, " \"A\" ~ = \"a\" ");
1214 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1216 r
= MsiEvaluateCondition(hpkg
, " \"A\" ~= \"a\" ");
1217 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1219 r
= MsiEvaluateCondition(hpkg
, " \"A\" ~= 1 ");
1220 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1222 r
= MsiEvaluateCondition(hpkg
, " \"A\" = 1 ");
1223 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1225 r
= MsiEvaluateCondition(hpkg
, " 1 ~= 1 ");
1226 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1228 r
= MsiEvaluateCondition(hpkg
, " 1 ~= \"1\" ");
1229 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1231 r
= MsiEvaluateCondition(hpkg
, " 1 = \"1\" ");
1232 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1234 r
= MsiEvaluateCondition(hpkg
, " 0 = \"1\" ");
1235 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1237 r
= MsiEvaluateCondition(hpkg
, " 0 < \"100\" ");
1238 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1240 r
= MsiEvaluateCondition(hpkg
, " 100 > \"0\" ");
1241 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1243 r
= MsiEvaluateCondition(hpkg
, "1 XOR 1");
1244 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1246 r
= MsiEvaluateCondition(hpkg
, "1 IMP 1");
1247 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1249 r
= MsiEvaluateCondition(hpkg
, "1 IMP 0");
1250 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1252 r
= MsiEvaluateCondition(hpkg
, "0 IMP 0");
1253 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1255 r
= MsiEvaluateCondition(hpkg
, "0 EQV 0");
1256 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1258 r
= MsiEvaluateCondition(hpkg
, "0 EQV 1");
1259 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1261 r
= MsiEvaluateCondition(hpkg
, "1 IMP 1 OR 0");
1262 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1264 r
= MsiEvaluateCondition(hpkg
, "1 IMPL 1");
1265 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1267 r
= MsiEvaluateCondition(hpkg
, "\"ASFD\" >< \"S\" ");
1268 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1270 r
= MsiEvaluateCondition(hpkg
, "\"ASFD\" ~>< \"s\" ");
1271 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1273 r
= MsiEvaluateCondition(hpkg
, "\"ASFD\" ~>< \"\" ");
1274 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1276 r
= MsiEvaluateCondition(hpkg
, "\"ASFD\" ~>< \"sss\" ");
1277 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1279 MsiSetProperty(hpkg
, "mm", "5" );
1281 r
= MsiEvaluateCondition(hpkg
, "mm = 5");
1282 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1284 r
= MsiEvaluateCondition(hpkg
, "mm < 6");
1285 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1287 r
= MsiEvaluateCondition(hpkg
, "mm <= 5");
1288 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1290 r
= MsiEvaluateCondition(hpkg
, "mm > 4");
1291 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1293 r
= MsiEvaluateCondition(hpkg
, "mm < 12");
1294 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1296 r
= MsiEvaluateCondition(hpkg
, "mm = \"5\"");
1297 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1299 r
= MsiEvaluateCondition(hpkg
, "0 = \"\"");
1300 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1302 r
= MsiEvaluateCondition(hpkg
, "0 AND \"\"");
1303 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1305 r
= MsiEvaluateCondition(hpkg
, "1 AND \"\"");
1306 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1308 r
= MsiEvaluateCondition(hpkg
, "1 AND \"1\"");
1309 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1311 r
= MsiEvaluateCondition(hpkg
, "3 >< 1");
1312 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1314 r
= MsiEvaluateCondition(hpkg
, "3 >< 4");
1315 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1317 r
= MsiEvaluateCondition(hpkg
, "NOT 0 AND 0");
1318 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1320 r
= MsiEvaluateCondition(hpkg
, "NOT 0 AND 1");
1321 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1323 r
= MsiEvaluateCondition(hpkg
, "NOT 1 OR 0");
1324 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1326 r
= MsiEvaluateCondition(hpkg
, "0 AND 1 OR 1");
1327 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1329 r
= MsiEvaluateCondition(hpkg
, "0 AND 0 OR 1");
1330 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1332 r
= MsiEvaluateCondition(hpkg
, "NOT 0 AND 1 OR 0");
1333 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1335 r
= MsiEvaluateCondition(hpkg
, "_1 = _1");
1336 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1338 r
= MsiEvaluateCondition(hpkg
, "( 1 AND 1 ) = 2");
1339 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1341 r
= MsiEvaluateCondition(hpkg
, "NOT ( 1 AND 1 )");
1342 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1344 r
= MsiEvaluateCondition(hpkg
, "NOT A AND (BBBBBBBBBB=2 OR CCC=1) AND Ddddddddd");
1345 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1347 r
= MsiEvaluateCondition(hpkg
, "Installed<>\"\"");
1348 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1350 r
= MsiEvaluateCondition(hpkg
, "NOT 1 AND 0");
1351 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1353 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1354 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1356 r
= MsiEvaluateCondition(hpkg
, "bandalmael<>0");
1357 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1359 r
= MsiEvaluateCondition(hpkg
, "bandalmael<0");
1360 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1362 r
= MsiEvaluateCondition(hpkg
, "bandalmael>0");
1363 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1365 r
= MsiEvaluateCondition(hpkg
, "bandalmael>=0");
1366 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1368 r
= MsiEvaluateCondition(hpkg
, "bandalmael<=0");
1369 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1371 r
= MsiEvaluateCondition(hpkg
, "bandalmael~<>0");
1372 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1374 MsiSetProperty(hpkg
, "bandalmael", "0" );
1375 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1376 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1378 MsiSetProperty(hpkg
, "bandalmael", "" );
1379 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1380 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1382 MsiSetProperty(hpkg
, "bandalmael", "asdf" );
1383 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1384 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1386 MsiSetProperty(hpkg
, "bandalmael", "0asdf" );
1387 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1388 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1390 MsiSetProperty(hpkg
, "bandalmael", "0 " );
1391 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1392 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1394 MsiSetProperty(hpkg
, "bandalmael", "-0" );
1395 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1396 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1398 MsiSetProperty(hpkg
, "bandalmael", "0000000000000" );
1399 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1400 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1402 MsiSetProperty(hpkg
, "bandalmael", "--0" );
1403 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1404 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1406 MsiSetProperty(hpkg
, "bandalmael", "0x00" );
1407 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1408 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1410 MsiSetProperty(hpkg
, "bandalmael", "-" );
1411 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1412 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1414 MsiSetProperty(hpkg
, "bandalmael", "+0" );
1415 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1416 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1418 MsiSetProperty(hpkg
, "bandalmael", "0.0" );
1419 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1420 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1421 r
= MsiEvaluateCondition(hpkg
, "bandalmael<>0");
1422 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1424 MsiSetProperty(hpkg
, "one", "hi");
1425 MsiSetProperty(hpkg
, "two", "hithere");
1426 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1427 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1429 MsiSetProperty(hpkg
, "one", "hithere");
1430 MsiSetProperty(hpkg
, "two", "hi");
1431 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1432 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1434 MsiSetProperty(hpkg
, "one", "hello");
1435 MsiSetProperty(hpkg
, "two", "hi");
1436 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1437 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1439 MsiSetProperty(hpkg
, "one", "hellohithere");
1440 MsiSetProperty(hpkg
, "two", "hi");
1441 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1442 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1444 MsiSetProperty(hpkg
, "one", "");
1445 MsiSetProperty(hpkg
, "two", "hi");
1446 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1447 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1449 MsiSetProperty(hpkg
, "one", "hi");
1450 MsiSetProperty(hpkg
, "two", "");
1451 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1452 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1454 MsiSetProperty(hpkg
, "one", "");
1455 MsiSetProperty(hpkg
, "two", "");
1456 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1457 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1459 MsiSetProperty(hpkg
, "one", "1234");
1460 MsiSetProperty(hpkg
, "two", "1");
1461 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1462 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1464 MsiSetProperty(hpkg
, "one", "one 1234");
1465 MsiSetProperty(hpkg
, "two", "1");
1466 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1467 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1469 MsiSetProperty(hpkg
, "one", "hithere");
1470 MsiSetProperty(hpkg
, "two", "hi");
1471 r
= MsiEvaluateCondition(hpkg
, "one << two");
1472 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1474 MsiSetProperty(hpkg
, "one", "hi");
1475 MsiSetProperty(hpkg
, "two", "hithere");
1476 r
= MsiEvaluateCondition(hpkg
, "one << two");
1477 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1479 MsiSetProperty(hpkg
, "one", "hi");
1480 MsiSetProperty(hpkg
, "two", "hi");
1481 r
= MsiEvaluateCondition(hpkg
, "one << two");
1482 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1484 MsiSetProperty(hpkg
, "one", "abcdhithere");
1485 MsiSetProperty(hpkg
, "two", "hi");
1486 r
= MsiEvaluateCondition(hpkg
, "one << two");
1487 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1489 MsiSetProperty(hpkg
, "one", "");
1490 MsiSetProperty(hpkg
, "two", "hi");
1491 r
= MsiEvaluateCondition(hpkg
, "one << two");
1492 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1494 MsiSetProperty(hpkg
, "one", "hithere");
1495 MsiSetProperty(hpkg
, "two", "");
1496 r
= MsiEvaluateCondition(hpkg
, "one << two");
1497 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1499 MsiSetProperty(hpkg
, "one", "");
1500 MsiSetProperty(hpkg
, "two", "");
1501 r
= MsiEvaluateCondition(hpkg
, "one << two");
1502 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1504 MsiSetProperty(hpkg
, "one", "1234");
1505 MsiSetProperty(hpkg
, "two", "1");
1506 r
= MsiEvaluateCondition(hpkg
, "one << two");
1507 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1509 MsiSetProperty(hpkg
, "one", "1234 one");
1510 MsiSetProperty(hpkg
, "two", "1");
1511 r
= MsiEvaluateCondition(hpkg
, "one << two");
1512 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1514 MsiSetProperty(hpkg
, "one", "hithere");
1515 MsiSetProperty(hpkg
, "two", "there");
1516 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1517 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1519 MsiSetProperty(hpkg
, "one", "hithere");
1520 MsiSetProperty(hpkg
, "two", "hi");
1521 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1522 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1524 MsiSetProperty(hpkg
, "one", "there");
1525 MsiSetProperty(hpkg
, "two", "hithere");
1526 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1527 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1529 MsiSetProperty(hpkg
, "one", "there");
1530 MsiSetProperty(hpkg
, "two", "there");
1531 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1532 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1534 MsiSetProperty(hpkg
, "one", "abcdhithere");
1535 MsiSetProperty(hpkg
, "two", "hi");
1536 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1537 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1539 MsiSetProperty(hpkg
, "one", "");
1540 MsiSetProperty(hpkg
, "two", "there");
1541 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1542 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1544 MsiSetProperty(hpkg
, "one", "there");
1545 MsiSetProperty(hpkg
, "two", "");
1546 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1547 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1549 MsiSetProperty(hpkg
, "one", "");
1550 MsiSetProperty(hpkg
, "two", "");
1551 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1552 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1554 MsiSetProperty(hpkg
, "one", "1234");
1555 MsiSetProperty(hpkg
, "two", "4");
1556 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1557 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1559 MsiSetProperty(hpkg
, "one", "one 1234");
1560 MsiSetProperty(hpkg
, "two", "4");
1561 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1562 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1564 MsiSetProperty(hpkg
, "MsiNetAssemblySupport", NULL
); /* make sure it's empty */
1566 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322\"");
1567 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1569 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport > \"1.1.4322\"");
1570 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1572 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport >= \"1.1.4322\"");
1573 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1575 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport <= \"1.1.4322\"");
1576 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1578 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport <> \"1.1.4322\"");
1579 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1581 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport ~< \"1.1.4322\"");
1582 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1584 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"abcd\"");
1585 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1587 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a1.1.4322\"");
1588 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1590 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322a\"");
1591 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1593 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"0000001.1.4322\"");
1594 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1596 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322.1\"");
1597 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1599 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322.1.1\"");
1600 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1602 r
= MsiEvaluateCondition(hpkg
, "\"2\" < \"1.1");
1603 ok( r
== MSICONDITION_ERROR
, "wrong return val (%d)\n", r
);
1605 r
= MsiEvaluateCondition(hpkg
, "\"2\" < \"1.1\"");
1606 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1608 r
= MsiEvaluateCondition(hpkg
, "\"2\" < \"12.1\"");
1609 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1611 r
= MsiEvaluateCondition(hpkg
, "\"02.1\" < \"2.11\"");
1612 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1614 r
= MsiEvaluateCondition(hpkg
, "\"02.1.1\" < \"2.1\"");
1615 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1617 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1\"");
1618 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1620 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1\"");
1621 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1623 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"0\"");
1624 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1626 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"-1\"");
1627 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1629 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a\"");
1630 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1632 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"!\"");
1633 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1635 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"!\"");
1636 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1638 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"/\"");
1639 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1641 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \" \"");
1642 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1644 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"azAZ_\"");
1645 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1647 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a[a]\"");
1648 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1650 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a[a]a\"");
1651 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1653 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"[a]\"");
1654 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1656 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"[a]a\"");
1657 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1659 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"{a}\"");
1660 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1662 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"{a\"");
1663 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1665 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"[a\"");
1666 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1668 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a{\"");
1669 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1671 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a]\"");
1672 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1674 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"A\"");
1675 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1677 MsiSetProperty(hpkg
, "MsiNetAssemblySupport", "1.1.4322");
1678 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322\"");
1679 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1681 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.14322\"");
1682 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1684 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.5\"");
1685 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1687 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1\"");
1688 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1690 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1\"");
1691 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1693 MsiSetProperty(hpkg
, "one", "1");
1694 r
= MsiEvaluateCondition(hpkg
, "one < \"1\"");
1695 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1697 MsiSetProperty(hpkg
, "X", "5.0");
1699 r
= MsiEvaluateCondition(hpkg
, "X != \"\"");
1700 ok( r
== MSICONDITION_ERROR
, "wrong return val (%d)\n", r
);
1702 r
= MsiEvaluateCondition(hpkg
, "X =\"5.0\"");
1703 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1705 r
= MsiEvaluateCondition(hpkg
, "X =\"5.1\"");
1706 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1708 r
= MsiEvaluateCondition(hpkg
, "X =\"6.0\"");
1709 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1711 r
= MsiEvaluateCondition(hpkg
, "X =\"5.0\" or X =\"5.1\" or X =\"6.0\"");
1712 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1714 r
= MsiEvaluateCondition(hpkg
, "(X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1715 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1717 r
= MsiEvaluateCondition(hpkg
, "X !=\"\" and (X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1718 ok( r
== MSICONDITION_ERROR
, "wrong return val (%d)\n", r
);
1720 /* feature doesn't exist */
1721 r
= MsiEvaluateCondition(hpkg
, "&nofeature");
1722 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1724 MsiSetProperty(hpkg
, "A", "2");
1725 MsiSetProperty(hpkg
, "X", "50");
1727 r
= MsiEvaluateCondition(hpkg
, "2 <= X");
1728 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1730 r
= MsiEvaluateCondition(hpkg
, "A <= X");
1731 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1733 r
= MsiEvaluateCondition(hpkg
, "A <= 50");
1734 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1736 MsiSetProperty(hpkg
, "X", "50val");
1738 r
= MsiEvaluateCondition(hpkg
, "2 <= X");
1739 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1741 r
= MsiEvaluateCondition(hpkg
, "A <= X");
1742 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1744 MsiSetProperty(hpkg
, "A", "7");
1745 MsiSetProperty(hpkg
, "X", "50");
1747 r
= MsiEvaluateCondition(hpkg
, "7 <= X");
1748 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1750 r
= MsiEvaluateCondition(hpkg
, "A <= X");
1751 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1753 r
= MsiEvaluateCondition(hpkg
, "A <= 50");
1754 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1756 MsiSetProperty(hpkg
, "X", "50val");
1758 r
= MsiEvaluateCondition(hpkg
, "2 <= X");
1759 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1761 r
= MsiEvaluateCondition(hpkg
, "A <= X");
1762 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1764 MsiCloseHandle( hpkg
);
1765 DeleteFile(msifile
);
1768 static BOOL
check_prop_empty( MSIHANDLE hpkg
, const char * prop
)
1776 r
= MsiGetProperty( hpkg
, prop
, buffer
, &sz
);
1777 return r
== ERROR_SUCCESS
&& buffer
[0] == 0 && sz
== 0;
1780 static void test_props(void)
1782 MSIHANDLE hpkg
, hdb
;
1787 hdb
= create_package_db();
1789 "CREATE TABLE `Property` ( "
1790 "`Property` CHAR(255) NOT NULL, "
1791 "`Value` CHAR(255) "
1792 "PRIMARY KEY `Property`)" );
1793 ok( r
== ERROR_SUCCESS
, "Failed\n" );
1796 "INSERT INTO `Property` "
1797 "(`Property`, `Value`) "
1798 "VALUES( 'MetadataCompName', 'Photoshop.dll' )");
1799 ok( r
== ERROR_SUCCESS
, "Failed\n" );
1801 hpkg
= package_from_db( hdb
);
1802 ok( hpkg
, "failed to create package\n");
1804 /* test invalid values */
1805 r
= MsiGetProperty( 0, NULL
, NULL
, NULL
);
1806 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
1808 r
= MsiGetProperty( hpkg
, NULL
, NULL
, NULL
);
1809 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
1811 r
= MsiGetProperty( hpkg
, "boo", NULL
, NULL
);
1812 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1814 r
= MsiGetProperty( hpkg
, "boo", buffer
, NULL
);
1815 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
1817 /* test retrieving an empty/nonexistent property */
1819 r
= MsiGetProperty( hpkg
, "boo", NULL
, &sz
);
1820 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1821 ok( sz
== 0, "wrong size returned\n");
1823 check_prop_empty( hpkg
, "boo");
1826 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1827 ok( r
== ERROR_MORE_DATA
, "wrong return val\n");
1828 ok( !strcmp(buffer
,"x"), "buffer was changed\n");
1829 ok( sz
== 0, "wrong size returned\n");
1833 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1834 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1835 ok( buffer
[0] == 0, "buffer was not changed\n");
1836 ok( sz
== 0, "wrong size returned\n");
1838 /* set the property to something */
1839 r
= MsiSetProperty( 0, NULL
, NULL
);
1840 ok( r
== ERROR_INVALID_HANDLE
, "wrong return val\n");
1842 r
= MsiSetProperty( hpkg
, NULL
, NULL
);
1843 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
1845 r
= MsiSetProperty( hpkg
, "", NULL
);
1846 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1848 /* try set and get some illegal property identifiers */
1849 r
= MsiSetProperty( hpkg
, "", "asdf" );
1850 ok( r
== ERROR_FUNCTION_FAILED
, "wrong return val\n");
1852 r
= MsiSetProperty( hpkg
, "=", "asdf" );
1853 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1855 r
= MsiSetProperty( hpkg
, " ", "asdf" );
1856 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1858 r
= MsiSetProperty( hpkg
, "'", "asdf" );
1859 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1863 r
= MsiGetProperty( hpkg
, "'", buffer
, &sz
);
1864 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1865 ok( !strcmp(buffer
,"asdf"), "buffer was not changed\n");
1867 /* set empty values */
1868 r
= MsiSetProperty( hpkg
, "boo", NULL
);
1869 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1870 ok( check_prop_empty( hpkg
, "boo"), "prop wasn't empty\n");
1872 r
= MsiSetProperty( hpkg
, "boo", "" );
1873 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1874 ok( check_prop_empty( hpkg
, "boo"), "prop wasn't empty\n");
1876 /* set a non-empty value */
1877 r
= MsiSetProperty( hpkg
, "boo", "xyz" );
1878 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1882 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1883 ok( r
== ERROR_MORE_DATA
, "wrong return val\n");
1884 ok( buffer
[0] == 0, "buffer was not changed\n");
1885 ok( sz
== 3, "wrong size returned\n");
1889 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1890 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1891 ok( !strcmp(buffer
,"xyz"), "buffer was not changed\n");
1892 ok( sz
== 3, "wrong size returned\n");
1896 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1897 ok( r
== ERROR_MORE_DATA
, "wrong return val\n");
1898 ok( !strcmp(buffer
,"xy"), "buffer was not changed\n");
1899 ok( sz
== 3, "wrong size returned\n");
1901 r
= MsiSetProperty(hpkg
, "SourceDir", "foo");
1902 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1905 r
= MsiGetProperty(hpkg
, "SOURCEDIR", buffer
, &sz
);
1906 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1907 ok( !strcmp(buffer
,""), "buffer wrong\n");
1908 ok( sz
== 0, "wrong size returned\n");
1911 r
= MsiGetProperty(hpkg
, "SOMERANDOMNAME", buffer
, &sz
);
1912 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1913 ok( !strcmp(buffer
,""), "buffer wrong\n");
1914 ok( sz
== 0, "wrong size returned\n");
1917 r
= MsiGetProperty(hpkg
, "SourceDir", buffer
, &sz
);
1918 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1919 ok( !strcmp(buffer
,"foo"), "buffer wrong\n");
1920 ok( sz
== 3, "wrong size returned\n");
1922 r
= MsiSetProperty(hpkg
, "MetadataCompName", "Photoshop.dll");
1923 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1926 r
= MsiGetProperty(hpkg
, "MetadataCompName", NULL
, &sz
);
1927 ok( r
== ERROR_SUCCESS
, "return wrong\n");
1928 ok( sz
== 13, "size wrong (%d)\n", sz
);
1931 r
= MsiGetProperty(hpkg
, "MetadataCompName", buffer
, &sz
);
1932 ok( r
== ERROR_MORE_DATA
, "return wrong\n");
1933 ok( !strcmp(buffer
,"Photoshop.dl"), "buffer wrong\n");
1935 r
= MsiSetProperty(hpkg
, "property", "value");
1936 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1939 r
= MsiGetProperty(hpkg
, "property", buffer
, &sz
);
1940 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1941 ok( !strcmp(buffer
, "value"), "Expected value, got %s\n", buffer
);
1943 r
= MsiSetProperty(hpkg
, "property", NULL
);
1944 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1947 r
= MsiGetProperty(hpkg
, "property", buffer
, &sz
);
1948 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1949 ok( !strlen(buffer
), "Expected empty string, got %s\n", buffer
);
1951 MsiCloseHandle( hpkg
);
1952 DeleteFile(msifile
);
1955 static BOOL
find_prop_in_property(MSIHANDLE hdb
, LPCSTR prop
, LPCSTR val
)
1957 MSIHANDLE hview
, hrec
;
1959 CHAR buffer
[MAX_PATH
];
1963 r
= MsiDatabaseOpenView(hdb
, "SELECT * FROM `_Property`", &hview
);
1964 ok(r
== ERROR_SUCCESS
, "MsiDatabaseOpenView failed\n");
1965 r
= MsiViewExecute(hview
, 0);
1966 ok(r
== ERROR_SUCCESS
, "MsiViewExecute failed\n");
1969 while (r
== ERROR_SUCCESS
&& !found
)
1971 r
= MsiViewFetch(hview
, &hrec
);
1972 if (r
!= ERROR_SUCCESS
) break;
1975 r
= MsiRecordGetString(hrec
, 1, buffer
, &sz
);
1976 if (r
== ERROR_SUCCESS
&& !lstrcmpA(buffer
, prop
))
1979 r
= MsiRecordGetString(hrec
, 2, buffer
, &sz
);
1980 if (r
== ERROR_SUCCESS
&& !lstrcmpA(buffer
, val
))
1984 MsiCloseHandle(hrec
);
1987 MsiViewClose(hview
);
1988 MsiCloseHandle(hview
);
1993 static void test_property_table(void)
1997 MSIHANDLE hpkg
, hdb
, hrec
;
1998 char buffer
[MAX_PATH
];
2002 hdb
= create_package_db();
2003 ok( hdb
, "failed to create package\n");
2005 hpkg
= package_from_db(hdb
);
2006 ok( hpkg
, "failed to create package\n");
2008 MsiCloseHandle(hdb
);
2010 hdb
= MsiGetActiveDatabase(hpkg
);
2012 query
= "CREATE TABLE `_Property` ( "
2013 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
2014 r
= run_query(hdb
, query
);
2015 ok(r
== ERROR_BAD_QUERY_SYNTAX
, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r
);
2017 MsiCloseHandle(hdb
);
2018 MsiCloseHandle(hpkg
);
2019 DeleteFile(msifile
);
2021 hdb
= create_package_db();
2022 ok( hdb
, "failed to create package\n");
2024 query
= "CREATE TABLE `_Property` ( "
2025 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
2026 r
= run_query(hdb
, query
);
2027 ok(r
== ERROR_SUCCESS
, "failed to create table\n");
2029 query
= "ALTER `_Property` ADD `foo` INTEGER";
2030 r
= run_query(hdb
, query
);
2031 ok(r
== ERROR_BAD_QUERY_SYNTAX
, "failed to add column\n");
2033 query
= "ALTER TABLE `_Property` ADD `foo` INTEGER";
2034 r
= run_query(hdb
, query
);
2035 ok(r
== ERROR_BAD_QUERY_SYNTAX
, "failed to add column\n");
2037 query
= "ALTER TABLE `_Property` ADD `extra` INTEGER";
2038 r
= run_query(hdb
, query
);
2039 ok(r
== ERROR_SUCCESS
, "failed to add column\n");
2041 hpkg
= package_from_db(hdb
);
2044 ok(!hpkg
, "package should not be created\n");
2047 MsiCloseHandle(hdb
);
2048 MsiCloseHandle(hpkg
);
2049 DeleteFile(msifile
);
2051 hdb
= create_package_db();
2052 ok (hdb
, "failed to create package database\n");
2054 r
= create_property_table(hdb
);
2055 ok(r
== ERROR_SUCCESS
, "cannot create Property table: %d\n", r
);
2057 r
= add_property_entry(hdb
, "'prop', 'val'");
2058 ok(r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
2060 hpkg
= package_from_db(hdb
);
2061 ok(hpkg
, "failed to create package\n");
2063 MsiCloseHandle(hdb
);
2066 r
= MsiGetProperty(hpkg
, "prop", buffer
, &sz
);
2067 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2068 ok(!lstrcmp(buffer
, "val"), "Expected val, got %s\n", buffer
);
2070 hdb
= MsiGetActiveDatabase(hpkg
);
2072 found
= find_prop_in_property(hdb
, "prop", "val");
2073 ok(found
, "prop should be in the _Property table\n");
2075 r
= add_property_entry(hdb
, "'dantes', 'mercedes'");
2076 ok(r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
2078 query
= "SELECT * FROM `_Property` WHERE `Property` = 'dantes'";
2079 r
= do_query(hdb
, query
, &hrec
);
2080 ok(r
== ERROR_BAD_QUERY_SYNTAX
, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r
);
2082 found
= find_prop_in_property(hdb
, "dantes", "mercedes");
2083 ok(found
== FALSE
, "dantes should not be in the _Property table\n");
2086 lstrcpy(buffer
, "aaa");
2087 r
= MsiGetProperty(hpkg
, "dantes", buffer
, &sz
);
2088 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2089 ok(lstrlenA(buffer
) == 0, "Expected empty string, got %s\n", buffer
);
2091 r
= MsiSetProperty(hpkg
, "dantes", "mercedes");
2092 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2094 found
= find_prop_in_property(hdb
, "dantes", "mercedes");
2095 ok(found
== TRUE
, "dantes should be in the _Property table\n");
2097 MsiCloseHandle(hdb
);
2098 MsiCloseHandle(hpkg
);
2099 DeleteFile(msifile
);
2102 static UINT
try_query_param( MSIHANDLE hdb
, LPCSTR szQuery
, MSIHANDLE hrec
)
2107 res
= MsiDatabaseOpenView( hdb
, szQuery
, &htab
);
2108 if( res
== ERROR_SUCCESS
)
2112 r
= MsiViewExecute( htab
, hrec
);
2113 if( r
!= ERROR_SUCCESS
)
2116 fprintf(stderr
,"MsiViewExecute failed %08x\n", res
);
2119 r
= MsiViewClose( htab
);
2120 if( r
!= ERROR_SUCCESS
)
2123 r
= MsiCloseHandle( htab
);
2124 if( r
!= ERROR_SUCCESS
)
2130 static UINT
try_query( MSIHANDLE hdb
, LPCSTR szQuery
)
2132 return try_query_param( hdb
, szQuery
, 0 );
2135 static void set_summary_str(MSIHANDLE hdb
, DWORD pid
, LPCSTR value
)
2140 r
= MsiGetSummaryInformationA(hdb
, NULL
, 1, &summary
);
2141 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2143 r
= MsiSummaryInfoSetPropertyA(summary
, pid
, VT_LPSTR
, 0, NULL
, value
);
2144 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
2146 r
= MsiSummaryInfoPersist(summary
);
2147 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
2149 MsiCloseHandle(summary
);
2152 static void set_summary_dword(MSIHANDLE hdb
, DWORD pid
, DWORD value
)
2157 r
= MsiGetSummaryInformationA(hdb
, NULL
, 1, &summary
);
2158 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2160 r
= MsiSummaryInfoSetPropertyA(summary
, pid
, VT_I4
, value
, NULL
, NULL
);
2161 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
2163 r
= MsiSummaryInfoPersist(summary
);
2164 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
2166 MsiCloseHandle(summary
);
2169 static void test_msipackage(void)
2171 MSIHANDLE hdb
= 0, hpack
= 100;
2176 /* NULL szPackagePath */
2177 r
= MsiOpenPackage(NULL
, &hpack
);
2178 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2180 /* empty szPackagePath */
2181 r
= MsiOpenPackage("", &hpack
);
2184 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2187 if (r
== ERROR_SUCCESS
)
2188 MsiCloseHandle(hpack
);
2190 /* nonexistent szPackagePath */
2191 r
= MsiOpenPackage("nonexistent", &hpack
);
2192 ok(r
== ERROR_FILE_NOT_FOUND
, "Expected ERROR_FILE_NOT_FOUND, got %d\n", r
);
2195 r
= MsiOpenPackage(msifile
, NULL
);
2196 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2200 r
= MsiOpenPackage(name
, &hpack
);
2201 ok(r
== ERROR_INVALID_HANDLE
, "Expected ERROR_INVALID_HANDLE, got %d\n", r
);
2203 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_CREATE
, &hdb
);
2204 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2206 /* database exists, but is emtpy */
2207 sprintf(name
, "#%ld", hdb
);
2208 r
= MsiOpenPackage(name
, &hpack
);
2209 ok(r
== ERROR_INSTALL_PACKAGE_INVALID
,
2210 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r
);
2212 query
= "CREATE TABLE `Property` ( "
2213 "`Property` CHAR(72), `Value` CHAR(0) "
2214 "PRIMARY KEY `Property`)";
2215 r
= try_query(hdb
, query
);
2216 ok(r
== ERROR_SUCCESS
, "failed to create Properties table\n");
2218 query
= "CREATE TABLE `InstallExecuteSequence` ("
2219 "`Action` CHAR(72), `Condition` CHAR(0), `Sequence` INTEGER "
2220 "PRIMARY KEY `Action`)";
2221 r
= try_query(hdb
, query
);
2222 ok(r
== ERROR_SUCCESS
, "failed to create InstallExecuteSequence table\n");
2224 /* a few key tables exist */
2225 sprintf(name
, "#%ld", hdb
);
2226 r
= MsiOpenPackage(name
, &hpack
);
2227 ok(r
== ERROR_INSTALL_PACKAGE_INVALID
,
2228 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r
);
2230 MsiCloseHandle(hdb
);
2231 DeleteFile(msifile
);
2233 /* start with a clean database to show what constitutes a valid package */
2234 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_CREATE
, &hdb
);
2235 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2237 sprintf(name
, "#%ld", hdb
);
2239 /* The following summary information props must exist:
2244 set_summary_dword(hdb
, PID_PAGECOUNT
, 100);
2245 r
= MsiOpenPackage(name
, &hpack
);
2246 ok(r
== ERROR_INSTALL_PACKAGE_INVALID
,
2247 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r
);
2249 set_summary_str(hdb
, PID_REVNUMBER
, "{004757CD-5092-49c2-AD20-28E1CE0DF5F2}");
2250 r
= MsiOpenPackage(name
, &hpack
);
2251 ok(r
== ERROR_SUCCESS
,
2252 "Expected ERROR_SUCCESS, got %d\n", r
);
2254 MsiCloseHandle(hpack
);
2255 MsiCloseHandle(hdb
);
2256 DeleteFile(msifile
);
2259 static void test_formatrecord2(void)
2261 MSIHANDLE hpkg
, hrec
;
2266 hpkg
= package_from_db(create_package_db());
2267 ok( hpkg
, "failed to create package\n");
2269 r
= MsiSetProperty(hpkg
, "Manufacturer", " " );
2270 ok( r
== ERROR_SUCCESS
, "set property failed\n");
2272 hrec
= MsiCreateRecord(2);
2273 ok(hrec
, "create record failed\n");
2275 r
= MsiRecordSetString( hrec
, 0, "[ProgramFilesFolder][Manufacturer]\\asdf");
2276 ok( r
== ERROR_SUCCESS
, "format record failed\n");
2280 r
= MsiFormatRecord( hpkg
, hrec
, buffer
, &sz
);
2282 r
= MsiRecordSetString(hrec
, 0, "[foo][1]");
2283 r
= MsiRecordSetString(hrec
, 1, "hoo");
2285 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2286 ok( sz
== 3, "size wrong\n");
2287 ok( 0 == strcmp(buffer
,"hoo"), "wrong output %s\n",buffer
);
2288 ok( r
== ERROR_SUCCESS
, "format failed\n");
2290 r
= MsiRecordSetString(hrec
, 0, "x[~]x");
2292 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2293 ok( sz
== 3, "size wrong\n");
2294 ok( 0 == strcmp(buffer
,"x"), "wrong output %s\n",buffer
);
2295 ok( r
== ERROR_SUCCESS
, "format failed\n");
2297 r
= MsiRecordSetString(hrec
, 0, "[foo.$%}][1]");
2298 r
= MsiRecordSetString(hrec
, 1, "hoo");
2300 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2301 ok( sz
== 3, "size wrong\n");
2302 ok( 0 == strcmp(buffer
,"hoo"), "wrong output %s\n",buffer
);
2303 ok( r
== ERROR_SUCCESS
, "format failed\n");
2305 r
= MsiRecordSetString(hrec
, 0, "[\\[]");
2307 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2308 ok( sz
== 1, "size wrong\n");
2309 ok( 0 == strcmp(buffer
,"["), "wrong output %s\n",buffer
);
2310 ok( r
== ERROR_SUCCESS
, "format failed\n");
2312 SetEnvironmentVariable("FOO", "BAR");
2313 r
= MsiRecordSetString(hrec
, 0, "[%FOO]");
2315 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2316 ok( sz
== 3, "size wrong\n");
2317 ok( 0 == strcmp(buffer
,"BAR"), "wrong output %s\n",buffer
);
2318 ok( r
== ERROR_SUCCESS
, "format failed\n");
2320 r
= MsiRecordSetString(hrec
, 0, "[[1]]");
2321 r
= MsiRecordSetString(hrec
, 1, "%FOO");
2323 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2324 ok( sz
== 3, "size wrong\n");
2325 ok( 0 == strcmp(buffer
,"BAR"), "wrong output %s\n",buffer
);
2326 ok( r
== ERROR_SUCCESS
, "format failed\n");
2328 MsiCloseHandle( hrec
);
2329 MsiCloseHandle( hpkg
);
2330 DeleteFile(msifile
);
2333 static void test_states(void)
2338 INSTALLSTATE state
, action
;
2340 static const CHAR msifile2
[] = "winetest2.msi";
2341 static const CHAR msifile3
[] = "winetest3.msi";
2343 hdb
= create_package_db();
2344 ok ( hdb
, "failed to create package database\n" );
2346 r
= add_directory_entry( hdb
, "'TARGETDIR', '', 'SourceDir'");
2347 ok( r
== ERROR_SUCCESS
, "cannot add directory: %d\n", r
);
2349 r
= create_property_table( hdb
);
2350 ok( r
== ERROR_SUCCESS
, "cannot create Property table: %d\n", r
);
2352 r
= add_property_entry( hdb
, "'ProductCode', '{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}'" );
2353 ok( r
== ERROR_SUCCESS
, "cannot add property entry: %d\n", r
);
2355 r
= add_property_entry( hdb
, "'ProductLanguage', '1033'" );
2356 ok( r
== ERROR_SUCCESS
, "cannot add property entry: %d\n", r
);
2358 r
= add_property_entry( hdb
, "'ProductName', 'MSITEST'" );
2359 ok( r
== ERROR_SUCCESS
, "cannot add property entry: %d\n", r
);
2361 r
= add_property_entry( hdb
, "'ProductVersion', '1.1.1'" );
2362 ok( r
== ERROR_SUCCESS
, "cannot add property entry: %d\n", r
);
2364 r
= create_install_execute_sequence_table( hdb
);
2365 ok( r
== ERROR_SUCCESS
, "cannot create InstallExecuteSequence table: %d\n", r
);
2367 r
= add_install_execute_sequence_entry( hdb
, "'CostInitialize', '', '800'" );
2368 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2370 r
= add_install_execute_sequence_entry( hdb
, "'FileCost', '', '900'" );
2371 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2373 r
= add_install_execute_sequence_entry( hdb
, "'CostFinalize', '', '1000'" );
2374 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2376 r
= add_install_execute_sequence_entry( hdb
, "'InstallValidate', '', '1400'" );
2377 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2379 r
= add_install_execute_sequence_entry( hdb
, "'InstallInitialize', '', '1500'" );
2380 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2382 r
= add_install_execute_sequence_entry( hdb
, "'ProcessComponents', '', '1600'" );
2383 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2385 r
= add_install_execute_sequence_entry( hdb
, "'UnpublishFeatures', '', '1800'" );
2386 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2388 r
= add_install_execute_sequence_entry( hdb
, "'RegisterProduct', '', '6100'" );
2389 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2391 r
= add_install_execute_sequence_entry( hdb
, "'PublishFeatures', '', '6300'" );
2392 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2394 r
= add_install_execute_sequence_entry( hdb
, "'PublishProduct', '', '6400'" );
2395 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2397 r
= add_install_execute_sequence_entry( hdb
, "'InstallFinalize', '', '6600'" );
2398 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2400 r
= create_media_table( hdb
);
2401 ok( r
== ERROR_SUCCESS
, "cannot create media table: %d\n", r
);
2403 r
= add_media_entry( hdb
, "'1', '3', '', '', 'DISK1', ''");
2404 ok( r
== ERROR_SUCCESS
, "cannot add media entry: %d\n", r
);
2406 r
= create_feature_table( hdb
);
2407 ok( r
== ERROR_SUCCESS
, "cannot create Feature table: %d\n", r
);
2409 r
= create_component_table( hdb
);
2410 ok( r
== ERROR_SUCCESS
, "cannot create Component table: %d\n", r
);
2412 /* msidbFeatureAttributesFavorLocal */
2413 r
= add_feature_entry( hdb
, "'one', '', '', '', 2, 1, '', 0" );
2414 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2416 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
2417 r
= add_component_entry( hdb
, "'alpha', '{467EC132-739D-4784-A37B-677AA43DBC94}', 'TARGETDIR', 0, '', 'alpha_file'" );
2418 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2420 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
2421 r
= add_component_entry( hdb
, "'beta', '{2C1F189C-24A6-4C34-B26B-994A6C026506}', 'TARGETDIR', 1, '', 'beta_file'" );
2422 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2424 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
2425 r
= add_component_entry( hdb
, "'gamma', '{C271E2A4-DE2E-4F70-86D1-6984AF7DE2CA}', 'TARGETDIR', 2, '', 'gamma_file'" );
2426 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2428 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSharedDllRefCount */
2429 r
= add_component_entry( hdb
, "'theta', '{4EB3129D-81A8-48D5-9801-75600FED3DD9}', 'TARGETDIR', 8, '', 'theta_file'" );
2430 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2432 /* msidbFeatureAttributesFavorSource */
2433 r
= add_feature_entry( hdb
, "'two', '', '', '', 2, 1, '', 1" );
2434 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2436 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
2437 r
= add_component_entry( hdb
, "'delta', '{938FD4F2-C648-4259-A03C-7AA3B45643F3}', 'TARGETDIR', 0, '', 'delta_file'" );
2438 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2440 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2441 r
= add_component_entry( hdb
, "'epsilon', '{D59713B6-C11D-47F2-A395-1E5321781190}', 'TARGETDIR', 1, '', 'epsilon_file'" );
2442 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2444 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
2445 r
= add_component_entry( hdb
, "'zeta', '{377D33AB-2FAA-42B9-A629-0C0DAE9B9C7A}', 'TARGETDIR', 2, '', 'zeta_file'" );
2446 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2448 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSharedDllRefCount */
2449 r
= add_component_entry( hdb
, "'iota', '{5D36F871-B5ED-4801-9E0F-C46B9E5C9669}', 'TARGETDIR', 8, '', 'iota_file'" );
2450 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2452 /* msidbFeatureAttributesFavorSource */
2453 r
= add_feature_entry( hdb
, "'three', '', '', '', 2, 1, '', 1" );
2454 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2456 /* msidbFeatureAttributesFavorLocal */
2457 r
= add_feature_entry( hdb
, "'four', '', '', '', 2, 1, '', 0" );
2458 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2461 r
= add_feature_entry( hdb
, "'five', '', '', '', 2, 0, '', 1" );
2462 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2464 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2465 r
= add_component_entry( hdb
, "'eta', '{DD89003F-0DD4-41B8-81C0-3411A7DA2695}', 'TARGETDIR', 1, '', 'eta_file'" );
2466 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2468 /* no feature parent:msidbComponentAttributesLocalOnly */
2469 r
= add_component_entry( hdb
, "'kappa', '{D6B93DC3-8DA5-4769-9888-42BFE156BB8B}', 'TARGETDIR', 1, '', 'kappa_file'" );
2470 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2472 /* msidbFeatureAttributesFavorLocal:removed */
2473 r
= add_feature_entry( hdb
, "'six', '', '', '', 2, 1, '', 0" );
2474 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2476 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesLocalOnly */
2477 r
= add_component_entry( hdb
, "'lambda', '{6528C5E4-02A4-4636-A214-7A66A6C35B64}', 'TARGETDIR', 0, '', 'lambda_file'" );
2478 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2480 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSourceOnly */
2481 r
= add_component_entry( hdb
, "'mu', '{97014BAB-6C56-4013-9A63-2BF913B42519}', 'TARGETDIR', 1, '', 'mu_file'" );
2482 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2484 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesOptional */
2485 r
= add_component_entry( hdb
, "'nu', '{943DD0D8-5808-4954-8526-3B8493FEDDCD}', 'TARGETDIR', 2, '', 'nu_file'" );
2486 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2488 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSharedDllRefCount */
2489 r
= add_component_entry( hdb
, "'xi', '{D6CF9EF7-6FCF-4930-B34B-F938AEFF9BDB}', 'TARGETDIR', 8, '', 'xi_file'" );
2490 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2492 /* msidbFeatureAttributesFavorSource:removed */
2493 r
= add_feature_entry( hdb
, "'seven', '', '', '', 2, 1, '', 1" );
2494 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2496 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesLocalOnly */
2497 r
= add_component_entry( hdb
, "'omicron', '{7B57521D-15DB-4141-9AA6-01D934A4433F}', 'TARGETDIR', 0, '', 'omicron_file'" );
2498 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2500 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSourceOnly */
2501 r
= add_component_entry( hdb
, "'pi', '{FB85346B-378E-4492-8769-792305471C81}', 'TARGETDIR', 1, '', 'pi_file'" );
2502 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2504 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesOptional */
2505 r
= add_component_entry( hdb
, "'rho', '{798F2047-7B0C-4783-8BB0-D703E554114B}', 'TARGETDIR', 2, '', 'rho_file'" );
2506 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2508 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSharedDllRefCount */
2509 r
= add_component_entry( hdb
, "'sigma', '{5CE9DDA8-B67B-4736-9D93-99D61C5B93E7}', 'TARGETDIR', 8, '', 'sigma_file'" );
2510 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2512 r
= create_feature_components_table( hdb
);
2513 ok( r
== ERROR_SUCCESS
, "cannot create FeatureComponents table: %d\n", r
);
2515 r
= add_feature_components_entry( hdb
, "'one', 'alpha'" );
2516 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2518 r
= add_feature_components_entry( hdb
, "'one', 'beta'" );
2519 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2521 r
= add_feature_components_entry( hdb
, "'one', 'gamma'" );
2522 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2524 r
= add_feature_components_entry( hdb
, "'one', 'theta'" );
2525 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2527 r
= add_feature_components_entry( hdb
, "'two', 'delta'" );
2528 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2530 r
= add_feature_components_entry( hdb
, "'two', 'epsilon'" );
2531 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2533 r
= add_feature_components_entry( hdb
, "'two', 'zeta'" );
2534 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2536 r
= add_feature_components_entry( hdb
, "'two', 'iota'" );
2537 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2539 r
= add_feature_components_entry( hdb
, "'three', 'eta'" );
2540 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2542 r
= add_feature_components_entry( hdb
, "'four', 'eta'" );
2543 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2545 r
= add_feature_components_entry( hdb
, "'five', 'eta'" );
2546 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2548 r
= add_feature_components_entry( hdb
, "'six', 'lambda'" );
2549 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2551 r
= add_feature_components_entry( hdb
, "'six', 'mu'" );
2552 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2554 r
= add_feature_components_entry( hdb
, "'six', 'nu'" );
2555 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2557 r
= add_feature_components_entry( hdb
, "'six', 'xi'" );
2558 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2560 r
= add_feature_components_entry( hdb
, "'seven', 'omicron'" );
2561 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2563 r
= add_feature_components_entry( hdb
, "'seven', 'pi'" );
2564 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2566 r
= add_feature_components_entry( hdb
, "'seven', 'rho'" );
2567 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2569 r
= add_feature_components_entry( hdb
, "'seven', 'sigma'" );
2570 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2572 r
= create_file_table( hdb
);
2573 ok( r
== ERROR_SUCCESS
, "cannot create File table: %d\n", r
);
2575 r
= add_file_entry( hdb
, "'alpha_file', 'alpha', 'alpha.txt', 100, '', '1033', 8192, 1" );
2576 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2578 r
= add_file_entry( hdb
, "'beta_file', 'beta', 'beta.txt', 0, '', '1033', 8192, 1" );
2579 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2581 r
= add_file_entry( hdb
, "'gamma_file', 'gamma', 'gamma.txt', 0, '', '1033', 8192, 1" );
2582 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2584 r
= add_file_entry( hdb
, "'theta_file', 'theta', 'theta.txt', 0, '', '1033', 8192, 1" );
2585 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2587 r
= add_file_entry( hdb
, "'delta_file', 'delta', 'delta.txt', 0, '', '1033', 8192, 1" );
2588 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2590 r
= add_file_entry( hdb
, "'epsilon_file', 'epsilon', 'epsilon.txt', 0, '', '1033', 8192, 1" );
2591 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2593 r
= add_file_entry( hdb
, "'zeta_file', 'zeta', 'zeta.txt', 0, '', '1033', 8192, 1" );
2594 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2596 r
= add_file_entry( hdb
, "'iota_file', 'iota', 'iota.txt', 0, '', '1033', 8192, 1" );
2597 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2599 /* compressed file */
2600 r
= add_file_entry( hdb
, "'eta_file', 'eta', 'eta.txt', 0, '', '1033', 16384, 1" );
2601 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2603 r
= add_file_entry( hdb
, "'kappa_file', 'kappa', 'kappa.txt', 0, '', '1033', 8192, 1" );
2604 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2606 r
= add_file_entry( hdb
, "'lambda_file', 'lambda', 'lambda.txt', 100, '', '1033', 8192, 1" );
2607 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2609 r
= add_file_entry( hdb
, "'mu_file', 'mu', 'mu.txt', 100, '', '1033', 8192, 1" );
2610 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2612 r
= add_file_entry( hdb
, "'nu_file', 'nu', 'nu.txt', 100, '', '1033', 8192, 1" );
2613 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2615 r
= add_file_entry( hdb
, "'xi_file', 'xi', 'xi.txt', 100, '', '1033', 8192, 1" );
2616 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2618 r
= add_file_entry( hdb
, "'omicron_file', 'omicron', 'omicron.txt', 100, '', '1033', 8192, 1" );
2619 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2621 r
= add_file_entry( hdb
, "'pi_file', 'pi', 'pi.txt', 100, '', '1033', 8192, 1" );
2622 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2624 r
= add_file_entry( hdb
, "'rho_file', 'rho', 'rho.txt', 100, '', '1033', 8192, 1" );
2625 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2627 r
= add_file_entry( hdb
, "'sigma_file', 'sigma', 'sigma.txt', 100, '', '1033', 8192, 1" );
2628 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2630 MsiDatabaseCommit(hdb
);
2632 /* these properties must not be in the saved msi file */
2633 r
= add_property_entry( hdb
, "'ADDLOCAL', 'one,four'");
2634 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
2636 r
= add_property_entry( hdb
, "'ADDSOURCE', 'two,three'");
2637 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
2639 r
= add_property_entry( hdb
, "'REMOVE', 'six,seven'");
2640 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
2642 hpkg
= package_from_db( hdb
);
2643 ok( hpkg
, "failed to create package\n");
2645 MsiCloseHandle(hdb
);
2647 CopyFileA(msifile
, msifile2
, FALSE
);
2648 CopyFileA(msifile
, msifile3
, FALSE
);
2652 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
2653 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2654 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2655 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2659 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
2660 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2661 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2662 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2666 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
2667 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2668 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2669 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2673 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
2674 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2675 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2676 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2680 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
2681 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2682 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2683 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2687 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
2688 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2689 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2690 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2694 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
2695 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2696 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2697 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2701 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
2702 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2703 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2704 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2708 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
2709 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2710 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2711 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2715 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
2716 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2717 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2718 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2722 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
2723 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2724 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2725 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2729 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
2730 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2731 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2732 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2736 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
2737 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2738 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2739 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2743 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
2744 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2745 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2746 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2750 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
2751 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2752 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2753 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2757 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
2758 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2759 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2760 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2764 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
2765 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2766 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2767 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2771 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
2772 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2773 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2774 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2778 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
2779 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2780 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2781 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2785 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
2786 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2787 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2788 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2792 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
2793 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2794 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2795 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2799 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
2800 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2801 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2802 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2806 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
2807 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2808 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2809 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2813 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
2814 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2815 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2816 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2820 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
2821 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2822 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2823 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2825 r
= MsiDoAction( hpkg
, "CostInitialize");
2826 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
2830 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
2831 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2832 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2833 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2837 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
2838 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2839 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2840 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2844 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
2845 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2846 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2847 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2851 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
2852 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2853 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2854 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2858 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
2859 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2860 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2861 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2865 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
2866 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2867 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2868 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2872 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
2873 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2874 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2875 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2879 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
2880 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2881 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2882 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2886 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
2887 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2888 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2889 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2893 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
2894 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2895 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2896 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2900 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
2901 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2902 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2903 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2907 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
2908 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2909 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2910 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2914 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
2915 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2916 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2917 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2921 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
2922 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2923 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2924 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2928 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
2929 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2930 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2931 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2935 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
2936 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2937 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2938 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2942 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
2943 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2944 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2945 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2949 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
2950 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2951 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2952 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2956 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
2957 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2958 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2959 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2963 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
2964 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2965 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2966 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2970 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
2971 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2972 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2973 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2977 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
2978 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2979 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2980 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2984 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
2985 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2986 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2987 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2991 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
2992 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2993 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2994 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2998 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
2999 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3000 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3001 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3003 r
= MsiDoAction( hpkg
, "FileCost");
3004 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
3008 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3009 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3010 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3011 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3015 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
3016 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3017 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3018 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3022 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3023 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3024 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3025 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3029 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3030 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3031 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3032 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3036 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3037 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3038 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3039 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3043 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
3044 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3045 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3046 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3050 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
3051 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3052 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3053 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3057 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3058 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3059 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3060 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3064 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
3065 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3066 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3067 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3071 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
3072 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3073 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3074 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3078 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
3079 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3080 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3081 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3085 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
3086 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3087 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3088 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3092 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
3093 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3094 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3095 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3099 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
3100 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3101 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3102 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3106 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
3107 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3108 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3109 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3113 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
3114 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3115 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3116 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3120 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
3121 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3122 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3123 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3127 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
3128 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3129 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3130 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3134 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3135 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3136 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3137 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3141 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
3142 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3143 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3144 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3148 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
3149 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3150 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3151 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3155 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
3156 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3157 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3158 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3162 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
3163 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3164 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3165 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3169 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
3170 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3171 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3172 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3176 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
3177 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3178 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3179 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3181 r
= MsiDoAction( hpkg
, "CostFinalize");
3182 ok( r
== ERROR_SUCCESS
, "cost finalize failed: %d\n", r
);
3186 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3187 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3188 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3189 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3193 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
3194 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3195 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3196 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3200 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3201 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3202 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3203 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3207 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3208 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3209 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3210 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3214 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3215 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3216 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3217 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3221 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
3222 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3223 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3224 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3228 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
3229 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3230 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3231 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3235 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3236 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3237 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3238 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3242 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
3243 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3244 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3245 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3249 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
3250 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3251 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3252 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3256 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
3257 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3258 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3259 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3263 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
3264 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3265 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3266 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3270 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
3271 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3272 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3273 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3277 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
3278 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3279 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3280 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3284 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
3285 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3286 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3287 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3291 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
3292 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3293 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3294 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3298 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
3299 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3300 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3301 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3305 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
3306 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3307 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3308 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3312 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3313 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3314 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3315 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3319 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
3320 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3321 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3322 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3326 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
3327 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3328 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3329 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3333 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
3334 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3335 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3336 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3340 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
3341 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3342 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3343 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3347 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
3348 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3349 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3350 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3354 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
3355 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3356 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3357 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3359 MsiCloseHandle( hpkg
);
3361 /* publish the features and components */
3362 r
= MsiInstallProduct(msifile
, "ADDLOCAL=one,four ADDSOURCE=two,three REMOVE=six,seven");
3363 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3365 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_DIRECT
, &hdb
);
3366 ok(r
== ERROR_SUCCESS
, "failed to open database: %d\n", r
);
3368 /* these properties must not be in the saved msi file */
3369 r
= add_property_entry( hdb
, "'ADDLOCAL', 'one,four'");
3370 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
3372 r
= add_property_entry( hdb
, "'ADDSOURCE', 'two,three'");
3373 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
3375 r
= add_property_entry( hdb
, "'REMOVE', 'six,seven'");
3376 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
3378 hpkg
= package_from_db( hdb
);
3379 ok( hpkg
, "failed to create package\n");
3381 MsiCloseHandle(hdb
);
3385 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3386 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3387 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3388 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3392 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
3393 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3394 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3395 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3399 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3400 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3401 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3402 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3406 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3407 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3408 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3409 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3413 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3414 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3415 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3416 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3420 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
3421 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3422 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3423 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3427 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
3428 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3429 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3430 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3434 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3435 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3436 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3437 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3441 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
3442 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3443 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3444 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3448 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
3449 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3450 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3451 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3455 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
3456 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3457 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3458 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3462 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
3463 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3464 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3465 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3469 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
3470 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3471 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3472 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3476 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
3477 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3478 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3479 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3483 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
3484 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3485 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3486 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3490 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
3491 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3492 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3493 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3497 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
3498 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3499 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3500 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3504 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
3505 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3506 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3507 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3511 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3512 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3513 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3514 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3518 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
3519 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3520 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3521 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3525 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
3526 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3527 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3528 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3532 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
3533 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3534 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3535 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3539 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
3540 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3541 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3542 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3546 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
3547 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3548 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3549 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3553 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
3554 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3555 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3556 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3558 r
= MsiDoAction( hpkg
, "CostInitialize");
3559 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
3563 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3564 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3565 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3566 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3570 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
3571 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3572 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3573 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3577 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3578 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3579 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3580 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3584 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3585 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3586 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3587 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3591 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3592 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3593 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3594 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3598 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
3599 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3600 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3601 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3605 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
3606 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3607 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3608 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3612 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3613 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3614 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3615 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3619 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
3620 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3621 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3622 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3626 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
3627 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3628 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3629 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3633 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
3634 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3635 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3636 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3640 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
3641 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3642 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3643 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3647 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
3648 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3649 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3650 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3654 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
3655 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3656 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3657 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3661 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
3662 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3663 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3664 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3668 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
3669 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3670 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3671 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3675 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
3676 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3677 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3678 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3682 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
3683 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3684 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3685 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3689 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3690 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3691 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3692 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3696 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
3697 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3698 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3699 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3703 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
3704 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3705 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3706 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3710 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
3711 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3712 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3713 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3717 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
3718 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3719 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3720 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3724 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
3725 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3726 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3727 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3731 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
3732 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3733 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3734 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3736 r
= MsiDoAction( hpkg
, "FileCost");
3737 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
3741 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3742 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3743 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3744 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3748 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
3749 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3750 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3751 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3755 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3756 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3757 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3758 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3762 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3763 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3764 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3765 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3769 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3770 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3771 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3772 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3776 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
3777 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3778 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3779 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3783 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
3784 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3785 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3786 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3790 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3791 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3792 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3793 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3797 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
3798 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3799 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3800 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3804 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
3805 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3806 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3807 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3811 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
3812 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3813 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3814 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3818 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
3819 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3820 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3821 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3825 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
3826 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3827 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3828 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3832 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
3833 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3834 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3835 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3839 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
3840 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3841 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3842 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3846 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
3847 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3848 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3849 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3853 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
3854 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3855 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3856 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3860 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
3861 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3862 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3863 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3867 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3868 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3869 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3870 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3874 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
3875 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3876 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3877 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3881 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
3882 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3883 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3884 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3888 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
3889 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3890 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3891 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3895 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
3896 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3897 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3898 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3902 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
3903 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3904 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3905 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3909 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
3910 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3911 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3912 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3914 r
= MsiDoAction( hpkg
, "CostFinalize");
3915 ok( r
== ERROR_SUCCESS
, "cost finalize failed: %d\n", r
);
3919 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3920 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3921 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3922 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3926 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
3927 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3928 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3929 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3933 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3934 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3935 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3936 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3940 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3941 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3942 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3943 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3947 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3948 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3949 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3950 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3954 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
3955 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3956 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3957 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3961 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
3962 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3963 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3964 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3968 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3969 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3970 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3971 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3975 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
3976 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3977 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3978 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3982 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
3983 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3984 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3985 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3989 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
3990 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3991 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3992 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3996 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
3997 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3998 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3999 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4003 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
4004 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4005 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4006 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4010 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
4011 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4012 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4013 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4017 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
4018 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4019 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4020 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4024 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
4025 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4026 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4027 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4031 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
4032 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4033 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4034 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4038 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
4039 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4040 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4041 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4045 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
4046 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4047 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4048 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4052 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
4053 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4054 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4055 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4059 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
4060 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4061 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4062 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4066 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
4067 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4068 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4069 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4073 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
4074 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4075 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4076 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4080 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
4081 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4082 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4083 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4087 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
4088 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4089 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4090 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4092 MsiCloseHandle(hpkg
);
4094 /* uninstall the product */
4095 r
= MsiInstallProduct(msifile
, "REMOVE=ALL");
4096 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4098 /* all features installed locally */
4099 r
= MsiInstallProduct(msifile2
, "ADDLOCAL=ALL");
4100 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4102 r
= MsiOpenDatabase(msifile2
, MSIDBOPEN_DIRECT
, &hdb
);
4103 ok(r
== ERROR_SUCCESS
, "failed to open database: %d\n", r
);
4105 /* these properties must not be in the saved msi file */
4106 r
= add_property_entry( hdb
, "'ADDLOCAL', 'one,two,three,four,five,six,seven'");
4107 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
4109 hpkg
= package_from_db( hdb
);
4110 ok( hpkg
, "failed to create package\n");
4114 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
4115 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4116 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4117 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4121 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
4122 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4123 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4124 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4128 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
4129 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4130 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4131 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4135 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
4136 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4137 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4138 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4142 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
4143 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4144 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4145 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4149 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
4150 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4151 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4152 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4156 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
4157 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4158 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4159 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4163 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
4164 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4165 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4166 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4170 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
4171 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4172 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4173 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4177 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
4178 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4179 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4180 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4184 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
4185 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4186 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4187 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4191 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
4192 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4193 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4194 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4198 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
4199 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4200 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4201 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4205 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
4206 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4207 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4208 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4212 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
4213 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4214 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4215 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4219 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
4220 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4221 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4222 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4226 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
4227 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4228 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4229 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4233 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
4234 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4235 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4236 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4240 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
4241 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4242 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4243 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4247 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
4248 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4249 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4250 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4254 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
4255 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4256 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4257 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4261 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
4262 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4263 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4264 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4268 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
4269 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4270 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4271 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4275 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
4276 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4277 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4278 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4282 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
4283 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4284 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4285 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4287 r
= MsiDoAction( hpkg
, "CostInitialize");
4288 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
4292 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
4293 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4294 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4295 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4299 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
4300 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4301 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4302 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4306 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
4307 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4308 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4309 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4313 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
4314 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4315 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4316 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4320 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
4321 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4322 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4323 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4327 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
4328 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4329 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4330 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4334 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
4335 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4336 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4337 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4341 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
4342 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4343 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4344 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4348 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
4349 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4350 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4351 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4355 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
4356 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4357 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4358 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4362 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
4363 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4364 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4365 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4369 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
4370 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4371 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4372 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4376 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
4377 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4378 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4379 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4383 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
4384 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4385 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4386 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4390 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
4391 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4392 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4393 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4397 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
4398 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4399 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4400 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4404 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
4405 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4406 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4407 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4411 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
4412 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4413 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4414 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4418 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
4419 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4420 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4421 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4425 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
4426 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4427 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4428 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4432 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
4433 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4434 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4435 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4439 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
4440 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4441 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4442 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4446 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
4447 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4448 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4449 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4453 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
4454 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4455 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4456 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4460 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
4461 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4462 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4463 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4465 r
= MsiDoAction( hpkg
, "FileCost");
4466 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
4470 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
4471 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4472 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4473 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4477 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
4478 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4479 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4480 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4484 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
4485 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4486 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4487 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4491 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
4492 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4493 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4494 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4498 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
4499 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4500 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4501 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4505 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
4506 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4507 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4508 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4512 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
4513 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4514 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4515 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4519 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
4520 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4521 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4522 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4526 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
4527 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4528 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4529 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4533 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
4534 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4535 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4536 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4540 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
4541 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4542 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4543 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4547 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
4548 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4549 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4550 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4554 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
4555 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4556 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4557 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4561 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
4562 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4563 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4564 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4568 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
4569 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4570 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4571 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4575 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
4576 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4577 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4578 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4582 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
4583 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4584 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4585 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4589 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
4590 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4591 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4592 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4596 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
4597 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4598 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4599 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4603 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
4604 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4605 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4606 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4610 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
4611 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4612 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4613 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4617 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
4618 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4619 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4620 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4624 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
4625 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4626 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4627 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4631 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
4632 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4633 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4634 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4638 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
4639 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4640 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4641 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4643 r
= MsiDoAction( hpkg
, "CostFinalize");
4644 ok( r
== ERROR_SUCCESS
, "cost finalize failed: %d\n", r
);
4648 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
4649 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4650 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4651 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4655 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
4656 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4657 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4658 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4662 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
4663 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4664 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4665 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4669 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
4670 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4671 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4672 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4676 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
4677 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4678 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4679 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4683 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
4684 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4685 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4686 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4690 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
4691 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4692 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4693 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4697 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
4698 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4699 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4700 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4704 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
4705 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4706 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4707 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4711 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
4712 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4713 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4714 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4718 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
4719 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4720 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4721 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4725 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
4726 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4727 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4728 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4732 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
4733 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4734 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4735 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
4739 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
4740 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4741 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4742 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4746 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
4747 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4748 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4749 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4753 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
4754 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4755 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4756 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4760 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
4761 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4762 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4763 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4767 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
4768 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4769 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4770 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4774 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
4775 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4776 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4777 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4781 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
4782 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4783 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4784 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4788 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
4789 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4790 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4791 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4795 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
4796 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4797 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4798 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4802 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
4803 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4804 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4805 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
4809 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
4810 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4811 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4812 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4816 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
4817 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4818 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4819 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4821 MsiCloseHandle(hpkg
);
4823 /* uninstall the product */
4824 r
= MsiInstallProduct(msifile2
, "REMOVE=ALL");
4825 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4827 /* all features installed from source */
4828 r
= MsiInstallProduct(msifile3
, "ADDSOURCE=ALL");
4829 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4831 r
= MsiOpenDatabase(msifile3
, MSIDBOPEN_DIRECT
, &hdb
);
4832 ok(r
== ERROR_SUCCESS
, "failed to open database: %d\n", r
);
4834 /* this property must not be in the saved msi file */
4835 r
= add_property_entry( hdb
, "'ADDSOURCE', 'one,two,three,four,five,six,seven'");
4836 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
4838 hpkg
= package_from_db( hdb
);
4839 ok( hpkg
, "failed to create package\n");
4843 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
4844 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4845 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4846 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4850 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
4851 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4852 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4853 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4857 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
4858 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4859 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4860 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4864 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
4865 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4866 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4867 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4871 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
4872 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4873 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4874 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4878 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
4879 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4880 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4881 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4885 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
4886 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4887 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4888 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4892 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
4893 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4894 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4895 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4899 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
4900 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4901 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4902 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4906 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
4907 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4908 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4909 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4913 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
4914 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4915 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4916 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4920 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
4921 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4922 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4923 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4927 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
4928 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4929 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4930 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4934 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
4935 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4936 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4937 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4941 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
4942 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4943 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4944 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4948 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
4949 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4950 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4951 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4955 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
4956 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4957 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4958 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4962 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
4963 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4964 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4965 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4969 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
4970 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4971 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4972 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4976 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
4977 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4978 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4979 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4983 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
4984 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4985 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4986 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4990 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
4991 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4992 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4993 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4997 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
4998 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4999 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
5000 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
5004 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
5005 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
5006 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
5007 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
5011 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
5012 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
5013 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
5014 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
5016 r
= MsiDoAction( hpkg
, "CostInitialize");
5017 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
5021 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
5022 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5023 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5024 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5028 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
5029 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5030 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5031 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5035 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
5036 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5037 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5038 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5042 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
5043 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5044 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5045 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5049 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
5050 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5051 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5052 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5056 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
5057 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5058 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5059 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5063 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
5064 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5065 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5066 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5070 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
5071 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5072 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5073 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5077 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
5078 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5079 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5080 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5084 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
5085 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5086 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5087 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5091 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
5092 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5093 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5094 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5098 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
5099 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5100 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5101 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5105 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
5106 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5107 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5108 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5112 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
5113 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5114 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5115 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5119 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
5120 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5121 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5122 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5126 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
5127 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5128 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5129 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5133 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
5134 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5135 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5136 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5140 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
5141 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5142 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5143 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5147 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
5148 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5149 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5150 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5154 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
5155 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5156 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5157 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5161 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
5162 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5163 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5164 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5168 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
5169 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5170 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5171 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5175 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
5176 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5177 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5178 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5182 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
5183 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5184 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5185 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5189 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
5190 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5191 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5192 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5194 r
= MsiDoAction( hpkg
, "FileCost");
5195 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
5199 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
5200 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5201 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5202 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5206 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
5207 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5208 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5209 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5213 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
5214 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5215 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5216 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5220 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
5221 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5222 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5223 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5227 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
5228 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5229 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5230 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5234 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
5235 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5236 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5237 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5241 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
5242 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5243 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5244 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5248 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
5249 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5250 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5251 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5255 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
5256 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5257 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5258 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5262 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
5263 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5264 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5265 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5269 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
5270 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5271 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5272 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5276 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
5277 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5278 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5279 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5283 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
5284 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5285 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5286 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5290 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
5291 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5292 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5293 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5297 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
5298 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5299 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5300 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5304 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
5305 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5306 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5307 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5311 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
5312 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5313 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5314 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5318 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
5319 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5320 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5321 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5325 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
5326 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5327 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5328 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5332 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
5333 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5334 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5335 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5339 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
5340 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5341 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5342 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5346 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
5347 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5348 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5349 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5353 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
5354 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5355 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5356 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5360 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
5361 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5362 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5363 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5367 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
5368 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5369 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5370 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5372 r
= MsiDoAction( hpkg
, "CostFinalize");
5373 ok( r
== ERROR_SUCCESS
, "cost finalize failed: %d\n", r
);
5377 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
5378 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5379 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5380 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5384 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
5385 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5386 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5387 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5391 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
5392 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5393 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5394 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
5398 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
5399 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5400 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5401 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5405 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
5406 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5407 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
5408 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5412 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
5413 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5414 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5415 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5419 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
5420 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5421 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5422 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5426 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
5427 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5428 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5429 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5433 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
5434 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5435 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5436 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5440 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
5441 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5442 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5443 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5447 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
5448 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5449 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5450 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5454 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
5455 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5456 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5457 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
5461 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
5462 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5463 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5464 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5468 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
5469 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5470 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5471 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5475 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
5476 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5477 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5478 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
5482 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
5483 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5484 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5485 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
5489 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
5490 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5491 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
5492 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5496 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
5497 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5498 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5499 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5503 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
5504 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5505 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5506 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5510 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
5511 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5512 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5513 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5517 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
5518 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5519 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5520 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5524 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
5525 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5526 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5527 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5531 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
5532 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5533 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5534 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5538 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
5539 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5540 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5541 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5545 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
5546 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5547 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5548 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5550 MsiCloseHandle(hpkg
);
5552 /* uninstall the product */
5553 r
= MsiInstallProduct(msifile3
, "REMOVE=ALL");
5554 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5556 DeleteFileA(msifile
);
5557 DeleteFileA(msifile2
);
5558 DeleteFileA(msifile3
);
5561 static void test_getproperty(void)
5563 MSIHANDLE hPackage
= 0;
5565 static CHAR empty
[] = "";
5569 hPackage
= package_from_db(create_package_db());
5570 ok( hPackage
!= 0, " Failed to create package\n");
5572 /* set the property */
5573 r
= MsiSetProperty(hPackage
, "Name", "Value");
5574 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5576 /* retrieve the size, NULL pointer */
5578 r
= MsiGetProperty(hPackage
, "Name", NULL
, &size
);
5579 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5580 ok( size
== 5, "Expected 5, got %d\n", size
);
5582 /* retrieve the size, empty string */
5584 r
= MsiGetProperty(hPackage
, "Name", empty
, &size
);
5585 ok( r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
5586 ok( size
== 5, "Expected 5, got %d\n", size
);
5588 /* don't change size */
5589 r
= MsiGetProperty(hPackage
, "Name", prop
, &size
);
5590 ok( r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
5591 ok( size
== 5, "Expected 5, got %d\n", size
);
5592 ok( !lstrcmp(prop
, "Valu"), "Expected Valu, got %s\n", prop
);
5594 /* increase the size by 1 */
5596 r
= MsiGetProperty(hPackage
, "Name", prop
, &size
);
5597 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5598 ok( size
== 5, "Expected 5, got %d\n", size
);
5599 ok( !lstrcmp(prop
, "Value"), "Expected Value, got %s\n", prop
);
5601 r
= MsiCloseHandle( hPackage
);
5602 ok( r
== ERROR_SUCCESS
, "Failed to close package\n" );
5603 DeleteFile(msifile
);
5606 static void test_removefiles(void)
5612 hdb
= create_package_db();
5613 ok ( hdb
, "failed to create package database\n" );
5615 r
= add_directory_entry( hdb
, "'TARGETDIR', '', 'SourceDir'");
5616 ok( r
== ERROR_SUCCESS
, "cannot add directory: %d\n", r
);
5618 r
= create_feature_table( hdb
);
5619 ok( r
== ERROR_SUCCESS
, "cannot create Feature table: %d\n", r
);
5621 r
= create_component_table( hdb
);
5622 ok( r
== ERROR_SUCCESS
, "cannot create Component table: %d\n", r
);
5624 r
= add_feature_entry( hdb
, "'one', '', '', '', 2, 1, '', 0" );
5625 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
5627 r
= add_component_entry( hdb
, "'hydrogen', '', 'TARGETDIR', 0, '', 'hydrogen_file'" );
5628 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
5630 r
= add_component_entry( hdb
, "'helium', '', 'TARGETDIR', 0, '', 'helium_file'" );
5631 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
5633 r
= add_component_entry( hdb
, "'lithium', '', 'TARGETDIR', 0, '', 'lithium_file'" );
5634 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
5636 r
= add_component_entry( hdb
, "'beryllium', '', 'TARGETDIR', 0, '', 'beryllium_file'" );
5637 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
5639 r
= add_component_entry( hdb
, "'boron', '', 'TARGETDIR', 0, '', 'boron_file'" );
5640 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
5642 r
= add_component_entry( hdb
, "'carbon', '', 'TARGETDIR', 0, '', 'carbon_file'" );
5643 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
5645 r
= create_feature_components_table( hdb
);
5646 ok( r
== ERROR_SUCCESS
, "cannot create FeatureComponents table: %d\n", r
);
5648 r
= add_feature_components_entry( hdb
, "'one', 'hydrogen'" );
5649 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
5651 r
= add_feature_components_entry( hdb
, "'one', 'helium'" );
5652 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
5654 r
= add_feature_components_entry( hdb
, "'one', 'lithium'" );
5655 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
5657 r
= add_feature_components_entry( hdb
, "'one', 'beryllium'" );
5658 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
5660 r
= add_feature_components_entry( hdb
, "'one', 'boron'" );
5661 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
5663 r
= add_feature_components_entry( hdb
, "'one', 'carbon'" );
5664 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
5666 r
= create_file_table( hdb
);
5667 ok( r
== ERROR_SUCCESS
, "cannot create File table: %d\n", r
);
5669 r
= add_file_entry( hdb
, "'hydrogen_file', 'hydrogen', 'hydrogen.txt', 0, '', '1033', 8192, 1" );
5670 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
5672 r
= add_file_entry( hdb
, "'helium_file', 'helium', 'helium.txt', 0, '', '1033', 8192, 1" );
5673 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
5675 r
= add_file_entry( hdb
, "'lithium_file', 'lithium', 'lithium.txt', 0, '', '1033', 8192, 1" );
5676 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
5678 r
= add_file_entry( hdb
, "'beryllium_file', 'beryllium', 'beryllium.txt', 0, '', '1033', 16384, 1" );
5679 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
5681 r
= add_file_entry( hdb
, "'boron_file', 'boron', 'boron.txt', 0, '', '1033', 16384, 1" );
5682 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
5684 r
= add_file_entry( hdb
, "'carbon_file', 'carbon', 'carbon.txt', 0, '', '1033', 16384, 1" );
5685 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
5687 r
= create_remove_file_table( hdb
);
5688 ok( r
== ERROR_SUCCESS
, "cannot create Remove File table: %d\n", r
);
5690 hpkg
= package_from_db( hdb
);
5691 ok( hpkg
, "failed to create package\n");
5693 MsiCloseHandle( hdb
);
5695 create_test_file( "hydrogen.txt" );
5696 create_test_file( "helium.txt" );
5697 create_test_file( "lithium.txt" );
5698 create_test_file( "beryllium.txt" );
5699 create_test_file( "boron.txt" );
5700 create_test_file( "carbon.txt" );
5702 r
= MsiSetProperty( hpkg
, "TARGETDIR", CURR_DIR
);
5703 ok( r
== ERROR_SUCCESS
, "set property failed\n");
5705 r
= MsiDoAction( hpkg
, "CostInitialize");
5706 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
5708 r
= MsiDoAction( hpkg
, "FileCost");
5709 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
5711 r
= MsiDoAction( hpkg
, "CostFinalize");
5712 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
5714 r
= MsiDoAction( hpkg
, "InstallValidate");
5715 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
5717 r
= MsiSetComponentState( hpkg
, "hydrogen", INSTALLSTATE_ABSENT
);
5718 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
5720 r
= MsiSetComponentState( hpkg
, "helium", INSTALLSTATE_LOCAL
);
5721 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
5723 r
= MsiSetComponentState( hpkg
, "lithium", INSTALLSTATE_SOURCE
);
5724 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
5726 r
= MsiSetComponentState( hpkg
, "beryllium", INSTALLSTATE_ABSENT
);
5727 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
5729 r
= MsiSetComponentState( hpkg
, "boron", INSTALLSTATE_LOCAL
);
5730 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
5732 r
= MsiSetComponentState( hpkg
, "carbon", INSTALLSTATE_SOURCE
);
5733 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
5735 r
= MsiDoAction( hpkg
, "RemoveFiles");
5736 ok( r
== ERROR_SUCCESS
, "remove files failed\n");
5738 ok(DeleteFileA("hydrogen.txt"), "Expected hydrogen.txt to exist\n");
5739 ok(DeleteFileA("lithium.txt"), "Expected lithium.txt to exist\n");
5740 ok(DeleteFileA("beryllium.txt"), "Expected beryllium.txt to exist\n");
5741 ok(DeleteFileA("carbon.txt"), "Expected carbon.txt to exist\n");
5742 ok(DeleteFileA("helium.txt"), "Expected helium.txt to exist\n");
5743 ok(DeleteFileA("boron.txt"), "Expected boron.txt to exist\n");
5745 MsiCloseHandle( hpkg
);
5746 DeleteFileA(msifile
);
5749 static void test_appsearch(void)
5754 CHAR prop
[MAX_PATH
];
5755 DWORD size
= MAX_PATH
;
5757 hdb
= create_package_db();
5758 ok ( hdb
, "failed to create package database\n" );
5760 r
= create_appsearch_table( hdb
);
5761 ok( r
== ERROR_SUCCESS
, "cannot create AppSearch table: %d\n", r
);
5763 r
= add_appsearch_entry( hdb
, "'WEBBROWSERPROG', 'NewSignature1'" );
5764 ok( r
== ERROR_SUCCESS
, "cannot add entry: %d\n", r
);
5766 r
= create_reglocator_table( hdb
);
5767 ok( r
== ERROR_SUCCESS
, "cannot create RegLocator table: %d\n", r
);
5769 r
= add_reglocator_entry( hdb
, "'NewSignature1', 0, 'htmlfile\\shell\\open\\command', '', 1" );
5770 ok( r
== ERROR_SUCCESS
, "cannot create RegLocator table: %d\n", r
);
5772 r
= create_signature_table( hdb
);
5773 ok( r
== ERROR_SUCCESS
, "cannot create Signature table: %d\n", r
);
5775 r
= add_signature_entry( hdb
, "'NewSignature1', 'FileName', '', '', '', '', '', '', ''" );
5776 ok( r
== ERROR_SUCCESS
, "cannot create Signature table: %d\n", r
);
5778 hpkg
= package_from_db( hdb
);
5779 ok( hpkg
, "failed to create package\n");
5781 MsiCloseHandle( hdb
);
5783 r
= MsiDoAction( hpkg
, "AppSearch" );
5784 ok( r
== ERROR_SUCCESS
, "AppSearch failed: %d\n", r
);
5786 r
= MsiGetPropertyA( hpkg
, "WEBBROWSERPROG", prop
, &size
);
5787 ok( r
== ERROR_SUCCESS
, "get property failed: %d\n", r
);
5788 ok( lstrlenA(prop
) != 0, "Expected non-zero length\n");
5790 MsiCloseHandle( hpkg
);
5791 DeleteFileA(msifile
);
5794 static void test_appsearch_complocator(void)
5796 MSIHANDLE hpkg
, hdb
;
5797 CHAR path
[MAX_PATH
];
5798 CHAR prop
[MAX_PATH
];
5803 get_user_sid(&usersid
);
5806 skip("ConvertSidToStringSidA is not available\n");
5810 create_test_file("FileName1");
5811 create_test_file("FileName4");
5812 set_component_path("FileName1", MSIINSTALLCONTEXT_MACHINE
,
5813 "{A8AE6692-96BA-4198-8399-145D7D1D0D0E}", NULL
, FALSE
);
5815 create_test_file("FileName2");
5816 set_component_path("FileName2", MSIINSTALLCONTEXT_USERUNMANAGED
,
5817 "{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}", usersid
, FALSE
);
5819 create_test_file("FileName3");
5820 set_component_path("FileName3", MSIINSTALLCONTEXT_USERMANAGED
,
5821 "{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}", usersid
, FALSE
);
5823 create_test_file("FileName5");
5824 set_component_path("FileName5", MSIINSTALLCONTEXT_MACHINE
,
5825 "{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}", NULL
, TRUE
);
5827 create_test_file("FileName6");
5828 set_component_path("FileName6", MSIINSTALLCONTEXT_MACHINE
,
5829 "{C0ECD96F-7898-4410-9667-194BD8C1B648}", NULL
, TRUE
);
5831 create_test_file("FileName7");
5832 set_component_path("FileName7", MSIINSTALLCONTEXT_MACHINE
,
5833 "{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}", NULL
, FALSE
);
5835 /* dir is FALSE, but we're pretending it's a directory */
5836 set_component_path("IDontExist\\", MSIINSTALLCONTEXT_MACHINE
,
5837 "{91B7359B-07F2-4221-AA8D-DE102BB87A5F}", NULL
, FALSE
);
5839 hdb
= create_package_db();
5840 ok(hdb
, "Expected a valid database handle\n");
5842 r
= create_appsearch_table(hdb
);
5843 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5845 r
= add_appsearch_entry(hdb
, "'SIGPROP1', 'NewSignature1'");
5846 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5848 r
= add_appsearch_entry(hdb
, "'SIGPROP2', 'NewSignature2'");
5849 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5851 r
= add_appsearch_entry(hdb
, "'SIGPROP3', 'NewSignature3'");
5852 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5854 r
= add_appsearch_entry(hdb
, "'SIGPROP4', 'NewSignature4'");
5855 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5857 r
= add_appsearch_entry(hdb
, "'SIGPROP5', 'NewSignature5'");
5858 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5860 r
= add_appsearch_entry(hdb
, "'SIGPROP6', 'NewSignature6'");
5861 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5863 r
= add_appsearch_entry(hdb
, "'SIGPROP7', 'NewSignature7'");
5864 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5866 r
= add_appsearch_entry(hdb
, "'SIGPROP8', 'NewSignature8'");
5867 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5869 r
= add_appsearch_entry(hdb
, "'SIGPROP9', 'NewSignature9'");
5870 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5872 r
= create_complocator_table(hdb
);
5873 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5875 /* published component, machine, file, signature, misdbLocatorTypeFile */
5876 r
= add_complocator_entry(hdb
, "'NewSignature1', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 1");
5877 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5879 /* published component, user-unmanaged, file, signature, misdbLocatorTypeFile */
5880 r
= add_complocator_entry(hdb
, "'NewSignature2', '{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}', 1");
5881 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5883 /* published component, user-managed, file, signature, misdbLocatorTypeFile */
5884 r
= add_complocator_entry(hdb
, "'NewSignature3', '{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}', 1");
5885 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5887 /* published component, machine, file, signature, misdbLocatorTypeDirectory */
5888 r
= add_complocator_entry(hdb
, "'NewSignature4', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 0");
5889 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5891 /* published component, machine, dir, signature, misdbLocatorTypeDirectory */
5892 r
= add_complocator_entry(hdb
, "'NewSignature5', '{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}', 0");
5893 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5895 /* published component, machine, dir, no signature, misdbLocatorTypeDirectory */
5896 r
= add_complocator_entry(hdb
, "'NewSignature6', '{C0ECD96F-7898-4410-9667-194BD8C1B648}', 0");
5897 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5899 /* published component, machine, file, no signature, misdbLocatorTypeFile */
5900 r
= add_complocator_entry(hdb
, "'NewSignature7', '{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}', 1");
5901 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5903 /* unpublished component, no signature, misdbLocatorTypeDir */
5904 r
= add_complocator_entry(hdb
, "'NewSignature8', '{FB671D5B-5083-4048-90E0-481C48D8F3A5}', 0");
5905 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5907 /* published component, no signature, dir does not exist misdbLocatorTypeDir */
5908 r
= add_complocator_entry(hdb
, "'NewSignature9', '{91B7359B-07F2-4221-AA8D-DE102BB87A5F}', 0");
5909 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5911 r
= create_signature_table(hdb
);
5912 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5914 r
= add_signature_entry(hdb
, "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''");
5915 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5917 r
= add_signature_entry(hdb
, "'NewSignature2', 'FileName2', '', '', '', '', '', '', ''");
5918 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5920 r
= add_signature_entry(hdb
, "'NewSignature3', 'FileName3', '', '', '', '', '', '', ''");
5921 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5923 r
= add_signature_entry(hdb
, "'NewSignature4', 'FileName4', '', '', '', '', '', '', ''");
5924 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5926 r
= add_signature_entry(hdb
, "'NewSignature5', 'FileName5', '', '', '', '', '', '', ''");
5927 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5929 hpkg
= package_from_db(hdb
);
5930 ok(hpkg
, "Expected a valid package handle\n");
5932 r
= MsiSetPropertyA(hpkg
, "SIGPROP8", "october");
5933 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5935 r
= MsiDoAction(hpkg
, "AppSearch");
5936 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5939 sprintf(path
, "%s\\FileName1", CURR_DIR
);
5940 r
= MsiGetPropertyA(hpkg
, "SIGPROP1", prop
, &size
);
5941 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5942 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
5945 sprintf(path
, "%s\\FileName2", CURR_DIR
);
5946 r
= MsiGetPropertyA(hpkg
, "SIGPROP2", prop
, &size
);
5947 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5948 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
5951 sprintf(path
, "%s\\FileName3", CURR_DIR
);
5952 r
= MsiGetPropertyA(hpkg
, "SIGPROP3", prop
, &size
);
5953 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5954 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
5957 sprintf(path
, "%s\\FileName4", CURR_DIR
);
5958 r
= MsiGetPropertyA(hpkg
, "SIGPROP4", prop
, &size
);
5959 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5960 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
5963 sprintf(path
, "%s\\FileName5", CURR_DIR
);
5964 r
= MsiGetPropertyA(hpkg
, "SIGPROP5", prop
, &size
);
5965 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5966 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
5969 sprintf(path
, "%s\\", CURR_DIR
);
5970 r
= MsiGetPropertyA(hpkg
, "SIGPROP6", prop
, &size
);
5971 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5972 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
5975 sprintf(path
, "%s\\", CURR_DIR
);
5976 r
= MsiGetPropertyA(hpkg
, "SIGPROP7", prop
, &size
);
5977 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5978 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
5980 r
= MsiGetPropertyA(hpkg
, "SIGPROP8", prop
, &size
);
5981 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5982 ok(!lstrcmpA(prop
, "october"), "Expected \"october\", got \"%s\"\n", prop
);
5984 r
= MsiGetPropertyA(hpkg
, "SIGPROP9", prop
, &size
);
5985 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5986 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
5988 delete_component_path("{A8AE6692-96BA-4198-8399-145D7D1D0D0E}",
5989 MSIINSTALLCONTEXT_MACHINE
, NULL
);
5990 delete_component_path("{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}",
5991 MSIINSTALLCONTEXT_USERUNMANAGED
, usersid
);
5992 delete_component_path("{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}",
5993 MSIINSTALLCONTEXT_USERMANAGED
, usersid
);
5994 delete_component_path("{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}",
5995 MSIINSTALLCONTEXT_MACHINE
, NULL
);
5996 delete_component_path("{C0ECD96F-7898-4410-9667-194BD8C1B648}",
5997 MSIINSTALLCONTEXT_MACHINE
, NULL
);
5998 delete_component_path("{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}",
5999 MSIINSTALLCONTEXT_MACHINE
, NULL
);
6000 delete_component_path("{91B7359B-07F2-4221-AA8D-DE102BB87A5F}",
6001 MSIINSTALLCONTEXT_MACHINE
, NULL
);
6003 DeleteFileA("FileName1");
6004 DeleteFileA("FileName2");
6005 DeleteFileA("FileName3");
6006 DeleteFileA("FileName4");
6007 DeleteFileA("FileName5");
6008 DeleteFileA("FileName6");
6009 DeleteFileA("FileName7");
6010 MsiCloseHandle(hpkg
);
6011 DeleteFileA(msifile
);
6014 static void test_appsearch_reglocator(void)
6016 MSIHANDLE hpkg
, hdb
;
6017 CHAR path
[MAX_PATH
];
6018 CHAR prop
[MAX_PATH
];
6027 res
= RegCreateKeyA(HKEY_CLASSES_ROOT
, "Software\\Wine", &classes
);
6028 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6030 res
= RegSetValueExA(classes
, "Value1", 0, REG_SZ
,
6031 (const BYTE
*)"regszdata", 10);
6032 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6034 res
= RegCreateKeyA(HKEY_CURRENT_USER
, "Software\\Wine", &hkcu
);
6035 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6037 res
= RegSetValueExA(hkcu
, "Value1", 0, REG_SZ
,
6038 (const BYTE
*)"regszdata", 10);
6039 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6041 res
= RegCreateKeyA(HKEY_USERS
, "S-1-5-18\\Software\\Wine", &users
);
6042 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6044 res
= RegSetValueExA(users
, "Value1", 0, REG_SZ
,
6045 (const BYTE
*)"regszdata", 10);
6046 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6048 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, "Software\\Wine", &hklm
);
6049 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6051 res
= RegSetValueA(hklm
, NULL
, REG_SZ
, "defvalue", 8);
6052 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6054 res
= RegSetValueExA(hklm
, "Value1", 0, REG_SZ
,
6055 (const BYTE
*)"regszdata", 10);
6056 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6059 res
= RegSetValueExA(hklm
, "Value2", 0, REG_DWORD
,
6060 (const BYTE
*)&val
, sizeof(DWORD
));
6061 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6064 res
= RegSetValueExA(hklm
, "Value3", 0, REG_DWORD
,
6065 (const BYTE
*)&val
, sizeof(DWORD
));
6066 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6068 res
= RegSetValueExA(hklm
, "Value4", 0, REG_EXPAND_SZ
,
6069 (const BYTE
*)"%PATH%", 7);
6070 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6072 res
= RegSetValueExA(hklm
, "Value5", 0, REG_EXPAND_SZ
,
6073 (const BYTE
*)"my%NOVAR%", 10);
6074 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6076 res
= RegSetValueExA(hklm
, "Value6", 0, REG_MULTI_SZ
,
6077 (const BYTE
*)"one\0two\0", 9);
6078 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6080 binary
[0] = 0x1234abcd;
6081 binary
[1] = 0x567890ef;
6082 res
= RegSetValueExA(hklm
, "Value7", 0, REG_BINARY
,
6083 (const BYTE
*)binary
, sizeof(binary
));
6084 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6086 res
= RegSetValueExA(hklm
, "Value8", 0, REG_SZ
,
6087 (const BYTE
*)"#regszdata", 11);
6088 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6090 create_test_file("FileName1");
6091 sprintf(path
, "%s\\FileName1", CURR_DIR
);
6092 res
= RegSetValueExA(hklm
, "Value9", 0, REG_SZ
,
6093 (const BYTE
*)path
, lstrlenA(path
) + 1);
6094 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6096 sprintf(path
, "%s\\FileName2", CURR_DIR
);
6097 res
= RegSetValueExA(hklm
, "Value10", 0, REG_SZ
,
6098 (const BYTE
*)path
, lstrlenA(path
) + 1);
6099 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6101 lstrcpyA(path
, CURR_DIR
);
6102 res
= RegSetValueExA(hklm
, "Value11", 0, REG_SZ
,
6103 (const BYTE
*)path
, lstrlenA(path
) + 1);
6104 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6106 res
= RegSetValueExA(hklm
, "Value12", 0, REG_SZ
,
6107 (const BYTE
*)"", 1);
6108 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6110 hdb
= create_package_db();
6111 ok(hdb
, "Expected a valid database handle\n");
6113 r
= create_appsearch_table(hdb
);
6114 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6116 r
= add_appsearch_entry(hdb
, "'SIGPROP1', 'NewSignature1'");
6117 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6119 r
= add_appsearch_entry(hdb
, "'SIGPROP2', 'NewSignature2'");
6120 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6122 r
= add_appsearch_entry(hdb
, "'SIGPROP3', 'NewSignature3'");
6123 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6125 r
= add_appsearch_entry(hdb
, "'SIGPROP4', 'NewSignature4'");
6126 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6128 r
= add_appsearch_entry(hdb
, "'SIGPROP5', 'NewSignature5'");
6129 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6131 r
= add_appsearch_entry(hdb
, "'SIGPROP6', 'NewSignature6'");
6132 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6134 r
= add_appsearch_entry(hdb
, "'SIGPROP7', 'NewSignature7'");
6135 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6137 r
= add_appsearch_entry(hdb
, "'SIGPROP8', 'NewSignature8'");
6138 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6140 r
= add_appsearch_entry(hdb
, "'SIGPROP9', 'NewSignature9'");
6141 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6143 r
= add_appsearch_entry(hdb
, "'SIGPROP10', 'NewSignature10'");
6144 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6146 r
= add_appsearch_entry(hdb
, "'SIGPROP11', 'NewSignature11'");
6147 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6149 r
= add_appsearch_entry(hdb
, "'SIGPROP12', 'NewSignature12'");
6150 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6152 r
= add_appsearch_entry(hdb
, "'SIGPROP13', 'NewSignature13'");
6153 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6155 r
= add_appsearch_entry(hdb
, "'SIGPROP14', 'NewSignature14'");
6156 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6158 r
= add_appsearch_entry(hdb
, "'SIGPROP15', 'NewSignature15'");
6159 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6161 r
= add_appsearch_entry(hdb
, "'SIGPROP16', 'NewSignature16'");
6162 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6164 r
= add_appsearch_entry(hdb
, "'SIGPROP17', 'NewSignature17'");
6165 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6167 r
= add_appsearch_entry(hdb
, "'SIGPROP18', 'NewSignature18'");
6168 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6170 r
= add_appsearch_entry(hdb
, "'SIGPROP19', 'NewSignature19'");
6171 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6173 r
= add_appsearch_entry(hdb
, "'SIGPROP20', 'NewSignatur20'");
6174 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6176 r
= create_reglocator_table(hdb
);
6177 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6179 /* HKLM, msidbLocatorTypeRawValue, REG_SZ */
6180 str
= "'NewSignature1', 2, 'Software\\Wine', 'Value1', 2";
6181 r
= add_reglocator_entry(hdb
, str
);
6182 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6184 /* HKLM, msidbLocatorTypeRawValue, positive DWORD */
6185 str
= "'NewSignature2', 2, 'Software\\Wine', 'Value2', 2";
6186 r
= add_reglocator_entry(hdb
, str
);
6187 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6189 /* HKLM, msidbLocatorTypeRawValue, negative DWORD */
6190 str
= "'NewSignature3', 2, 'Software\\Wine', 'Value3', 2";
6191 r
= add_reglocator_entry(hdb
, str
);
6192 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6194 /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
6195 str
= "'NewSignature4', 2, 'Software\\Wine', 'Value4', 2";
6196 r
= add_reglocator_entry(hdb
, str
);
6197 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6199 /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
6200 str
= "'NewSignature5', 2, 'Software\\Wine', 'Value5', 2";
6201 r
= add_reglocator_entry(hdb
, str
);
6202 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6204 /* HKLM, msidbLocatorTypeRawValue, REG_MULTI_SZ */
6205 str
= "'NewSignature6', 2, 'Software\\Wine', 'Value6', 2";
6206 r
= add_reglocator_entry(hdb
, str
);
6207 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6209 /* HKLM, msidbLocatorTypeRawValue, REG_BINARY */
6210 str
= "'NewSignature7', 2, 'Software\\Wine', 'Value7', 2";
6211 r
= add_reglocator_entry(hdb
, str
);
6212 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6214 /* HKLM, msidbLocatorTypeRawValue, REG_SZ first char is # */
6215 str
= "'NewSignature8', 2, 'Software\\Wine', 'Value8', 2";
6216 r
= add_reglocator_entry(hdb
, str
);
6217 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6219 /* HKLM, msidbLocatorTypeFileName, file exists */
6220 str
= "'NewSignature9', 2, 'Software\\Wine', 'Value9', 1";
6221 r
= add_reglocator_entry(hdb
, str
);
6222 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6224 /* HKLM, msidbLocatorTypeFileName, file does not exist */
6225 str
= "'NewSignature10', 2, 'Software\\Wine', 'Value10', 1";
6226 r
= add_reglocator_entry(hdb
, str
);
6227 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6229 /* HKLM, msidbLocatorTypeFileName, no signature */
6230 str
= "'NewSignature11', 2, 'Software\\Wine', 'Value9', 1";
6231 r
= add_reglocator_entry(hdb
, str
);
6232 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6234 /* HKLM, msidbLocatorTypeDirectory, file exists */
6235 str
= "'NewSignature12', 2, 'Software\\Wine', 'Value9', 0";
6236 r
= add_reglocator_entry(hdb
, str
);
6237 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6239 /* HKLM, msidbLocatorTypeDirectory, directory */
6240 str
= "'NewSignature13', 2, 'Software\\Wine', 'Value11', 0";
6241 r
= add_reglocator_entry(hdb
, str
);
6242 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6244 /* HKLM, msidbLocatorTypeDirectory, file exists, with signature */
6245 str
= "'NewSignature14', 2, 'Software\\Wine', 'Value9', 0";
6246 r
= add_reglocator_entry(hdb
, str
);
6247 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6249 /* HKCR, msidbLocatorTypeRawValue, REG_SZ */
6250 str
= "'NewSignature15', 0, 'Software\\Wine', 'Value1', 2";
6251 r
= add_reglocator_entry(hdb
, str
);
6252 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6254 /* HKCU, msidbLocatorTypeRawValue, REG_SZ */
6255 str
= "'NewSignature16', 1, 'Software\\Wine', 'Value1', 2";
6256 r
= add_reglocator_entry(hdb
, str
);
6257 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6259 /* HKU, msidbLocatorTypeRawValue, REG_SZ */
6260 str
= "'NewSignature17', 3, 'S-1-5-18\\Software\\Wine', 'Value1', 2";
6261 r
= add_reglocator_entry(hdb
, str
);
6262 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6264 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, NULL Name */
6265 str
= "'NewSignature18', 2, 'Software\\Wine', '', 2";
6266 r
= add_reglocator_entry(hdb
, str
);
6267 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6269 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, key does not exist */
6270 str
= "'NewSignature19', 2, 'Software\\IDontExist', '', 2";
6271 r
= add_reglocator_entry(hdb
, str
);
6272 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6274 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, value is empty */
6275 str
= "'NewSignature20', 2, 'Software\\Wine', 'Value12', 2";
6276 r
= add_reglocator_entry(hdb
, str
);
6277 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6279 r
= create_signature_table(hdb
);
6280 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6282 str
= "'NewSignature9', 'FileName1', '', '', '', '', '', '', ''";
6283 r
= add_signature_entry(hdb
, str
);
6284 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6286 str
= "'NewSignature10', 'FileName2', '', '', '', '', '', '', ''";
6287 r
= add_signature_entry(hdb
, str
);
6288 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6290 str
= "'NewSignature14', 'FileName1', '', '', '', '', '', '', ''";
6291 r
= add_signature_entry(hdb
, str
);
6292 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6294 hpkg
= package_from_db(hdb
);
6295 ok(hpkg
, "Expected a valid package handle\n");
6297 r
= MsiDoAction(hpkg
, "AppSearch");
6298 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6301 r
= MsiGetPropertyA(hpkg
, "SIGPROP1", prop
, &size
);
6302 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6303 ok(!lstrcmpA(prop
, "regszdata"),
6304 "Expected \"regszdata\", got \"%s\"\n", prop
);
6307 r
= MsiGetPropertyA(hpkg
, "SIGPROP2", prop
, &size
);
6308 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6309 ok(!lstrcmpA(prop
, "#42"), "Expected \"#42\", got \"%s\"\n", prop
);
6312 r
= MsiGetPropertyA(hpkg
, "SIGPROP3", prop
, &size
);
6313 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6314 ok(!lstrcmpA(prop
, "#-42"), "Expected \"#-42\", got \"%s\"\n", prop
);
6316 ExpandEnvironmentStringsA("%PATH%", path
, MAX_PATH
);
6319 r
= MsiGetPropertyA(hpkg
, "SIGPROP4", prop
, &size
);
6320 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6321 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6324 r
= MsiGetPropertyA(hpkg
, "SIGPROP5", prop
, &size
);
6325 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6327 "my%NOVAR%"), "Expected \"my%%NOVAR%%\", got \"%s\"\n", prop
);
6330 r
= MsiGetPropertyA(hpkg
, "SIGPROP6", prop
, &size
);
6331 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6334 ok(!memcmp(prop
, "\0one\0two\0\0", 10),
6335 "Expected \"\\0one\\0two\\0\\0\"\n");
6339 lstrcpyA(path
, "#xCDAB3412EF907856");
6340 r
= MsiGetPropertyA(hpkg
, "SIGPROP7", prop
, &size
);
6341 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6342 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6345 r
= MsiGetPropertyA(hpkg
, "SIGPROP8", prop
, &size
);
6346 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6347 ok(!lstrcmpA(prop
, "##regszdata"),
6348 "Expected \"##regszdata\", got \"%s\"\n", prop
);
6351 sprintf(path
, "%s\\FileName1", CURR_DIR
);
6352 r
= MsiGetPropertyA(hpkg
, "SIGPROP9", prop
, &size
);
6353 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6354 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6357 r
= MsiGetPropertyA(hpkg
, "SIGPROP10", prop
, &size
);
6358 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6361 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6365 sprintf(path
, "%s\\", CURR_DIR
);
6366 r
= MsiGetPropertyA(hpkg
, "SIGPROP11", prop
, &size
);
6367 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6370 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6374 r
= MsiGetPropertyA(hpkg
, "SIGPROP12", prop
, &size
);
6375 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6376 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6379 sprintf(path
, "%s\\", CURR_DIR
);
6380 r
= MsiGetPropertyA(hpkg
, "SIGPROP13", prop
, &size
);
6381 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6384 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6388 r
= MsiGetPropertyA(hpkg
, "SIGPROP14", prop
, &size
);
6389 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6390 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6393 r
= MsiGetPropertyA(hpkg
, "SIGPROP15", prop
, &size
);
6394 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6395 ok(!lstrcmpA(prop
, "regszdata"),
6396 "Expected \"regszdata\", got \"%s\"\n", prop
);
6399 r
= MsiGetPropertyA(hpkg
, "SIGPROP16", prop
, &size
);
6400 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6401 ok(!lstrcmpA(prop
, "regszdata"),
6402 "Expected \"regszdata\", got \"%s\"\n", prop
);
6405 r
= MsiGetPropertyA(hpkg
, "SIGPROP17", prop
, &size
);
6406 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6407 ok(!lstrcmpA(prop
, "regszdata"),
6408 "Expected \"regszdata\", got \"%s\"\n", prop
);
6411 r
= MsiGetPropertyA(hpkg
, "SIGPROP18", prop
, &size
);
6412 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6413 ok(!lstrcmpA(prop
, "defvalue"),
6414 "Expected \"defvalue\", got \"%s\"\n", prop
);
6417 r
= MsiGetPropertyA(hpkg
, "SIGPROP19", prop
, &size
);
6418 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6419 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6422 r
= MsiGetPropertyA(hpkg
, "SIGPROP20", prop
, &size
);
6423 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6424 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6426 RegSetValueA(hklm
, NULL
, REG_SZ
, "", 0);
6427 RegDeleteValueA(hklm
, "Value1");
6428 RegDeleteValueA(hklm
, "Value2");
6429 RegDeleteValueA(hklm
, "Value3");
6430 RegDeleteValueA(hklm
, "Value4");
6431 RegDeleteValueA(hklm
, "Value5");
6432 RegDeleteValueA(hklm
, "Value6");
6433 RegDeleteValueA(hklm
, "Value7");
6434 RegDeleteValueA(hklm
, "Value8");
6435 RegDeleteValueA(hklm
, "Value9");
6436 RegDeleteValueA(hklm
, "Value10");
6437 RegDeleteValueA(hklm
, "Value11");
6438 RegDeleteValueA(hklm
, "Value12");
6439 RegDeleteKeyA(hklm
, "");
6442 RegDeleteValueA(classes
, "Value1");
6443 RegDeleteKeyA(classes
, "");
6444 RegCloseKey(classes
);
6446 RegDeleteValueA(hkcu
, "Value1");
6447 RegDeleteKeyA(hkcu
, "");
6450 RegDeleteValueA(users
, "Value1");
6451 RegDeleteKeyA(users
, "");
6454 DeleteFileA("FileName1");
6455 MsiCloseHandle(hpkg
);
6456 DeleteFileA(msifile
);
6459 static void delete_win_ini(LPCSTR file
)
6461 CHAR path
[MAX_PATH
];
6463 GetWindowsDirectoryA(path
, MAX_PATH
);
6464 lstrcatA(path
, "\\");
6465 lstrcatA(path
, file
);
6470 static void test_appsearch_inilocator(void)
6472 MSIHANDLE hpkg
, hdb
;
6473 CHAR path
[MAX_PATH
];
6474 CHAR prop
[MAX_PATH
];
6480 WritePrivateProfileStringA("Section", "Key", "keydata,field2", "IniFile.ini");
6482 create_test_file("FileName1");
6483 sprintf(path
, "%s\\FileName1", CURR_DIR
);
6484 WritePrivateProfileStringA("Section", "Key2", path
, "IniFile.ini");
6486 WritePrivateProfileStringA("Section", "Key3", CURR_DIR
, "IniFile.ini");
6488 sprintf(path
, "%s\\IDontExist", CURR_DIR
);
6489 WritePrivateProfileStringA("Section", "Key4", path
, "IniFile.ini");
6491 hdb
= create_package_db();
6492 ok(hdb
, "Expected a valid database handle\n");
6494 r
= create_appsearch_table(hdb
);
6495 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6497 r
= add_appsearch_entry(hdb
, "'SIGPROP1', 'NewSignature1'");
6498 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6500 r
= add_appsearch_entry(hdb
, "'SIGPROP2', 'NewSignature2'");
6501 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6503 r
= add_appsearch_entry(hdb
, "'SIGPROP3', 'NewSignature3'");
6504 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6506 r
= add_appsearch_entry(hdb
, "'SIGPROP4', 'NewSignature4'");
6507 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6509 r
= add_appsearch_entry(hdb
, "'SIGPROP5', 'NewSignature5'");
6510 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6512 r
= add_appsearch_entry(hdb
, "'SIGPROP6', 'NewSignature6'");
6513 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6515 r
= add_appsearch_entry(hdb
, "'SIGPROP7', 'NewSignature7'");
6516 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6518 r
= add_appsearch_entry(hdb
, "'SIGPROP8', 'NewSignature8'");
6519 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6521 r
= add_appsearch_entry(hdb
, "'SIGPROP9', 'NewSignature9'");
6522 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6524 r
= create_inilocator_table(hdb
);
6525 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6527 /* msidbLocatorTypeRawValue, field 1 */
6528 str
= "'NewSignature1', 'IniFile.ini', 'Section', 'Key', 1, 2";
6529 r
= add_inilocator_entry(hdb
, str
);
6530 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6532 /* msidbLocatorTypeRawValue, field 2 */
6533 str
= "'NewSignature2', 'IniFile.ini', 'Section', 'Key', 2, 2";
6534 r
= add_inilocator_entry(hdb
, str
);
6535 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6537 /* msidbLocatorTypeRawValue, entire field */
6538 str
= "'NewSignature3', 'IniFile.ini', 'Section', 'Key', 0, 2";
6539 r
= add_inilocator_entry(hdb
, str
);
6540 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6542 /* msidbLocatorTypeFile */
6543 str
= "'NewSignature4', 'IniFile.ini', 'Section', 'Key2', 1, 1";
6544 r
= add_inilocator_entry(hdb
, str
);
6545 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6547 /* msidbLocatorTypeDirectory, file */
6548 str
= "'NewSignature5', 'IniFile.ini', 'Section', 'Key2', 1, 0";
6549 r
= add_inilocator_entry(hdb
, str
);
6550 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6552 /* msidbLocatorTypeDirectory, directory */
6553 str
= "'NewSignature6', 'IniFile.ini', 'Section', 'Key3', 1, 0";
6554 r
= add_inilocator_entry(hdb
, str
);
6555 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6557 /* msidbLocatorTypeFile, file, no signature */
6558 str
= "'NewSignature7', 'IniFile.ini', 'Section', 'Key2', 1, 1";
6559 r
= add_inilocator_entry(hdb
, str
);
6560 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6562 /* msidbLocatorTypeFile, dir, no signature */
6563 str
= "'NewSignature8', 'IniFile.ini', 'Section', 'Key3', 1, 1";
6564 r
= add_inilocator_entry(hdb
, str
);
6565 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6567 /* msidbLocatorTypeFile, file does not exist */
6568 str
= "'NewSignature9', 'IniFile.ini', 'Section', 'Key4', 1, 1";
6569 r
= add_inilocator_entry(hdb
, str
);
6570 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6572 r
= create_signature_table(hdb
);
6573 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6575 r
= add_signature_entry(hdb
, "'NewSignature4', 'FileName1', '', '', '', '', '', '', ''");
6576 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6578 r
= add_signature_entry(hdb
, "'NewSignature9', 'IDontExist', '', '', '', '', '', '', ''");
6579 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6581 hpkg
= package_from_db(hdb
);
6582 ok(hpkg
, "Expected a valid package handle\n");
6584 r
= MsiDoAction(hpkg
, "AppSearch");
6585 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6588 r
= MsiGetPropertyA(hpkg
, "SIGPROP1", prop
, &size
);
6589 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6592 ok(!lstrcmpA(prop
, "keydata"), "Expected \"keydata\", got \"%s\"\n", prop
);
6596 r
= MsiGetPropertyA(hpkg
, "SIGPROP2", prop
, &size
);
6597 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6600 ok(!lstrcmpA(prop
, "field2"), "Expected \"field2\", got \"%s\"\n", prop
);
6604 r
= MsiGetPropertyA(hpkg
, "SIGPROP3", prop
, &size
);
6605 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6606 ok(!lstrcmpA(prop
, "keydata,field2"),
6607 "Expected \"keydata,field2\", got \"%s\"\n", prop
);
6610 sprintf(path
, "%s\\FileName1", CURR_DIR
);
6611 r
= MsiGetPropertyA(hpkg
, "SIGPROP4", prop
, &size
);
6612 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6615 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6619 r
= MsiGetPropertyA(hpkg
, "SIGPROP5", prop
, &size
);
6620 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6621 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6624 sprintf(path
, "%s\\", CURR_DIR
);
6625 r
= MsiGetPropertyA(hpkg
, "SIGPROP6", prop
, &size
);
6626 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6629 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6633 sprintf(path
, "%s\\", CURR_DIR
);
6634 r
= MsiGetPropertyA(hpkg
, "SIGPROP7", prop
, &size
);
6635 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6638 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6642 lstrcpyA(path
, CURR_DIR
);
6643 ptr
= strrchr(path
, '\\');
6645 r
= MsiGetPropertyA(hpkg
, "SIGPROP8", prop
, &size
);
6646 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6649 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6653 r
= MsiGetPropertyA(hpkg
, "SIGPROP9", prop
, &size
);
6654 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6655 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6657 delete_win_ini("IniFile.ini");
6658 DeleteFileA("FileName1");
6659 MsiCloseHandle(hpkg
);
6660 DeleteFileA(msifile
);
6663 static void test_appsearch_drlocator(void)
6665 MSIHANDLE hpkg
, hdb
;
6666 CHAR path
[MAX_PATH
];
6667 CHAR prop
[MAX_PATH
];
6672 create_test_file("FileName1");
6673 CreateDirectoryA("one", NULL
);
6674 CreateDirectoryA("one\\two", NULL
);
6675 CreateDirectoryA("one\\two\\three", NULL
);
6676 create_test_file("one\\two\\three\\FileName2");
6677 CreateDirectoryA("another", NULL
);
6679 hdb
= create_package_db();
6680 ok(hdb
, "Expected a valid database handle\n");
6682 r
= create_appsearch_table(hdb
);
6683 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6685 r
= add_appsearch_entry(hdb
, "'SIGPROP1', 'NewSignature1'");
6686 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6688 r
= add_appsearch_entry(hdb
, "'SIGPROP2', 'NewSignature2'");
6689 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6691 r
= add_appsearch_entry(hdb
, "'SIGPROP3', 'NewSignature3'");
6692 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6694 r
= add_appsearch_entry(hdb
, "'SIGPROP4', 'NewSignature4'");
6695 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6697 r
= add_appsearch_entry(hdb
, "'SIGPROP5', 'NewSignature5'");
6698 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6700 r
= add_appsearch_entry(hdb
, "'SIGPROP6', 'NewSignature6'");
6701 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6703 r
= add_appsearch_entry(hdb
, "'SIGPROP7', 'NewSignature7'");
6704 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6706 r
= create_drlocator_table(hdb
);
6707 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6709 /* no parent, full path, depth 0, signature */
6710 sprintf(path
, "'NewSignature1', '', '%s', 0", CURR_DIR
);
6711 r
= add_drlocator_entry(hdb
, path
);
6712 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6714 /* no parent, full path, depth 0, no signature */
6715 sprintf(path
, "'NewSignature2', '', '%s', 0", CURR_DIR
);
6716 r
= add_drlocator_entry(hdb
, path
);
6717 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6719 /* no parent, relative path, depth 0, no signature */
6720 sprintf(path
, "'NewSignature3', '', '%s', 0", CURR_DIR
+ 3);
6721 r
= add_drlocator_entry(hdb
, path
);
6722 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6724 /* no parent, full path, depth 2, signature */
6725 sprintf(path
, "'NewSignature4', '', '%s', 2", CURR_DIR
);
6726 r
= add_drlocator_entry(hdb
, path
);
6727 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6729 /* no parent, full path, depth 3, signature */
6730 sprintf(path
, "'NewSignature5', '', '%s', 3", CURR_DIR
);
6731 r
= add_drlocator_entry(hdb
, path
);
6732 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6734 /* no parent, full path, depth 1, signature is dir */
6735 sprintf(path
, "'NewSignature6', '', '%s', 1", CURR_DIR
);
6736 r
= add_drlocator_entry(hdb
, path
);
6737 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6739 /* parent is in DrLocator, relative path, depth 0, signature */
6740 sprintf(path
, "'NewSignature7', 'NewSignature1', 'one\\two\\three', 1");
6741 r
= add_drlocator_entry(hdb
, path
);
6742 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6744 r
= create_signature_table(hdb
);
6745 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6747 str
= "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''";
6748 r
= add_signature_entry(hdb
, str
);
6749 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6751 str
= "'NewSignature4', 'FileName2', '', '', '', '', '', '', ''";
6752 r
= add_signature_entry(hdb
, str
);
6753 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6755 str
= "'NewSignature5', 'FileName2', '', '', '', '', '', '', ''";
6756 r
= add_signature_entry(hdb
, str
);
6757 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6759 str
= "'NewSignature6', 'another', '', '', '', '', '', '', ''";
6760 r
= add_signature_entry(hdb
, str
);
6761 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6763 str
= "'NewSignature7', 'FileName2', '', '', '', '', '', '', ''";
6764 r
= add_signature_entry(hdb
, str
);
6765 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6767 hpkg
= package_from_db(hdb
);
6768 ok(hpkg
, "Expected a valid package handle\n");
6770 r
= MsiDoAction(hpkg
, "AppSearch");
6771 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6774 sprintf(path
, "%s\\FileName1", CURR_DIR
);
6775 r
= MsiGetPropertyA(hpkg
, "SIGPROP1", prop
, &size
);
6776 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6779 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6783 sprintf(path
, "%s\\", CURR_DIR
);
6784 r
= MsiGetPropertyA(hpkg
, "SIGPROP2", prop
, &size
);
6785 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6788 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6792 sprintf(path
, "%s\\", CURR_DIR
);
6793 r
= MsiGetPropertyA(hpkg
, "SIGPROP3", prop
, &size
);
6794 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6797 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6801 r
= MsiGetPropertyA(hpkg
, "SIGPROP4", prop
, &size
);
6802 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6805 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6809 sprintf(path
, "%s\\one\\two\\three\\FileName2", CURR_DIR
);
6810 r
= MsiGetPropertyA(hpkg
, "SIGPROP5", prop
, &size
);
6811 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6814 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6818 r
= MsiGetPropertyA(hpkg
, "SIGPROP6", prop
, &size
);
6819 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6822 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6826 sprintf(path
, "%s\\one\\two\\three\\FileName2", CURR_DIR
);
6827 r
= MsiGetPropertyA(hpkg
, "SIGPROP7", prop
, &size
);
6828 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6831 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6834 DeleteFileA("FileName1");
6835 DeleteFileA("one\\two\\three\\FileName2");
6836 RemoveDirectoryA("one\\two\\three");
6837 RemoveDirectoryA("one\\two");
6838 RemoveDirectoryA("one");
6839 RemoveDirectoryA("another");
6840 MsiCloseHandle(hpkg
);
6841 DeleteFileA(msifile
);
6844 static void test_featureparents(void)
6849 INSTALLSTATE state
, action
;
6851 hdb
= create_package_db();
6852 ok ( hdb
, "failed to create package database\n" );
6854 r
= add_directory_entry( hdb
, "'TARGETDIR', '', 'SourceDir'");
6855 ok( r
== ERROR_SUCCESS
, "cannot add directory: %d\n", r
);
6857 r
= create_feature_table( hdb
);
6858 ok( r
== ERROR_SUCCESS
, "cannot create Feature table: %d\n", r
);
6860 r
= create_component_table( hdb
);
6861 ok( r
== ERROR_SUCCESS
, "cannot create Component table: %d\n", r
);
6863 r
= create_feature_components_table( hdb
);
6864 ok( r
== ERROR_SUCCESS
, "cannot create FeatureComponents table: %d\n", r
);
6866 r
= create_file_table( hdb
);
6867 ok( r
== ERROR_SUCCESS
, "cannot create File table: %d\n", r
);
6869 /* msidbFeatureAttributesFavorLocal */
6870 r
= add_feature_entry( hdb
, "'zodiac', '', '', '', 2, 1, '', 0" );
6871 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
6873 /* msidbFeatureAttributesFavorSource */
6874 r
= add_feature_entry( hdb
, "'perseus', '', '', '', 2, 1, '', 1" );
6875 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
6877 /* msidbFeatureAttributesFavorLocal */
6878 r
= add_feature_entry( hdb
, "'orion', '', '', '', 2, 1, '', 0" );
6879 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
6881 /* disabled because of install level */
6882 r
= add_feature_entry( hdb
, "'waters', '', '', '', 15, 101, '', 9" );
6883 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
6885 /* child feature of disabled feature */
6886 r
= add_feature_entry( hdb
, "'bayer', 'waters', '', '', 14, 1, '', 9" );
6887 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
6889 /* component of disabled feature (install level) */
6890 r
= add_component_entry( hdb
, "'delphinus', '', 'TARGETDIR', 0, '', 'delphinus_file'" );
6891 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
6893 /* component of disabled child feature (install level) */
6894 r
= add_component_entry( hdb
, "'hydrus', '', 'TARGETDIR', 0, '', 'hydrus_file'" );
6895 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
6897 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
6898 r
= add_component_entry( hdb
, "'leo', '', 'TARGETDIR', 0, '', 'leo_file'" );
6899 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
6901 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
6902 r
= add_component_entry( hdb
, "'virgo', '', 'TARGETDIR', 1, '', 'virgo_file'" );
6903 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
6905 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
6906 r
= add_component_entry( hdb
, "'libra', '', 'TARGETDIR', 2, '', 'libra_file'" );
6907 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
6909 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
6910 r
= add_component_entry( hdb
, "'cassiopeia', '', 'TARGETDIR', 0, '', 'cassiopeia_file'" );
6911 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
6913 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
6914 r
= add_component_entry( hdb
, "'cepheus', '', 'TARGETDIR', 1, '', 'cepheus_file'" );
6915 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
6917 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
6918 r
= add_component_entry( hdb
, "'andromeda', '', 'TARGETDIR', 2, '', 'andromeda_file'" );
6919 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
6921 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
6922 r
= add_component_entry( hdb
, "'canis', '', 'TARGETDIR', 0, '', 'canis_file'" );
6923 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
6925 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
6926 r
= add_component_entry( hdb
, "'monoceros', '', 'TARGETDIR', 1, '', 'monoceros_file'" );
6927 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
6929 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
6930 r
= add_component_entry( hdb
, "'lepus', '', 'TARGETDIR', 2, '', 'lepus_file'" );
6932 r
= add_feature_components_entry( hdb
, "'zodiac', 'leo'" );
6933 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
6935 r
= add_feature_components_entry( hdb
, "'zodiac', 'virgo'" );
6936 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
6938 r
= add_feature_components_entry( hdb
, "'zodiac', 'libra'" );
6939 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
6941 r
= add_feature_components_entry( hdb
, "'perseus', 'cassiopeia'" );
6942 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
6944 r
= add_feature_components_entry( hdb
, "'perseus', 'cepheus'" );
6945 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
6947 r
= add_feature_components_entry( hdb
, "'perseus', 'andromeda'" );
6948 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
6950 r
= add_feature_components_entry( hdb
, "'orion', 'leo'" );
6951 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
6953 r
= add_feature_components_entry( hdb
, "'orion', 'virgo'" );
6954 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
6956 r
= add_feature_components_entry( hdb
, "'orion', 'libra'" );
6957 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
6959 r
= add_feature_components_entry( hdb
, "'orion', 'cassiopeia'" );
6960 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
6962 r
= add_feature_components_entry( hdb
, "'orion', 'cepheus'" );
6963 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
6965 r
= add_feature_components_entry( hdb
, "'orion', 'andromeda'" );
6966 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
6968 r
= add_feature_components_entry( hdb
, "'orion', 'canis'" );
6969 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
6971 r
= add_feature_components_entry( hdb
, "'orion', 'monoceros'" );
6972 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
6974 r
= add_feature_components_entry( hdb
, "'orion', 'lepus'" );
6975 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
6977 r
= add_feature_components_entry( hdb
, "'waters', 'delphinus'" );
6978 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
6980 r
= add_feature_components_entry( hdb
, "'bayer', 'hydrus'" );
6981 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
6983 r
= add_file_entry( hdb
, "'leo_file', 'leo', 'leo.txt', 100, '', '1033', 8192, 1" );
6984 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
6986 r
= add_file_entry( hdb
, "'virgo_file', 'virgo', 'virgo.txt', 0, '', '1033', 8192, 1" );
6987 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
6989 r
= add_file_entry( hdb
, "'libra_file', 'libra', 'libra.txt', 0, '', '1033', 8192, 1" );
6990 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
6992 r
= add_file_entry( hdb
, "'cassiopeia_file', 'cassiopeia', 'cassiopeia.txt', 0, '', '1033', 8192, 1" );
6993 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
6995 r
= add_file_entry( hdb
, "'cepheus_file', 'cepheus', 'cepheus.txt', 0, '', '1033', 8192, 1" );
6996 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
6998 r
= add_file_entry( hdb
, "'andromeda_file', 'andromeda', 'andromeda.txt', 0, '', '1033', 8192, 1" );
6999 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7001 r
= add_file_entry( hdb
, "'canis_file', 'canis', 'canis.txt', 0, '', '1033', 8192, 1" );
7002 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7004 r
= add_file_entry( hdb
, "'monoceros_file', 'monoceros', 'monoceros.txt', 0, '', '1033', 8192, 1" );
7005 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7007 r
= add_file_entry( hdb
, "'lepus_file', 'lepus', 'lepus.txt', 0, '', '1033', 8192, 1" );
7008 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7010 r
= add_file_entry( hdb
, "'delphinus_file', 'delphinus', 'delphinus.txt', 0, '', '1033', 8192, 1" );
7011 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7013 r
= add_file_entry( hdb
, "'hydrus_file', 'hydrus', 'hydrus.txt', 0, '', '1033', 8192, 1" );
7014 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7016 hpkg
= package_from_db( hdb
);
7017 ok( hpkg
, "failed to create package\n");
7019 MsiCloseHandle( hdb
);
7021 r
= MsiDoAction( hpkg
, "CostInitialize");
7022 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
7024 r
= MsiDoAction( hpkg
, "FileCost");
7025 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
7027 r
= MsiDoAction( hpkg
, "CostFinalize");
7028 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
7032 r
= MsiGetFeatureState(hpkg
, "zodiac", &state
, &action
);
7033 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7034 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
7035 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
7039 r
= MsiGetFeatureState(hpkg
, "perseus", &state
, &action
);
7040 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7041 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
7042 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
7046 r
= MsiGetFeatureState(hpkg
, "orion", &state
, &action
);
7047 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7048 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
7049 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
7053 r
= MsiGetFeatureState(hpkg
, "waters", &state
, &action
);
7054 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7055 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
7056 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
7060 r
= MsiGetFeatureState(hpkg
, "bayer", &state
, &action
);
7061 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7062 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
7063 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
7067 r
= MsiGetComponentState(hpkg
, "leo", &state
, &action
);
7068 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7069 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
7070 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
7074 r
= MsiGetComponentState(hpkg
, "virgo", &state
, &action
);
7075 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7076 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state
);
7077 ok( action
== INSTALLSTATE_SOURCE
, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action
);
7081 r
= MsiGetComponentState(hpkg
, "libra", &state
, &action
);
7082 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7083 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state
);
7084 ok( action
== INSTALLSTATE_LOCAL
, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action
);
7088 r
= MsiGetComponentState(hpkg
, "cassiopeia", &state
, &action
);
7089 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7090 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state
);
7091 ok( action
== INSTALLSTATE_LOCAL
, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action
);
7095 r
= MsiGetComponentState(hpkg
, "cepheus", &state
, &action
);
7096 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7097 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7098 ok( action
== INSTALLSTATE_SOURCE
, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action
);
7102 r
= MsiGetComponentState(hpkg
, "andromeda", &state
, &action
);
7103 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7104 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state
);
7105 ok( action
== INSTALLSTATE_LOCAL
, "Expected andromeda INSTALLSTATE_LOCAL, got %d\n", action
);
7109 r
= MsiGetComponentState(hpkg
, "canis", &state
, &action
);
7110 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7111 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state
);
7112 ok( action
== INSTALLSTATE_LOCAL
, "Expected canis INSTALLSTATE_LOCAL, got %d\n", action
);
7116 r
= MsiGetComponentState(hpkg
, "monoceros", &state
, &action
);
7117 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7118 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state
);
7119 ok( action
== INSTALLSTATE_SOURCE
, "Expected monoceros INSTALLSTATE_SOURCE, got %d\n", action
);
7123 r
= MsiGetComponentState(hpkg
, "lepus", &state
, &action
);
7124 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7125 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7126 ok( action
== INSTALLSTATE_LOCAL
, "Expected lepus INSTALLSTATE_LOCAL, got %d\n", action
);
7130 r
= MsiGetComponentState(hpkg
, "delphinus", &state
, &action
);
7131 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7132 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7133 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action
);
7137 r
= MsiGetComponentState(hpkg
, "hydrus", &state
, &action
);
7138 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7139 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7140 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action
);
7142 r
= MsiSetFeatureState(hpkg
, "orion", INSTALLSTATE_ABSENT
);
7143 ok( r
== ERROR_SUCCESS
, "failed to set feature state: %d\n", r
);
7147 r
= MsiGetFeatureState(hpkg
, "zodiac", &state
, &action
);
7148 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7149 ok( state
== INSTALLSTATE_ABSENT
, "Expected zodiac INSTALLSTATE_ABSENT, got %d\n", state
);
7150 ok( action
== INSTALLSTATE_LOCAL
, "Expected zodiac INSTALLSTATE_LOCAL, got %d\n", action
);
7154 r
= MsiGetFeatureState(hpkg
, "perseus", &state
, &action
);
7155 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7156 ok( state
== INSTALLSTATE_ABSENT
, "Expected perseus INSTALLSTATE_ABSENT, got %d\n", state
);
7157 ok( action
== INSTALLSTATE_SOURCE
, "Expected perseus INSTALLSTATE_SOURCE, got %d\n", action
);
7161 r
= MsiGetFeatureState(hpkg
, "orion", &state
, &action
);
7162 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7163 ok( state
== INSTALLSTATE_ABSENT
, "Expected orion INSTALLSTATE_ABSENT, got %d\n", state
);
7164 ok( action
== INSTALLSTATE_ABSENT
, "Expected orion INSTALLSTATE_ABSENT, got %d\n", action
);
7168 r
= MsiGetComponentState(hpkg
, "leo", &state
, &action
);
7169 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7170 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected leo INSTALLSTATE_UNKNOWN, got %d\n", state
);
7171 ok( action
== INSTALLSTATE_LOCAL
, "Expected leo INSTALLSTATE_LOCAL, got %d\n", action
);
7175 r
= MsiGetComponentState(hpkg
, "virgo", &state
, &action
);
7176 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7177 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state
);
7178 ok( action
== INSTALLSTATE_SOURCE
, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action
);
7182 r
= MsiGetComponentState(hpkg
, "libra", &state
, &action
);
7183 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7184 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state
);
7185 ok( action
== INSTALLSTATE_LOCAL
, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action
);
7189 r
= MsiGetComponentState(hpkg
, "cassiopeia", &state
, &action
);
7190 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7191 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state
);
7192 ok( action
== INSTALLSTATE_LOCAL
, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action
);
7196 r
= MsiGetComponentState(hpkg
, "cepheus", &state
, &action
);
7197 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7198 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7199 ok( action
== INSTALLSTATE_SOURCE
, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action
);
7203 r
= MsiGetComponentState(hpkg
, "andromeda", &state
, &action
);
7204 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7205 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state
);
7206 ok( action
== INSTALLSTATE_SOURCE
, "Expected andromeda INSTALLSTATE_SOURCE, got %d\n", action
);
7210 r
= MsiGetComponentState(hpkg
, "canis", &state
, &action
);
7211 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7212 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state
);
7213 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", action
);
7217 r
= MsiGetComponentState(hpkg
, "monoceros", &state
, &action
);
7218 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7219 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state
);
7220 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", action
);
7224 r
= MsiGetComponentState(hpkg
, "lepus", &state
, &action
);
7225 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7226 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7227 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", action
);
7231 r
= MsiGetComponentState(hpkg
, "delphinus", &state
, &action
);
7232 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7233 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7234 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action
);
7238 r
= MsiGetComponentState(hpkg
, "hydrus", &state
, &action
);
7239 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7240 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7241 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action
);
7243 MsiCloseHandle(hpkg
);
7244 DeleteFileA(msifile
);
7247 static void test_installprops(void)
7249 MSIHANDLE hpkg
, hdb
;
7250 CHAR path
[MAX_PATH
];
7258 GetCurrentDirectory(MAX_PATH
, path
);
7259 lstrcat(path
, "\\");
7260 lstrcat(path
, msifile
);
7262 hdb
= create_package_db();
7263 ok( hdb
, "failed to create database\n");
7265 hpkg
= package_from_db(hdb
);
7266 ok( hpkg
, "failed to create package\n");
7268 MsiCloseHandle(hdb
);
7271 r
= MsiGetProperty(hpkg
, "DATABASE", buf
, &size
);
7272 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7273 ok( !lstrcmp(buf
, path
), "Expected %s, got %s\n", path
, buf
);
7275 RegOpenKey(HKEY_CURRENT_USER
, "SOFTWARE\\Microsoft\\MS Setup (ACME)\\User Info", &hkey1
);
7277 RegOpenKey(HKEY_LOCAL_MACHINE
, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", &hkey2
);
7282 if (RegQueryValueEx(hkey1
, "DefName", NULL
, &type
, (LPBYTE
)path
, &size
) != ERROR_SUCCESS
)
7286 RegQueryValueEx(hkey2
, "RegisteredOwner", NULL
, &type
, (LPBYTE
)path
, &size
);
7289 /* win9x doesn't set this */
7293 r
= MsiGetProperty(hpkg
, "USERNAME", buf
, &size
);
7294 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7295 ok( !lstrcmp(buf
, path
), "Expected %s, got %s\n", path
, buf
);
7301 if (RegQueryValueEx(hkey1
, "DefCompany", NULL
, &type
, (LPBYTE
)path
, &size
) != ERROR_SUCCESS
)
7305 RegQueryValueEx(hkey2
, "RegisteredOrganization", NULL
, &type
, (LPBYTE
)path
, &size
);
7311 r
= MsiGetProperty(hpkg
, "COMPANYNAME", buf
, &size
);
7312 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7313 ok( !lstrcmp(buf
, path
), "Expected %s, got %s\n", path
, buf
);
7317 r
= MsiGetProperty(hpkg
, "VersionDatabase", buf
, &size
);
7318 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7319 trace("VersionDatabase = %s\n", buf
);
7322 r
= MsiGetProperty(hpkg
, "VersionMsi", buf
, &size
);
7323 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7324 trace("VersionMsi = %s\n", buf
);
7327 r
= MsiGetProperty(hpkg
, "Date", buf
, &size
);
7328 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7329 trace("Date = %s\n", buf
);
7332 r
= MsiGetProperty(hpkg
, "Time", buf
, &size
);
7333 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7334 trace("Time = %s\n", buf
);
7337 r
= MsiGetProperty(hpkg
, "PackageCode", buf
, &size
);
7338 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7339 trace("PackageCode = %s\n", buf
);
7341 langid
= GetUserDefaultLangID();
7342 sprintf(path
, "%d", langid
);
7345 r
= MsiGetProperty(hpkg
, "UserLanguageID", buf
, &size
);
7346 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS< got %d\n", r
);
7347 ok( !lstrcmpA(buf
, path
), "Expected \"%s\", got \"%s\"\n", path
, buf
);
7349 res
= GetSystemMetrics(SM_CXSCREEN
);
7351 r
= MsiGetProperty(hpkg
, "ScreenX", buf
, &size
);
7352 ok(atol(buf
) == res
, "Expected %d, got %ld\n", res
, atol(buf
));
7354 res
= GetSystemMetrics(SM_CYSCREEN
);
7356 r
= MsiGetProperty(hpkg
, "ScreenY", buf
, &size
);
7357 ok(atol(buf
) == res
, "Expected %d, got %ld\n", res
, atol(buf
));
7361 MsiCloseHandle(hpkg
);
7362 DeleteFile(msifile
);
7365 static void test_launchconditions(void)
7371 MsiSetInternalUI(INSTALLUILEVEL_NONE
, NULL
);
7373 hdb
= create_package_db();
7374 ok( hdb
, "failed to create package database\n" );
7376 r
= create_launchcondition_table( hdb
);
7377 ok( r
== ERROR_SUCCESS
, "cannot create LaunchCondition table: %d\n", r
);
7379 r
= add_launchcondition_entry( hdb
, "'X = \"1\"', 'one'" );
7380 ok( r
== ERROR_SUCCESS
, "cannot add launch condition: %d\n", r
);
7382 /* invalid condition */
7383 r
= add_launchcondition_entry( hdb
, "'X != \"1\"', 'one'" );
7384 ok( r
== ERROR_SUCCESS
, "cannot add launch condition: %d\n", r
);
7386 hpkg
= package_from_db( hdb
);
7387 ok( hpkg
, "failed to create package\n");
7389 MsiCloseHandle( hdb
);
7391 r
= MsiSetProperty( hpkg
, "X", "1" );
7392 ok( r
== ERROR_SUCCESS
, "failed to set property\n" );
7394 /* invalid conditions are ignored */
7395 r
= MsiDoAction( hpkg
, "LaunchConditions" );
7396 ok( r
== ERROR_SUCCESS
, "cost init failed\n" );
7398 /* verify LaunchConditions still does some verification */
7399 r
= MsiSetProperty( hpkg
, "X", "2" );
7400 ok( r
== ERROR_SUCCESS
, "failed to set property\n" );
7402 r
= MsiDoAction( hpkg
, "LaunchConditions" );
7403 ok( r
== ERROR_INSTALL_FAILURE
, "Expected ERROR_INSTALL_FAILURE, got %d\n", r
);
7405 MsiCloseHandle( hpkg
);
7406 DeleteFile( msifile
);
7409 static void test_ccpsearch(void)
7411 MSIHANDLE hdb
, hpkg
;
7412 CHAR prop
[MAX_PATH
];
7413 DWORD size
= MAX_PATH
;
7416 MsiSetInternalUI(INSTALLUILEVEL_NONE
, NULL
);
7418 hdb
= create_package_db();
7419 ok(hdb
, "failed to create package database\n");
7421 r
= create_ccpsearch_table(hdb
);
7422 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7424 r
= add_ccpsearch_entry(hdb
, "'CCP_random'");
7425 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7427 r
= add_ccpsearch_entry(hdb
, "'RMCCP_random'");
7428 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7430 r
= create_reglocator_table(hdb
);
7431 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7433 r
= add_reglocator_entry(hdb
, "'CCP_random', 0, 'htmlfile\\shell\\open\\nonexistent', '', 1");
7434 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7436 r
= create_drlocator_table(hdb
);
7437 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7439 r
= add_drlocator_entry(hdb
, "'RMCCP_random', '', 'C:\\', '0'");
7440 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7442 r
= create_signature_table(hdb
);
7443 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7445 hpkg
= package_from_db(hdb
);
7446 ok(hpkg
, "failed to create package\n");
7448 MsiCloseHandle(hdb
);
7450 r
= MsiDoAction(hpkg
, "CCPSearch");
7451 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7453 r
= MsiGetPropertyA(hpkg
, "CCP_Success", prop
, &size
);
7454 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7455 ok(!lstrcmpA(prop
, "1"), "Expected 1, got %s\n", prop
);
7457 MsiCloseHandle(hpkg
);
7458 DeleteFileA(msifile
);
7461 static void test_complocator(void)
7463 MSIHANDLE hdb
, hpkg
;
7465 CHAR prop
[MAX_PATH
];
7466 CHAR expected
[MAX_PATH
];
7467 DWORD size
= MAX_PATH
;
7469 hdb
= create_package_db();
7470 ok(hdb
, "failed to create package database\n");
7472 r
= create_appsearch_table(hdb
);
7473 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7475 r
= add_appsearch_entry(hdb
, "'ABELISAURUS', 'abelisaurus'");
7476 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7478 r
= add_appsearch_entry(hdb
, "'BACTROSAURUS', 'bactrosaurus'");
7479 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7481 r
= add_appsearch_entry(hdb
, "'CAMELOTIA', 'camelotia'");
7482 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7484 r
= add_appsearch_entry(hdb
, "'DICLONIUS', 'diclonius'");
7485 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7487 r
= add_appsearch_entry(hdb
, "'ECHINODON', 'echinodon'");
7488 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7490 r
= add_appsearch_entry(hdb
, "'FALCARIUS', 'falcarius'");
7491 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7493 r
= add_appsearch_entry(hdb
, "'GALLIMIMUS', 'gallimimus'");
7494 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7496 r
= add_appsearch_entry(hdb
, "'HAGRYPHUS', 'hagryphus'");
7497 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7499 r
= add_appsearch_entry(hdb
, "'IGUANODON', 'iguanodon'");
7500 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7502 r
= add_appsearch_entry(hdb
, "'JOBARIA', 'jobaria'");
7503 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7505 r
= add_appsearch_entry(hdb
, "'KAKURU', 'kakuru'");
7506 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7508 r
= add_appsearch_entry(hdb
, "'LABOCANIA', 'labocania'");
7509 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7511 r
= add_appsearch_entry(hdb
, "'MEGARAPTOR', 'megaraptor'");
7512 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7514 r
= add_appsearch_entry(hdb
, "'NEOSODON', 'neosodon'");
7515 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7517 r
= add_appsearch_entry(hdb
, "'OLOROTITAN', 'olorotitan'");
7518 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7520 r
= add_appsearch_entry(hdb
, "'PANTYDRACO', 'pantydraco'");
7521 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7523 r
= create_complocator_table(hdb
);
7524 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7526 r
= add_complocator_entry(hdb
, "'abelisaurus', '{E3619EED-305A-418C-B9C7-F7D7377F0934}', 1");
7527 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7529 r
= add_complocator_entry(hdb
, "'bactrosaurus', '{D56B688D-542F-42Ef-90FD-B6DA76EE8119}', 0");
7530 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7532 r
= add_complocator_entry(hdb
, "'camelotia', '{8211BE36-2466-47E3-AFB7-6AC72E51AED2}', 1");
7533 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7535 r
= add_complocator_entry(hdb
, "'diclonius', '{5C767B20-A33C-45A4-B80B-555E512F01AE}', 0");
7536 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7538 r
= add_complocator_entry(hdb
, "'echinodon', '{A19E16C5-C75D-4699-8111-C4338C40C3CB}', 1");
7539 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7541 r
= add_complocator_entry(hdb
, "'falcarius', '{17762FA1-A7AE-4CC6-8827-62873C35361D}', 0");
7542 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7544 r
= add_complocator_entry(hdb
, "'gallimimus', '{75EBF568-C959-41E0-A99E-9050638CF5FB}', 1");
7545 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7547 r
= add_complocator_entry(hdb
, "'hagrphus', '{D4969B72-17D9-4AB6-BE49-78F2FEE857AC}', 0");
7548 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7550 r
= add_complocator_entry(hdb
, "'iguanodon', '{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}', 1");
7551 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7553 r
= add_complocator_entry(hdb
, "'jobaria', '{243C22B1-8C51-4151-B9D1-1AE5265E079E}', 0");
7554 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7556 r
= add_complocator_entry(hdb
, "'kakuru', '{5D0F03BA-50BC-44F2-ABB1-72C972F4E514}', 1");
7557 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7559 r
= add_complocator_entry(hdb
, "'labocania', '{C7DDB60C-7828-4046-A6F8-699D5E92F1ED}', 0");
7560 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7562 r
= add_complocator_entry(hdb
, "'megaraptor', '{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}', 1");
7563 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7565 r
= add_complocator_entry(hdb
, "'neosodon', '{0B499649-197A-48EF-93D2-AF1C17ED6E90}', 0");
7566 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7568 r
= add_complocator_entry(hdb
, "'olorotitan', '{54E9E91F-AED2-46D5-A25A-7E50AFA24513}', 1");
7569 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7571 r
= add_complocator_entry(hdb
, "'pantydraco', '{2A989951-5565-4FA7-93A7-E800A3E67D71}', 0");
7572 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7574 r
= create_signature_table(hdb
);
7575 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7577 r
= add_signature_entry(hdb
, "'abelisaurus', 'abelisaurus', '', '', '', '', '', '', ''");
7578 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7580 r
= add_signature_entry(hdb
, "'bactrosaurus', 'bactrosaurus', '', '', '', '', '', '', ''");
7581 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7583 r
= add_signature_entry(hdb
, "'camelotia', 'camelotia', '', '', '', '', '', '', ''");
7584 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7586 r
= add_signature_entry(hdb
, "'diclonius', 'diclonius', '', '', '', '', '', '', ''");
7587 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7589 r
= add_signature_entry(hdb
, "'iguanodon', 'iguanodon', '', '', '', '', '', '', ''");
7590 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7592 r
= add_signature_entry(hdb
, "'jobaria', 'jobaria', '', '', '', '', '', '', ''");
7593 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7595 r
= add_signature_entry(hdb
, "'kakuru', 'kakuru', '', '', '', '', '', '', ''");
7596 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7598 r
= add_signature_entry(hdb
, "'labocania', 'labocania', '', '', '', '', '', '', ''");
7599 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7601 hpkg
= package_from_db(hdb
);
7602 ok(hpkg
, "failed to create package\n");
7604 MsiCloseHandle(hdb
);
7606 create_test_file("abelisaurus");
7607 create_test_file("bactrosaurus");
7608 create_test_file("camelotia");
7609 create_test_file("diclonius");
7610 create_test_file("echinodon");
7611 create_test_file("falcarius");
7612 create_test_file("gallimimus");
7613 create_test_file("hagryphus");
7614 CreateDirectoryA("iguanodon", NULL
);
7615 CreateDirectoryA("jobaria", NULL
);
7616 CreateDirectoryA("kakuru", NULL
);
7617 CreateDirectoryA("labocania", NULL
);
7618 CreateDirectoryA("megaraptor", NULL
);
7619 CreateDirectoryA("neosodon", NULL
);
7620 CreateDirectoryA("olorotitan", NULL
);
7621 CreateDirectoryA("pantydraco", NULL
);
7623 set_component_path("abelisaurus", MSIINSTALLCONTEXT_MACHINE
,
7624 "{E3619EED-305A-418C-B9C7-F7D7377F0934}", NULL
, FALSE
);
7625 set_component_path("bactrosaurus", MSIINSTALLCONTEXT_MACHINE
,
7626 "{D56B688D-542F-42Ef-90FD-B6DA76EE8119}", NULL
, FALSE
);
7627 set_component_path("echinodon", MSIINSTALLCONTEXT_MACHINE
,
7628 "{A19E16C5-C75D-4699-8111-C4338C40C3CB}", NULL
, FALSE
);
7629 set_component_path("falcarius", MSIINSTALLCONTEXT_MACHINE
,
7630 "{17762FA1-A7AE-4CC6-8827-62873C35361D}", NULL
, FALSE
);
7631 set_component_path("iguanodon", MSIINSTALLCONTEXT_MACHINE
,
7632 "{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}", NULL
, FALSE
);
7633 set_component_path("jobaria", MSIINSTALLCONTEXT_MACHINE
,
7634 "{243C22B1-8C51-4151-B9D1-1AE5265E079E}", NULL
, FALSE
);
7635 set_component_path("megaraptor", MSIINSTALLCONTEXT_MACHINE
,
7636 "{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}", NULL
, FALSE
);
7637 set_component_path("neosodon", MSIINSTALLCONTEXT_MACHINE
,
7638 "{0B499649-197A-48EF-93D2-AF1C17ED6E90}", NULL
, FALSE
);
7640 r
= MsiDoAction(hpkg
, "AppSearch");
7641 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7644 r
= MsiGetPropertyA(hpkg
, "ABELISAURUS", prop
, &size
);
7645 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7647 lstrcpyA(expected
, CURR_DIR
);
7648 lstrcatA(expected
, "\\abelisaurus");
7649 ok(!lstrcmpA(prop
, expected
) || !lstrcmpA(prop
, ""),
7650 "Expected %s or empty string, got %s\n", expected
, prop
);
7653 r
= MsiGetPropertyA(hpkg
, "BACTROSAURUS", prop
, &size
);
7654 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7655 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
7658 r
= MsiGetPropertyA(hpkg
, "CAMELOTIA", prop
, &size
);
7659 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7660 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
7663 r
= MsiGetPropertyA(hpkg
, "DICLONIUS", prop
, &size
);
7664 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7665 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
7668 r
= MsiGetPropertyA(hpkg
, "ECHINODON", prop
, &size
);
7669 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7671 lstrcpyA(expected
, CURR_DIR
);
7672 lstrcatA(expected
, "\\");
7673 ok(!lstrcmpA(prop
, expected
) || !lstrcmpA(prop
, ""),
7674 "Expected %s or empty string, got %s\n", expected
, prop
);
7677 r
= MsiGetPropertyA(hpkg
, "FALCARIUS", prop
, &size
);
7678 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7679 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
7682 r
= MsiGetPropertyA(hpkg
, "GALLIMIMUS", prop
, &size
);
7683 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7684 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
7687 r
= MsiGetPropertyA(hpkg
, "HAGRYPHUS", prop
, &size
);
7688 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7689 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
7692 r
= MsiGetPropertyA(hpkg
, "IGUANODON", prop
, &size
);
7693 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7694 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
7697 r
= MsiGetPropertyA(hpkg
, "JOBARIA", prop
, &size
);
7698 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7699 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
7702 r
= MsiGetPropertyA(hpkg
, "KAKURU", prop
, &size
);
7703 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7704 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
7707 r
= MsiGetPropertyA(hpkg
, "LABOCANIA", prop
, &size
);
7708 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7709 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
7712 r
= MsiGetPropertyA(hpkg
, "MEGARAPTOR", prop
, &size
);
7713 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7715 lstrcpyA(expected
, CURR_DIR
);
7716 lstrcatA(expected
, "\\");
7717 ok(!lstrcmpA(prop
, expected
) || !lstrcmpA(prop
, ""),
7718 "Expected %s or empty string, got %s\n", expected
, prop
);
7721 r
= MsiGetPropertyA(hpkg
, "NEOSODON", prop
, &size
);
7722 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7724 lstrcpyA(expected
, CURR_DIR
);
7725 lstrcatA(expected
, "\\neosodon\\");
7726 ok(!lstrcmpA(prop
, expected
) || !lstrcmpA(prop
, ""),
7727 "Expected %s or empty string, got %s\n", expected
, prop
);
7730 r
= MsiGetPropertyA(hpkg
, "OLOROTITAN", prop
, &size
);
7731 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7732 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
7735 r
= MsiGetPropertyA(hpkg
, "PANTYDRACO", prop
, &size
);
7736 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7737 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
7739 MsiCloseHandle(hpkg
);
7740 DeleteFileA("abelisaurus");
7741 DeleteFileA("bactrosaurus");
7742 DeleteFileA("camelotia");
7743 DeleteFileA("diclonius");
7744 DeleteFileA("echinodon");
7745 DeleteFileA("falcarius");
7746 DeleteFileA("gallimimus");
7747 DeleteFileA("hagryphus");
7748 RemoveDirectoryA("iguanodon");
7749 RemoveDirectoryA("jobaria");
7750 RemoveDirectoryA("kakuru");
7751 RemoveDirectoryA("labocania");
7752 RemoveDirectoryA("megaraptor");
7753 RemoveDirectoryA("neosodon");
7754 RemoveDirectoryA("olorotitan");
7755 RemoveDirectoryA("pantydraco");
7756 delete_component_path("{E3619EED-305A-418C-B9C7-F7D7377F0934}",
7757 MSIINSTALLCONTEXT_MACHINE
, NULL
);
7758 delete_component_path("{D56B688D-542F-42Ef-90FD-B6DA76EE8119}",
7759 MSIINSTALLCONTEXT_MACHINE
, NULL
);
7760 delete_component_path("{A19E16C5-C75D-4699-8111-C4338C40C3CB}",
7761 MSIINSTALLCONTEXT_MACHINE
, NULL
);
7762 delete_component_path("{17762FA1-A7AE-4CC6-8827-62873C35361D}",
7763 MSIINSTALLCONTEXT_MACHINE
, NULL
);
7764 delete_component_path("{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}",
7765 MSIINSTALLCONTEXT_MACHINE
, NULL
);
7766 delete_component_path("{243C22B1-8C51-4151-B9D1-1AE5265E079E}",
7767 MSIINSTALLCONTEXT_MACHINE
, NULL
);
7768 delete_component_path("{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}",
7769 MSIINSTALLCONTEXT_MACHINE
, NULL
);
7770 delete_component_path("{0B499649-197A-48EF-93D2-AF1C17ED6E90}",
7771 MSIINSTALLCONTEXT_MACHINE
, NULL
);
7772 DeleteFileA(msifile
);
7775 static void set_suminfo_prop(MSIHANDLE db
, DWORD prop
, DWORD val
)
7780 r
= MsiGetSummaryInformationA(db
, NULL
, 1, &summary
);
7781 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7783 r
= MsiSummaryInfoSetPropertyA(summary
, prop
, VT_I4
, val
, NULL
, NULL
);
7784 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7786 r
= MsiSummaryInfoPersist(summary
);
7787 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
7789 MsiCloseHandle(summary
);
7792 static void test_MsiGetSourcePath(void)
7794 MSIHANDLE hdb
, hpkg
;
7795 CHAR path
[MAX_PATH
];
7797 CHAR subsrc
[MAX_PATH
];
7798 CHAR sub2
[MAX_PATH
];
7802 lstrcpyA(cwd
, CURR_DIR
);
7803 lstrcatA(cwd
, "\\");
7805 lstrcpyA(subsrc
, cwd
);
7806 lstrcatA(subsrc
, "subsource");
7807 lstrcatA(subsrc
, "\\");
7809 lstrcpyA(sub2
, subsrc
);
7810 lstrcatA(sub2
, "sub2");
7811 lstrcatA(sub2
, "\\");
7813 /* uncompressed source */
7815 hdb
= create_package_db();
7816 ok( hdb
, "failed to create database\n");
7818 set_suminfo_prop(hdb
, PID_WORDCOUNT
, 0);
7820 r
= add_directory_entry(hdb
, "'TARGETDIR', '', 'SourceDir'");
7821 ok(r
== S_OK
, "failed\n");
7823 r
= add_directory_entry(hdb
, "'SubDir', 'TARGETDIR', 'subtarget:subsource'");
7824 ok(r
== S_OK
, "failed\n");
7826 r
= add_directory_entry(hdb
, "'SubDir2', 'SubDir', 'sub2'");
7827 ok(r
== S_OK
, "failed\n");
7829 r
= MsiDatabaseCommit(hdb
);
7830 ok(r
== ERROR_SUCCESS
, "Failed to commit database\n");
7832 hpkg
= package_from_db(hdb
);
7833 ok(hpkg
, "failed to create package\n");
7835 MsiCloseHandle(hdb
);
7837 /* invalid database handle */
7839 lstrcpyA(path
, "kiwi");
7840 r
= MsiGetSourcePath(-1, "TARGETDIR", path
, &size
);
7841 ok(r
== ERROR_INVALID_HANDLE
,
7842 "Expected ERROR_INVALID_HANDLE, got %d\n", r
);
7843 ok(!lstrcmpA(path
, "kiwi"),
7844 "Expected path to be unchanged, got \"%s\"\n", path
);
7845 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
7849 lstrcpyA(path
, "kiwi");
7850 r
= MsiGetSourcePath(hpkg
, NULL
, path
, &size
);
7851 ok(r
== ERROR_INVALID_PARAMETER
,
7852 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
7853 ok(!lstrcmpA(path
, "kiwi"),
7854 "Expected path to be unchanged, got \"%s\"\n", path
);
7855 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
7857 /* empty szFolder */
7859 lstrcpyA(path
, "kiwi");
7860 r
= MsiGetSourcePath(hpkg
, "", path
, &size
);
7861 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
7862 ok(!lstrcmpA(path
, "kiwi"),
7863 "Expected path to be unchanged, got \"%s\"\n", path
);
7864 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
7868 lstrcpyA(path
, "kiwi");
7869 r
= MsiGetSourcePath(hpkg
, "TARGETDIR", path
, &size
);
7870 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
7871 ok(!lstrcmpA(path
, "kiwi"),
7872 "Expected path to be unchanged, got \"%s\"\n", path
);
7873 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
7877 lstrcpyA(path
, "kiwi");
7878 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
7879 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
7880 ok(!lstrcmpA(path
, "kiwi"),
7881 "Expected path to be unchanged, got \"%s\"\n", path
);
7882 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
7886 lstrcpyA(path
, "kiwi");
7887 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
7888 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
7889 ok(!lstrcmpA(path
, "kiwi"),
7890 "Expected path to be unchanged, got \"%s\"\n", path
);
7891 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
7893 /* source path does not exist, but the property exists */
7895 lstrcpyA(path
, "kiwi");
7896 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
7897 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7898 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
7899 ok(size
== 0, "Expected 0, got %d\n", size
);
7903 lstrcpyA(path
, "kiwi");
7904 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
7905 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
7906 ok(!lstrcmpA(path
, "kiwi"),
7907 "Expected path to be unchanged, got \"%s\"\n", path
);
7908 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
7912 lstrcpyA(path
, "kiwi");
7913 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
7914 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
7915 ok(!lstrcmpA(path
, "kiwi"),
7916 "Expected path to be unchanged, got \"%s\"\n", path
);
7917 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
7919 r
= MsiDoAction(hpkg
, "CostInitialize");
7920 ok(r
== ERROR_SUCCESS
, "cost init failed\n");
7922 /* try TARGETDIR after CostInitialize */
7924 lstrcpyA(path
, "kiwi");
7925 r
= MsiGetSourcePath(hpkg
, "TARGETDIR", path
, &size
);
7926 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7927 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
7928 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
7930 /* try SourceDir after CostInitialize */
7932 lstrcpyA(path
, "kiwi");
7933 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
7934 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7935 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
7936 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
7938 /* try SOURCEDIR after CostInitialize */
7940 lstrcpyA(path
, "kiwi");
7941 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
7942 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
7943 ok(!lstrcmpA(path
, "kiwi"),
7944 "Expected path to be unchanged, got \"%s\"\n", path
);
7945 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
7947 /* source path does not exist, but the property exists */
7949 lstrcpyA(path
, "kiwi");
7950 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
7951 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7954 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
7955 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
7958 /* try SubDir after CostInitialize */
7960 lstrcpyA(path
, "kiwi");
7961 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
7962 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7963 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
7964 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
7966 /* try SubDir2 after CostInitialize */
7968 lstrcpyA(path
, "kiwi");
7969 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
7970 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7971 ok(!lstrcmpA(path
, sub2
), "Expected \"%s\", got \"%s\"\n", sub2
, path
);
7972 ok(size
== lstrlenA(sub2
), "Expected %d, got %d\n", lstrlenA(sub2
), size
);
7974 r
= MsiDoAction(hpkg
, "ResolveSource");
7975 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
7977 /* try TARGETDIR after ResolveSource */
7979 lstrcpyA(path
, "kiwi");
7980 r
= MsiGetSourcePath(hpkg
, "TARGETDIR", path
, &size
);
7981 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7982 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
7983 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
7985 /* try SourceDir after ResolveSource */
7987 lstrcpyA(path
, "kiwi");
7988 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
7989 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7990 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
7991 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
7993 /* try SOURCEDIR after ResolveSource */
7995 lstrcpyA(path
, "kiwi");
7996 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
7997 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
7998 ok(!lstrcmpA(path
, "kiwi"),
7999 "Expected path to be unchanged, got \"%s\"\n", path
);
8000 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8002 /* source path does not exist, but the property exists */
8004 lstrcpyA(path
, "kiwi");
8005 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8006 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8007 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8008 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8010 /* try SubDir after ResolveSource */
8012 lstrcpyA(path
, "kiwi");
8013 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8014 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8015 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8016 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8018 /* try SubDir2 after ResolveSource */
8020 lstrcpyA(path
, "kiwi");
8021 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
8022 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8023 ok(!lstrcmpA(path
, sub2
), "Expected \"%s\", got \"%s\"\n", sub2
, path
);
8024 ok(size
== lstrlenA(sub2
), "Expected %d, got %d\n", lstrlenA(sub2
), size
);
8026 r
= MsiDoAction(hpkg
, "FileCost");
8027 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8029 /* try TARGETDIR after FileCost */
8031 lstrcpyA(path
, "kiwi");
8032 r
= MsiGetSourcePath(hpkg
, "TARGETDIR", path
, &size
);
8033 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8034 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8035 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8037 /* try SourceDir after FileCost */
8039 lstrcpyA(path
, "kiwi");
8040 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8041 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8042 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8043 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8045 /* try SOURCEDIR after FileCost */
8047 lstrcpyA(path
, "kiwi");
8048 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
8049 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8050 ok(!lstrcmpA(path
, "kiwi"),
8051 "Expected path to be unchanged, got \"%s\"\n", path
);
8052 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8054 /* try SubDir after FileCost */
8056 lstrcpyA(path
, "kiwi");
8057 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8058 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8059 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8060 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8062 /* try SubDir2 after FileCost */
8064 lstrcpyA(path
, "kiwi");
8065 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
8066 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8067 ok(!lstrcmpA(path
, sub2
), "Expected \"%s\", got \"%s\"\n", sub2
, path
);
8068 ok(size
== lstrlenA(sub2
), "Expected %d, got %d\n", lstrlenA(sub2
), size
);
8070 r
= MsiDoAction(hpkg
, "CostFinalize");
8071 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8073 /* try TARGETDIR after CostFinalize */
8075 lstrcpyA(path
, "kiwi");
8076 r
= MsiGetSourcePath(hpkg
, "TARGETDIR", path
, &size
);
8077 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8078 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8079 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8081 /* try SourceDir after CostFinalize */
8083 lstrcpyA(path
, "kiwi");
8084 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8085 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8086 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8087 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8089 /* try SOURCEDIR after CostFinalize */
8091 lstrcpyA(path
, "kiwi");
8092 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
8093 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8094 ok(!lstrcmpA(path
, "kiwi"),
8095 "Expected path to be unchanged, got \"%s\"\n", path
);
8096 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8098 /* try SubDir after CostFinalize */
8100 lstrcpyA(path
, "kiwi");
8101 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8102 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8103 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8104 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8106 /* try SubDir2 after CostFinalize */
8108 lstrcpyA(path
, "kiwi");
8109 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
8110 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8111 ok(!lstrcmpA(path
, sub2
), "Expected \"%s\", got \"%s\"\n", sub2
, path
);
8112 ok(size
== lstrlenA(sub2
), "Expected %d, got %d\n", lstrlenA(sub2
), size
);
8114 /* nonexistent directory */
8116 lstrcpyA(path
, "kiwi");
8117 r
= MsiGetSourcePath(hpkg
, "IDontExist", path
, &size
);
8118 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8119 ok(!lstrcmpA(path
, "kiwi"),
8120 "Expected path to be unchanged, got \"%s\"\n", path
);
8121 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8123 /* NULL szPathBuf */
8125 r
= MsiGetSourcePath(hpkg
, "SourceDir", NULL
, &size
);
8126 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8127 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8129 /* NULL pcchPathBuf */
8130 lstrcpyA(path
, "kiwi");
8131 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, NULL
);
8132 ok(r
== ERROR_INVALID_PARAMETER
,
8133 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
8134 ok(!lstrcmpA(path
, "kiwi"),
8135 "Expected path to be unchanged, got \"%s\"\n", path
);
8137 /* pcchPathBuf is 0 */
8139 lstrcpyA(path
, "kiwi");
8140 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8141 ok(r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
8142 ok(!lstrcmpA(path
, "kiwi"),
8143 "Expected path to be unchanged, got \"%s\"\n", path
);
8144 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8146 /* pcchPathBuf does not have room for NULL terminator */
8147 size
= lstrlenA(cwd
);
8148 lstrcpyA(path
, "kiwi");
8149 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8150 ok(r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
8151 ok(!strncmp(path
, cwd
, lstrlenA(cwd
) - 1),
8152 "Expected path with no backslash, got \"%s\"\n", path
);
8153 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8155 /* pcchPathBuf has room for NULL terminator */
8156 size
= lstrlenA(cwd
) + 1;
8157 lstrcpyA(path
, "kiwi");
8158 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8159 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8160 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8161 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8163 MsiCloseHandle(hpkg
);
8165 /* compressed source */
8167 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_DIRECT
, &hdb
);
8168 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8170 set_suminfo_prop(hdb
, PID_WORDCOUNT
, msidbSumInfoSourceTypeCompressed
);
8172 hpkg
= package_from_db(hdb
);
8173 ok(hpkg
, "failed to create package\n");
8175 r
= MsiDoAction(hpkg
, "CostInitialize");
8176 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8177 r
= MsiDoAction(hpkg
, "FileCost");
8178 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8179 r
= MsiDoAction(hpkg
, "CostFinalize");
8180 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8182 /* try TARGETDIR after CostFinalize */
8184 lstrcpyA(path
, "kiwi");
8185 r
= MsiGetSourcePath(hpkg
, "TARGETDIR", path
, &size
);
8186 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8187 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8188 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8190 /* try SourceDir after CostFinalize */
8192 lstrcpyA(path
, "kiwi");
8193 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8194 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8195 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8196 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8198 /* try SOURCEDIR after CostFinalize */
8200 lstrcpyA(path
, "kiwi");
8201 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
8204 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8205 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8206 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8209 /* try SubDir after CostFinalize */
8211 lstrcpyA(path
, "kiwi");
8212 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8213 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8214 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8215 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8217 /* try SubDir2 after CostFinalize */
8219 lstrcpyA(path
, "kiwi");
8220 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
8221 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8222 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8223 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8225 MsiCloseHandle(hpkg
);
8226 DeleteFile(msifile
);
8229 static void test_shortlongsource(void)
8231 MSIHANDLE hdb
, hpkg
;
8232 CHAR path
[MAX_PATH
];
8234 CHAR subsrc
[MAX_PATH
];
8238 lstrcpyA(cwd
, CURR_DIR
);
8239 lstrcatA(cwd
, "\\");
8241 lstrcpyA(subsrc
, cwd
);
8242 lstrcatA(subsrc
, "long");
8243 lstrcatA(subsrc
, "\\");
8245 /* long file names */
8247 hdb
= create_package_db();
8248 ok( hdb
, "failed to create database\n");
8250 set_suminfo_prop(hdb
, PID_WORDCOUNT
, 0);
8252 r
= add_directory_entry(hdb
, "'TARGETDIR', '', 'SourceDir'");
8253 ok(r
== S_OK
, "failed\n");
8255 r
= add_directory_entry(hdb
, "'SubDir', 'TARGETDIR', 'short|long'");
8256 ok(r
== S_OK
, "failed\n");
8258 /* CostInitialize:short */
8259 r
= add_directory_entry(hdb
, "'SubDir2', 'TARGETDIR', 'one|two'");
8260 ok(r
== S_OK
, "failed\n");
8262 /* CostInitialize:long */
8263 r
= add_directory_entry(hdb
, "'SubDir3', 'TARGETDIR', 'three|four'");
8264 ok(r
== S_OK
, "failed\n");
8266 /* FileCost:short */
8267 r
= add_directory_entry(hdb
, "'SubDir4', 'TARGETDIR', 'five|six'");
8268 ok(r
== S_OK
, "failed\n");
8271 r
= add_directory_entry(hdb
, "'SubDir5', 'TARGETDIR', 'seven|eight'");
8272 ok(r
== S_OK
, "failed\n");
8274 /* CostFinalize:short */
8275 r
= add_directory_entry(hdb
, "'SubDir6', 'TARGETDIR', 'nine|ten'");
8276 ok(r
== S_OK
, "failed\n");
8278 /* CostFinalize:long */
8279 r
= add_directory_entry(hdb
, "'SubDir7', 'TARGETDIR', 'eleven|twelve'");
8280 ok(r
== S_OK
, "failed\n");
8282 MsiDatabaseCommit(hdb
);
8284 hpkg
= package_from_db(hdb
);
8285 ok(hpkg
, "failed to create package\n");
8287 MsiCloseHandle(hdb
);
8289 CreateDirectoryA("one", NULL
);
8290 CreateDirectoryA("four", NULL
);
8292 r
= MsiDoAction(hpkg
, "CostInitialize");
8293 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8295 CreateDirectory("five", NULL
);
8296 CreateDirectory("eight", NULL
);
8298 r
= MsiDoAction(hpkg
, "FileCost");
8299 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8301 CreateDirectory("nine", NULL
);
8302 CreateDirectory("twelve", NULL
);
8304 r
= MsiDoAction(hpkg
, "CostFinalize");
8305 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8307 /* neither short nor long source directories exist */
8309 lstrcpyA(path
, "kiwi");
8310 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8311 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8312 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8313 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8315 CreateDirectoryA("short", NULL
);
8317 /* short source directory exists */
8319 lstrcpyA(path
, "kiwi");
8320 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8321 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8322 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8323 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8325 CreateDirectoryA("long", NULL
);
8327 /* both short and long source directories exist */
8329 lstrcpyA(path
, "kiwi");
8330 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8331 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8332 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8333 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8335 lstrcpyA(subsrc
, cwd
);
8336 lstrcatA(subsrc
, "two");
8337 lstrcatA(subsrc
, "\\");
8339 /* short dir exists before CostInitialize */
8341 lstrcpyA(path
, "kiwi");
8342 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
8343 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8344 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8345 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8347 lstrcpyA(subsrc
, cwd
);
8348 lstrcatA(subsrc
, "four");
8349 lstrcatA(subsrc
, "\\");
8351 /* long dir exists before CostInitialize */
8353 lstrcpyA(path
, "kiwi");
8354 r
= MsiGetSourcePath(hpkg
, "SubDir3", path
, &size
);
8355 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8356 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8357 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8359 lstrcpyA(subsrc
, cwd
);
8360 lstrcatA(subsrc
, "six");
8361 lstrcatA(subsrc
, "\\");
8363 /* short dir exists before FileCost */
8365 lstrcpyA(path
, "kiwi");
8366 r
= MsiGetSourcePath(hpkg
, "SubDir4", path
, &size
);
8367 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8368 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8369 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8371 lstrcpyA(subsrc
, cwd
);
8372 lstrcatA(subsrc
, "eight");
8373 lstrcatA(subsrc
, "\\");
8375 /* long dir exists before FileCost */
8377 lstrcpyA(path
, "kiwi");
8378 r
= MsiGetSourcePath(hpkg
, "SubDir5", path
, &size
);
8379 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8380 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8381 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8383 lstrcpyA(subsrc
, cwd
);
8384 lstrcatA(subsrc
, "ten");
8385 lstrcatA(subsrc
, "\\");
8387 /* short dir exists before CostFinalize */
8389 lstrcpyA(path
, "kiwi");
8390 r
= MsiGetSourcePath(hpkg
, "SubDir6", path
, &size
);
8391 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8392 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8393 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8395 lstrcpyA(subsrc
, cwd
);
8396 lstrcatA(subsrc
, "twelve");
8397 lstrcatA(subsrc
, "\\");
8399 /* long dir exists before CostFinalize */
8401 lstrcpyA(path
, "kiwi");
8402 r
= MsiGetSourcePath(hpkg
, "SubDir7", path
, &size
);
8403 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8404 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8405 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8407 MsiCloseHandle(hpkg
);
8408 RemoveDirectoryA("short");
8409 RemoveDirectoryA("long");
8410 RemoveDirectoryA("one");
8411 RemoveDirectoryA("four");
8412 RemoveDirectoryA("five");
8413 RemoveDirectoryA("eight");
8414 RemoveDirectoryA("nine");
8415 RemoveDirectoryA("twelve");
8417 /* short file names */
8419 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_DIRECT
, &hdb
);
8420 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8422 set_suminfo_prop(hdb
, PID_WORDCOUNT
, msidbSumInfoSourceTypeSFN
);
8424 hpkg
= package_from_db(hdb
);
8425 ok(hpkg
, "failed to create package\n");
8427 MsiCloseHandle(hdb
);
8429 CreateDirectoryA("one", NULL
);
8430 CreateDirectoryA("four", NULL
);
8432 r
= MsiDoAction(hpkg
, "CostInitialize");
8433 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8435 CreateDirectory("five", NULL
);
8436 CreateDirectory("eight", NULL
);
8438 r
= MsiDoAction(hpkg
, "FileCost");
8439 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8441 CreateDirectory("nine", NULL
);
8442 CreateDirectory("twelve", NULL
);
8444 r
= MsiDoAction(hpkg
, "CostFinalize");
8445 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8447 lstrcpyA(subsrc
, cwd
);
8448 lstrcatA(subsrc
, "short");
8449 lstrcatA(subsrc
, "\\");
8451 /* neither short nor long source directories exist */
8453 lstrcpyA(path
, "kiwi");
8454 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8455 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8456 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8457 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8459 CreateDirectoryA("short", NULL
);
8461 /* short source directory exists */
8463 lstrcpyA(path
, "kiwi");
8464 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8465 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8466 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8467 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8469 CreateDirectoryA("long", NULL
);
8471 /* both short and long source directories exist */
8473 lstrcpyA(path
, "kiwi");
8474 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8475 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8476 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8477 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8479 lstrcpyA(subsrc
, cwd
);
8480 lstrcatA(subsrc
, "one");
8481 lstrcatA(subsrc
, "\\");
8483 /* short dir exists before CostInitialize */
8485 lstrcpyA(path
, "kiwi");
8486 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
8487 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8488 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8489 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8491 lstrcpyA(subsrc
, cwd
);
8492 lstrcatA(subsrc
, "three");
8493 lstrcatA(subsrc
, "\\");
8495 /* long dir exists before CostInitialize */
8497 lstrcpyA(path
, "kiwi");
8498 r
= MsiGetSourcePath(hpkg
, "SubDir3", path
, &size
);
8499 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8500 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8501 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8503 lstrcpyA(subsrc
, cwd
);
8504 lstrcatA(subsrc
, "five");
8505 lstrcatA(subsrc
, "\\");
8507 /* short dir exists before FileCost */
8509 lstrcpyA(path
, "kiwi");
8510 r
= MsiGetSourcePath(hpkg
, "SubDir4", path
, &size
);
8511 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8512 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8513 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8515 lstrcpyA(subsrc
, cwd
);
8516 lstrcatA(subsrc
, "seven");
8517 lstrcatA(subsrc
, "\\");
8519 /* long dir exists before FileCost */
8521 lstrcpyA(path
, "kiwi");
8522 r
= MsiGetSourcePath(hpkg
, "SubDir5", path
, &size
);
8523 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8524 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8525 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8527 lstrcpyA(subsrc
, cwd
);
8528 lstrcatA(subsrc
, "nine");
8529 lstrcatA(subsrc
, "\\");
8531 /* short dir exists before CostFinalize */
8533 lstrcpyA(path
, "kiwi");
8534 r
= MsiGetSourcePath(hpkg
, "SubDir6", path
, &size
);
8535 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8536 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8537 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8539 lstrcpyA(subsrc
, cwd
);
8540 lstrcatA(subsrc
, "eleven");
8541 lstrcatA(subsrc
, "\\");
8543 /* long dir exists before CostFinalize */
8545 lstrcpyA(path
, "kiwi");
8546 r
= MsiGetSourcePath(hpkg
, "SubDir7", path
, &size
);
8547 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8548 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8549 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8551 MsiCloseHandle(hpkg
);
8552 RemoveDirectoryA("short");
8553 RemoveDirectoryA("long");
8554 RemoveDirectoryA("one");
8555 RemoveDirectoryA("four");
8556 RemoveDirectoryA("five");
8557 RemoveDirectoryA("eight");
8558 RemoveDirectoryA("nine");
8559 RemoveDirectoryA("twelve");
8560 DeleteFileA(msifile
);
8563 static void test_sourcedir(void)
8565 MSIHANDLE hdb
, hpkg
;
8567 CHAR path
[MAX_PATH
];
8569 CHAR subsrc
[MAX_PATH
];
8573 lstrcpyA(cwd
, CURR_DIR
);
8574 lstrcatA(cwd
, "\\");
8576 lstrcpyA(subsrc
, cwd
);
8577 lstrcatA(subsrc
, "long");
8578 lstrcatA(subsrc
, "\\");
8580 hdb
= create_package_db();
8581 ok( hdb
, "failed to create database\n");
8583 r
= add_directory_entry(hdb
, "'TARGETDIR', '', 'SourceDir'");
8584 ok(r
== S_OK
, "failed\n");
8586 sprintf(package
, "#%li", hdb
);
8587 r
= MsiOpenPackage(package
, &hpkg
);
8588 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8590 /* properties only */
8592 /* SourceDir prop */
8594 lstrcpyA(path
, "kiwi");
8595 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
8596 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8597 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8598 ok(size
== 0, "Expected 0, got %d\n", size
);
8600 /* SOURCEDIR prop */
8602 lstrcpyA(path
, "kiwi");
8603 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8604 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8605 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8606 ok(size
== 0, "Expected 0, got %d\n", size
);
8608 r
= MsiDoAction(hpkg
, "CostInitialize");
8609 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8611 /* SourceDir after CostInitialize */
8613 lstrcpyA(path
, "kiwi");
8614 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
8615 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8616 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8617 ok(size
== 0, "Expected 0, got %d\n", size
);
8619 /* SOURCEDIR after CostInitialize */
8621 lstrcpyA(path
, "kiwi");
8622 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8623 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8624 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8625 ok(size
== 0, "Expected 0, got %d\n", size
);
8627 r
= MsiDoAction(hpkg
, "FileCost");
8628 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8630 /* SourceDir after FileCost */
8632 lstrcpyA(path
, "kiwi");
8633 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
8634 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8635 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8636 ok(size
== 0, "Expected 0, got %d\n", size
);
8638 /* SOURCEDIR after FileCost */
8640 lstrcpyA(path
, "kiwi");
8641 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8642 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8643 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8644 ok(size
== 0, "Expected 0, got %d\n", size
);
8646 r
= MsiDoAction(hpkg
, "CostFinalize");
8647 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8649 /* SourceDir after CostFinalize */
8651 lstrcpyA(path
, "kiwi");
8652 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
8653 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8654 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8655 ok(size
== 0, "Expected 0, got %d\n", size
);
8657 /* SOURCEDIR after CostFinalize */
8659 lstrcpyA(path
, "kiwi");
8660 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8661 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8662 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8663 ok(size
== 0, "Expected 0, got %d\n", size
);
8665 r
= MsiDoAction(hpkg
, "ResolveSource");
8666 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8668 /* SourceDir after ResolveSource */
8670 lstrcpyA(path
, "kiwi");
8671 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
8672 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8673 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8674 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8676 /* SOURCEDIR after ResolveSource */
8678 lstrcpyA(path
, "kiwi");
8679 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8680 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8681 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8682 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8686 lstrcpyA(path
, "kiwi");
8687 r
= MsiGetProperty(hpkg
, "SoUrCeDiR", path
, &size
);
8688 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8689 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8690 ok(size
== 0, "Expected 0, got %d\n", size
);
8692 MsiCloseHandle(hpkg
);
8694 /* reset the package state */
8695 sprintf(package
, "#%li", hdb
);
8696 r
= MsiOpenPackage(package
, &hpkg
);
8697 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8699 /* test how MsiGetSourcePath affects the properties */
8701 /* SourceDir prop */
8703 lstrcpyA(path
, "kiwi");
8704 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
8705 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8708 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8709 ok(size
== 0, "Expected 0, got %d\n", size
);
8713 lstrcpyA(path
, "kiwi");
8714 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8715 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8716 ok(!lstrcmpA(path
, "kiwi"),
8717 "Expected path to be unchanged, got \"%s\"\n", path
);
8718 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8720 /* SourceDir after MsiGetSourcePath */
8722 lstrcpyA(path
, "kiwi");
8723 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
8724 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8727 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8728 ok(size
== 0, "Expected 0, got %d\n", size
);
8731 /* SOURCEDIR prop */
8733 lstrcpyA(path
, "kiwi");
8734 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8735 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8738 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8739 ok(size
== 0, "Expected 0, got %d\n", size
);
8743 lstrcpyA(path
, "kiwi");
8744 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
8745 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8746 ok(!lstrcmpA(path
, "kiwi"),
8747 "Expected path to be unchanged, got \"%s\"\n", path
);
8748 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8750 /* SOURCEDIR prop after MsiGetSourcePath */
8752 lstrcpyA(path
, "kiwi");
8753 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8754 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8757 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8758 ok(size
== 0, "Expected 0, got %d\n", size
);
8761 r
= MsiDoAction(hpkg
, "CostInitialize");
8762 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8764 /* SourceDir after CostInitialize */
8766 lstrcpyA(path
, "kiwi");
8767 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
8768 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8771 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8772 ok(size
== 0, "Expected 0, got %d\n", size
);
8776 lstrcpyA(path
, "kiwi");
8777 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8778 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8779 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8780 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8782 /* SourceDir after MsiGetSourcePath */
8784 lstrcpyA(path
, "kiwi");
8785 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
8786 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8787 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8788 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8790 /* SOURCEDIR after CostInitialize */
8792 lstrcpyA(path
, "kiwi");
8793 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8794 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8795 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8796 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8798 /* SOURCEDIR source path still does not exist */
8800 lstrcpyA(path
, "kiwi");
8801 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
8802 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8803 ok(!lstrcmpA(path
, "kiwi"),
8804 "Expected path to be unchanged, got \"%s\"\n", path
);
8805 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8807 r
= MsiDoAction(hpkg
, "FileCost");
8808 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8810 /* SourceDir after FileCost */
8812 lstrcpyA(path
, "kiwi");
8813 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
8814 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8815 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8816 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8818 /* SOURCEDIR after FileCost */
8820 lstrcpyA(path
, "kiwi");
8821 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8822 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8823 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8824 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8826 /* SOURCEDIR source path still does not exist */
8828 lstrcpyA(path
, "kiwi");
8829 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
8830 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8831 ok(!lstrcmpA(path
, "kiwi"),
8832 "Expected path to be unchanged, got \"%s\"\n", path
);
8833 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8835 r
= MsiDoAction(hpkg
, "CostFinalize");
8836 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8838 /* SourceDir after CostFinalize */
8840 lstrcpyA(path
, "kiwi");
8841 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
8842 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8843 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8844 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8846 /* SOURCEDIR after CostFinalize */
8848 lstrcpyA(path
, "kiwi");
8849 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8850 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8851 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8852 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8854 /* SOURCEDIR source path still does not exist */
8856 lstrcpyA(path
, "kiwi");
8857 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
8858 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8859 ok(!lstrcmpA(path
, "kiwi"),
8860 "Expected path to be unchanged, got \"%s\"\n", path
);
8861 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8863 r
= MsiDoAction(hpkg
, "ResolveSource");
8864 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8866 /* SourceDir after ResolveSource */
8868 lstrcpyA(path
, "kiwi");
8869 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
8870 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8871 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8872 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8874 /* SOURCEDIR after ResolveSource */
8876 lstrcpyA(path
, "kiwi");
8877 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8878 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8879 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8880 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8882 /* SOURCEDIR source path still does not exist */
8884 lstrcpyA(path
, "kiwi");
8885 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
8886 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8887 ok(!lstrcmpA(path
, "kiwi"),
8888 "Expected path to be unchanged, got \"%s\"\n", path
);
8889 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8891 MsiCloseHandle(hdb
);
8892 MsiCloseHandle(hpkg
);
8893 DeleteFileA(msifile
);
8903 static const struct access_res create
[16] =
8905 { TRUE
, ERROR_SUCCESS
, TRUE
},
8906 { TRUE
, ERROR_SUCCESS
, TRUE
},
8907 { TRUE
, ERROR_SUCCESS
, FALSE
},
8908 { TRUE
, ERROR_SUCCESS
, FALSE
},
8909 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
8910 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
8911 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
8912 { TRUE
, ERROR_SUCCESS
, FALSE
},
8913 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
8914 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
8915 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
8916 { TRUE
, ERROR_SUCCESS
, TRUE
},
8917 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
8918 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
8919 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
8920 { TRUE
, ERROR_SUCCESS
, TRUE
}
8923 static const struct access_res create_commit
[16] =
8925 { TRUE
, ERROR_SUCCESS
, TRUE
},
8926 { TRUE
, ERROR_SUCCESS
, TRUE
},
8927 { TRUE
, ERROR_SUCCESS
, FALSE
},
8928 { TRUE
, ERROR_SUCCESS
, FALSE
},
8929 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
8930 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
8931 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
8932 { TRUE
, ERROR_SUCCESS
, FALSE
},
8933 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
8934 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
8935 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
8936 { TRUE
, ERROR_SUCCESS
, TRUE
},
8937 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
8938 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
8939 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
8940 { TRUE
, ERROR_SUCCESS
, TRUE
}
8943 static const struct access_res create_close
[16] =
8945 { TRUE
, ERROR_SUCCESS
, FALSE
},
8946 { TRUE
, ERROR_SUCCESS
, FALSE
},
8947 { TRUE
, ERROR_SUCCESS
, FALSE
},
8948 { TRUE
, ERROR_SUCCESS
, FALSE
},
8949 { TRUE
, ERROR_SUCCESS
, FALSE
},
8950 { TRUE
, ERROR_SUCCESS
, FALSE
},
8951 { TRUE
, ERROR_SUCCESS
, FALSE
},
8952 { TRUE
, ERROR_SUCCESS
, FALSE
},
8953 { TRUE
, ERROR_SUCCESS
, FALSE
},
8954 { TRUE
, ERROR_SUCCESS
, FALSE
},
8955 { TRUE
, ERROR_SUCCESS
, FALSE
},
8956 { TRUE
, ERROR_SUCCESS
, FALSE
},
8957 { TRUE
, ERROR_SUCCESS
, FALSE
},
8958 { TRUE
, ERROR_SUCCESS
, FALSE
},
8959 { TRUE
, ERROR_SUCCESS
, FALSE
},
8960 { TRUE
, ERROR_SUCCESS
}
8963 static void _test_file_access(LPCSTR file
, const struct access_res
*ares
, DWORD line
)
8965 DWORD access
= 0, share
= 0;
8970 for (i
= 0; i
< 4; i
++)
8972 if (i
== 0) access
= 0;
8973 if (i
== 1) access
= GENERIC_READ
;
8974 if (i
== 2) access
= GENERIC_WRITE
;
8975 if (i
== 3) access
= GENERIC_READ
| GENERIC_WRITE
;
8977 for (j
= 0; j
< 4; j
++)
8979 if (ares
[idx
].ignore
)
8982 if (j
== 0) share
= 0;
8983 if (j
== 1) share
= FILE_SHARE_READ
;
8984 if (j
== 2) share
= FILE_SHARE_WRITE
;
8985 if (j
== 3) share
= FILE_SHARE_READ
| FILE_SHARE_WRITE
;
8987 SetLastError(0xdeadbeef);
8988 hfile
= CreateFileA(file
, access
, share
, NULL
, OPEN_EXISTING
,
8989 FILE_ATTRIBUTE_NORMAL
, 0);
8990 lasterr
= GetLastError();
8992 ok((hfile
!= INVALID_HANDLE_VALUE
) == ares
[idx
].gothandle
,
8993 "(%d, handle, %d): Expected %d, got %d\n",
8994 line
, idx
, ares
[idx
].gothandle
,
8995 (hfile
!= INVALID_HANDLE_VALUE
));
8997 ok(lasterr
== ares
[idx
].lasterr
||
8998 lasterr
== 0xdeadbeef, /* win9x */
8999 "(%d, lasterr, %d): Expected %d, got %d\n",
9000 line
, idx
, ares
[idx
].lasterr
, lasterr
);
9008 #define test_file_access(file, ares) _test_file_access(file, ares, __LINE__)
9010 static void test_access(void)
9015 r
= MsiOpenDatabaseA(msifile
, MSIDBOPEN_CREATE
, &hdb
);
9016 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9018 test_file_access(msifile
, create
);
9020 r
= MsiDatabaseCommit(hdb
);
9021 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9023 test_file_access(msifile
, create_commit
);
9025 MsiCloseHandle(hdb
);
9027 test_file_access(msifile
, create_close
);
9029 DeleteFileA(msifile
);
9031 r
= MsiOpenDatabaseA(msifile
, MSIDBOPEN_CREATEDIRECT
, &hdb
);
9032 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9034 test_file_access(msifile
, create
);
9036 r
= MsiDatabaseCommit(hdb
);
9037 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9039 test_file_access(msifile
, create_commit
);
9041 MsiCloseHandle(hdb
);
9043 test_file_access(msifile
, create_close
);
9045 DeleteFileA(msifile
);
9048 static void test_emptypackage(void)
9050 MSIHANDLE hpkg
, hdb
, hsuminfo
;
9051 MSIHANDLE hview
, hrec
;
9052 MSICONDITION condition
;
9053 CHAR buffer
[MAX_PATH
];
9057 r
= MsiOpenPackageA("", &hpkg
);
9060 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9063 hdb
= MsiGetActiveDatabase(hpkg
);
9066 ok(hdb
!= 0, "Expected a valid database handle\n");
9069 r
= MsiDatabaseOpenView(hdb
, "SELECT * FROM `_Tables`", &hview
);
9072 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9074 r
= MsiViewExecute(hview
, 0);
9077 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9080 r
= MsiViewFetch(hview
, &hrec
);
9083 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9087 r
= MsiRecordGetString(hrec
, 1, buffer
, &size
);
9090 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9091 ok(!lstrcmpA(buffer
, "_Property"),
9092 "Expected \"_Property\", got \"%s\"\n", buffer
);
9095 MsiCloseHandle(hrec
);
9097 r
= MsiViewFetch(hview
, &hrec
);
9100 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9104 r
= MsiRecordGetString(hrec
, 1, buffer
, &size
);
9107 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9108 ok(!lstrcmpA(buffer
, "#_FolderCache"),
9109 "Expected \"_Property\", got \"%s\"\n", buffer
);
9112 MsiCloseHandle(hrec
);
9113 MsiViewClose(hview
);
9114 MsiCloseHandle(hview
);
9116 condition
= MsiDatabaseIsTablePersistentA(hdb
, "_Property");
9119 ok(condition
== MSICONDITION_FALSE
,
9120 "Expected MSICONDITION_FALSE, got %d\n", condition
);
9123 r
= MsiDatabaseOpenView(hdb
, "SELECT * FROM `_Property`", &hview
);
9126 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9128 r
= MsiViewExecute(hview
, 0);
9131 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9134 /* _Property table is not empty */
9135 r
= MsiViewFetch(hview
, &hrec
);
9138 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9141 MsiCloseHandle(hrec
);
9142 MsiViewClose(hview
);
9143 MsiCloseHandle(hview
);
9145 condition
= MsiDatabaseIsTablePersistentA(hdb
, "#_FolderCache");
9148 ok(condition
== MSICONDITION_FALSE
,
9149 "Expected MSICONDITION_FALSE, got %d\n", condition
);
9152 r
= MsiDatabaseOpenView(hdb
, "SELECT * FROM `#_FolderCache`", &hview
);
9155 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9157 r
= MsiViewExecute(hview
, 0);
9160 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9163 /* #_FolderCache is not empty */
9164 r
= MsiViewFetch(hview
, &hrec
);
9167 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9170 MsiCloseHandle(hrec
);
9171 MsiViewClose(hview
);
9172 MsiCloseHandle(hview
);
9174 r
= MsiDatabaseOpenView(hdb
, "SELECT * FROM `_Streams`", &hview
);
9177 ok(r
== ERROR_BAD_QUERY_SYNTAX
,
9178 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r
);
9181 r
= MsiDatabaseOpenView(hdb
, "SELECT * FROM `_Storages`", &hview
);
9184 ok(r
== ERROR_BAD_QUERY_SYNTAX
,
9185 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r
);
9188 r
= MsiGetSummaryInformationA(hdb
, NULL
, 0, &hsuminfo
);
9191 ok(r
== ERROR_INSTALL_PACKAGE_INVALID
,
9192 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r
);
9195 MsiCloseHandle(hsuminfo
);
9197 r
= MsiDatabaseCommit(hdb
);
9200 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9203 MsiCloseHandle(hdb
);
9204 MsiCloseHandle(hpkg
);
9209 GetCurrentDirectoryA(MAX_PATH
, CURR_DIR
);
9211 test_createpackage();
9213 test_gettargetpath_bad();
9214 test_settargetpath();
9216 test_property_table();
9219 test_formatrecord2();
9224 test_appsearch_complocator();
9225 test_appsearch_reglocator();
9226 test_appsearch_inilocator();
9227 test_appsearch_drlocator();
9228 test_featureparents();
9229 test_installprops();
9230 test_launchconditions();
9233 test_MsiGetSourcePath();
9234 test_shortlongsource();
9237 test_emptypackage();