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 create_test_guid(LPSTR prodcode
, LPSTR squashed
)
154 WCHAR guidW
[MAX_PATH
];
155 WCHAR squashedW
[MAX_PATH
];
160 hr
= CoCreateGuid(&guid
);
161 ok(hr
== S_OK
, "Expected S_OK, got %d\n", hr
);
163 size
= StringFromGUID2(&guid
, (LPOLESTR
)guidW
, MAX_PATH
);
164 ok(size
== 39, "Expected 39, got %d\n", hr
);
166 WideCharToMultiByte(CP_ACP
, 0, guidW
, size
, prodcode
, MAX_PATH
, NULL
, NULL
);
167 squash_guid(guidW
, squashedW
);
168 WideCharToMultiByte(CP_ACP
, 0, squashedW
, -1, squashed
, MAX_PATH
, NULL
, NULL
);
171 static void set_component_path(LPCSTR filename
, MSIINSTALLCONTEXT context
,
172 LPCSTR guid
, LPSTR usersid
, BOOL dir
)
174 WCHAR guidW
[MAX_PATH
];
175 WCHAR squashedW
[MAX_PATH
];
176 CHAR squashed
[MAX_PATH
];
177 CHAR comppath
[MAX_PATH
];
178 CHAR prodpath
[MAX_PATH
];
183 MultiByteToWideChar(CP_ACP
, 0, guid
, -1, guidW
, MAX_PATH
);
184 squash_guid(guidW
, squashedW
);
185 WideCharToMultiByte(CP_ACP
, 0, squashedW
, -1, squashed
, MAX_PATH
, NULL
, NULL
);
187 if (context
== MSIINSTALLCONTEXT_MACHINE
)
189 prod
= "3D0DAE300FACA1300AD792060BCDAA92";
191 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
192 "Installer\\UserData\\S-1-5-18\\Components\\%s", squashed
);
194 "SOFTWARE\\Classes\\Installer\\"
195 "Products\\3D0DAE300FACA1300AD792060BCDAA92");
197 else if (context
== MSIINSTALLCONTEXT_USERUNMANAGED
)
199 prod
= "7D2F387510109040002000060BECB6AB";
201 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
202 "Installer\\UserData\\%s\\Components\\%s", usersid
, squashed
);
204 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
205 "Installer\\%s\\Installer\\Products\\"
206 "7D2F387510109040002000060BECB6AB", usersid
);
208 else if (context
== MSIINSTALLCONTEXT_USERMANAGED
)
210 prod
= "7D2F387510109040002000060BECB6AB";
212 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
213 "Installer\\UserData\\%s\\Components\\%s", usersid
, squashed
);
215 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
216 "Installer\\Managed\\%s\\Installer\\Products\\"
217 "7D2F387510109040002000060BECB6AB", usersid
);
220 RegCreateKeyA(HKEY_LOCAL_MACHINE
, comppath
, &hkey
);
222 lstrcpyA(path
, CURR_DIR
);
223 lstrcatA(path
, "\\");
224 if (!dir
) lstrcatA(path
, filename
);
226 RegSetValueExA(hkey
, prod
, 0, REG_SZ
, (LPBYTE
)path
, lstrlenA(path
));
229 RegCreateKeyA(HKEY_LOCAL_MACHINE
, prodpath
, &hkey
);
233 static void delete_component_path(LPCSTR guid
, MSIINSTALLCONTEXT context
, LPSTR usersid
)
235 WCHAR guidW
[MAX_PATH
];
236 WCHAR squashedW
[MAX_PATH
];
237 WCHAR substrW
[MAX_PATH
];
238 CHAR squashed
[MAX_PATH
];
239 CHAR comppath
[MAX_PATH
];
240 CHAR prodpath
[MAX_PATH
];
242 MultiByteToWideChar(CP_ACP
, 0, guid
, -1, guidW
, MAX_PATH
);
243 squash_guid(guidW
, squashedW
);
244 WideCharToMultiByte(CP_ACP
, 0, squashedW
, -1, squashed
, MAX_PATH
, NULL
, NULL
);
246 if (context
== MSIINSTALLCONTEXT_MACHINE
)
249 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
250 "Installer\\UserData\\S-1-5-18\\Components\\%s", squashed
);
252 "SOFTWARE\\Classes\\Installer\\"
253 "Products\\3D0DAE300FACA1300AD792060BCDAA92");
255 else if (context
== MSIINSTALLCONTEXT_USERUNMANAGED
)
258 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
259 "Installer\\UserData\\%s\\Components\\%s", usersid
, squashed
);
261 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
262 "Installer\\%s\\Installer\\Products\\"
263 "7D2F387510109040002000060BECB6AB", usersid
);
265 else if (context
== MSIINSTALLCONTEXT_USERMANAGED
)
268 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
269 "Installer\\UserData\\%s\\Components\\%s", usersid
, squashed
);
271 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
272 "Installer\\Managed\\%s\\Installer\\Products\\"
273 "7D2F387510109040002000060BECB6AB", usersid
);
276 MultiByteToWideChar(CP_ACP
, 0, comppath
, -1, substrW
, MAX_PATH
);
277 package_RegDeleteTreeW(HKEY_LOCAL_MACHINE
, substrW
);
279 MultiByteToWideChar(CP_ACP
, 0, prodpath
, -1, substrW
, MAX_PATH
);
280 package_RegDeleteTreeW(HKEY_LOCAL_MACHINE
, substrW
);
283 static UINT
do_query(MSIHANDLE hdb
, const char *query
, MSIHANDLE
*phrec
)
288 /* open a select query */
289 r
= MsiDatabaseOpenView(hdb
, query
, &hview
);
290 if (r
!= ERROR_SUCCESS
)
292 r
= MsiViewExecute(hview
, 0);
293 if (r
!= ERROR_SUCCESS
)
295 ret
= MsiViewFetch(hview
, phrec
);
296 r
= MsiViewClose(hview
);
297 if (r
!= ERROR_SUCCESS
)
299 r
= MsiCloseHandle(hview
);
300 if (r
!= ERROR_SUCCESS
)
305 static UINT
run_query( MSIHANDLE hdb
, const char *query
)
310 r
= MsiDatabaseOpenView(hdb
, query
, &hview
);
311 if( r
!= ERROR_SUCCESS
)
314 r
= MsiViewExecute(hview
, 0);
315 if( r
== ERROR_SUCCESS
)
316 r
= MsiViewClose(hview
);
317 MsiCloseHandle(hview
);
321 static UINT
create_component_table( MSIHANDLE hdb
)
323 return run_query( hdb
,
324 "CREATE TABLE `Component` ( "
325 "`Component` CHAR(72) NOT NULL, "
326 "`ComponentId` CHAR(38), "
327 "`Directory_` CHAR(72) NOT NULL, "
328 "`Attributes` SHORT NOT NULL, "
329 "`Condition` CHAR(255), "
330 "`KeyPath` CHAR(72) "
331 "PRIMARY KEY `Component`)" );
334 static UINT
create_feature_table( MSIHANDLE hdb
)
336 return run_query( hdb
,
337 "CREATE TABLE `Feature` ( "
338 "`Feature` CHAR(38) NOT NULL, "
339 "`Feature_Parent` CHAR(38), "
341 "`Description` CHAR(255), "
342 "`Display` SHORT NOT NULL, "
343 "`Level` SHORT NOT NULL, "
344 "`Directory_` CHAR(72), "
345 "`Attributes` SHORT NOT NULL "
346 "PRIMARY KEY `Feature`)" );
349 static UINT
create_feature_components_table( MSIHANDLE hdb
)
351 return run_query( hdb
,
352 "CREATE TABLE `FeatureComponents` ( "
353 "`Feature_` CHAR(38) NOT NULL, "
354 "`Component_` CHAR(72) NOT NULL "
355 "PRIMARY KEY `Feature_`, `Component_` )" );
358 static UINT
create_file_table( MSIHANDLE hdb
)
360 return run_query( hdb
,
361 "CREATE TABLE `File` ("
362 "`File` CHAR(72) NOT NULL, "
363 "`Component_` CHAR(72) NOT NULL, "
364 "`FileName` CHAR(255) NOT NULL, "
365 "`FileSize` LONG NOT NULL, "
366 "`Version` CHAR(72), "
367 "`Language` CHAR(20), "
368 "`Attributes` SHORT, "
369 "`Sequence` SHORT NOT NULL "
370 "PRIMARY KEY `File`)" );
373 static UINT
create_remove_file_table( MSIHANDLE hdb
)
375 return run_query( hdb
,
376 "CREATE TABLE `RemoveFile` ("
377 "`FileKey` CHAR(72) NOT NULL, "
378 "`Component_` CHAR(72) NOT NULL, "
379 "`FileName` CHAR(255) LOCALIZABLE, "
380 "`DirProperty` CHAR(72) NOT NULL, "
381 "`InstallMode` SHORT NOT NULL "
382 "PRIMARY KEY `FileKey`)" );
385 static UINT
create_appsearch_table( MSIHANDLE hdb
)
387 return run_query( hdb
,
388 "CREATE TABLE `AppSearch` ("
389 "`Property` CHAR(72) NOT NULL, "
390 "`Signature_` CHAR(72) NOT NULL "
391 "PRIMARY KEY `Property`, `Signature_`)" );
394 static UINT
create_reglocator_table( MSIHANDLE hdb
)
396 return run_query( hdb
,
397 "CREATE TABLE `RegLocator` ("
398 "`Signature_` CHAR(72) NOT NULL, "
399 "`Root` SHORT NOT NULL, "
400 "`Key` CHAR(255) NOT NULL, "
403 "PRIMARY KEY `Signature_`)" );
406 static UINT
create_signature_table( MSIHANDLE hdb
)
408 return run_query( hdb
,
409 "CREATE TABLE `Signature` ("
410 "`Signature` CHAR(72) NOT NULL, "
411 "`FileName` CHAR(255) NOT NULL, "
412 "`MinVersion` CHAR(20), "
413 "`MaxVersion` CHAR(20), "
418 "`Languages` CHAR(255) "
419 "PRIMARY KEY `Signature`)" );
422 static UINT
create_launchcondition_table( MSIHANDLE hdb
)
424 return run_query( hdb
,
425 "CREATE TABLE `LaunchCondition` ("
426 "`Condition` CHAR(255) NOT NULL, "
427 "`Description` CHAR(255) NOT NULL "
428 "PRIMARY KEY `Condition`)" );
431 static UINT
create_property_table( MSIHANDLE hdb
)
433 return run_query( hdb
,
434 "CREATE TABLE `Property` ("
435 "`Property` CHAR(72) NOT NULL, "
437 "PRIMARY KEY `Property`)" );
440 static UINT
create_install_execute_sequence_table( MSIHANDLE hdb
)
442 return run_query( hdb
,
443 "CREATE TABLE `InstallExecuteSequence` ("
444 "`Action` CHAR(72) NOT NULL, "
445 "`Condition` CHAR(255), "
447 "PRIMARY KEY `Action`)" );
450 static UINT
create_media_table( MSIHANDLE hdb
)
452 return run_query( hdb
,
453 "CREATE TABLE `Media` ("
454 "`DiskId` SHORT NOT NULL, "
455 "`LastSequence` SHORT NOT NULL, "
456 "`DiskPrompt` CHAR(64), "
457 "`Cabinet` CHAR(255), "
458 "`VolumeLabel` CHAR(32), "
460 "PRIMARY KEY `DiskId`)" );
463 static UINT
create_ccpsearch_table( MSIHANDLE hdb
)
465 return run_query( hdb
,
466 "CREATE TABLE `CCPSearch` ("
467 "`Signature_` CHAR(72) NOT NULL "
468 "PRIMARY KEY `Signature_`)" );
471 static UINT
create_drlocator_table( MSIHANDLE hdb
)
473 return run_query( hdb
,
474 "CREATE TABLE `DrLocator` ("
475 "`Signature_` CHAR(72) NOT NULL, "
476 "`Parent` CHAR(72), "
479 "PRIMARY KEY `Signature_`, `Parent`, `Path`)" );
482 static UINT
create_complocator_table( MSIHANDLE hdb
)
484 return run_query( hdb
,
485 "CREATE TABLE `CompLocator` ("
486 "`Signature_` CHAR(72) NOT NULL, "
487 "`ComponentId` CHAR(38) NOT NULL, "
489 "PRIMARY KEY `Signature_`)" );
492 static UINT
create_inilocator_table( MSIHANDLE hdb
)
494 return run_query( hdb
,
495 "CREATE TABLE `IniLocator` ("
496 "`Signature_` CHAR(72) NOT NULL, "
497 "`FileName` CHAR(255) NOT NULL, "
498 "`Section` CHAR(96)NOT NULL, "
499 "`Key` CHAR(128)NOT NULL, "
502 "PRIMARY KEY `Signature_`)" );
505 #define make_add_entry(type, qtext) \
506 static UINT add##_##type##_##entry( MSIHANDLE hdb, const char *values ) \
508 char insert[] = qtext; \
511 sz = strlen(values) + sizeof insert; \
512 query = HeapAlloc(GetProcessHeap(),0,sz); \
513 sprintf(query,insert,values); \
514 r = run_query( hdb, query ); \
515 HeapFree(GetProcessHeap(), 0, query); \
519 make_add_entry(component
,
520 "INSERT INTO `Component` "
521 "(`Component`, `ComponentId`, `Directory_`, "
522 "`Attributes`, `Condition`, `KeyPath`) VALUES( %s )")
524 make_add_entry(directory
,
525 "INSERT INTO `Directory` "
526 "(`Directory`,`Directory_Parent`,`DefaultDir`) VALUES( %s )")
528 make_add_entry(feature
,
529 "INSERT INTO `Feature` "
530 "(`Feature`, `Feature_Parent`, `Title`, `Description`, "
531 "`Display`, `Level`, `Directory_`, `Attributes`) VALUES( %s )")
533 make_add_entry(feature_components
,
534 "INSERT INTO `FeatureComponents` "
535 "(`Feature_`, `Component_`) VALUES( %s )")
538 "INSERT INTO `File` "
539 "(`File`, `Component_`, `FileName`, `FileSize`, "
540 "`Version`, `Language`, `Attributes`, `Sequence`) VALUES( %s )")
542 make_add_entry(appsearch
,
543 "INSERT INTO `AppSearch` "
544 "(`Property`, `Signature_`) VALUES( %s )")
546 make_add_entry(reglocator
,
547 "INSERT INTO `RegLocator` "
548 "(`Signature_`, `Root`, `Key`, `Name`, `Type`) VALUES( %s )")
550 make_add_entry(signature
,
551 "INSERT INTO `Signature` "
552 "(`Signature`, `FileName`, `MinVersion`, `MaxVersion`,"
553 " `MinSize`, `MaxSize`, `MinDate`, `MaxDate`, `Languages`) "
556 make_add_entry(launchcondition
,
557 "INSERT INTO `LaunchCondition` "
558 "(`Condition`, `Description`) VALUES( %s )")
560 make_add_entry(property
,
561 "INSERT INTO `Property` (`Property`, `Value`) VALUES( %s )")
563 make_add_entry(install_execute_sequence
,
564 "INSERT INTO `InstallExecuteSequence` "
565 "(`Action`, `Condition`, `Sequence`) VALUES( %s )")
567 make_add_entry(media
,
568 "INSERT INTO `Media` "
569 "(`DiskId`, `LastSequence`, `DiskPrompt`, "
570 "`Cabinet`, `VolumeLabel`, `Source`) VALUES( %s )")
572 make_add_entry(ccpsearch
,
573 "INSERT INTO `CCPSearch` (`Signature_`) VALUES( %s )")
575 make_add_entry(drlocator
,
576 "INSERT INTO `DrLocator` "
577 "(`Signature_`, `Parent`, `Path`, `Depth`) VALUES( %s )")
579 make_add_entry(complocator
,
580 "INSERT INTO `CompLocator` "
581 "(`Signature_`, `ComponentId`, `Type`) VALUES( %s )")
583 make_add_entry(inilocator
,
584 "INSERT INTO `IniLocator` "
585 "(`Signature_`, `FileName`, `Section`, `Key`, `Field`, `Type`) "
588 static UINT
set_summary_info(MSIHANDLE hdb
)
593 /* build summary info */
594 res
= MsiGetSummaryInformation(hdb
, NULL
, 7, &suminfo
);
595 ok( res
== ERROR_SUCCESS
, "Failed to open summaryinfo\n" );
597 res
= MsiSummaryInfoSetProperty(suminfo
,2, VT_LPSTR
, 0,NULL
,
598 "Installation Database");
599 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
601 res
= MsiSummaryInfoSetProperty(suminfo
,3, VT_LPSTR
, 0,NULL
,
602 "Installation Database");
603 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
605 res
= MsiSummaryInfoSetProperty(suminfo
,4, VT_LPSTR
, 0,NULL
,
607 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
609 res
= MsiSummaryInfoSetProperty(suminfo
,7, VT_LPSTR
, 0,NULL
,
611 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
613 res
= MsiSummaryInfoSetProperty(suminfo
,9, VT_LPSTR
, 0,NULL
,
614 "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}");
615 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
617 res
= MsiSummaryInfoSetProperty(suminfo
, 14, VT_I4
, 100, NULL
, NULL
);
618 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
620 res
= MsiSummaryInfoSetProperty(suminfo
, 15, VT_I4
, 0, NULL
, NULL
);
621 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
623 res
= MsiSummaryInfoPersist(suminfo
);
624 ok( res
== ERROR_SUCCESS
, "Failed to make summary info persist\n" );
626 res
= MsiCloseHandle( suminfo
);
627 ok( res
== ERROR_SUCCESS
, "Failed to close suminfo\n" );
633 static MSIHANDLE
create_package_db(void)
640 /* create an empty database */
641 res
= MsiOpenDatabase(msifile
, MSIDBOPEN_CREATE
, &hdb
);
642 ok( res
== ERROR_SUCCESS
, "Failed to create database\n" );
643 if( res
!= ERROR_SUCCESS
)
646 res
= MsiDatabaseCommit( hdb
);
647 ok( res
== ERROR_SUCCESS
, "Failed to commit database\n" );
649 res
= set_summary_info(hdb
);
651 res
= run_query( hdb
,
652 "CREATE TABLE `Directory` ( "
653 "`Directory` CHAR(255) NOT NULL, "
654 "`Directory_Parent` CHAR(255), "
655 "`DefaultDir` CHAR(255) NOT NULL "
656 "PRIMARY KEY `Directory`)" );
657 ok( res
== ERROR_SUCCESS
, "Failed to create directory table\n" );
662 static MSIHANDLE
package_from_db(MSIHANDLE hdb
)
668 sprintf(szPackage
,"#%li",hdb
);
669 res
= MsiOpenPackage(szPackage
,&hPackage
);
670 if (res
!= ERROR_SUCCESS
)
673 res
= MsiCloseHandle(hdb
);
674 if (res
!= ERROR_SUCCESS
)
680 static void create_test_file(const CHAR
*name
)
685 file
= CreateFileA(name
, GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
, 0, NULL
);
686 ok(file
!= INVALID_HANDLE_VALUE
, "Failure to open file %s\n", name
);
687 WriteFile(file
, name
, strlen(name
), &written
, NULL
);
688 WriteFile(file
, "\n", strlen("\n"), &written
, NULL
);
692 typedef struct _tagVS_VERSIONINFO
699 VS_FIXEDFILEINFO Value
;
704 #define roundoffs(a, b, r) (((BYTE *)(b) - (BYTE *)(a) + ((r) - 1)) & ~((r) - 1))
705 #define roundpos(a, b, r) (((BYTE *)(a)) + roundoffs(a, b, r))
707 static BOOL
create_file_with_version(const CHAR
*name
, LONG ms
, LONG ls
)
709 VS_VERSIONINFO
*pVerInfo
;
710 VS_FIXEDFILEINFO
*pFixedInfo
;
717 GetSystemDirectory(path
, MAX_PATH
);
718 lstrcatA(path
, "\\kernel32.dll");
720 CopyFileA(path
, name
, FALSE
);
722 size
= GetFileVersionInfoSize(path
, &handle
);
723 buffer
= HeapAlloc(GetProcessHeap(), 0, size
);
725 GetFileVersionInfoA(path
, 0, size
, buffer
);
727 pVerInfo
= (VS_VERSIONINFO
*)buffer
;
728 ofs
= (BYTE
*)&pVerInfo
->szKey
[lstrlenW(pVerInfo
->szKey
) + 1];
729 pFixedInfo
= (VS_FIXEDFILEINFO
*)roundpos(pVerInfo
, ofs
, 4);
731 pFixedInfo
->dwFileVersionMS
= ms
;
732 pFixedInfo
->dwFileVersionLS
= ls
;
733 pFixedInfo
->dwProductVersionMS
= ms
;
734 pFixedInfo
->dwProductVersionLS
= ls
;
736 resource
= BeginUpdateResource(name
, FALSE
);
740 if (!UpdateResource(resource
, RT_VERSION
, MAKEINTRESOURCE(VS_VERSION_INFO
),
741 MAKELANGID(LANG_NEUTRAL
, SUBLANG_NEUTRAL
), buffer
, size
))
744 if (!EndUpdateResource(resource
, FALSE
))
750 HeapFree(GetProcessHeap(), 0, buffer
);
754 static void test_createpackage(void)
756 MSIHANDLE hPackage
= 0;
759 hPackage
= package_from_db(create_package_db());
760 ok( hPackage
!= 0, " Failed to create package\n");
762 res
= MsiCloseHandle( hPackage
);
763 ok( res
== ERROR_SUCCESS
, "Failed to close package\n" );
767 static void test_doaction( void )
772 r
= MsiDoAction( -1, NULL
);
773 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
775 hpkg
= package_from_db(create_package_db());
776 ok( hpkg
, "failed to create package\n");
778 r
= MsiDoAction(hpkg
, NULL
);
779 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
781 r
= MsiDoAction(0, "boo");
782 ok( r
== ERROR_INVALID_HANDLE
, "wrong return val\n");
784 r
= MsiDoAction(hpkg
, "boo");
785 ok( r
== ERROR_FUNCTION_NOT_CALLED
, "wrong return val\n");
787 MsiCloseHandle( hpkg
);
791 static void test_gettargetpath_bad(void)
798 hpkg
= package_from_db(create_package_db());
799 ok( hpkg
, "failed to create package\n");
801 r
= MsiGetTargetPath( 0, NULL
, NULL
, NULL
);
802 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
804 r
= MsiGetTargetPath( 0, NULL
, NULL
, &sz
);
805 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
807 r
= MsiGetTargetPath( 0, "boo", NULL
, NULL
);
808 ok( r
== ERROR_INVALID_HANDLE
, "wrong return val\n");
810 r
= MsiGetTargetPath( 0, "boo", NULL
, NULL
);
811 ok( r
== ERROR_INVALID_HANDLE
, "wrong return val\n");
813 r
= MsiGetTargetPath( hpkg
, "boo", NULL
, NULL
);
814 ok( r
== ERROR_DIRECTORY
, "wrong return val\n");
816 r
= MsiGetTargetPath( hpkg
, "boo", buffer
, NULL
);
817 ok( r
== ERROR_DIRECTORY
, "wrong return val\n");
819 MsiCloseHandle( hpkg
);
823 static void query_file_path(MSIHANDLE hpkg
, LPCSTR file
, LPSTR buff
)
829 rec
= MsiCreateRecord( 1 );
830 ok(rec
, "MsiCreate record failed\n");
832 r
= MsiRecordSetString( rec
, 0, file
);
833 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
836 r
= MsiFormatRecord( hpkg
, rec
, buff
, &size
);
837 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
839 MsiCloseHandle( rec
);
842 static void test_settargetpath(void)
844 char tempdir
[MAX_PATH
+8], buffer
[MAX_PATH
], file
[MAX_PATH
];
850 hdb
= create_package_db();
851 ok ( hdb
, "failed to create package database\n" );
853 r
= add_directory_entry( hdb
, "'TARGETDIR', '', 'SourceDir'" );
854 ok( r
== S_OK
, "failed to add directory entry: %d\n" , r
);
856 r
= create_component_table( hdb
);
857 ok( r
== S_OK
, "cannot create Component table: %d\n", r
);
859 r
= add_component_entry( hdb
, "'RootComp', '{83e2694d-0864-4124-9323-6d37630912a1}', 'TARGETDIR', 8, '', 'RootFile'" );
860 ok( r
== S_OK
, "cannot add dummy component: %d\n", r
);
862 r
= add_component_entry( hdb
, "'TestComp', '{A3FB59C8-C293-4F7E-B8C5-F0E1D8EEE4E5}', 'TestDir', 0, '', 'TestFile'" );
863 ok( r
== S_OK
, "cannot add test component: %d\n", r
);
865 r
= create_feature_table( hdb
);
866 ok( r
== S_OK
, "cannot create Feature table: %d\n", r
);
868 r
= add_feature_entry( hdb
, "'TestFeature', '', '', '', 0, 1, '', 0" );
869 ok( r
== ERROR_SUCCESS
, "cannot add TestFeature to Feature table: %d\n", r
);
871 r
= create_feature_components_table( hdb
);
872 ok( r
== S_OK
, "cannot create FeatureComponents table: %d\n", r
);
874 r
= add_feature_components_entry( hdb
, "'TestFeature', 'RootComp'" );
875 ok( r
== S_OK
, "cannot insert component into FeatureComponents table: %d\n", r
);
877 r
= add_feature_components_entry( hdb
, "'TestFeature', 'TestComp'" );
878 ok( r
== S_OK
, "cannot insert component into FeatureComponents table: %d\n", r
);
880 add_directory_entry( hdb
, "'TestParent', 'TARGETDIR', 'TestParent'" );
881 add_directory_entry( hdb
, "'TestDir', 'TestParent', 'TestDir'" );
883 r
= create_file_table( hdb
);
884 ok( r
== S_OK
, "cannot create File table: %d\n", r
);
886 r
= add_file_entry( hdb
, "'RootFile', 'RootComp', 'rootfile.txt', 0, '', '1033', 8192, 1" );
887 ok( r
== S_OK
, "cannot add file to the File table: %d\n", r
);
889 r
= add_file_entry( hdb
, "'TestFile', 'TestComp', 'testfile.txt', 0, '', '1033', 8192, 1" );
890 ok( r
== S_OK
, "cannot add file to the File table: %d\n", r
);
892 hpkg
= package_from_db( hdb
);
893 ok( hpkg
, "failed to create package\n");
895 r
= MsiDoAction( hpkg
, "CostInitialize");
896 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
898 r
= MsiDoAction( hpkg
, "FileCost");
899 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
901 r
= MsiDoAction( hpkg
, "CostFinalize");
902 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
904 r
= MsiSetTargetPath( 0, NULL
, NULL
);
905 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
907 r
= MsiSetTargetPath( 0, "boo", "C:\\bogusx" );
908 ok( r
== ERROR_INVALID_HANDLE
, "wrong return val\n");
910 r
= MsiSetTargetPath( hpkg
, "boo", NULL
);
911 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
913 r
= MsiSetTargetPath( hpkg
, "boo", "c:\\bogusx" );
914 ok( r
== ERROR_DIRECTORY
, "wrong return val\n");
916 sz
= sizeof tempdir
- 1;
917 r
= MsiGetTargetPath( hpkg
, "TARGETDIR", tempdir
, &sz
);
918 sprintf( file
, "%srootfile.txt", tempdir
);
919 query_file_path( hpkg
, "[#RootFile]", buffer
);
920 ok( r
== ERROR_SUCCESS
, "failed to get target path: %d\n", r
);
921 ok( !lstrcmp(buffer
, file
), "Expected %s, got %s\n", file
, buffer
);
923 GetTempFileName( tempdir
, "_wt", 0, buffer
);
924 sprintf( tempdir
, "%s\\subdir", buffer
);
926 r
= MsiSetTargetPath( hpkg
, "TARGETDIR", buffer
);
927 ok( r
== ERROR_SUCCESS
|| r
== ERROR_DIRECTORY
,
928 "MsiSetTargetPath on file returned %d\n", r
);
930 r
= MsiSetTargetPath( hpkg
, "TARGETDIR", tempdir
);
931 ok( r
== ERROR_SUCCESS
|| r
== ERROR_DIRECTORY
,
932 "MsiSetTargetPath on 'subdir' of file returned %d\n", r
);
934 DeleteFile( buffer
);
936 r
= MsiSetTargetPath( hpkg
, "TARGETDIR", buffer
);
937 ok( r
== ERROR_SUCCESS
, "MsiSetTargetPath returned %d\n", r
);
939 r
= GetFileAttributes( buffer
);
940 ok ( r
== INVALID_FILE_ATTRIBUTES
, "file/directory exists after MsiSetTargetPath. Attributes: %08X\n", r
);
942 r
= MsiSetTargetPath( hpkg
, "TARGETDIR", tempdir
);
943 ok( r
== ERROR_SUCCESS
, "MsiSetTargetPath on subsubdir returned %d\n", r
);
945 sz
= sizeof buffer
- 1;
946 lstrcat( tempdir
, "\\" );
947 r
= MsiGetTargetPath( hpkg
, "TARGETDIR", buffer
, &sz
);
948 ok( r
== ERROR_SUCCESS
, "failed to get target path: %d\n", r
);
949 ok( !lstrcmp(buffer
, tempdir
), "Expected %s, got %s\n", tempdir
, buffer
);
951 sprintf( file
, "%srootfile.txt", tempdir
);
952 query_file_path( hpkg
, "[#RootFile]", buffer
);
953 ok( !lstrcmp(buffer
, file
), "Expected %s, got %s\n", file
, buffer
);
955 r
= MsiSetTargetPath( hpkg
, "TestParent", "C:\\one\\two" );
956 ok( r
== ERROR_SUCCESS
, "MsiSetTargetPath returned %d\n", r
);
958 query_file_path( hpkg
, "[#TestFile]", buffer
);
959 ok( !lstrcmp(buffer
, "C:\\one\\two\\TestDir\\testfile.txt"),
960 "Expected C:\\one\\two\\TestDir\\testfile.txt, got %s\n", buffer
);
962 sz
= sizeof buffer
- 1;
963 r
= MsiGetTargetPath( hpkg
, "TestParent", buffer
, &sz
);
964 ok( r
== ERROR_SUCCESS
, "failed to get target path: %d\n", r
);
965 ok( !lstrcmp(buffer
, "C:\\one\\two\\"), "Expected C:\\one\\two\\, got %s\n", buffer
);
967 MsiCloseHandle( hpkg
);
970 static void test_condition(void)
975 hpkg
= package_from_db(create_package_db());
976 ok( hpkg
, "failed to create package\n");
978 r
= MsiEvaluateCondition(0, NULL
);
979 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
981 r
= MsiEvaluateCondition(hpkg
, NULL
);
982 ok( r
== MSICONDITION_NONE
, "wrong return val\n");
984 r
= MsiEvaluateCondition(hpkg
, "");
985 ok( r
== MSICONDITION_NONE
, "wrong return val\n");
987 r
= MsiEvaluateCondition(hpkg
, "1");
988 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
990 r
= MsiEvaluateCondition(hpkg
, "0");
991 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
993 r
= MsiEvaluateCondition(hpkg
, "-1");
994 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
996 r
= MsiEvaluateCondition(hpkg
, "0 = 0");
997 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
999 r
= MsiEvaluateCondition(hpkg
, "0 <> 0");
1000 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1002 r
= MsiEvaluateCondition(hpkg
, "0 = 1");
1003 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1005 r
= MsiEvaluateCondition(hpkg
, "0 > 1");
1006 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1008 r
= MsiEvaluateCondition(hpkg
, "0 ~> 1");
1009 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1011 r
= MsiEvaluateCondition(hpkg
, "1 > 1");
1012 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1014 r
= MsiEvaluateCondition(hpkg
, "1 ~> 1");
1015 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1017 r
= MsiEvaluateCondition(hpkg
, "0 >= 1");
1018 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1020 r
= MsiEvaluateCondition(hpkg
, "0 ~>= 1");
1021 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1023 r
= MsiEvaluateCondition(hpkg
, "1 >= 1");
1024 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1026 r
= MsiEvaluateCondition(hpkg
, "1 ~>= 1");
1027 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1029 r
= MsiEvaluateCondition(hpkg
, "0 < 1");
1030 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1032 r
= MsiEvaluateCondition(hpkg
, "0 ~< 1");
1033 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1035 r
= MsiEvaluateCondition(hpkg
, "1 < 1");
1036 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1038 r
= MsiEvaluateCondition(hpkg
, "1 ~< 1");
1039 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1041 r
= MsiEvaluateCondition(hpkg
, "0 <= 1");
1042 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1044 r
= MsiEvaluateCondition(hpkg
, "0 ~<= 1");
1045 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1047 r
= MsiEvaluateCondition(hpkg
, "1 <= 1");
1048 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1050 r
= MsiEvaluateCondition(hpkg
, "1 ~<= 1");
1051 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1053 r
= MsiEvaluateCondition(hpkg
, "0 >=");
1054 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1056 r
= MsiEvaluateCondition(hpkg
, " ");
1057 ok( r
== MSICONDITION_NONE
, "wrong return val\n");
1059 r
= MsiEvaluateCondition(hpkg
, "LicView <> \"1\"");
1060 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1062 r
= MsiEvaluateCondition(hpkg
, "LicView <> \"0\"");
1063 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1065 r
= MsiEvaluateCondition(hpkg
, "LicView <> LicView");
1066 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1068 r
= MsiEvaluateCondition(hpkg
, "not 0");
1069 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1071 r
= MsiEvaluateCondition(hpkg
, "not LicView");
1072 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1074 r
= MsiEvaluateCondition(hpkg
, "not \"A\"");
1075 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1077 r
= MsiEvaluateCondition(hpkg
, "~not \"A\"");
1078 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1080 r
= MsiEvaluateCondition(hpkg
, "\"0\"");
1081 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1083 r
= MsiEvaluateCondition(hpkg
, "1 and 2");
1084 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1086 r
= MsiEvaluateCondition(hpkg
, "not 0 and 3");
1087 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1089 r
= MsiEvaluateCondition(hpkg
, "not 0 and 0");
1090 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1092 r
= MsiEvaluateCondition(hpkg
, "not 0 or 1");
1093 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1095 r
= MsiEvaluateCondition(hpkg
, "(0)");
1096 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1098 r
= MsiEvaluateCondition(hpkg
, "(((((1))))))");
1099 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1101 r
= MsiEvaluateCondition(hpkg
, "(((((1)))))");
1102 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1104 r
= MsiEvaluateCondition(hpkg
, " \"A\" < \"B\" ");
1105 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1107 r
= MsiEvaluateCondition(hpkg
, " \"A\" > \"B\" ");
1108 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1110 r
= MsiEvaluateCondition(hpkg
, " \"1\" > \"12\" ");
1111 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1113 r
= MsiEvaluateCondition(hpkg
, " \"100\" < \"21\" ");
1114 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1116 r
= MsiEvaluateCondition(hpkg
, "0 < > 0");
1117 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1119 r
= MsiEvaluateCondition(hpkg
, "(1<<1) == 2");
1120 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1122 r
= MsiEvaluateCondition(hpkg
, " \"A\" = \"a\" ");
1123 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1125 r
= MsiEvaluateCondition(hpkg
, " \"A\" ~ = \"a\" ");
1126 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1128 r
= MsiEvaluateCondition(hpkg
, " \"A\" ~= \"a\" ");
1129 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1131 r
= MsiEvaluateCondition(hpkg
, " \"A\" ~= 1 ");
1132 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1134 r
= MsiEvaluateCondition(hpkg
, " \"A\" = 1 ");
1135 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1137 r
= MsiEvaluateCondition(hpkg
, " 1 ~= 1 ");
1138 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1140 r
= MsiEvaluateCondition(hpkg
, " 1 ~= \"1\" ");
1141 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1143 r
= MsiEvaluateCondition(hpkg
, " 1 = \"1\" ");
1144 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1146 r
= MsiEvaluateCondition(hpkg
, " 0 = \"1\" ");
1147 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1149 r
= MsiEvaluateCondition(hpkg
, " 0 < \"100\" ");
1150 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1152 r
= MsiEvaluateCondition(hpkg
, " 100 > \"0\" ");
1153 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1155 r
= MsiEvaluateCondition(hpkg
, "1 XOR 1");
1156 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1158 r
= MsiEvaluateCondition(hpkg
, "1 IMP 1");
1159 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1161 r
= MsiEvaluateCondition(hpkg
, "1 IMP 0");
1162 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1164 r
= MsiEvaluateCondition(hpkg
, "0 IMP 0");
1165 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1167 r
= MsiEvaluateCondition(hpkg
, "0 EQV 0");
1168 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1170 r
= MsiEvaluateCondition(hpkg
, "0 EQV 1");
1171 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1173 r
= MsiEvaluateCondition(hpkg
, "1 IMP 1 OR 0");
1174 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1176 r
= MsiEvaluateCondition(hpkg
, "1 IMPL 1");
1177 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1179 r
= MsiEvaluateCondition(hpkg
, "\"ASFD\" >< \"S\" ");
1180 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1182 r
= MsiEvaluateCondition(hpkg
, "\"ASFD\" ~>< \"s\" ");
1183 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1185 r
= MsiEvaluateCondition(hpkg
, "\"ASFD\" ~>< \"\" ");
1186 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1188 r
= MsiEvaluateCondition(hpkg
, "\"ASFD\" ~>< \"sss\" ");
1189 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1191 MsiSetProperty(hpkg
, "mm", "5" );
1193 r
= MsiEvaluateCondition(hpkg
, "mm = 5");
1194 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1196 r
= MsiEvaluateCondition(hpkg
, "mm < 6");
1197 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1199 r
= MsiEvaluateCondition(hpkg
, "mm <= 5");
1200 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1202 r
= MsiEvaluateCondition(hpkg
, "mm > 4");
1203 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1205 r
= MsiEvaluateCondition(hpkg
, "mm < 12");
1206 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1208 r
= MsiEvaluateCondition(hpkg
, "mm = \"5\"");
1209 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1211 r
= MsiEvaluateCondition(hpkg
, "0 = \"\"");
1212 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1214 r
= MsiEvaluateCondition(hpkg
, "0 AND \"\"");
1215 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1217 r
= MsiEvaluateCondition(hpkg
, "1 AND \"\"");
1218 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1220 r
= MsiEvaluateCondition(hpkg
, "1 AND \"1\"");
1221 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1223 r
= MsiEvaluateCondition(hpkg
, "3 >< 1");
1224 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1226 r
= MsiEvaluateCondition(hpkg
, "3 >< 4");
1227 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1229 r
= MsiEvaluateCondition(hpkg
, "NOT 0 AND 0");
1230 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1232 r
= MsiEvaluateCondition(hpkg
, "NOT 0 AND 1");
1233 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1235 r
= MsiEvaluateCondition(hpkg
, "NOT 1 OR 0");
1236 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1238 r
= MsiEvaluateCondition(hpkg
, "0 AND 1 OR 1");
1239 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1241 r
= MsiEvaluateCondition(hpkg
, "0 AND 0 OR 1");
1242 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1244 r
= MsiEvaluateCondition(hpkg
, "NOT 0 AND 1 OR 0");
1245 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1247 r
= MsiEvaluateCondition(hpkg
, "_1 = _1");
1248 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1250 r
= MsiEvaluateCondition(hpkg
, "( 1 AND 1 ) = 2");
1251 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1253 r
= MsiEvaluateCondition(hpkg
, "NOT ( 1 AND 1 )");
1254 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1256 r
= MsiEvaluateCondition(hpkg
, "NOT A AND (BBBBBBBBBB=2 OR CCC=1) AND Ddddddddd");
1257 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1259 r
= MsiEvaluateCondition(hpkg
, "Installed<>\"\"");
1260 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1262 r
= MsiEvaluateCondition(hpkg
, "NOT 1 AND 0");
1263 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1265 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1266 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1268 r
= MsiEvaluateCondition(hpkg
, "bandalmael<>0");
1269 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1271 r
= MsiEvaluateCondition(hpkg
, "bandalmael<0");
1272 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1274 r
= MsiEvaluateCondition(hpkg
, "bandalmael>0");
1275 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1277 r
= MsiEvaluateCondition(hpkg
, "bandalmael>=0");
1278 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1280 r
= MsiEvaluateCondition(hpkg
, "bandalmael<=0");
1281 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1283 r
= MsiEvaluateCondition(hpkg
, "bandalmael~<>0");
1284 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1286 MsiSetProperty(hpkg
, "bandalmael", "0" );
1287 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1288 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1290 MsiSetProperty(hpkg
, "bandalmael", "" );
1291 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1292 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1294 MsiSetProperty(hpkg
, "bandalmael", "asdf" );
1295 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1296 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1298 MsiSetProperty(hpkg
, "bandalmael", "0asdf" );
1299 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1300 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1302 MsiSetProperty(hpkg
, "bandalmael", "0 " );
1303 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1304 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1306 MsiSetProperty(hpkg
, "bandalmael", "-0" );
1307 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1308 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1310 MsiSetProperty(hpkg
, "bandalmael", "0000000000000" );
1311 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1312 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1314 MsiSetProperty(hpkg
, "bandalmael", "--0" );
1315 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1316 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1318 MsiSetProperty(hpkg
, "bandalmael", "0x00" );
1319 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1320 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1322 MsiSetProperty(hpkg
, "bandalmael", "-" );
1323 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1324 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1326 MsiSetProperty(hpkg
, "bandalmael", "+0" );
1327 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1328 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1330 MsiSetProperty(hpkg
, "bandalmael", "0.0" );
1331 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1332 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1333 r
= MsiEvaluateCondition(hpkg
, "bandalmael<>0");
1334 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1336 MsiSetProperty(hpkg
, "one", "hi");
1337 MsiSetProperty(hpkg
, "two", "hithere");
1338 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1339 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1341 MsiSetProperty(hpkg
, "one", "hithere");
1342 MsiSetProperty(hpkg
, "two", "hi");
1343 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1344 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1346 MsiSetProperty(hpkg
, "one", "hello");
1347 MsiSetProperty(hpkg
, "two", "hi");
1348 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1349 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1351 MsiSetProperty(hpkg
, "one", "hellohithere");
1352 MsiSetProperty(hpkg
, "two", "hi");
1353 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1354 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1356 MsiSetProperty(hpkg
, "one", "");
1357 MsiSetProperty(hpkg
, "two", "hi");
1358 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1359 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1361 MsiSetProperty(hpkg
, "one", "hi");
1362 MsiSetProperty(hpkg
, "two", "");
1363 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1364 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1366 MsiSetProperty(hpkg
, "one", "");
1367 MsiSetProperty(hpkg
, "two", "");
1368 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1369 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1371 MsiSetProperty(hpkg
, "one", "1234");
1372 MsiSetProperty(hpkg
, "two", "1");
1373 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1374 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1376 MsiSetProperty(hpkg
, "one", "one 1234");
1377 MsiSetProperty(hpkg
, "two", "1");
1378 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1379 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1381 MsiSetProperty(hpkg
, "one", "hithere");
1382 MsiSetProperty(hpkg
, "two", "hi");
1383 r
= MsiEvaluateCondition(hpkg
, "one << two");
1384 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1386 MsiSetProperty(hpkg
, "one", "hi");
1387 MsiSetProperty(hpkg
, "two", "hithere");
1388 r
= MsiEvaluateCondition(hpkg
, "one << two");
1389 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1391 MsiSetProperty(hpkg
, "one", "hi");
1392 MsiSetProperty(hpkg
, "two", "hi");
1393 r
= MsiEvaluateCondition(hpkg
, "one << two");
1394 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1396 MsiSetProperty(hpkg
, "one", "abcdhithere");
1397 MsiSetProperty(hpkg
, "two", "hi");
1398 r
= MsiEvaluateCondition(hpkg
, "one << two");
1399 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1401 MsiSetProperty(hpkg
, "one", "");
1402 MsiSetProperty(hpkg
, "two", "hi");
1403 r
= MsiEvaluateCondition(hpkg
, "one << two");
1404 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1406 MsiSetProperty(hpkg
, "one", "hithere");
1407 MsiSetProperty(hpkg
, "two", "");
1408 r
= MsiEvaluateCondition(hpkg
, "one << two");
1409 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1411 MsiSetProperty(hpkg
, "one", "");
1412 MsiSetProperty(hpkg
, "two", "");
1413 r
= MsiEvaluateCondition(hpkg
, "one << two");
1414 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1416 MsiSetProperty(hpkg
, "one", "1234");
1417 MsiSetProperty(hpkg
, "two", "1");
1418 r
= MsiEvaluateCondition(hpkg
, "one << two");
1419 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1421 MsiSetProperty(hpkg
, "one", "1234 one");
1422 MsiSetProperty(hpkg
, "two", "1");
1423 r
= MsiEvaluateCondition(hpkg
, "one << two");
1424 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1426 MsiSetProperty(hpkg
, "one", "hithere");
1427 MsiSetProperty(hpkg
, "two", "there");
1428 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1429 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1431 MsiSetProperty(hpkg
, "one", "hithere");
1432 MsiSetProperty(hpkg
, "two", "hi");
1433 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1434 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1436 MsiSetProperty(hpkg
, "one", "there");
1437 MsiSetProperty(hpkg
, "two", "hithere");
1438 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1439 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1441 MsiSetProperty(hpkg
, "one", "there");
1442 MsiSetProperty(hpkg
, "two", "there");
1443 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1444 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1446 MsiSetProperty(hpkg
, "one", "abcdhithere");
1447 MsiSetProperty(hpkg
, "two", "hi");
1448 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1449 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1451 MsiSetProperty(hpkg
, "one", "");
1452 MsiSetProperty(hpkg
, "two", "there");
1453 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1454 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1456 MsiSetProperty(hpkg
, "one", "there");
1457 MsiSetProperty(hpkg
, "two", "");
1458 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1459 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1461 MsiSetProperty(hpkg
, "one", "");
1462 MsiSetProperty(hpkg
, "two", "");
1463 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1464 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1466 MsiSetProperty(hpkg
, "one", "1234");
1467 MsiSetProperty(hpkg
, "two", "4");
1468 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1469 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1471 MsiSetProperty(hpkg
, "one", "one 1234");
1472 MsiSetProperty(hpkg
, "two", "4");
1473 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1474 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1476 MsiSetProperty(hpkg
, "MsiNetAssemblySupport", NULL
); /* make sure it's empty */
1478 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322\"");
1479 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1481 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport > \"1.1.4322\"");
1482 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1484 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport >= \"1.1.4322\"");
1485 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1487 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport <= \"1.1.4322\"");
1488 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1490 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport <> \"1.1.4322\"");
1491 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1493 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport ~< \"1.1.4322\"");
1494 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1496 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"abcd\"");
1497 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1499 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a1.1.4322\"");
1500 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1502 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322a\"");
1503 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1505 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"0000001.1.4322\"");
1506 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1508 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322.1\"");
1509 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1511 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322.1.1\"");
1512 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1514 r
= MsiEvaluateCondition(hpkg
, "\"2\" < \"1.1");
1515 ok( r
== MSICONDITION_ERROR
, "wrong return val (%d)\n", r
);
1517 r
= MsiEvaluateCondition(hpkg
, "\"2\" < \"1.1\"");
1518 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1520 r
= MsiEvaluateCondition(hpkg
, "\"2\" < \"12.1\"");
1521 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1523 r
= MsiEvaluateCondition(hpkg
, "\"02.1\" < \"2.11\"");
1524 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1526 r
= MsiEvaluateCondition(hpkg
, "\"02.1.1\" < \"2.1\"");
1527 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1529 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1\"");
1530 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1532 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1\"");
1533 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1535 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"0\"");
1536 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1538 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"-1\"");
1539 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1541 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a\"");
1542 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1544 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"!\"");
1545 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1547 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"!\"");
1548 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1550 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"/\"");
1551 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1553 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \" \"");
1554 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1556 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"azAZ_\"");
1557 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1559 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a[a]\"");
1560 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1562 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a[a]a\"");
1563 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1565 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"[a]\"");
1566 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1568 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"[a]a\"");
1569 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1571 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"{a}\"");
1572 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1574 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"{a\"");
1575 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1577 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"[a\"");
1578 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1580 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a{\"");
1581 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1583 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a]\"");
1584 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1586 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"A\"");
1587 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1589 MsiSetProperty(hpkg
, "MsiNetAssemblySupport", "1.1.4322");
1590 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322\"");
1591 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1593 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.14322\"");
1594 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1596 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.5\"");
1597 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1599 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1\"");
1600 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1602 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1\"");
1603 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1605 MsiSetProperty(hpkg
, "one", "1");
1606 r
= MsiEvaluateCondition(hpkg
, "one < \"1\"");
1607 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1609 MsiSetProperty(hpkg
, "X", "5.0");
1611 r
= MsiEvaluateCondition(hpkg
, "X != \"\"");
1612 ok( r
== MSICONDITION_ERROR
, "wrong return val (%d)\n", r
);
1614 r
= MsiEvaluateCondition(hpkg
, "X =\"5.0\"");
1615 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1617 r
= MsiEvaluateCondition(hpkg
, "X =\"5.1\"");
1618 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1620 r
= MsiEvaluateCondition(hpkg
, "X =\"6.0\"");
1621 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1623 r
= MsiEvaluateCondition(hpkg
, "X =\"5.0\" or X =\"5.1\" or X =\"6.0\"");
1624 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1626 r
= MsiEvaluateCondition(hpkg
, "(X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1627 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1629 r
= MsiEvaluateCondition(hpkg
, "X !=\"\" and (X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1630 ok( r
== MSICONDITION_ERROR
, "wrong return val (%d)\n", r
);
1632 /* feature doesn't exist */
1633 r
= MsiEvaluateCondition(hpkg
, "&nofeature");
1634 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1636 MsiSetProperty(hpkg
, "A", "2");
1637 MsiSetProperty(hpkg
, "X", "50");
1639 r
= MsiEvaluateCondition(hpkg
, "2 <= X");
1640 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1642 r
= MsiEvaluateCondition(hpkg
, "A <= X");
1643 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1645 r
= MsiEvaluateCondition(hpkg
, "A <= 50");
1646 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1648 MsiSetProperty(hpkg
, "X", "50val");
1650 r
= MsiEvaluateCondition(hpkg
, "2 <= X");
1651 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1653 r
= MsiEvaluateCondition(hpkg
, "A <= X");
1654 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1656 MsiSetProperty(hpkg
, "A", "7");
1657 MsiSetProperty(hpkg
, "X", "50");
1659 r
= MsiEvaluateCondition(hpkg
, "7 <= X");
1660 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1662 r
= MsiEvaluateCondition(hpkg
, "A <= X");
1663 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1665 r
= MsiEvaluateCondition(hpkg
, "A <= 50");
1666 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1668 MsiSetProperty(hpkg
, "X", "50val");
1670 r
= MsiEvaluateCondition(hpkg
, "2 <= X");
1671 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1673 r
= MsiEvaluateCondition(hpkg
, "A <= X");
1674 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1676 MsiCloseHandle( hpkg
);
1677 DeleteFile(msifile
);
1680 static BOOL
check_prop_empty( MSIHANDLE hpkg
, const char * prop
)
1688 r
= MsiGetProperty( hpkg
, prop
, buffer
, &sz
);
1689 return r
== ERROR_SUCCESS
&& buffer
[0] == 0 && sz
== 0;
1692 static void test_props(void)
1694 MSIHANDLE hpkg
, hdb
;
1699 hdb
= create_package_db();
1701 "CREATE TABLE `Property` ( "
1702 "`Property` CHAR(255) NOT NULL, "
1703 "`Value` CHAR(255) "
1704 "PRIMARY KEY `Property`)" );
1705 ok( r
== ERROR_SUCCESS
, "Failed\n" );
1708 "INSERT INTO `Property` "
1709 "(`Property`, `Value`) "
1710 "VALUES( 'MetadataCompName', 'Photoshop.dll' )");
1711 ok( r
== ERROR_SUCCESS
, "Failed\n" );
1713 hpkg
= package_from_db( hdb
);
1714 ok( hpkg
, "failed to create package\n");
1716 /* test invalid values */
1717 r
= MsiGetProperty( 0, NULL
, NULL
, NULL
);
1718 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
1720 r
= MsiGetProperty( hpkg
, NULL
, NULL
, NULL
);
1721 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
1723 r
= MsiGetProperty( hpkg
, "boo", NULL
, NULL
);
1724 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1726 r
= MsiGetProperty( hpkg
, "boo", buffer
, NULL
);
1727 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
1729 /* test retrieving an empty/nonexistent property */
1731 r
= MsiGetProperty( hpkg
, "boo", NULL
, &sz
);
1732 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1733 ok( sz
== 0, "wrong size returned\n");
1735 check_prop_empty( hpkg
, "boo");
1738 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1739 ok( r
== ERROR_MORE_DATA
, "wrong return val\n");
1740 ok( !strcmp(buffer
,"x"), "buffer was changed\n");
1741 ok( sz
== 0, "wrong size returned\n");
1745 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1746 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1747 ok( buffer
[0] == 0, "buffer was not changed\n");
1748 ok( sz
== 0, "wrong size returned\n");
1750 /* set the property to something */
1751 r
= MsiSetProperty( 0, NULL
, NULL
);
1752 ok( r
== ERROR_INVALID_HANDLE
, "wrong return val\n");
1754 r
= MsiSetProperty( hpkg
, NULL
, NULL
);
1755 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
1757 r
= MsiSetProperty( hpkg
, "", NULL
);
1758 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1760 /* try set and get some illegal property identifiers */
1761 r
= MsiSetProperty( hpkg
, "", "asdf" );
1762 ok( r
== ERROR_FUNCTION_FAILED
, "wrong return val\n");
1764 r
= MsiSetProperty( hpkg
, "=", "asdf" );
1765 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1767 r
= MsiSetProperty( hpkg
, " ", "asdf" );
1768 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1770 r
= MsiSetProperty( hpkg
, "'", "asdf" );
1771 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1775 r
= MsiGetProperty( hpkg
, "'", buffer
, &sz
);
1776 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1777 ok( !strcmp(buffer
,"asdf"), "buffer was not changed\n");
1779 /* set empty values */
1780 r
= MsiSetProperty( hpkg
, "boo", NULL
);
1781 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1782 ok( check_prop_empty( hpkg
, "boo"), "prop wasn't empty\n");
1784 r
= MsiSetProperty( hpkg
, "boo", "" );
1785 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1786 ok( check_prop_empty( hpkg
, "boo"), "prop wasn't empty\n");
1788 /* set a non-empty value */
1789 r
= MsiSetProperty( hpkg
, "boo", "xyz" );
1790 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1794 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1795 ok( r
== ERROR_MORE_DATA
, "wrong return val\n");
1796 ok( buffer
[0] == 0, "buffer was not changed\n");
1797 ok( sz
== 3, "wrong size returned\n");
1801 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1802 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1803 ok( !strcmp(buffer
,"xyz"), "buffer was not changed\n");
1804 ok( sz
== 3, "wrong size returned\n");
1808 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1809 ok( r
== ERROR_MORE_DATA
, "wrong return val\n");
1810 ok( !strcmp(buffer
,"xy"), "buffer was not changed\n");
1811 ok( sz
== 3, "wrong size returned\n");
1813 r
= MsiSetProperty(hpkg
, "SourceDir", "foo");
1814 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1817 r
= MsiGetProperty(hpkg
, "SOURCEDIR", buffer
, &sz
);
1818 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1819 ok( !strcmp(buffer
,""), "buffer wrong\n");
1820 ok( sz
== 0, "wrong size returned\n");
1823 r
= MsiGetProperty(hpkg
, "SOMERANDOMNAME", buffer
, &sz
);
1824 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1825 ok( !strcmp(buffer
,""), "buffer wrong\n");
1826 ok( sz
== 0, "wrong size returned\n");
1829 r
= MsiGetProperty(hpkg
, "SourceDir", buffer
, &sz
);
1830 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1831 ok( !strcmp(buffer
,"foo"), "buffer wrong\n");
1832 ok( sz
== 3, "wrong size returned\n");
1834 r
= MsiSetProperty(hpkg
, "MetadataCompName", "Photoshop.dll");
1835 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1838 r
= MsiGetProperty(hpkg
, "MetadataCompName", NULL
, &sz
);
1839 ok( r
== ERROR_SUCCESS
, "return wrong\n");
1840 ok( sz
== 13, "size wrong (%d)\n", sz
);
1843 r
= MsiGetProperty(hpkg
, "MetadataCompName", buffer
, &sz
);
1844 ok( r
== ERROR_MORE_DATA
, "return wrong\n");
1845 ok( !strcmp(buffer
,"Photoshop.dl"), "buffer wrong\n");
1847 r
= MsiSetProperty(hpkg
, "property", "value");
1848 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1851 r
= MsiGetProperty(hpkg
, "property", buffer
, &sz
);
1852 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1853 ok( !strcmp(buffer
, "value"), "Expected value, got %s\n", buffer
);
1855 r
= MsiSetProperty(hpkg
, "property", NULL
);
1856 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1859 r
= MsiGetProperty(hpkg
, "property", buffer
, &sz
);
1860 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1861 ok( !strlen(buffer
), "Expected empty string, got %s\n", buffer
);
1863 MsiCloseHandle( hpkg
);
1864 DeleteFile(msifile
);
1867 static BOOL
find_prop_in_property(MSIHANDLE hdb
, LPCSTR prop
, LPCSTR val
)
1869 MSIHANDLE hview
, hrec
;
1871 CHAR buffer
[MAX_PATH
];
1875 r
= MsiDatabaseOpenView(hdb
, "SELECT * FROM `_Property`", &hview
);
1876 ok(r
== ERROR_SUCCESS
, "MsiDatabaseOpenView failed\n");
1877 r
= MsiViewExecute(hview
, 0);
1878 ok(r
== ERROR_SUCCESS
, "MsiViewExecute failed\n");
1881 while (r
== ERROR_SUCCESS
&& !found
)
1883 r
= MsiViewFetch(hview
, &hrec
);
1884 if (r
!= ERROR_SUCCESS
) break;
1887 r
= MsiRecordGetString(hrec
, 1, buffer
, &sz
);
1888 if (r
== ERROR_SUCCESS
&& !lstrcmpA(buffer
, prop
))
1891 r
= MsiRecordGetString(hrec
, 2, buffer
, &sz
);
1892 if (r
== ERROR_SUCCESS
&& !lstrcmpA(buffer
, val
))
1896 MsiCloseHandle(hrec
);
1899 MsiViewClose(hview
);
1900 MsiCloseHandle(hview
);
1905 static void test_property_table(void)
1909 MSIHANDLE hpkg
, hdb
, hrec
;
1910 char buffer
[MAX_PATH
];
1914 hdb
= create_package_db();
1915 ok( hdb
, "failed to create package\n");
1917 hpkg
= package_from_db(hdb
);
1918 ok( hpkg
, "failed to create package\n");
1920 MsiCloseHandle(hdb
);
1922 hdb
= MsiGetActiveDatabase(hpkg
);
1924 query
= "CREATE TABLE `_Property` ( "
1925 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
1926 r
= run_query(hdb
, query
);
1927 ok(r
== ERROR_BAD_QUERY_SYNTAX
, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r
);
1929 MsiCloseHandle(hdb
);
1930 MsiCloseHandle(hpkg
);
1931 DeleteFile(msifile
);
1933 hdb
= create_package_db();
1934 ok( hdb
, "failed to create package\n");
1936 query
= "CREATE TABLE `_Property` ( "
1937 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
1938 r
= run_query(hdb
, query
);
1939 ok(r
== ERROR_SUCCESS
, "failed to create table\n");
1941 query
= "ALTER `_Property` ADD `foo` INTEGER";
1942 r
= run_query(hdb
, query
);
1943 ok(r
== ERROR_BAD_QUERY_SYNTAX
, "failed to add column\n");
1945 query
= "ALTER TABLE `_Property` ADD `foo` INTEGER";
1946 r
= run_query(hdb
, query
);
1947 ok(r
== ERROR_BAD_QUERY_SYNTAX
, "failed to add column\n");
1949 query
= "ALTER TABLE `_Property` ADD `extra` INTEGER";
1950 r
= run_query(hdb
, query
);
1951 ok(r
== ERROR_SUCCESS
, "failed to add column\n");
1953 hpkg
= package_from_db(hdb
);
1956 ok(!hpkg
, "package should not be created\n");
1959 MsiCloseHandle(hdb
);
1960 MsiCloseHandle(hpkg
);
1961 DeleteFile(msifile
);
1963 hdb
= create_package_db();
1964 ok (hdb
, "failed to create package database\n");
1966 r
= create_property_table(hdb
);
1967 ok(r
== ERROR_SUCCESS
, "cannot create Property table: %d\n", r
);
1969 r
= add_property_entry(hdb
, "'prop', 'val'");
1970 ok(r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
1972 hpkg
= package_from_db(hdb
);
1973 ok(hpkg
, "failed to create package\n");
1975 MsiCloseHandle(hdb
);
1978 r
= MsiGetProperty(hpkg
, "prop", buffer
, &sz
);
1979 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1980 ok(!lstrcmp(buffer
, "val"), "Expected val, got %s\n", buffer
);
1982 hdb
= MsiGetActiveDatabase(hpkg
);
1984 found
= find_prop_in_property(hdb
, "prop", "val");
1985 ok(found
, "prop should be in the _Property table\n");
1987 r
= add_property_entry(hdb
, "'dantes', 'mercedes'");
1988 ok(r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
1990 query
= "SELECT * FROM `_Property` WHERE `Property` = 'dantes'";
1991 r
= do_query(hdb
, query
, &hrec
);
1992 ok(r
== ERROR_BAD_QUERY_SYNTAX
, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r
);
1994 found
= find_prop_in_property(hdb
, "dantes", "mercedes");
1995 ok(found
== FALSE
, "dantes should not be in the _Property table\n");
1998 lstrcpy(buffer
, "aaa");
1999 r
= MsiGetProperty(hpkg
, "dantes", buffer
, &sz
);
2000 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2001 ok(lstrlenA(buffer
) == 0, "Expected empty string, got %s\n", buffer
);
2003 r
= MsiSetProperty(hpkg
, "dantes", "mercedes");
2004 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2006 found
= find_prop_in_property(hdb
, "dantes", "mercedes");
2007 ok(found
== TRUE
, "dantes should be in the _Property table\n");
2009 MsiCloseHandle(hdb
);
2010 MsiCloseHandle(hpkg
);
2011 DeleteFile(msifile
);
2014 static UINT
try_query_param( MSIHANDLE hdb
, LPCSTR szQuery
, MSIHANDLE hrec
)
2019 res
= MsiDatabaseOpenView( hdb
, szQuery
, &htab
);
2020 if( res
== ERROR_SUCCESS
)
2024 r
= MsiViewExecute( htab
, hrec
);
2025 if( r
!= ERROR_SUCCESS
)
2028 fprintf(stderr
,"MsiViewExecute failed %08x\n", res
);
2031 r
= MsiViewClose( htab
);
2032 if( r
!= ERROR_SUCCESS
)
2035 r
= MsiCloseHandle( htab
);
2036 if( r
!= ERROR_SUCCESS
)
2042 static UINT
try_query( MSIHANDLE hdb
, LPCSTR szQuery
)
2044 return try_query_param( hdb
, szQuery
, 0 );
2047 static void set_summary_str(MSIHANDLE hdb
, DWORD pid
, LPCSTR value
)
2052 r
= MsiGetSummaryInformationA(hdb
, NULL
, 1, &summary
);
2053 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2055 r
= MsiSummaryInfoSetPropertyA(summary
, pid
, VT_LPSTR
, 0, NULL
, value
);
2056 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
2058 r
= MsiSummaryInfoPersist(summary
);
2059 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
2061 MsiCloseHandle(summary
);
2064 static void set_summary_dword(MSIHANDLE hdb
, DWORD pid
, DWORD value
)
2069 r
= MsiGetSummaryInformationA(hdb
, NULL
, 1, &summary
);
2070 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2072 r
= MsiSummaryInfoSetPropertyA(summary
, pid
, VT_I4
, value
, NULL
, NULL
);
2073 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
2075 r
= MsiSummaryInfoPersist(summary
);
2076 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
2078 MsiCloseHandle(summary
);
2081 static void test_msipackage(void)
2083 MSIHANDLE hdb
= 0, hpack
= 100;
2088 /* NULL szPackagePath */
2089 r
= MsiOpenPackage(NULL
, &hpack
);
2090 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2092 /* empty szPackagePath */
2093 r
= MsiOpenPackage("", &hpack
);
2096 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2099 if (r
== ERROR_SUCCESS
)
2100 MsiCloseHandle(hpack
);
2102 /* nonexistent szPackagePath */
2103 r
= MsiOpenPackage("nonexistent", &hpack
);
2104 ok(r
== ERROR_FILE_NOT_FOUND
, "Expected ERROR_FILE_NOT_FOUND, got %d\n", r
);
2107 r
= MsiOpenPackage(msifile
, NULL
);
2108 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2112 r
= MsiOpenPackage(name
, &hpack
);
2113 ok(r
== ERROR_INVALID_HANDLE
, "Expected ERROR_INVALID_HANDLE, got %d\n", r
);
2115 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_CREATE
, &hdb
);
2116 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2118 /* database exists, but is emtpy */
2119 sprintf(name
, "#%ld", hdb
);
2120 r
= MsiOpenPackage(name
, &hpack
);
2121 ok(r
== ERROR_INSTALL_PACKAGE_INVALID
,
2122 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r
);
2124 query
= "CREATE TABLE `Property` ( "
2125 "`Property` CHAR(72), `Value` CHAR(0) "
2126 "PRIMARY KEY `Property`)";
2127 r
= try_query(hdb
, query
);
2128 ok(r
== ERROR_SUCCESS
, "failed to create Properties table\n");
2130 query
= "CREATE TABLE `InstallExecuteSequence` ("
2131 "`Action` CHAR(72), `Condition` CHAR(0), `Sequence` INTEGER "
2132 "PRIMARY KEY `Action`)";
2133 r
= try_query(hdb
, query
);
2134 ok(r
== ERROR_SUCCESS
, "failed to create InstallExecuteSequence table\n");
2136 /* a few key tables exist */
2137 sprintf(name
, "#%ld", hdb
);
2138 r
= MsiOpenPackage(name
, &hpack
);
2139 ok(r
== ERROR_INSTALL_PACKAGE_INVALID
,
2140 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r
);
2142 MsiCloseHandle(hdb
);
2143 DeleteFile(msifile
);
2145 /* start with a clean database to show what constitutes a valid package */
2146 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_CREATE
, &hdb
);
2147 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2149 sprintf(name
, "#%ld", hdb
);
2151 /* The following summary information props must exist:
2156 set_summary_dword(hdb
, PID_PAGECOUNT
, 100);
2157 r
= MsiOpenPackage(name
, &hpack
);
2158 ok(r
== ERROR_INSTALL_PACKAGE_INVALID
,
2159 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r
);
2161 set_summary_str(hdb
, PID_REVNUMBER
, "{004757CD-5092-49c2-AD20-28E1CE0DF5F2}");
2162 r
= MsiOpenPackage(name
, &hpack
);
2163 ok(r
== ERROR_SUCCESS
,
2164 "Expected ERROR_SUCCESS, got %d\n", r
);
2166 MsiCloseHandle(hpack
);
2167 MsiCloseHandle(hdb
);
2168 DeleteFile(msifile
);
2171 static void test_formatrecord2(void)
2173 MSIHANDLE hpkg
, hrec
;
2178 hpkg
= package_from_db(create_package_db());
2179 ok( hpkg
, "failed to create package\n");
2181 r
= MsiSetProperty(hpkg
, "Manufacturer", " " );
2182 ok( r
== ERROR_SUCCESS
, "set property failed\n");
2184 hrec
= MsiCreateRecord(2);
2185 ok(hrec
, "create record failed\n");
2187 r
= MsiRecordSetString( hrec
, 0, "[ProgramFilesFolder][Manufacturer]\\asdf");
2188 ok( r
== ERROR_SUCCESS
, "format record failed\n");
2192 r
= MsiFormatRecord( hpkg
, hrec
, buffer
, &sz
);
2194 r
= MsiRecordSetString(hrec
, 0, "[foo][1]");
2195 r
= MsiRecordSetString(hrec
, 1, "hoo");
2197 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2198 ok( sz
== 3, "size wrong\n");
2199 ok( 0 == strcmp(buffer
,"hoo"), "wrong output %s\n",buffer
);
2200 ok( r
== ERROR_SUCCESS
, "format failed\n");
2202 r
= MsiRecordSetString(hrec
, 0, "x[~]x");
2204 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2205 ok( sz
== 3, "size wrong\n");
2206 ok( 0 == strcmp(buffer
,"x"), "wrong output %s\n",buffer
);
2207 ok( r
== ERROR_SUCCESS
, "format failed\n");
2209 r
= MsiRecordSetString(hrec
, 0, "[foo.$%}][1]");
2210 r
= MsiRecordSetString(hrec
, 1, "hoo");
2212 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2213 ok( sz
== 3, "size wrong\n");
2214 ok( 0 == strcmp(buffer
,"hoo"), "wrong output %s\n",buffer
);
2215 ok( r
== ERROR_SUCCESS
, "format failed\n");
2217 r
= MsiRecordSetString(hrec
, 0, "[\\[]");
2219 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2220 ok( sz
== 1, "size wrong\n");
2221 ok( 0 == strcmp(buffer
,"["), "wrong output %s\n",buffer
);
2222 ok( r
== ERROR_SUCCESS
, "format failed\n");
2224 SetEnvironmentVariable("FOO", "BAR");
2225 r
= MsiRecordSetString(hrec
, 0, "[%FOO]");
2227 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2228 ok( sz
== 3, "size wrong\n");
2229 ok( 0 == strcmp(buffer
,"BAR"), "wrong output %s\n",buffer
);
2230 ok( r
== ERROR_SUCCESS
, "format failed\n");
2232 r
= MsiRecordSetString(hrec
, 0, "[[1]]");
2233 r
= MsiRecordSetString(hrec
, 1, "%FOO");
2235 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2236 ok( sz
== 3, "size wrong\n");
2237 ok( 0 == strcmp(buffer
,"BAR"), "wrong output %s\n",buffer
);
2238 ok( r
== ERROR_SUCCESS
, "format failed\n");
2240 MsiCloseHandle( hrec
);
2241 MsiCloseHandle( hpkg
);
2242 DeleteFile(msifile
);
2245 static void test_states(void)
2250 INSTALLSTATE state
, action
;
2252 static const CHAR msifile2
[] = "winetest2.msi";
2253 static const CHAR msifile3
[] = "winetest3.msi";
2255 hdb
= create_package_db();
2256 ok ( hdb
, "failed to create package database\n" );
2258 r
= add_directory_entry( hdb
, "'TARGETDIR', '', 'SourceDir'");
2259 ok( r
== ERROR_SUCCESS
, "cannot add directory: %d\n", r
);
2261 r
= create_property_table( hdb
);
2262 ok( r
== ERROR_SUCCESS
, "cannot create Property table: %d\n", r
);
2264 r
= add_property_entry( hdb
, "'ProductCode', '{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}'" );
2265 ok( r
== ERROR_SUCCESS
, "cannot add property entry: %d\n", r
);
2267 r
= add_property_entry( hdb
, "'ProductLanguage', '1033'" );
2268 ok( r
== ERROR_SUCCESS
, "cannot add property entry: %d\n", r
);
2270 r
= add_property_entry( hdb
, "'ProductName', 'MSITEST'" );
2271 ok( r
== ERROR_SUCCESS
, "cannot add property entry: %d\n", r
);
2273 r
= add_property_entry( hdb
, "'ProductVersion', '1.1.1'" );
2274 ok( r
== ERROR_SUCCESS
, "cannot add property entry: %d\n", r
);
2276 r
= create_install_execute_sequence_table( hdb
);
2277 ok( r
== ERROR_SUCCESS
, "cannot create InstallExecuteSequence table: %d\n", r
);
2279 r
= add_install_execute_sequence_entry( hdb
, "'CostInitialize', '', '800'" );
2280 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2282 r
= add_install_execute_sequence_entry( hdb
, "'FileCost', '', '900'" );
2283 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2285 r
= add_install_execute_sequence_entry( hdb
, "'CostFinalize', '', '1000'" );
2286 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2288 r
= add_install_execute_sequence_entry( hdb
, "'InstallValidate', '', '1400'" );
2289 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2291 r
= add_install_execute_sequence_entry( hdb
, "'InstallInitialize', '', '1500'" );
2292 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2294 r
= add_install_execute_sequence_entry( hdb
, "'ProcessComponents', '', '1600'" );
2295 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2297 r
= add_install_execute_sequence_entry( hdb
, "'UnpublishFeatures', '', '1800'" );
2298 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2300 r
= add_install_execute_sequence_entry( hdb
, "'RegisterProduct', '', '6100'" );
2301 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2303 r
= add_install_execute_sequence_entry( hdb
, "'PublishFeatures', '', '6300'" );
2304 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2306 r
= add_install_execute_sequence_entry( hdb
, "'PublishProduct', '', '6400'" );
2307 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2309 r
= add_install_execute_sequence_entry( hdb
, "'InstallFinalize', '', '6600'" );
2310 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2312 r
= create_media_table( hdb
);
2313 ok( r
== ERROR_SUCCESS
, "cannot create media table: %d\n", r
);
2315 r
= add_media_entry( hdb
, "'1', '3', '', '', 'DISK1', ''");
2316 ok( r
== ERROR_SUCCESS
, "cannot add media entry: %d\n", r
);
2318 r
= create_feature_table( hdb
);
2319 ok( r
== ERROR_SUCCESS
, "cannot create Feature table: %d\n", r
);
2321 r
= create_component_table( hdb
);
2322 ok( r
== ERROR_SUCCESS
, "cannot create Component table: %d\n", r
);
2324 /* msidbFeatureAttributesFavorLocal */
2325 r
= add_feature_entry( hdb
, "'one', '', '', '', 2, 1, '', 0" );
2326 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2328 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
2329 r
= add_component_entry( hdb
, "'alpha', '{467EC132-739D-4784-A37B-677AA43DBC94}', 'TARGETDIR', 0, '', 'alpha_file'" );
2330 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2332 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
2333 r
= add_component_entry( hdb
, "'beta', '{2C1F189C-24A6-4C34-B26B-994A6C026506}', 'TARGETDIR', 1, '', 'beta_file'" );
2334 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2336 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
2337 r
= add_component_entry( hdb
, "'gamma', '{C271E2A4-DE2E-4F70-86D1-6984AF7DE2CA}', 'TARGETDIR', 2, '', 'gamma_file'" );
2338 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2340 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSharedDllRefCount */
2341 r
= add_component_entry( hdb
, "'theta', '{4EB3129D-81A8-48D5-9801-75600FED3DD9}', 'TARGETDIR', 8, '', 'theta_file'" );
2342 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2344 /* msidbFeatureAttributesFavorSource */
2345 r
= add_feature_entry( hdb
, "'two', '', '', '', 2, 1, '', 1" );
2346 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2348 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
2349 r
= add_component_entry( hdb
, "'delta', '{938FD4F2-C648-4259-A03C-7AA3B45643F3}', 'TARGETDIR', 0, '', 'delta_file'" );
2350 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2352 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2353 r
= add_component_entry( hdb
, "'epsilon', '{D59713B6-C11D-47F2-A395-1E5321781190}', 'TARGETDIR', 1, '', 'epsilon_file'" );
2354 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2356 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
2357 r
= add_component_entry( hdb
, "'zeta', '{377D33AB-2FAA-42B9-A629-0C0DAE9B9C7A}', 'TARGETDIR', 2, '', 'zeta_file'" );
2358 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2360 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSharedDllRefCount */
2361 r
= add_component_entry( hdb
, "'iota', '{5D36F871-B5ED-4801-9E0F-C46B9E5C9669}', 'TARGETDIR', 8, '', 'iota_file'" );
2362 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2364 /* msidbFeatureAttributesFavorSource */
2365 r
= add_feature_entry( hdb
, "'three', '', '', '', 2, 1, '', 1" );
2366 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2368 /* msidbFeatureAttributesFavorLocal */
2369 r
= add_feature_entry( hdb
, "'four', '', '', '', 2, 1, '', 0" );
2370 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2373 r
= add_feature_entry( hdb
, "'five', '', '', '', 2, 0, '', 1" );
2374 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2376 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2377 r
= add_component_entry( hdb
, "'eta', '{DD89003F-0DD4-41B8-81C0-3411A7DA2695}', 'TARGETDIR', 1, '', 'eta_file'" );
2378 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2380 /* no feature parent:msidbComponentAttributesLocalOnly */
2381 r
= add_component_entry( hdb
, "'kappa', '{D6B93DC3-8DA5-4769-9888-42BFE156BB8B}', 'TARGETDIR', 1, '', 'kappa_file'" );
2382 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2384 /* msidbFeatureAttributesFavorLocal:removed */
2385 r
= add_feature_entry( hdb
, "'six', '', '', '', 2, 1, '', 0" );
2386 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2388 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesLocalOnly */
2389 r
= add_component_entry( hdb
, "'lambda', '{6528C5E4-02A4-4636-A214-7A66A6C35B64}', 'TARGETDIR', 0, '', 'lambda_file'" );
2390 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2392 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSourceOnly */
2393 r
= add_component_entry( hdb
, "'mu', '{97014BAB-6C56-4013-9A63-2BF913B42519}', 'TARGETDIR', 1, '', 'mu_file'" );
2394 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2396 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesOptional */
2397 r
= add_component_entry( hdb
, "'nu', '{943DD0D8-5808-4954-8526-3B8493FEDDCD}', 'TARGETDIR', 2, '', 'nu_file'" );
2398 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2400 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSharedDllRefCount */
2401 r
= add_component_entry( hdb
, "'xi', '{D6CF9EF7-6FCF-4930-B34B-F938AEFF9BDB}', 'TARGETDIR', 8, '', 'xi_file'" );
2402 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2404 /* msidbFeatureAttributesFavorSource:removed */
2405 r
= add_feature_entry( hdb
, "'seven', '', '', '', 2, 1, '', 1" );
2406 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2408 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesLocalOnly */
2409 r
= add_component_entry( hdb
, "'omicron', '{7B57521D-15DB-4141-9AA6-01D934A4433F}', 'TARGETDIR', 0, '', 'omicron_file'" );
2410 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2412 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSourceOnly */
2413 r
= add_component_entry( hdb
, "'pi', '{FB85346B-378E-4492-8769-792305471C81}', 'TARGETDIR', 1, '', 'pi_file'" );
2414 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2416 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesOptional */
2417 r
= add_component_entry( hdb
, "'rho', '{798F2047-7B0C-4783-8BB0-D703E554114B}', 'TARGETDIR', 2, '', 'rho_file'" );
2418 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2420 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSharedDllRefCount */
2421 r
= add_component_entry( hdb
, "'sigma', '{5CE9DDA8-B67B-4736-9D93-99D61C5B93E7}', 'TARGETDIR', 8, '', 'sigma_file'" );
2422 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2424 r
= create_feature_components_table( hdb
);
2425 ok( r
== ERROR_SUCCESS
, "cannot create FeatureComponents table: %d\n", r
);
2427 r
= add_feature_components_entry( hdb
, "'one', 'alpha'" );
2428 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2430 r
= add_feature_components_entry( hdb
, "'one', 'beta'" );
2431 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2433 r
= add_feature_components_entry( hdb
, "'one', 'gamma'" );
2434 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2436 r
= add_feature_components_entry( hdb
, "'one', 'theta'" );
2437 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2439 r
= add_feature_components_entry( hdb
, "'two', 'delta'" );
2440 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2442 r
= add_feature_components_entry( hdb
, "'two', 'epsilon'" );
2443 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2445 r
= add_feature_components_entry( hdb
, "'two', 'zeta'" );
2446 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2448 r
= add_feature_components_entry( hdb
, "'two', 'iota'" );
2449 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2451 r
= add_feature_components_entry( hdb
, "'three', 'eta'" );
2452 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2454 r
= add_feature_components_entry( hdb
, "'four', 'eta'" );
2455 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2457 r
= add_feature_components_entry( hdb
, "'five', 'eta'" );
2458 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2460 r
= add_feature_components_entry( hdb
, "'six', 'lambda'" );
2461 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2463 r
= add_feature_components_entry( hdb
, "'six', 'mu'" );
2464 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2466 r
= add_feature_components_entry( hdb
, "'six', 'nu'" );
2467 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2469 r
= add_feature_components_entry( hdb
, "'six', 'xi'" );
2470 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2472 r
= add_feature_components_entry( hdb
, "'seven', 'omicron'" );
2473 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2475 r
= add_feature_components_entry( hdb
, "'seven', 'pi'" );
2476 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2478 r
= add_feature_components_entry( hdb
, "'seven', 'rho'" );
2479 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2481 r
= add_feature_components_entry( hdb
, "'seven', 'sigma'" );
2482 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2484 r
= create_file_table( hdb
);
2485 ok( r
== ERROR_SUCCESS
, "cannot create File table: %d\n", r
);
2487 r
= add_file_entry( hdb
, "'alpha_file', 'alpha', 'alpha.txt', 100, '', '1033', 8192, 1" );
2488 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2490 r
= add_file_entry( hdb
, "'beta_file', 'beta', 'beta.txt', 0, '', '1033', 8192, 1" );
2491 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2493 r
= add_file_entry( hdb
, "'gamma_file', 'gamma', 'gamma.txt', 0, '', '1033', 8192, 1" );
2494 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2496 r
= add_file_entry( hdb
, "'theta_file', 'theta', 'theta.txt', 0, '', '1033', 8192, 1" );
2497 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2499 r
= add_file_entry( hdb
, "'delta_file', 'delta', 'delta.txt', 0, '', '1033', 8192, 1" );
2500 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2502 r
= add_file_entry( hdb
, "'epsilon_file', 'epsilon', 'epsilon.txt', 0, '', '1033', 8192, 1" );
2503 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2505 r
= add_file_entry( hdb
, "'zeta_file', 'zeta', 'zeta.txt', 0, '', '1033', 8192, 1" );
2506 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2508 r
= add_file_entry( hdb
, "'iota_file', 'iota', 'iota.txt', 0, '', '1033', 8192, 1" );
2509 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2511 /* compressed file */
2512 r
= add_file_entry( hdb
, "'eta_file', 'eta', 'eta.txt', 0, '', '1033', 16384, 1" );
2513 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2515 r
= add_file_entry( hdb
, "'kappa_file', 'kappa', 'kappa.txt', 0, '', '1033', 8192, 1" );
2516 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2518 r
= add_file_entry( hdb
, "'lambda_file', 'lambda', 'lambda.txt', 100, '', '1033', 8192, 1" );
2519 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2521 r
= add_file_entry( hdb
, "'mu_file', 'mu', 'mu.txt', 100, '', '1033', 8192, 1" );
2522 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2524 r
= add_file_entry( hdb
, "'nu_file', 'nu', 'nu.txt', 100, '', '1033', 8192, 1" );
2525 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2527 r
= add_file_entry( hdb
, "'xi_file', 'xi', 'xi.txt', 100, '', '1033', 8192, 1" );
2528 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2530 r
= add_file_entry( hdb
, "'omicron_file', 'omicron', 'omicron.txt', 100, '', '1033', 8192, 1" );
2531 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2533 r
= add_file_entry( hdb
, "'pi_file', 'pi', 'pi.txt', 100, '', '1033', 8192, 1" );
2534 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2536 r
= add_file_entry( hdb
, "'rho_file', 'rho', 'rho.txt', 100, '', '1033', 8192, 1" );
2537 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2539 r
= add_file_entry( hdb
, "'sigma_file', 'sigma', 'sigma.txt', 100, '', '1033', 8192, 1" );
2540 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2542 MsiDatabaseCommit(hdb
);
2544 /* these properties must not be in the saved msi file */
2545 r
= add_property_entry( hdb
, "'ADDLOCAL', 'one,four'");
2546 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
2548 r
= add_property_entry( hdb
, "'ADDSOURCE', 'two,three'");
2549 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
2551 r
= add_property_entry( hdb
, "'REMOVE', 'six,seven'");
2552 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
2554 hpkg
= package_from_db( hdb
);
2555 ok( hpkg
, "failed to create package\n");
2557 MsiCloseHandle(hdb
);
2559 CopyFileA(msifile
, msifile2
, FALSE
);
2560 CopyFileA(msifile
, msifile3
, FALSE
);
2564 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
2565 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2566 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2567 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2571 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
2572 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2573 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2574 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2578 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
2579 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2580 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2581 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2585 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
2586 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2587 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2588 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2592 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
2593 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2594 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2595 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2599 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
2600 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2601 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2602 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2606 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
2607 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2608 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2609 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2613 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
2614 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2615 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2616 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2620 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
2621 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2622 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2623 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2627 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
2628 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2629 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2630 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2634 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
2635 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2636 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2637 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2641 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
2642 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2643 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2644 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2648 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
2649 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2650 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2651 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2655 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
2656 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2657 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2658 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2662 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
2663 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2664 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2665 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2669 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
2670 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2671 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2672 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2676 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
2677 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2678 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2679 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2683 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
2684 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2685 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2686 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2690 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
2691 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2692 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2693 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2697 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
2698 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2699 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2700 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2704 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
2705 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2706 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2707 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2711 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
2712 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2713 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2714 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2718 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
2719 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2720 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2721 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2725 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
2726 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2727 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2728 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2732 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
2733 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2734 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2735 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2737 r
= MsiDoAction( hpkg
, "CostInitialize");
2738 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
2742 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
2743 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2744 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2745 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2749 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
2750 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2751 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2752 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2756 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
2757 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2758 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2759 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2763 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
2764 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2765 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2766 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2770 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
2771 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2772 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2773 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2777 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
2778 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2779 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2780 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2784 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
2785 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2786 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2787 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2791 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
2792 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2793 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2794 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2798 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
2799 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2800 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2801 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2805 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
2806 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2807 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2808 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2812 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
2813 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2814 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2815 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2819 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
2820 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2821 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2822 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2826 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
2827 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2828 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2829 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2833 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
2834 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2835 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2836 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2840 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
2841 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2842 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2843 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2847 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
2848 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2849 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2850 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2854 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
2855 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2856 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2857 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2861 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
2862 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2863 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2864 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2868 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
2869 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2870 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2871 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2875 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
2876 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2877 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2878 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2882 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
2883 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2884 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2885 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2889 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
2890 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2891 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2892 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2896 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
2897 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2898 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2899 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2903 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
2904 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2905 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2906 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2910 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
2911 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2912 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2913 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2915 r
= MsiDoAction( hpkg
, "FileCost");
2916 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
2920 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
2921 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2922 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2923 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2927 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
2928 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2929 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2930 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2934 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
2935 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2936 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2937 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2941 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
2942 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2943 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2944 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2948 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
2949 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2950 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2951 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2955 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
2956 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2957 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2958 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2962 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
2963 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2964 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2965 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2969 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
2970 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2971 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2972 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2976 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
2977 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2978 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2979 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2983 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
2984 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2985 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2986 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2990 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
2991 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2992 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2993 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2997 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
2998 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2999 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3000 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3004 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
3005 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3006 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3007 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3011 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
3012 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3013 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3014 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3018 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
3019 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3020 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3021 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3025 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
3026 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3027 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3028 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3032 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
3033 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3034 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3035 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3039 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
3040 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3041 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3042 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3046 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3047 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3048 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3049 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3053 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
3054 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3055 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3056 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3060 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
3061 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3062 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3063 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3067 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
3068 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3069 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3070 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3074 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
3075 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3076 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3077 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3081 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
3082 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3083 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3084 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3088 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
3089 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3090 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3091 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3093 r
= MsiDoAction( hpkg
, "CostFinalize");
3094 ok( r
== ERROR_SUCCESS
, "cost finalize failed: %d\n", r
);
3098 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3099 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3100 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3101 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3105 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
3106 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3107 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3108 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3112 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3113 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3114 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3115 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3119 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3120 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3121 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3122 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3126 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3127 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3128 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3129 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3133 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
3134 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3135 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3136 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3140 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
3141 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3142 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3143 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3147 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3148 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3149 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3150 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3154 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
3155 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3156 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3157 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3161 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
3162 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3163 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3164 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3168 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
3169 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3170 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3171 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3175 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
3176 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3177 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3178 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3182 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
3183 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3184 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3185 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3189 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
3190 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3191 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3192 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3196 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
3197 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3198 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3199 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3203 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
3204 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3205 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3206 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3210 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
3211 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3212 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3213 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3217 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
3218 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3219 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3220 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3224 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3225 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3226 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3227 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3231 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
3232 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3233 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3234 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3238 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
3239 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3240 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3241 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3245 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
3246 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3247 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3248 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3252 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
3253 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3254 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3255 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3259 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
3260 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3261 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3262 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3266 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
3267 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3268 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3269 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3271 MsiCloseHandle( hpkg
);
3273 /* publish the features and components */
3274 r
= MsiInstallProduct(msifile
, "ADDLOCAL=one,four ADDSOURCE=two,three REMOVE=six,seven");
3275 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3277 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_DIRECT
, &hdb
);
3278 ok(r
== ERROR_SUCCESS
, "failed to open database: %d\n", r
);
3280 /* these properties must not be in the saved msi file */
3281 r
= add_property_entry( hdb
, "'ADDLOCAL', 'one,four'");
3282 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
3284 r
= add_property_entry( hdb
, "'ADDSOURCE', 'two,three'");
3285 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
3287 r
= add_property_entry( hdb
, "'REMOVE', 'six,seven'");
3288 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
3290 hpkg
= package_from_db( hdb
);
3291 ok( hpkg
, "failed to create package\n");
3293 MsiCloseHandle(hdb
);
3297 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3298 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3299 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3300 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3304 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
3305 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3306 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3307 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3311 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3312 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3313 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3314 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3318 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3319 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3320 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3321 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3325 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3326 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3327 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3328 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3332 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
3333 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3334 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3335 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3339 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
3340 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3341 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3342 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3346 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3347 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3348 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3349 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3353 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
3354 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3355 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3356 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3360 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
3361 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3362 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3363 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3367 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
3368 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3369 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3370 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3374 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
3375 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3376 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3377 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3381 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
3382 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3383 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3384 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3388 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
3389 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3390 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3391 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3395 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
3396 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3397 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3398 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3402 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
3403 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3404 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3405 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3409 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
3410 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3411 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3412 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3416 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
3417 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3418 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3419 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3423 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3424 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3425 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3426 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3430 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
3431 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3432 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3433 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3437 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
3438 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3439 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3440 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3444 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
3445 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3446 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3447 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3451 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
3452 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3453 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3454 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3458 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
3459 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3460 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3461 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3465 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
3466 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3467 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3468 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3470 r
= MsiDoAction( hpkg
, "CostInitialize");
3471 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
3475 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3476 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3477 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3478 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3482 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
3483 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3484 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3485 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3489 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3490 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3491 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3492 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3496 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3497 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3498 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3499 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3503 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3504 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3505 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3506 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3510 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
3511 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3512 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3513 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3517 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
3518 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3519 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3520 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3524 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3525 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3526 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3527 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3531 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
3532 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3533 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3534 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3538 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
3539 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3540 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3541 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3545 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
3546 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3547 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3548 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3552 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
3553 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3554 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3555 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3559 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
3560 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3561 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3562 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3566 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
3567 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3568 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3569 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3573 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
3574 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3575 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3576 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3580 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
3581 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3582 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3583 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3587 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
3588 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3589 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3590 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3594 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
3595 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3596 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3597 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3601 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3602 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3603 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3604 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3608 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
3609 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3610 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3611 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3615 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
3616 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3617 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3618 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3622 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
3623 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3624 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3625 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3629 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
3630 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3631 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3632 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3636 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
3637 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3638 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3639 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3643 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
3644 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3645 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3646 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3648 r
= MsiDoAction( hpkg
, "FileCost");
3649 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
3653 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3654 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3655 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3656 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3660 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
3661 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3662 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3663 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3667 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3668 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3669 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3670 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3674 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3675 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3676 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3677 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3681 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3682 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3683 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3684 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3688 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
3689 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3690 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3691 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3695 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
3696 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3697 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3698 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3702 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3703 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3704 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3705 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3709 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
3710 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3711 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3712 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3716 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
3717 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3718 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3719 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3723 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
3724 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3725 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3726 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3730 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
3731 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3732 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3733 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3737 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
3738 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3739 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3740 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3744 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
3745 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3746 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3747 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3751 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
3752 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3753 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3754 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3758 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
3759 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3760 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3761 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3765 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
3766 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3767 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3768 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3772 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
3773 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3774 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3775 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3779 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3780 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3781 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3782 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3786 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
3787 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3788 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3789 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3793 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
3794 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3795 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3796 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3800 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
3801 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3802 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3803 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3807 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
3808 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3809 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3810 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3814 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
3815 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3816 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3817 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3821 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
3822 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3823 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3824 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3826 r
= MsiDoAction( hpkg
, "CostFinalize");
3827 ok( r
== ERROR_SUCCESS
, "cost finalize failed: %d\n", r
);
3831 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3832 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3833 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3834 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3838 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
3839 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3840 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3841 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3845 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3846 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3847 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3848 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3852 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3853 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3854 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3855 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3859 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3860 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3861 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3862 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3866 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
3867 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3868 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3869 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3873 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
3874 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3875 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3876 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3880 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3881 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3882 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3883 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3887 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
3888 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3889 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3890 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3894 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
3895 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3896 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3897 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3901 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
3902 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3903 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3904 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3908 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
3909 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3910 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3911 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3915 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
3916 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3917 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3918 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3922 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
3923 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3924 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3925 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3929 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
3930 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3931 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3932 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3936 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
3937 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3938 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3939 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3943 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
3944 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3945 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3946 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3950 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
3951 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3952 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3953 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3957 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3958 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3959 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3960 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3964 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
3965 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3966 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3967 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3971 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
3972 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3973 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3974 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3978 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
3979 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3980 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3981 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3985 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
3986 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3987 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3988 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3992 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
3993 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3994 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3995 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3999 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
4000 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4001 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4002 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4004 MsiCloseHandle(hpkg
);
4006 /* uninstall the product */
4007 r
= MsiInstallProduct(msifile
, "REMOVE=ALL");
4008 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4010 /* all features installed locally */
4011 r
= MsiInstallProduct(msifile2
, "ADDLOCAL=ALL");
4012 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4014 r
= MsiOpenDatabase(msifile2
, MSIDBOPEN_DIRECT
, &hdb
);
4015 ok(r
== ERROR_SUCCESS
, "failed to open database: %d\n", r
);
4017 /* these properties must not be in the saved msi file */
4018 r
= add_property_entry( hdb
, "'ADDLOCAL', 'one,two,three,four,five,six,seven'");
4019 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
4021 hpkg
= package_from_db( hdb
);
4022 ok( hpkg
, "failed to create package\n");
4026 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
4027 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4028 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4029 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4033 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
4034 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4035 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4036 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4040 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
4041 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4042 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4043 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4047 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
4048 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4049 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4050 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4054 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
4055 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4056 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4057 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4061 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
4062 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4063 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4064 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4068 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
4069 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4070 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4071 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4075 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
4076 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4077 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4078 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4082 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
4083 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4084 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4085 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4089 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
4090 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4091 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4092 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4096 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
4097 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4098 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4099 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4103 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
4104 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4105 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4106 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4110 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
4111 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4112 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4113 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4117 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
4118 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4119 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4120 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4124 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
4125 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4126 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4127 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4131 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
4132 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4133 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4134 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4138 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
4139 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4140 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4141 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4145 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
4146 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4147 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4148 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4152 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
4153 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4154 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4155 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4159 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
4160 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4161 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4162 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4166 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
4167 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4168 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4169 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4173 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
4174 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4175 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4176 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4180 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
4181 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4182 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4183 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4187 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
4188 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4189 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4190 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4194 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
4195 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4196 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4197 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4199 r
= MsiDoAction( hpkg
, "CostInitialize");
4200 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
4204 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
4205 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4206 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4207 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4211 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
4212 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4213 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4214 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4218 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
4219 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4220 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4221 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4225 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
4226 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4227 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4228 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4232 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
4233 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4234 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4235 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4239 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
4240 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4241 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4242 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4246 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
4247 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4248 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4249 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4253 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
4254 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4255 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4256 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4260 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
4261 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4262 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4263 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4267 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
4268 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4269 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4270 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4274 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
4275 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4276 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4277 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4281 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
4282 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4283 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4284 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4288 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
4289 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4290 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4291 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4295 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
4296 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4297 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4298 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4302 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
4303 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4304 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4305 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4309 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
4310 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4311 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4312 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4316 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
4317 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4318 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4319 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4323 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
4324 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4325 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4326 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4330 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
4331 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4332 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4333 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4337 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
4338 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4339 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4340 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4344 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
4345 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4346 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4347 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4351 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
4352 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4353 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4354 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4358 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
4359 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4360 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4361 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4365 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
4366 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4367 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4368 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4372 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
4373 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4374 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4375 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4377 r
= MsiDoAction( hpkg
, "FileCost");
4378 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
4382 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
4383 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4384 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4385 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4389 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
4390 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4391 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4392 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4396 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
4397 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4398 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4399 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4403 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
4404 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4405 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4406 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4410 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
4411 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4412 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4413 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4417 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
4418 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4419 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4420 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4424 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
4425 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4426 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4427 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4431 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
4432 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4433 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4434 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4438 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
4439 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4440 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4441 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4445 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
4446 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4447 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4448 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4452 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
4453 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4454 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4455 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4459 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
4460 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4461 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4462 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4466 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
4467 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4468 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4469 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4473 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
4474 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4475 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4476 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4480 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
4481 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4482 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4483 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4487 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
4488 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4489 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4490 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4494 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
4495 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4496 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4497 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4501 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
4502 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4503 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4504 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4508 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
4509 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4510 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4511 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4515 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
4516 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4517 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4518 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4522 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
4523 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4524 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4525 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4529 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
4530 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4531 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4532 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4536 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
4537 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4538 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4539 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4543 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
4544 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4545 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4546 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4550 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
4551 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4552 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4553 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4555 r
= MsiDoAction( hpkg
, "CostFinalize");
4556 ok( r
== ERROR_SUCCESS
, "cost finalize failed: %d\n", r
);
4560 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
4561 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4562 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4563 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4567 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
4568 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4569 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4570 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4574 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
4575 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4576 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4577 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4581 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
4582 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4583 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4584 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4588 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
4589 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4590 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4591 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4595 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
4596 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4597 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4598 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4602 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
4603 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4604 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4605 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4609 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
4610 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4611 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4612 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4616 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
4617 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4618 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4619 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4623 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
4624 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4625 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4626 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4630 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
4631 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4632 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4633 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4637 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
4638 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4639 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4640 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4644 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
4645 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4646 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4647 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
4651 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
4652 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4653 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4654 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4658 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
4659 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4660 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4661 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4665 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
4666 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4667 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4668 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4672 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
4673 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4674 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4675 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4679 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
4680 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4681 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4682 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4686 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
4687 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4688 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4689 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4693 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
4694 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4695 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4696 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4700 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
4701 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4702 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4703 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4707 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
4708 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4709 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4710 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4714 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
4715 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4716 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4717 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
4721 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
4722 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4723 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4724 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4728 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
4729 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4730 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4731 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4733 MsiCloseHandle(hpkg
);
4735 /* uninstall the product */
4736 r
= MsiInstallProduct(msifile2
, "REMOVE=ALL");
4737 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4739 /* all features installed from source */
4740 r
= MsiInstallProduct(msifile3
, "ADDSOURCE=ALL");
4741 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4743 r
= MsiOpenDatabase(msifile3
, MSIDBOPEN_DIRECT
, &hdb
);
4744 ok(r
== ERROR_SUCCESS
, "failed to open database: %d\n", r
);
4746 /* this property must not be in the saved msi file */
4747 r
= add_property_entry( hdb
, "'ADDSOURCE', 'one,two,three,four,five,six,seven'");
4748 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
4750 hpkg
= package_from_db( hdb
);
4751 ok( hpkg
, "failed to create package\n");
4755 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
4756 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4757 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4758 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4762 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
4763 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4764 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4765 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4769 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
4770 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4771 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4772 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4776 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
4777 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4778 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4779 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4783 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
4784 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4785 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4786 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4790 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
4791 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4792 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4793 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4797 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
4798 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4799 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4800 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4804 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
4805 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4806 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4807 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4811 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
4812 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4813 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4814 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4818 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
4819 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4820 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4821 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4825 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
4826 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4827 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4828 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4832 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
4833 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4834 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4835 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4839 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
4840 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4841 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4842 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4846 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
4847 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4848 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4849 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4853 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
4854 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4855 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4856 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4860 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
4861 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4862 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4863 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4867 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
4868 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4869 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4870 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4874 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
4875 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4876 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4877 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4881 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
4882 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4883 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4884 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4888 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
4889 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4890 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4891 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4895 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
4896 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4897 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4898 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4902 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
4903 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4904 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4905 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4909 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
4910 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4911 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4912 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4916 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
4917 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4918 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4919 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4923 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
4924 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4925 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4926 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4928 r
= MsiDoAction( hpkg
, "CostInitialize");
4929 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
4933 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
4934 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4935 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4936 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4940 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
4941 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4942 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4943 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4947 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
4948 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4949 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4950 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4954 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
4955 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4956 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4957 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4961 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
4962 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4963 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4964 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4968 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
4969 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4970 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4971 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4975 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
4976 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4977 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4978 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4982 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
4983 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4984 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4985 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4989 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
4990 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4991 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4992 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4996 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
4997 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4998 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4999 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5003 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
5004 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5005 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5006 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5010 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
5011 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5012 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5013 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5017 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
5018 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5019 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5020 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5024 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
5025 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5026 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5027 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5031 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
5032 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5033 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5034 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5038 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
5039 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5040 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5041 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5045 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
5046 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5047 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5048 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5052 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
5053 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5054 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5055 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5059 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
5060 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5061 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5062 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5066 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
5067 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5068 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5069 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5073 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
5074 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5075 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5076 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5080 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
5081 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5082 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5083 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5087 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
5088 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5089 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5090 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5094 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
5095 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5096 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5097 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5101 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
5102 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5103 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5104 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5106 r
= MsiDoAction( hpkg
, "FileCost");
5107 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
5111 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
5112 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5113 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5114 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5118 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
5119 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5120 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5121 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5125 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
5126 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5127 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5128 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5132 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
5133 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5134 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5135 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5139 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
5140 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5141 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5142 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5146 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
5147 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5148 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5149 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5153 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
5154 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5155 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5156 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5160 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
5161 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5162 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5163 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5167 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
5168 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5169 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5170 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5174 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
5175 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5176 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5177 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5181 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
5182 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5183 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5184 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5188 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
5189 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5190 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5191 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5195 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
5196 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5197 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5198 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5202 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
5203 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5204 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5205 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5209 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
5210 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5211 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5212 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5216 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
5217 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5218 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5219 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5223 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
5224 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5225 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5226 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5230 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
5231 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5232 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5233 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5237 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
5238 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5239 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5240 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5244 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
5245 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5246 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5247 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5251 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
5252 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5253 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5254 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5258 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
5259 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5260 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5261 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5265 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
5266 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5267 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5268 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5272 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
5273 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5274 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5275 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5279 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
5280 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5281 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5282 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5284 r
= MsiDoAction( hpkg
, "CostFinalize");
5285 ok( r
== ERROR_SUCCESS
, "cost finalize failed: %d\n", r
);
5289 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
5290 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5291 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5292 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5296 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
5297 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5298 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5299 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5303 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
5304 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5305 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5306 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
5310 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
5311 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5312 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5313 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5317 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
5318 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5319 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
5320 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5324 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
5325 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5326 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5327 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5331 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
5332 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5333 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5334 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5338 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
5339 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5340 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5341 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5345 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
5346 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5347 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5348 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5352 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
5353 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5354 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5355 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5359 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
5360 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5361 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5362 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5366 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
5367 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5368 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5369 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
5373 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
5374 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5375 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5376 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5380 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
5381 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5382 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5383 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5387 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
5388 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5389 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5390 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
5394 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
5395 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5396 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5397 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
5401 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
5402 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5403 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
5404 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5408 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
5409 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5410 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5411 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5415 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
5416 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5417 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5418 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5422 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
5423 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5424 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5425 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5429 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
5430 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5431 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5432 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5436 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
5437 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5438 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5439 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5443 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
5444 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5445 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5446 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5450 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
5451 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5452 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5453 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5457 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
5458 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5459 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5460 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5462 MsiCloseHandle(hpkg
);
5464 /* uninstall the product */
5465 r
= MsiInstallProduct(msifile3
, "REMOVE=ALL");
5466 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5468 DeleteFileA(msifile
);
5469 DeleteFileA(msifile2
);
5470 DeleteFileA(msifile3
);
5473 static void test_getproperty(void)
5475 MSIHANDLE hPackage
= 0;
5477 static CHAR empty
[] = "";
5481 hPackage
= package_from_db(create_package_db());
5482 ok( hPackage
!= 0, " Failed to create package\n");
5484 /* set the property */
5485 r
= MsiSetProperty(hPackage
, "Name", "Value");
5486 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5488 /* retrieve the size, NULL pointer */
5490 r
= MsiGetProperty(hPackage
, "Name", NULL
, &size
);
5491 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5492 ok( size
== 5, "Expected 5, got %d\n", size
);
5494 /* retrieve the size, empty string */
5496 r
= MsiGetProperty(hPackage
, "Name", empty
, &size
);
5497 ok( r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
5498 ok( size
== 5, "Expected 5, got %d\n", size
);
5500 /* don't change size */
5501 r
= MsiGetProperty(hPackage
, "Name", prop
, &size
);
5502 ok( r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
5503 ok( size
== 5, "Expected 5, got %d\n", size
);
5504 ok( !lstrcmp(prop
, "Valu"), "Expected Valu, got %s\n", prop
);
5506 /* increase the size by 1 */
5508 r
= MsiGetProperty(hPackage
, "Name", prop
, &size
);
5509 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5510 ok( size
== 5, "Expected 5, got %d\n", size
);
5511 ok( !lstrcmp(prop
, "Value"), "Expected Value, got %s\n", prop
);
5513 r
= MsiCloseHandle( hPackage
);
5514 ok( r
== ERROR_SUCCESS
, "Failed to close package\n" );
5515 DeleteFile(msifile
);
5518 static void test_removefiles(void)
5524 hdb
= create_package_db();
5525 ok ( hdb
, "failed to create package database\n" );
5527 r
= add_directory_entry( hdb
, "'TARGETDIR', '', 'SourceDir'");
5528 ok( r
== ERROR_SUCCESS
, "cannot add directory: %d\n", r
);
5530 r
= create_feature_table( hdb
);
5531 ok( r
== ERROR_SUCCESS
, "cannot create Feature table: %d\n", r
);
5533 r
= create_component_table( hdb
);
5534 ok( r
== ERROR_SUCCESS
, "cannot create Component table: %d\n", r
);
5536 r
= add_feature_entry( hdb
, "'one', '', '', '', 2, 1, '', 0" );
5537 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
5539 r
= add_component_entry( hdb
, "'hydrogen', '', 'TARGETDIR', 0, '', 'hydrogen_file'" );
5540 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
5542 r
= add_component_entry( hdb
, "'helium', '', 'TARGETDIR', 0, '', 'helium_file'" );
5543 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
5545 r
= add_component_entry( hdb
, "'lithium', '', 'TARGETDIR', 0, '', 'lithium_file'" );
5546 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
5548 r
= add_component_entry( hdb
, "'beryllium', '', 'TARGETDIR', 0, '', 'beryllium_file'" );
5549 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
5551 r
= add_component_entry( hdb
, "'boron', '', 'TARGETDIR', 0, '', 'boron_file'" );
5552 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
5554 r
= add_component_entry( hdb
, "'carbon', '', 'TARGETDIR', 0, '', 'carbon_file'" );
5555 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
5557 r
= create_feature_components_table( hdb
);
5558 ok( r
== ERROR_SUCCESS
, "cannot create FeatureComponents table: %d\n", r
);
5560 r
= add_feature_components_entry( hdb
, "'one', 'hydrogen'" );
5561 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
5563 r
= add_feature_components_entry( hdb
, "'one', 'helium'" );
5564 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
5566 r
= add_feature_components_entry( hdb
, "'one', 'lithium'" );
5567 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
5569 r
= add_feature_components_entry( hdb
, "'one', 'beryllium'" );
5570 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
5572 r
= add_feature_components_entry( hdb
, "'one', 'boron'" );
5573 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
5575 r
= add_feature_components_entry( hdb
, "'one', 'carbon'" );
5576 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
5578 r
= create_file_table( hdb
);
5579 ok( r
== ERROR_SUCCESS
, "cannot create File table: %d\n", r
);
5581 r
= add_file_entry( hdb
, "'hydrogen_file', 'hydrogen', 'hydrogen.txt', 0, '', '1033', 8192, 1" );
5582 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
5584 r
= add_file_entry( hdb
, "'helium_file', 'helium', 'helium.txt', 0, '', '1033', 8192, 1" );
5585 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
5587 r
= add_file_entry( hdb
, "'lithium_file', 'lithium', 'lithium.txt', 0, '', '1033', 8192, 1" );
5588 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
5590 r
= add_file_entry( hdb
, "'beryllium_file', 'beryllium', 'beryllium.txt', 0, '', '1033', 16384, 1" );
5591 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
5593 r
= add_file_entry( hdb
, "'boron_file', 'boron', 'boron.txt', 0, '', '1033', 16384, 1" );
5594 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
5596 r
= add_file_entry( hdb
, "'carbon_file', 'carbon', 'carbon.txt', 0, '', '1033', 16384, 1" );
5597 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
5599 r
= create_remove_file_table( hdb
);
5600 ok( r
== ERROR_SUCCESS
, "cannot create Remove File table: %d\n", r
);
5602 hpkg
= package_from_db( hdb
);
5603 ok( hpkg
, "failed to create package\n");
5605 MsiCloseHandle( hdb
);
5607 create_test_file( "hydrogen.txt" );
5608 create_test_file( "helium.txt" );
5609 create_test_file( "lithium.txt" );
5610 create_test_file( "beryllium.txt" );
5611 create_test_file( "boron.txt" );
5612 create_test_file( "carbon.txt" );
5614 r
= MsiSetProperty( hpkg
, "TARGETDIR", CURR_DIR
);
5615 ok( r
== ERROR_SUCCESS
, "set property failed\n");
5617 r
= MsiDoAction( hpkg
, "CostInitialize");
5618 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
5620 r
= MsiDoAction( hpkg
, "FileCost");
5621 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
5623 r
= MsiDoAction( hpkg
, "CostFinalize");
5624 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
5626 r
= MsiDoAction( hpkg
, "InstallValidate");
5627 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
5629 r
= MsiSetComponentState( hpkg
, "hydrogen", INSTALLSTATE_ABSENT
);
5630 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
5632 r
= MsiSetComponentState( hpkg
, "helium", INSTALLSTATE_LOCAL
);
5633 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
5635 r
= MsiSetComponentState( hpkg
, "lithium", INSTALLSTATE_SOURCE
);
5636 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
5638 r
= MsiSetComponentState( hpkg
, "beryllium", INSTALLSTATE_ABSENT
);
5639 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
5641 r
= MsiSetComponentState( hpkg
, "boron", INSTALLSTATE_LOCAL
);
5642 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
5644 r
= MsiSetComponentState( hpkg
, "carbon", INSTALLSTATE_SOURCE
);
5645 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
5647 r
= MsiDoAction( hpkg
, "RemoveFiles");
5648 ok( r
== ERROR_SUCCESS
, "remove files failed\n");
5650 ok(DeleteFileA("hydrogen.txt"), "Expected hydrogen.txt to exist\n");
5651 ok(DeleteFileA("lithium.txt"), "Expected lithium.txt to exist\n");
5652 ok(DeleteFileA("beryllium.txt"), "Expected beryllium.txt to exist\n");
5653 ok(DeleteFileA("carbon.txt"), "Expected carbon.txt to exist\n");
5654 ok(DeleteFileA("helium.txt"), "Expected helium.txt to exist\n");
5655 ok(DeleteFileA("boron.txt"), "Expected boron.txt to exist\n");
5657 MsiCloseHandle( hpkg
);
5658 DeleteFileA(msifile
);
5661 static void test_appsearch(void)
5666 CHAR prop
[MAX_PATH
];
5667 DWORD size
= MAX_PATH
;
5669 hdb
= create_package_db();
5670 ok ( hdb
, "failed to create package database\n" );
5672 r
= create_appsearch_table( hdb
);
5673 ok( r
== ERROR_SUCCESS
, "cannot create AppSearch table: %d\n", r
);
5675 r
= add_appsearch_entry( hdb
, "'WEBBROWSERPROG', 'NewSignature1'" );
5676 ok( r
== ERROR_SUCCESS
, "cannot add entry: %d\n", r
);
5678 r
= create_reglocator_table( hdb
);
5679 ok( r
== ERROR_SUCCESS
, "cannot create RegLocator table: %d\n", r
);
5681 r
= add_reglocator_entry( hdb
, "'NewSignature1', 0, 'htmlfile\\shell\\open\\command', '', 1" );
5682 ok( r
== ERROR_SUCCESS
, "cannot create RegLocator table: %d\n", r
);
5684 r
= create_signature_table( hdb
);
5685 ok( r
== ERROR_SUCCESS
, "cannot create Signature table: %d\n", r
);
5687 r
= add_signature_entry( hdb
, "'NewSignature1', 'FileName', '', '', '', '', '', '', ''" );
5688 ok( r
== ERROR_SUCCESS
, "cannot create Signature table: %d\n", r
);
5690 hpkg
= package_from_db( hdb
);
5691 ok( hpkg
, "failed to create package\n");
5693 MsiCloseHandle( hdb
);
5695 r
= MsiDoAction( hpkg
, "AppSearch" );
5696 ok( r
== ERROR_SUCCESS
, "AppSearch failed: %d\n", r
);
5698 r
= MsiGetPropertyA( hpkg
, "WEBBROWSERPROG", prop
, &size
);
5699 ok( r
== ERROR_SUCCESS
, "get property failed: %d\n", r
);
5702 ok( lstrlenA(prop
) != 0, "Expected non-zero length\n");
5705 MsiCloseHandle( hpkg
);
5706 DeleteFileA(msifile
);
5709 static void test_appsearch_complocator(void)
5711 MSIHANDLE hpkg
, hdb
;
5712 CHAR path
[MAX_PATH
];
5713 CHAR prop
[MAX_PATH
];
5718 get_user_sid(&usersid
);
5721 skip("ConvertSidToStringSidA is not available\n");
5725 create_test_file("FileName1");
5726 create_test_file("FileName4");
5727 set_component_path("FileName1", MSIINSTALLCONTEXT_MACHINE
,
5728 "{A8AE6692-96BA-4198-8399-145D7D1D0D0E}", NULL
, FALSE
);
5730 create_test_file("FileName2");
5731 set_component_path("FileName2", MSIINSTALLCONTEXT_USERUNMANAGED
,
5732 "{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}", usersid
, FALSE
);
5734 create_test_file("FileName3");
5735 set_component_path("FileName3", MSIINSTALLCONTEXT_USERMANAGED
,
5736 "{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}", usersid
, FALSE
);
5738 create_test_file("FileName5");
5739 set_component_path("FileName5", MSIINSTALLCONTEXT_MACHINE
,
5740 "{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}", NULL
, TRUE
);
5742 create_test_file("FileName6");
5743 set_component_path("FileName6", MSIINSTALLCONTEXT_MACHINE
,
5744 "{C0ECD96F-7898-4410-9667-194BD8C1B648}", NULL
, TRUE
);
5746 create_test_file("FileName7");
5747 set_component_path("FileName7", MSIINSTALLCONTEXT_MACHINE
,
5748 "{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}", NULL
, FALSE
);
5750 /* dir is FALSE, but we're pretending it's a directory */
5751 set_component_path("IDontExist\\", MSIINSTALLCONTEXT_MACHINE
,
5752 "{91B7359B-07F2-4221-AA8D-DE102BB87A5F}", NULL
, FALSE
);
5754 create_file_with_version("FileName8.dll", MAKELONG(2, 1), MAKELONG(4, 3));
5755 set_component_path("FileName8.dll", MSIINSTALLCONTEXT_MACHINE
,
5756 "{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}", NULL
, FALSE
);
5758 create_file_with_version("FileName9.dll", MAKELONG(1, 2), MAKELONG(3, 4));
5759 set_component_path("FileName9.dll", MSIINSTALLCONTEXT_MACHINE
,
5760 "{A204DF48-7346-4635-BA2E-66247DBAC9DF}", NULL
, FALSE
);
5762 create_file_with_version("FileName10.dll", MAKELONG(2, 1), MAKELONG(4, 3));
5763 set_component_path("FileName10.dll", MSIINSTALLCONTEXT_MACHINE
,
5764 "{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}", NULL
, FALSE
);
5766 hdb
= create_package_db();
5767 ok(hdb
, "Expected a valid database handle\n");
5769 r
= create_appsearch_table(hdb
);
5770 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5772 r
= add_appsearch_entry(hdb
, "'SIGPROP1', 'NewSignature1'");
5773 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5775 r
= add_appsearch_entry(hdb
, "'SIGPROP2', 'NewSignature2'");
5776 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5778 r
= add_appsearch_entry(hdb
, "'SIGPROP3', 'NewSignature3'");
5779 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5781 r
= add_appsearch_entry(hdb
, "'SIGPROP4', 'NewSignature4'");
5782 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5784 r
= add_appsearch_entry(hdb
, "'SIGPROP5', 'NewSignature5'");
5785 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5787 r
= add_appsearch_entry(hdb
, "'SIGPROP6', 'NewSignature6'");
5788 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5790 r
= add_appsearch_entry(hdb
, "'SIGPROP7', 'NewSignature7'");
5791 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5793 r
= add_appsearch_entry(hdb
, "'SIGPROP8', 'NewSignature8'");
5794 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5796 r
= add_appsearch_entry(hdb
, "'SIGPROP9', 'NewSignature9'");
5797 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5799 r
= add_appsearch_entry(hdb
, "'SIGPROP10', 'NewSignature10'");
5800 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5802 r
= add_appsearch_entry(hdb
, "'SIGPROP11', 'NewSignature11'");
5803 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5805 r
= add_appsearch_entry(hdb
, "'SIGPROP12', 'NewSignature12'");
5806 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5808 r
= create_complocator_table(hdb
);
5809 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5811 /* published component, machine, file, signature, misdbLocatorTypeFile */
5812 r
= add_complocator_entry(hdb
, "'NewSignature1', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 1");
5813 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5815 /* published component, user-unmanaged, file, signature, misdbLocatorTypeFile */
5816 r
= add_complocator_entry(hdb
, "'NewSignature2', '{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}', 1");
5817 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5819 /* published component, user-managed, file, signature, misdbLocatorTypeFile */
5820 r
= add_complocator_entry(hdb
, "'NewSignature3', '{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}', 1");
5821 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5823 /* published component, machine, file, signature, misdbLocatorTypeDirectory */
5824 r
= add_complocator_entry(hdb
, "'NewSignature4', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 0");
5825 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5827 /* published component, machine, dir, signature, misdbLocatorTypeDirectory */
5828 r
= add_complocator_entry(hdb
, "'NewSignature5', '{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}', 0");
5829 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5831 /* published component, machine, dir, no signature, misdbLocatorTypeDirectory */
5832 r
= add_complocator_entry(hdb
, "'NewSignature6', '{C0ECD96F-7898-4410-9667-194BD8C1B648}', 0");
5833 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5835 /* published component, machine, file, no signature, misdbLocatorTypeFile */
5836 r
= add_complocator_entry(hdb
, "'NewSignature7', '{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}', 1");
5837 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5839 /* unpublished component, no signature, misdbLocatorTypeDir */
5840 r
= add_complocator_entry(hdb
, "'NewSignature8', '{FB671D5B-5083-4048-90E0-481C48D8F3A5}', 0");
5841 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5843 /* published component, no signature, dir does not exist misdbLocatorTypeDir */
5844 r
= add_complocator_entry(hdb
, "'NewSignature9', '{91B7359B-07F2-4221-AA8D-DE102BB87A5F}', 0");
5845 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5847 /* published component, signature w/ ver, misdbLocatorTypeFile */
5848 r
= add_complocator_entry(hdb
, "'NewSignature10', '{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}', 1");
5849 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5851 /* published component, signature w/ ver, ver > max, misdbLocatorTypeFile */
5852 r
= add_complocator_entry(hdb
, "'NewSignature11', '{A204DF48-7346-4635-BA2E-66247DBAC9DF}', 1");
5853 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5855 /* published component, signature w/ ver, sig->name ignored, misdbLocatorTypeFile */
5856 r
= add_complocator_entry(hdb
, "'NewSignature12', '{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}', 1");
5857 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5859 r
= create_signature_table(hdb
);
5860 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5862 r
= add_signature_entry(hdb
, "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''");
5863 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5865 r
= add_signature_entry(hdb
, "'NewSignature2', 'FileName2', '', '', '', '', '', '', ''");
5866 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5868 r
= add_signature_entry(hdb
, "'NewSignature3', 'FileName3', '', '', '', '', '', '', ''");
5869 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5871 r
= add_signature_entry(hdb
, "'NewSignature4', 'FileName4', '', '', '', '', '', '', ''");
5872 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5874 r
= add_signature_entry(hdb
, "'NewSignature5', 'FileName5', '', '', '', '', '', '', ''");
5875 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5877 r
= add_signature_entry(hdb
, "'NewSignature10', 'FileName8.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
5878 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5880 r
= add_signature_entry(hdb
, "'NewSignature11', 'FileName9.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
5881 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5883 r
= add_signature_entry(hdb
, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
5884 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5886 hpkg
= package_from_db(hdb
);
5887 ok(hpkg
, "Expected a valid package handle\n");
5889 r
= MsiSetPropertyA(hpkg
, "SIGPROP8", "october");
5890 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5892 r
= MsiDoAction(hpkg
, "AppSearch");
5893 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5896 sprintf(path
, "%s\\FileName1", CURR_DIR
);
5897 r
= MsiGetPropertyA(hpkg
, "SIGPROP1", prop
, &size
);
5898 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5899 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
5902 sprintf(path
, "%s\\FileName2", CURR_DIR
);
5903 r
= MsiGetPropertyA(hpkg
, "SIGPROP2", prop
, &size
);
5904 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5905 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
5908 sprintf(path
, "%s\\FileName3", CURR_DIR
);
5909 r
= MsiGetPropertyA(hpkg
, "SIGPROP3", prop
, &size
);
5910 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5911 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
5914 sprintf(path
, "%s\\FileName4", CURR_DIR
);
5915 r
= MsiGetPropertyA(hpkg
, "SIGPROP4", prop
, &size
);
5916 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5917 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
5920 sprintf(path
, "%s\\FileName5", CURR_DIR
);
5921 r
= MsiGetPropertyA(hpkg
, "SIGPROP5", prop
, &size
);
5922 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5923 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
5926 sprintf(path
, "%s\\", CURR_DIR
);
5927 r
= MsiGetPropertyA(hpkg
, "SIGPROP6", prop
, &size
);
5928 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5929 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
5932 sprintf(path
, "%s\\", CURR_DIR
);
5933 r
= MsiGetPropertyA(hpkg
, "SIGPROP7", prop
, &size
);
5934 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5935 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
5938 r
= MsiGetPropertyA(hpkg
, "SIGPROP8", prop
, &size
);
5939 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5940 ok(!lstrcmpA(prop
, "october"), "Expected \"october\", got \"%s\"\n", prop
);
5943 r
= MsiGetPropertyA(hpkg
, "SIGPROP9", prop
, &size
);
5944 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5945 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
5948 sprintf(path
, "%s\\FileName8.dll", CURR_DIR
);
5949 r
= MsiGetPropertyA(hpkg
, "SIGPROP10", prop
, &size
);
5950 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5951 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
5954 r
= MsiGetPropertyA(hpkg
, "SIGPROP11", prop
, &size
);
5955 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5956 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
5959 sprintf(path
, "%s\\FileName10.dll", CURR_DIR
);
5960 r
= MsiGetPropertyA(hpkg
, "SIGPROP12", prop
, &size
);
5961 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5962 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
5964 delete_component_path("{A8AE6692-96BA-4198-8399-145D7D1D0D0E}",
5965 MSIINSTALLCONTEXT_MACHINE
, NULL
);
5966 delete_component_path("{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}",
5967 MSIINSTALLCONTEXT_USERUNMANAGED
, usersid
);
5968 delete_component_path("{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}",
5969 MSIINSTALLCONTEXT_USERMANAGED
, usersid
);
5970 delete_component_path("{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}",
5971 MSIINSTALLCONTEXT_MACHINE
, NULL
);
5972 delete_component_path("{C0ECD96F-7898-4410-9667-194BD8C1B648}",
5973 MSIINSTALLCONTEXT_MACHINE
, NULL
);
5974 delete_component_path("{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}",
5975 MSIINSTALLCONTEXT_MACHINE
, NULL
);
5976 delete_component_path("{91B7359B-07F2-4221-AA8D-DE102BB87A5F}",
5977 MSIINSTALLCONTEXT_MACHINE
, NULL
);
5978 delete_component_path("{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}",
5979 MSIINSTALLCONTEXT_MACHINE
, NULL
);
5980 delete_component_path("{A204DF48-7346-4635-BA2E-66247DBAC9DF}",
5981 MSIINSTALLCONTEXT_MACHINE
, NULL
);
5982 delete_component_path("{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}",
5983 MSIINSTALLCONTEXT_MACHINE
, NULL
);
5985 DeleteFileA("FileName1");
5986 DeleteFileA("FileName2");
5987 DeleteFileA("FileName3");
5988 DeleteFileA("FileName4");
5989 DeleteFileA("FileName5");
5990 DeleteFileA("FileName6");
5991 DeleteFileA("FileName7");
5992 DeleteFileA("FileName8.dll");
5993 DeleteFileA("FileName9.dll");
5994 DeleteFileA("FileName10.dll");
5995 MsiCloseHandle(hpkg
);
5996 DeleteFileA(msifile
);
5999 static void test_appsearch_reglocator(void)
6001 MSIHANDLE hpkg
, hdb
;
6002 CHAR path
[MAX_PATH
];
6003 CHAR prop
[MAX_PATH
];
6006 BOOL space
, version
;
6015 if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
6018 DeleteFileA("test.dll");
6020 res
= RegCreateKeyA(HKEY_CLASSES_ROOT
, "Software\\Wine", &classes
);
6021 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6023 res
= RegSetValueExA(classes
, "Value1", 0, REG_SZ
,
6024 (const BYTE
*)"regszdata", 10);
6025 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6027 res
= RegCreateKeyA(HKEY_CURRENT_USER
, "Software\\Wine", &hkcu
);
6028 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6030 res
= RegSetValueExA(hkcu
, "Value1", 0, REG_SZ
,
6031 (const BYTE
*)"regszdata", 10);
6032 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6035 res
= RegCreateKeyA(HKEY_USERS
, "S-1-5-18\\Software\\Wine", &users
);
6036 ok(res
== ERROR_SUCCESS
||
6037 broken(res
== ERROR_INVALID_PARAMETER
),
6038 "Expected ERROR_SUCCESS, got %d\n", res
);
6040 if (res
== ERROR_SUCCESS
)
6042 res
= RegSetValueExA(users
, "Value1", 0, REG_SZ
,
6043 (const BYTE
*)"regszdata", 10);
6044 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6047 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, "Software\\Wine", &hklm
);
6048 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6050 res
= RegSetValueA(hklm
, NULL
, REG_SZ
, "defvalue", 8);
6051 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6053 res
= RegSetValueExA(hklm
, "Value1", 0, REG_SZ
,
6054 (const BYTE
*)"regszdata", 10);
6055 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6058 res
= RegSetValueExA(hklm
, "Value2", 0, REG_DWORD
,
6059 (const BYTE
*)&val
, sizeof(DWORD
));
6060 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6063 res
= RegSetValueExA(hklm
, "Value3", 0, REG_DWORD
,
6064 (const BYTE
*)&val
, sizeof(DWORD
));
6065 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6067 res
= RegSetValueExA(hklm
, "Value4", 0, REG_EXPAND_SZ
,
6068 (const BYTE
*)"%PATH%", 7);
6069 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6071 res
= RegSetValueExA(hklm
, "Value5", 0, REG_EXPAND_SZ
,
6072 (const BYTE
*)"my%NOVAR%", 10);
6073 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6075 res
= RegSetValueExA(hklm
, "Value6", 0, REG_MULTI_SZ
,
6076 (const BYTE
*)"one\0two\0", 9);
6077 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6079 binary
[0] = 0x1234abcd;
6080 binary
[1] = 0x567890ef;
6081 res
= RegSetValueExA(hklm
, "Value7", 0, REG_BINARY
,
6082 (const BYTE
*)binary
, sizeof(binary
));
6083 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6085 res
= RegSetValueExA(hklm
, "Value8", 0, REG_SZ
,
6086 (const BYTE
*)"#regszdata", 11);
6087 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6089 create_test_file("FileName1");
6090 sprintf(path
, "%s\\FileName1", CURR_DIR
);
6091 res
= RegSetValueExA(hklm
, "Value9", 0, REG_SZ
,
6092 (const BYTE
*)path
, lstrlenA(path
) + 1);
6093 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6095 sprintf(path
, "%s\\FileName2", CURR_DIR
);
6096 res
= RegSetValueExA(hklm
, "Value10", 0, REG_SZ
,
6097 (const BYTE
*)path
, lstrlenA(path
) + 1);
6098 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6100 lstrcpyA(path
, CURR_DIR
);
6101 res
= RegSetValueExA(hklm
, "Value11", 0, REG_SZ
,
6102 (const BYTE
*)path
, lstrlenA(path
) + 1);
6103 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6105 res
= RegSetValueExA(hklm
, "Value12", 0, REG_SZ
,
6106 (const BYTE
*)"", 1);
6107 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6109 create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6110 sprintf(path
, "%s\\FileName3.dll", CURR_DIR
);
6111 res
= RegSetValueExA(hklm
, "Value13", 0, REG_SZ
,
6112 (const BYTE
*)path
, lstrlenA(path
) + 1);
6113 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6115 create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
6116 sprintf(path
, "%s\\FileName4.dll", CURR_DIR
);
6117 res
= RegSetValueExA(hklm
, "Value14", 0, REG_SZ
,
6118 (const BYTE
*)path
, lstrlenA(path
) + 1);
6119 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6121 create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6122 sprintf(path
, "%s\\FileName5.dll", CURR_DIR
);
6123 res
= RegSetValueExA(hklm
, "Value15", 0, REG_SZ
,
6124 (const BYTE
*)path
, lstrlenA(path
) + 1);
6125 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6127 sprintf(path
, "\"%s\\FileName1\" -option", CURR_DIR
);
6128 res
= RegSetValueExA(hklm
, "value16", 0, REG_SZ
,
6129 (const BYTE
*)path
, lstrlenA(path
) + 1);
6131 space
= (strchr(CURR_DIR
, ' ')) ? TRUE
: FALSE
;
6132 sprintf(path
, "%s\\FileName1 -option", CURR_DIR
);
6133 res
= RegSetValueExA(hklm
, "value17", 0, REG_SZ
,
6134 (const BYTE
*)path
, lstrlenA(path
) + 1);
6136 hdb
= create_package_db();
6137 ok(hdb
, "Expected a valid database handle\n");
6139 r
= create_appsearch_table(hdb
);
6140 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6142 r
= add_appsearch_entry(hdb
, "'SIGPROP1', 'NewSignature1'");
6143 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6145 r
= add_appsearch_entry(hdb
, "'SIGPROP2', 'NewSignature2'");
6146 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6148 r
= add_appsearch_entry(hdb
, "'SIGPROP3', 'NewSignature3'");
6149 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6151 r
= add_appsearch_entry(hdb
, "'SIGPROP4', 'NewSignature4'");
6152 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6154 r
= add_appsearch_entry(hdb
, "'SIGPROP5', 'NewSignature5'");
6155 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6157 r
= add_appsearch_entry(hdb
, "'SIGPROP6', 'NewSignature6'");
6158 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6160 r
= add_appsearch_entry(hdb
, "'SIGPROP7', 'NewSignature7'");
6161 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6163 r
= add_appsearch_entry(hdb
, "'SIGPROP8', 'NewSignature8'");
6164 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6166 r
= add_appsearch_entry(hdb
, "'SIGPROP9', 'NewSignature9'");
6167 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6169 r
= add_appsearch_entry(hdb
, "'SIGPROP10', 'NewSignature10'");
6170 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6172 r
= add_appsearch_entry(hdb
, "'SIGPROP11', 'NewSignature11'");
6173 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6175 r
= add_appsearch_entry(hdb
, "'SIGPROP12', 'NewSignature12'");
6176 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6178 r
= add_appsearch_entry(hdb
, "'SIGPROP13', 'NewSignature13'");
6179 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6181 r
= add_appsearch_entry(hdb
, "'SIGPROP14', 'NewSignature14'");
6182 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6184 r
= add_appsearch_entry(hdb
, "'SIGPROP15', 'NewSignature15'");
6185 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6187 r
= add_appsearch_entry(hdb
, "'SIGPROP16', 'NewSignature16'");
6188 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6190 r
= add_appsearch_entry(hdb
, "'SIGPROP17', 'NewSignature17'");
6191 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6193 r
= add_appsearch_entry(hdb
, "'SIGPROP18', 'NewSignature18'");
6194 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6196 r
= add_appsearch_entry(hdb
, "'SIGPROP19', 'NewSignature19'");
6197 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6199 r
= add_appsearch_entry(hdb
, "'SIGPROP20', 'NewSignature20'");
6200 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6202 r
= add_appsearch_entry(hdb
, "'SIGPROP21', 'NewSignature21'");
6203 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6205 r
= add_appsearch_entry(hdb
, "'SIGPROP22', 'NewSignature22'");
6206 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6208 r
= add_appsearch_entry(hdb
, "'SIGPROP23', 'NewSignature23'");
6209 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6211 r
= add_appsearch_entry(hdb
, "'SIGPROP24', 'NewSignature24'");
6212 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6214 r
= add_appsearch_entry(hdb
, "'SIGPROP25', 'NewSignature25'");
6215 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6217 r
= add_appsearch_entry(hdb
, "'SIGPROP26', 'NewSignature26'");
6218 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6220 r
= add_appsearch_entry(hdb
, "'SIGPROP27', 'NewSignature27'");
6221 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6223 r
= add_appsearch_entry(hdb
, "'SIGPROP28', 'NewSignature28'");
6224 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6226 r
= add_appsearch_entry(hdb
, "'SIGPROP29', 'NewSignature29'");
6227 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6229 r
= add_appsearch_entry(hdb
, "'SIGPROP30', 'NewSignature30'");
6230 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6232 r
= create_reglocator_table(hdb
);
6233 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6235 /* HKLM, msidbLocatorTypeRawValue, REG_SZ */
6236 str
= "'NewSignature1', 2, 'Software\\Wine', 'Value1', 2";
6237 r
= add_reglocator_entry(hdb
, str
);
6238 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6240 /* HKLM, msidbLocatorTypeRawValue, positive DWORD */
6241 str
= "'NewSignature2', 2, 'Software\\Wine', 'Value2', 2";
6242 r
= add_reglocator_entry(hdb
, str
);
6243 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6245 /* HKLM, msidbLocatorTypeRawValue, negative DWORD */
6246 str
= "'NewSignature3', 2, 'Software\\Wine', 'Value3', 2";
6247 r
= add_reglocator_entry(hdb
, str
);
6248 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6250 /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
6251 str
= "'NewSignature4', 2, 'Software\\Wine', 'Value4', 2";
6252 r
= add_reglocator_entry(hdb
, str
);
6253 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6255 /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
6256 str
= "'NewSignature5', 2, 'Software\\Wine', 'Value5', 2";
6257 r
= add_reglocator_entry(hdb
, str
);
6258 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6260 /* HKLM, msidbLocatorTypeRawValue, REG_MULTI_SZ */
6261 str
= "'NewSignature6', 2, 'Software\\Wine', 'Value6', 2";
6262 r
= add_reglocator_entry(hdb
, str
);
6263 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6265 /* HKLM, msidbLocatorTypeRawValue, REG_BINARY */
6266 str
= "'NewSignature7', 2, 'Software\\Wine', 'Value7', 2";
6267 r
= add_reglocator_entry(hdb
, str
);
6268 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6270 /* HKLM, msidbLocatorTypeRawValue, REG_SZ first char is # */
6271 str
= "'NewSignature8', 2, 'Software\\Wine', 'Value8', 2";
6272 r
= add_reglocator_entry(hdb
, str
);
6273 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6275 /* HKLM, msidbLocatorTypeFileName, signature, file exists */
6276 str
= "'NewSignature9', 2, 'Software\\Wine', 'Value9', 1";
6277 r
= add_reglocator_entry(hdb
, str
);
6278 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6280 /* HKLM, msidbLocatorTypeFileName, signature, file does not exist */
6281 str
= "'NewSignature10', 2, 'Software\\Wine', 'Value10', 1";
6282 r
= add_reglocator_entry(hdb
, str
);
6283 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6285 /* HKLM, msidbLocatorTypeFileName, no signature */
6286 str
= "'NewSignature11', 2, 'Software\\Wine', 'Value9', 1";
6287 r
= add_reglocator_entry(hdb
, str
);
6288 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6290 /* HKLM, msidbLocatorTypeDirectory, no signature, file exists */
6291 str
= "'NewSignature12', 2, 'Software\\Wine', 'Value9', 0";
6292 r
= add_reglocator_entry(hdb
, str
);
6293 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6295 /* HKLM, msidbLocatorTypeDirectory, no signature, directory exists */
6296 str
= "'NewSignature13', 2, 'Software\\Wine', 'Value11', 0";
6297 r
= add_reglocator_entry(hdb
, str
);
6298 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6300 /* HKLM, msidbLocatorTypeDirectory, signature, file exists */
6301 str
= "'NewSignature14', 2, 'Software\\Wine', 'Value9', 0";
6302 r
= add_reglocator_entry(hdb
, str
);
6303 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6305 /* HKCR, msidbLocatorTypeRawValue, REG_SZ */
6306 str
= "'NewSignature15', 0, 'Software\\Wine', 'Value1', 2";
6307 r
= add_reglocator_entry(hdb
, str
);
6308 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6310 /* HKCU, msidbLocatorTypeRawValue, REG_SZ */
6311 str
= "'NewSignature16', 1, 'Software\\Wine', 'Value1', 2";
6312 r
= add_reglocator_entry(hdb
, str
);
6313 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6315 /* HKU, msidbLocatorTypeRawValue, REG_SZ */
6316 str
= "'NewSignature17', 3, 'S-1-5-18\\Software\\Wine', 'Value1', 2";
6317 r
= add_reglocator_entry(hdb
, str
);
6318 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6320 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, NULL Name */
6321 str
= "'NewSignature18', 2, 'Software\\Wine', '', 2";
6322 r
= add_reglocator_entry(hdb
, str
);
6323 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6325 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, key does not exist */
6326 str
= "'NewSignature19', 2, 'Software\\IDontExist', '', 2";
6327 r
= add_reglocator_entry(hdb
, str
);
6328 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6330 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, value is empty */
6331 str
= "'NewSignature20', 2, 'Software\\Wine', 'Value12', 2";
6332 r
= add_reglocator_entry(hdb
, str
);
6333 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6335 /* HKLM, msidbLocatorTypeFileName, signature, file exists w/ version */
6336 str
= "'NewSignature21', 2, 'Software\\Wine', 'Value13', 1";
6337 r
= add_reglocator_entry(hdb
, str
);
6338 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6340 /* HKLM, msidbLocatorTypeFileName, file exists w/ version, version > max */
6341 str
= "'NewSignature22', 2, 'Software\\Wine', 'Value14', 1";
6342 r
= add_reglocator_entry(hdb
, str
);
6343 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6345 /* HKLM, msidbLocatorTypeFileName, file exists w/ version, sig->name ignored */
6346 str
= "'NewSignature23', 2, 'Software\\Wine', 'Value15', 1";
6347 r
= add_reglocator_entry(hdb
, str
);
6348 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6350 /* HKLM, msidbLocatorTypeFileName, no signature, directory exists */
6351 str
= "'NewSignature24', 2, 'Software\\Wine', 'Value11', 1";
6352 r
= add_reglocator_entry(hdb
, str
);
6353 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6355 /* HKLM, msidbLocatorTypeFileName, no signature, file does not exist */
6356 str
= "'NewSignature25', 2, 'Software\\Wine', 'Value10', 1";
6357 r
= add_reglocator_entry(hdb
, str
);
6358 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6360 /* HKLM, msidbLocatorTypeDirectory, signature, directory exists */
6361 str
= "'NewSignature26', 2, 'Software\\Wine', 'Value11', 0";
6362 r
= add_reglocator_entry(hdb
, str
);
6363 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6365 /* HKLM, msidbLocatorTypeDirectory, signature, file does not exist */
6366 str
= "'NewSignature27', 2, 'Software\\Wine', 'Value10', 0";
6367 r
= add_reglocator_entry(hdb
, str
);
6368 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6370 /* HKLM, msidbLocatorTypeDirectory, no signature, file does not exist */
6371 str
= "'NewSignature28', 2, 'Software\\Wine', 'Value10', 0";
6372 r
= add_reglocator_entry(hdb
, str
);
6373 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6375 /* HKLM, msidbLocatorTypeFile, file exists, in quotes */
6376 str
= "'NewSignature29', 2, 'Software\\Wine', 'Value16', 1";
6377 r
= add_reglocator_entry(hdb
, str
);
6378 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6380 /* HKLM, msidbLocatorTypeFile, file exists, no quotes */
6381 str
= "'NewSignature30', 2, 'Software\\Wine', 'Value17', 1";
6382 r
= add_reglocator_entry(hdb
, str
);
6383 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6385 r
= create_signature_table(hdb
);
6386 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6388 str
= "'NewSignature9', 'FileName1', '', '', '', '', '', '', ''";
6389 r
= add_signature_entry(hdb
, str
);
6390 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6392 str
= "'NewSignature10', 'FileName2', '', '', '', '', '', '', ''";
6393 r
= add_signature_entry(hdb
, str
);
6394 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6396 str
= "'NewSignature14', 'FileName1', '', '', '', '', '', '', ''";
6397 r
= add_signature_entry(hdb
, str
);
6398 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6400 str
= "'NewSignature21', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
6401 r
= add_signature_entry(hdb
, str
);
6402 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6404 str
= "'NewSignature22', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
6405 r
= add_signature_entry(hdb
, str
);
6406 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6408 str
= "'NewSignature23', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
6409 r
= add_signature_entry(hdb
, str
);
6410 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6412 ptr
= strrchr(CURR_DIR
, '\\') + 1;
6413 sprintf(path
, "'NewSignature26', '%s', '', '', '', '', '', '', ''", ptr
);
6414 r
= add_signature_entry(hdb
, path
);
6415 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6417 str
= "'NewSignature27', 'FileName2', '', '', '', '', '', '', ''";
6418 r
= add_signature_entry(hdb
, str
);
6419 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6421 str
= "'NewSignature29', 'FileName1', '', '', '', '', '', '', ''";
6422 r
= add_signature_entry(hdb
, str
);
6423 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6425 str
= "'NewSignature30', 'FileName1', '', '', '', '', '', '', ''";
6426 r
= add_signature_entry(hdb
, str
);
6427 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6429 hpkg
= package_from_db(hdb
);
6430 ok(hpkg
, "Expected a valid package handle\n");
6432 r
= MsiDoAction(hpkg
, "AppSearch");
6433 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6436 r
= MsiGetPropertyA(hpkg
, "SIGPROP1", prop
, &size
);
6437 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6438 ok(!lstrcmpA(prop
, "regszdata"),
6439 "Expected \"regszdata\", got \"%s\"\n", prop
);
6442 r
= MsiGetPropertyA(hpkg
, "SIGPROP2", prop
, &size
);
6443 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6444 ok(!lstrcmpA(prop
, "#42"), "Expected \"#42\", got \"%s\"\n", prop
);
6447 r
= MsiGetPropertyA(hpkg
, "SIGPROP3", prop
, &size
);
6448 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6449 ok(!lstrcmpA(prop
, "#-42"), "Expected \"#-42\", got \"%s\"\n", prop
);
6451 ExpandEnvironmentStringsA("%PATH%", path
, MAX_PATH
);
6454 r
= MsiGetPropertyA(hpkg
, "SIGPROP4", prop
, &size
);
6455 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6456 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6459 r
= MsiGetPropertyA(hpkg
, "SIGPROP5", prop
, &size
);
6460 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6462 "my%NOVAR%"), "Expected \"my%%NOVAR%%\", got \"%s\"\n", prop
);
6465 r
= MsiGetPropertyA(hpkg
, "SIGPROP6", prop
, &size
);
6466 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6469 ok(!memcmp(prop
, "\0one\0two\0\0", 10),
6470 "Expected \"\\0one\\0two\\0\\0\"\n");
6474 lstrcpyA(path
, "#xCDAB3412EF907856");
6475 r
= MsiGetPropertyA(hpkg
, "SIGPROP7", prop
, &size
);
6476 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6477 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6480 r
= MsiGetPropertyA(hpkg
, "SIGPROP8", prop
, &size
);
6481 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6482 ok(!lstrcmpA(prop
, "##regszdata"),
6483 "Expected \"##regszdata\", got \"%s\"\n", prop
);
6486 sprintf(path
, "%s\\FileName1", CURR_DIR
);
6487 r
= MsiGetPropertyA(hpkg
, "SIGPROP9", prop
, &size
);
6488 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6489 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6492 r
= MsiGetPropertyA(hpkg
, "SIGPROP10", prop
, &size
);
6493 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6494 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6497 sprintf(path
, "%s\\", CURR_DIR
);
6498 r
= MsiGetPropertyA(hpkg
, "SIGPROP11", prop
, &size
);
6499 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6500 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6503 r
= MsiGetPropertyA(hpkg
, "SIGPROP12", prop
, &size
);
6504 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6505 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6508 sprintf(path
, "%s\\", CURR_DIR
);
6509 r
= MsiGetPropertyA(hpkg
, "SIGPROP13", prop
, &size
);
6510 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6511 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6514 r
= MsiGetPropertyA(hpkg
, "SIGPROP14", prop
, &size
);
6515 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6516 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6519 r
= MsiGetPropertyA(hpkg
, "SIGPROP15", prop
, &size
);
6520 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6521 ok(!lstrcmpA(prop
, "regszdata"),
6522 "Expected \"regszdata\", got \"%s\"\n", prop
);
6525 r
= MsiGetPropertyA(hpkg
, "SIGPROP16", prop
, &size
);
6526 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6527 ok(!lstrcmpA(prop
, "regszdata"),
6528 "Expected \"regszdata\", got \"%s\"\n", prop
);
6533 r
= MsiGetPropertyA(hpkg
, "SIGPROP17", prop
, &size
);
6534 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6535 ok(!lstrcmpA(prop
, "regszdata"),
6536 "Expected \"regszdata\", got \"%s\"\n", prop
);
6540 r
= MsiGetPropertyA(hpkg
, "SIGPROP18", prop
, &size
);
6541 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6542 ok(!lstrcmpA(prop
, "defvalue"),
6543 "Expected \"defvalue\", got \"%s\"\n", prop
);
6546 r
= MsiGetPropertyA(hpkg
, "SIGPROP19", prop
, &size
);
6547 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6548 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6551 r
= MsiGetPropertyA(hpkg
, "SIGPROP20", prop
, &size
);
6552 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6553 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6558 sprintf(path
, "%s\\FileName3.dll", CURR_DIR
);
6559 r
= MsiGetPropertyA(hpkg
, "SIGPROP21", prop
, &size
);
6560 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6561 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6564 r
= MsiGetPropertyA(hpkg
, "SIGPROP22", prop
, &size
);
6565 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6566 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6569 sprintf(path
, "%s\\FileName5.dll", CURR_DIR
);
6570 r
= MsiGetPropertyA(hpkg
, "SIGPROP23", prop
, &size
);
6571 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6572 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6576 lstrcpyA(path
, CURR_DIR
);
6577 ptr
= strrchr(path
, '\\') + 1;
6579 r
= MsiGetPropertyA(hpkg
, "SIGPROP24", prop
, &size
);
6580 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6581 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6584 sprintf(path
, "%s\\", CURR_DIR
);
6585 r
= MsiGetPropertyA(hpkg
, "SIGPROP25", prop
, &size
);
6586 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6587 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6590 r
= MsiGetPropertyA(hpkg
, "SIGPROP26", prop
, &size
);
6591 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6592 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6595 r
= MsiGetPropertyA(hpkg
, "SIGPROP27", prop
, &size
);
6596 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6597 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6600 r
= MsiGetPropertyA(hpkg
, "SIGPROP28", prop
, &size
);
6601 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6602 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6605 sprintf(path
, "%s\\FileName1", CURR_DIR
);
6606 r
= MsiGetPropertyA(hpkg
, "SIGPROP29", prop
, &size
);
6607 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6608 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6611 sprintf(path
, "%s\\FileName1", CURR_DIR
);
6612 r
= MsiGetPropertyA(hpkg
, "SIGPROP30", prop
, &size
);
6613 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6615 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6617 todo_wine
ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6619 RegSetValueA(hklm
, NULL
, REG_SZ
, "", 0);
6620 RegDeleteValueA(hklm
, "Value1");
6621 RegDeleteValueA(hklm
, "Value2");
6622 RegDeleteValueA(hklm
, "Value3");
6623 RegDeleteValueA(hklm
, "Value4");
6624 RegDeleteValueA(hklm
, "Value5");
6625 RegDeleteValueA(hklm
, "Value6");
6626 RegDeleteValueA(hklm
, "Value7");
6627 RegDeleteValueA(hklm
, "Value8");
6628 RegDeleteValueA(hklm
, "Value9");
6629 RegDeleteValueA(hklm
, "Value10");
6630 RegDeleteValueA(hklm
, "Value11");
6631 RegDeleteValueA(hklm
, "Value12");
6632 RegDeleteValueA(hklm
, "Value13");
6633 RegDeleteValueA(hklm
, "Value14");
6634 RegDeleteValueA(hklm
, "Value15");
6635 RegDeleteValueA(hklm
, "Value16");
6636 RegDeleteValueA(hklm
, "Value17");
6637 RegDeleteKeyA(hklm
, "");
6640 RegDeleteValueA(classes
, "Value1");
6641 RegDeleteKeyA(classes
, "");
6642 RegCloseKey(classes
);
6644 RegDeleteValueA(hkcu
, "Value1");
6645 RegDeleteKeyA(hkcu
, "");
6648 RegDeleteValueA(users
, "Value1");
6649 RegDeleteKeyA(users
, "");
6652 DeleteFileA("FileName1");
6653 DeleteFileA("FileName3.dll");
6654 DeleteFileA("FileName4.dll");
6655 DeleteFileA("FileName5.dll");
6656 MsiCloseHandle(hpkg
);
6657 DeleteFileA(msifile
);
6660 static void delete_win_ini(LPCSTR file
)
6662 CHAR path
[MAX_PATH
];
6664 GetWindowsDirectoryA(path
, MAX_PATH
);
6665 lstrcatA(path
, "\\");
6666 lstrcatA(path
, file
);
6671 static void test_appsearch_inilocator(void)
6673 MSIHANDLE hpkg
, hdb
;
6674 CHAR path
[MAX_PATH
];
6675 CHAR prop
[MAX_PATH
];
6683 if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
6686 DeleteFileA("test.dll");
6688 WritePrivateProfileStringA("Section", "Key", "keydata,field2", "IniFile.ini");
6690 create_test_file("FileName1");
6691 sprintf(path
, "%s\\FileName1", CURR_DIR
);
6692 WritePrivateProfileStringA("Section", "Key2", path
, "IniFile.ini");
6694 WritePrivateProfileStringA("Section", "Key3", CURR_DIR
, "IniFile.ini");
6696 sprintf(path
, "%s\\IDontExist", CURR_DIR
);
6697 WritePrivateProfileStringA("Section", "Key4", path
, "IniFile.ini");
6699 create_file_with_version("FileName2.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6700 sprintf(path
, "%s\\FileName2.dll", CURR_DIR
);
6701 WritePrivateProfileStringA("Section", "Key5", path
, "IniFile.ini");
6703 create_file_with_version("FileName3.dll", MAKELONG(1, 2), MAKELONG(3, 4));
6704 sprintf(path
, "%s\\FileName3.dll", CURR_DIR
);
6705 WritePrivateProfileStringA("Section", "Key6", path
, "IniFile.ini");
6707 create_file_with_version("FileName4.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6708 sprintf(path
, "%s\\FileName4.dll", CURR_DIR
);
6709 WritePrivateProfileStringA("Section", "Key7", path
, "IniFile.ini");
6711 hdb
= create_package_db();
6712 ok(hdb
, "Expected a valid database handle\n");
6714 r
= create_appsearch_table(hdb
);
6715 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6717 r
= add_appsearch_entry(hdb
, "'SIGPROP1', 'NewSignature1'");
6718 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6720 r
= add_appsearch_entry(hdb
, "'SIGPROP2', 'NewSignature2'");
6721 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6723 r
= add_appsearch_entry(hdb
, "'SIGPROP3', 'NewSignature3'");
6724 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6726 r
= add_appsearch_entry(hdb
, "'SIGPROP4', 'NewSignature4'");
6727 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6729 r
= add_appsearch_entry(hdb
, "'SIGPROP5', 'NewSignature5'");
6730 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6732 r
= add_appsearch_entry(hdb
, "'SIGPROP6', 'NewSignature6'");
6733 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6735 r
= add_appsearch_entry(hdb
, "'SIGPROP7', 'NewSignature7'");
6736 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6738 r
= add_appsearch_entry(hdb
, "'SIGPROP8', 'NewSignature8'");
6739 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6741 r
= add_appsearch_entry(hdb
, "'SIGPROP9', 'NewSignature9'");
6742 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6744 r
= add_appsearch_entry(hdb
, "'SIGPROP10', 'NewSignature10'");
6745 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6747 r
= add_appsearch_entry(hdb
, "'SIGPROP11', 'NewSignature11'");
6748 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6750 r
= add_appsearch_entry(hdb
, "'SIGPROP12', 'NewSignature12'");
6751 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6753 r
= create_inilocator_table(hdb
);
6754 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6756 /* msidbLocatorTypeRawValue, field 1 */
6757 str
= "'NewSignature1', 'IniFile.ini', 'Section', 'Key', 1, 2";
6758 r
= add_inilocator_entry(hdb
, str
);
6759 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6761 /* msidbLocatorTypeRawValue, field 2 */
6762 str
= "'NewSignature2', 'IniFile.ini', 'Section', 'Key', 2, 2";
6763 r
= add_inilocator_entry(hdb
, str
);
6764 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6766 /* msidbLocatorTypeRawValue, entire field */
6767 str
= "'NewSignature3', 'IniFile.ini', 'Section', 'Key', 0, 2";
6768 r
= add_inilocator_entry(hdb
, str
);
6769 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6771 /* msidbLocatorTypeFile */
6772 str
= "'NewSignature4', 'IniFile.ini', 'Section', 'Key2', 1, 1";
6773 r
= add_inilocator_entry(hdb
, str
);
6774 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6776 /* msidbLocatorTypeDirectory, file */
6777 str
= "'NewSignature5', 'IniFile.ini', 'Section', 'Key2', 1, 0";
6778 r
= add_inilocator_entry(hdb
, str
);
6779 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6781 /* msidbLocatorTypeDirectory, directory */
6782 str
= "'NewSignature6', 'IniFile.ini', 'Section', 'Key3', 1, 0";
6783 r
= add_inilocator_entry(hdb
, str
);
6784 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6786 /* msidbLocatorTypeFile, file, no signature */
6787 str
= "'NewSignature7', 'IniFile.ini', 'Section', 'Key2', 1, 1";
6788 r
= add_inilocator_entry(hdb
, str
);
6789 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6791 /* msidbLocatorTypeFile, dir, no signature */
6792 str
= "'NewSignature8', 'IniFile.ini', 'Section', 'Key3', 1, 1";
6793 r
= add_inilocator_entry(hdb
, str
);
6794 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6796 /* msidbLocatorTypeFile, file does not exist */
6797 str
= "'NewSignature9', 'IniFile.ini', 'Section', 'Key4', 1, 1";
6798 r
= add_inilocator_entry(hdb
, str
);
6799 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6801 /* msidbLocatorTypeFile, signature with version */
6802 str
= "'NewSignature10', 'IniFile.ini', 'Section', 'Key5', 1, 1";
6803 r
= add_inilocator_entry(hdb
, str
);
6804 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6806 /* msidbLocatorTypeFile, signature with version, ver > max */
6807 str
= "'NewSignature11', 'IniFile.ini', 'Section', 'Key6', 1, 1";
6808 r
= add_inilocator_entry(hdb
, str
);
6809 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6811 /* msidbLocatorTypeFile, signature with version, sig->name ignored */
6812 str
= "'NewSignature12', 'IniFile.ini', 'Section', 'Key7', 1, 1";
6813 r
= add_inilocator_entry(hdb
, str
);
6814 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6816 r
= create_signature_table(hdb
);
6817 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6819 r
= add_signature_entry(hdb
, "'NewSignature4', 'FileName1', '', '', '', '', '', '', ''");
6820 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6822 r
= add_signature_entry(hdb
, "'NewSignature9', 'IDontExist', '', '', '', '', '', '', ''");
6823 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6825 r
= add_signature_entry(hdb
, "'NewSignature10', 'FileName2.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
6826 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6828 r
= add_signature_entry(hdb
, "'NewSignature11', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
6829 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6831 r
= add_signature_entry(hdb
, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
6832 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6834 hpkg
= package_from_db(hdb
);
6835 ok(hpkg
, "Expected a valid package handle\n");
6837 r
= MsiDoAction(hpkg
, "AppSearch");
6838 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6841 r
= MsiGetPropertyA(hpkg
, "SIGPROP1", prop
, &size
);
6842 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6843 ok(!lstrcmpA(prop
, "keydata"), "Expected \"keydata\", got \"%s\"\n", prop
);
6846 r
= MsiGetPropertyA(hpkg
, "SIGPROP2", prop
, &size
);
6847 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6848 ok(!lstrcmpA(prop
, "field2"), "Expected \"field2\", got \"%s\"\n", prop
);
6851 r
= MsiGetPropertyA(hpkg
, "SIGPROP3", prop
, &size
);
6852 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6853 ok(!lstrcmpA(prop
, "keydata,field2"),
6854 "Expected \"keydata,field2\", got \"%s\"\n", prop
);
6857 sprintf(path
, "%s\\FileName1", CURR_DIR
);
6858 r
= MsiGetPropertyA(hpkg
, "SIGPROP4", prop
, &size
);
6859 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6860 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6863 r
= MsiGetPropertyA(hpkg
, "SIGPROP5", prop
, &size
);
6864 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6865 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6868 sprintf(path
, "%s\\", CURR_DIR
);
6869 r
= MsiGetPropertyA(hpkg
, "SIGPROP6", prop
, &size
);
6870 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6871 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6874 sprintf(path
, "%s\\", CURR_DIR
);
6875 r
= MsiGetPropertyA(hpkg
, "SIGPROP7", prop
, &size
);
6876 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6877 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6880 lstrcpyA(path
, CURR_DIR
);
6881 ptr
= strrchr(path
, '\\');
6883 r
= MsiGetPropertyA(hpkg
, "SIGPROP8", prop
, &size
);
6884 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6885 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6888 r
= MsiGetPropertyA(hpkg
, "SIGPROP9", prop
, &size
);
6889 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6890 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6895 sprintf(path
, "%s\\FileName2.dll", CURR_DIR
);
6896 r
= MsiGetPropertyA(hpkg
, "SIGPROP10", prop
, &size
);
6897 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6898 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6901 r
= MsiGetPropertyA(hpkg
, "SIGPROP11", prop
, &size
);
6902 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6903 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6906 sprintf(path
, "%s\\FileName4.dll", CURR_DIR
);
6907 r
= MsiGetPropertyA(hpkg
, "SIGPROP12", prop
, &size
);
6908 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6909 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6912 delete_win_ini("IniFile.ini");
6913 DeleteFileA("FileName1");
6914 DeleteFileA("FileName2.dll");
6915 DeleteFileA("FileName3.dll");
6916 DeleteFileA("FileName4.dll");
6917 MsiCloseHandle(hpkg
);
6918 DeleteFileA(msifile
);
6921 static void test_appsearch_drlocator(void)
6923 MSIHANDLE hpkg
, hdb
;
6924 CHAR path
[MAX_PATH
];
6925 CHAR prop
[MAX_PATH
];
6932 if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
6935 DeleteFileA("test.dll");
6937 create_test_file("FileName1");
6938 CreateDirectoryA("one", NULL
);
6939 CreateDirectoryA("one\\two", NULL
);
6940 CreateDirectoryA("one\\two\\three", NULL
);
6941 create_test_file("one\\two\\three\\FileName2");
6942 CreateDirectoryA("another", NULL
);
6943 create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6944 create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
6945 create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6947 hdb
= create_package_db();
6948 ok(hdb
, "Expected a valid database handle\n");
6950 r
= create_appsearch_table(hdb
);
6951 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6953 r
= add_appsearch_entry(hdb
, "'SIGPROP1', 'NewSignature1'");
6954 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6956 r
= add_appsearch_entry(hdb
, "'SIGPROP2', 'NewSignature2'");
6957 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6959 r
= add_appsearch_entry(hdb
, "'SIGPROP3', 'NewSignature3'");
6960 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6962 r
= add_appsearch_entry(hdb
, "'SIGPROP4', 'NewSignature4'");
6963 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6965 r
= add_appsearch_entry(hdb
, "'SIGPROP5', 'NewSignature5'");
6966 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6968 r
= add_appsearch_entry(hdb
, "'SIGPROP6', 'NewSignature6'");
6969 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6971 r
= add_appsearch_entry(hdb
, "'SIGPROP7', 'NewSignature7'");
6972 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6974 r
= add_appsearch_entry(hdb
, "'SIGPROP8', 'NewSignature8'");
6975 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6977 r
= add_appsearch_entry(hdb
, "'SIGPROP9', 'NewSignature9'");
6978 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6980 r
= add_appsearch_entry(hdb
, "'SIGPROP10', 'NewSignature10'");
6981 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6983 r
= create_drlocator_table(hdb
);
6984 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6986 /* no parent, full path, depth 0, signature */
6987 sprintf(path
, "'NewSignature1', '', '%s', 0", CURR_DIR
);
6988 r
= add_drlocator_entry(hdb
, path
);
6989 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6991 /* no parent, full path, depth 0, no signature */
6992 sprintf(path
, "'NewSignature2', '', '%s', 0", CURR_DIR
);
6993 r
= add_drlocator_entry(hdb
, path
);
6994 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6996 /* no parent, relative path, depth 0, no signature */
6997 sprintf(path
, "'NewSignature3', '', '%s', 0", CURR_DIR
+ 3);
6998 r
= add_drlocator_entry(hdb
, path
);
6999 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7001 /* no parent, full path, depth 2, signature */
7002 sprintf(path
, "'NewSignature4', '', '%s', 2", CURR_DIR
);
7003 r
= add_drlocator_entry(hdb
, path
);
7004 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7006 /* no parent, full path, depth 3, signature */
7007 sprintf(path
, "'NewSignature5', '', '%s', 3", CURR_DIR
);
7008 r
= add_drlocator_entry(hdb
, path
);
7009 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7011 /* no parent, full path, depth 1, signature is dir */
7012 sprintf(path
, "'NewSignature6', '', '%s', 1", CURR_DIR
);
7013 r
= add_drlocator_entry(hdb
, path
);
7014 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7016 /* parent is in DrLocator, relative path, depth 0, signature */
7017 sprintf(path
, "'NewSignature7', 'NewSignature1', 'one\\two\\three', 1");
7018 r
= add_drlocator_entry(hdb
, path
);
7019 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7021 /* no parent, full path, depth 0, signature w/ version */
7022 sprintf(path
, "'NewSignature8', '', '%s', 0", CURR_DIR
);
7023 r
= add_drlocator_entry(hdb
, path
);
7024 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7026 /* no parent, full path, depth 0, signature w/ version, ver > max */
7027 sprintf(path
, "'NewSignature9', '', '%s', 0", CURR_DIR
);
7028 r
= add_drlocator_entry(hdb
, path
);
7029 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7031 /* no parent, full path, depth 0, signature w/ version, sig->name not ignored */
7032 sprintf(path
, "'NewSignature10', '', '%s', 0", CURR_DIR
);
7033 r
= add_drlocator_entry(hdb
, path
);
7034 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7036 r
= create_signature_table(hdb
);
7037 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7039 str
= "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''";
7040 r
= add_signature_entry(hdb
, str
);
7041 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7043 str
= "'NewSignature4', 'FileName2', '', '', '', '', '', '', ''";
7044 r
= add_signature_entry(hdb
, str
);
7045 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7047 str
= "'NewSignature5', 'FileName2', '', '', '', '', '', '', ''";
7048 r
= add_signature_entry(hdb
, str
);
7049 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7051 str
= "'NewSignature6', 'another', '', '', '', '', '', '', ''";
7052 r
= add_signature_entry(hdb
, str
);
7053 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7055 str
= "'NewSignature7', 'FileName2', '', '', '', '', '', '', ''";
7056 r
= add_signature_entry(hdb
, str
);
7057 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7059 str
= "'NewSignature8', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
7060 r
= add_signature_entry(hdb
, str
);
7061 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7063 str
= "'NewSignature9', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
7064 r
= add_signature_entry(hdb
, str
);
7065 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7067 str
= "'NewSignature10', 'necessary', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
7068 r
= add_signature_entry(hdb
, str
);
7069 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7071 hpkg
= package_from_db(hdb
);
7072 ok(hpkg
, "Expected a valid package handle\n");
7074 r
= MsiDoAction(hpkg
, "AppSearch");
7075 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7078 sprintf(path
, "%s\\FileName1", CURR_DIR
);
7079 r
= MsiGetPropertyA(hpkg
, "SIGPROP1", prop
, &size
);
7080 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7081 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
7084 sprintf(path
, "%s\\", CURR_DIR
);
7085 r
= MsiGetPropertyA(hpkg
, "SIGPROP2", prop
, &size
);
7086 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7087 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
7090 sprintf(path
, "%s\\", CURR_DIR
);
7091 r
= MsiGetPropertyA(hpkg
, "SIGPROP3", prop
, &size
);
7092 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7093 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
7096 r
= MsiGetPropertyA(hpkg
, "SIGPROP4", prop
, &size
);
7097 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7098 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
7101 sprintf(path
, "%s\\one\\two\\three\\FileName2", CURR_DIR
);
7102 r
= MsiGetPropertyA(hpkg
, "SIGPROP5", prop
, &size
);
7103 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7104 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
7107 r
= MsiGetPropertyA(hpkg
, "SIGPROP6", prop
, &size
);
7108 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7109 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
7112 sprintf(path
, "%s\\one\\two\\three\\FileName2", CURR_DIR
);
7113 r
= MsiGetPropertyA(hpkg
, "SIGPROP7", prop
, &size
);
7114 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7115 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
7120 sprintf(path
, "%s\\FileName3.dll", CURR_DIR
);
7121 r
= MsiGetPropertyA(hpkg
, "SIGPROP8", prop
, &size
);
7122 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7123 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
7126 r
= MsiGetPropertyA(hpkg
, "SIGPROP9", prop
, &size
);
7127 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7128 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
7131 r
= MsiGetPropertyA(hpkg
, "SIGPROP10", prop
, &size
);
7132 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7133 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
7136 DeleteFileA("FileName1");
7137 DeleteFileA("FileName3.dll");
7138 DeleteFileA("FileName4.dll");
7139 DeleteFileA("FileName5.dll");
7140 DeleteFileA("one\\two\\three\\FileName2");
7141 RemoveDirectoryA("one\\two\\three");
7142 RemoveDirectoryA("one\\two");
7143 RemoveDirectoryA("one");
7144 RemoveDirectoryA("another");
7145 MsiCloseHandle(hpkg
);
7146 DeleteFileA(msifile
);
7149 static void test_featureparents(void)
7154 INSTALLSTATE state
, action
;
7156 hdb
= create_package_db();
7157 ok ( hdb
, "failed to create package database\n" );
7159 r
= add_directory_entry( hdb
, "'TARGETDIR', '', 'SourceDir'");
7160 ok( r
== ERROR_SUCCESS
, "cannot add directory: %d\n", r
);
7162 r
= create_feature_table( hdb
);
7163 ok( r
== ERROR_SUCCESS
, "cannot create Feature table: %d\n", r
);
7165 r
= create_component_table( hdb
);
7166 ok( r
== ERROR_SUCCESS
, "cannot create Component table: %d\n", r
);
7168 r
= create_feature_components_table( hdb
);
7169 ok( r
== ERROR_SUCCESS
, "cannot create FeatureComponents table: %d\n", r
);
7171 r
= create_file_table( hdb
);
7172 ok( r
== ERROR_SUCCESS
, "cannot create File table: %d\n", r
);
7174 /* msidbFeatureAttributesFavorLocal */
7175 r
= add_feature_entry( hdb
, "'zodiac', '', '', '', 2, 1, '', 0" );
7176 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
7178 /* msidbFeatureAttributesFavorSource */
7179 r
= add_feature_entry( hdb
, "'perseus', '', '', '', 2, 1, '', 1" );
7180 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
7182 /* msidbFeatureAttributesFavorLocal */
7183 r
= add_feature_entry( hdb
, "'orion', '', '', '', 2, 1, '', 0" );
7184 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
7186 /* disabled because of install level */
7187 r
= add_feature_entry( hdb
, "'waters', '', '', '', 15, 101, '', 9" );
7188 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
7190 /* child feature of disabled feature */
7191 r
= add_feature_entry( hdb
, "'bayer', 'waters', '', '', 14, 1, '', 9" );
7192 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
7194 /* component of disabled feature (install level) */
7195 r
= add_component_entry( hdb
, "'delphinus', '', 'TARGETDIR', 0, '', 'delphinus_file'" );
7196 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
7198 /* component of disabled child feature (install level) */
7199 r
= add_component_entry( hdb
, "'hydrus', '', 'TARGETDIR', 0, '', 'hydrus_file'" );
7200 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
7202 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
7203 r
= add_component_entry( hdb
, "'leo', '', 'TARGETDIR', 0, '', 'leo_file'" );
7204 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
7206 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
7207 r
= add_component_entry( hdb
, "'virgo', '', 'TARGETDIR', 1, '', 'virgo_file'" );
7208 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
7210 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
7211 r
= add_component_entry( hdb
, "'libra', '', 'TARGETDIR', 2, '', 'libra_file'" );
7212 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
7214 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
7215 r
= add_component_entry( hdb
, "'cassiopeia', '', 'TARGETDIR', 0, '', 'cassiopeia_file'" );
7216 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
7218 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
7219 r
= add_component_entry( hdb
, "'cepheus', '', 'TARGETDIR', 1, '', 'cepheus_file'" );
7220 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
7222 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
7223 r
= add_component_entry( hdb
, "'andromeda', '', 'TARGETDIR', 2, '', 'andromeda_file'" );
7224 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
7226 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
7227 r
= add_component_entry( hdb
, "'canis', '', 'TARGETDIR', 0, '', 'canis_file'" );
7228 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
7230 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
7231 r
= add_component_entry( hdb
, "'monoceros', '', 'TARGETDIR', 1, '', 'monoceros_file'" );
7232 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
7234 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
7235 r
= add_component_entry( hdb
, "'lepus', '', 'TARGETDIR', 2, '', 'lepus_file'" );
7237 r
= add_feature_components_entry( hdb
, "'zodiac', 'leo'" );
7238 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7240 r
= add_feature_components_entry( hdb
, "'zodiac', 'virgo'" );
7241 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7243 r
= add_feature_components_entry( hdb
, "'zodiac', 'libra'" );
7244 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7246 r
= add_feature_components_entry( hdb
, "'perseus', 'cassiopeia'" );
7247 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7249 r
= add_feature_components_entry( hdb
, "'perseus', 'cepheus'" );
7250 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7252 r
= add_feature_components_entry( hdb
, "'perseus', 'andromeda'" );
7253 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7255 r
= add_feature_components_entry( hdb
, "'orion', 'leo'" );
7256 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7258 r
= add_feature_components_entry( hdb
, "'orion', 'virgo'" );
7259 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7261 r
= add_feature_components_entry( hdb
, "'orion', 'libra'" );
7262 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7264 r
= add_feature_components_entry( hdb
, "'orion', 'cassiopeia'" );
7265 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7267 r
= add_feature_components_entry( hdb
, "'orion', 'cepheus'" );
7268 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7270 r
= add_feature_components_entry( hdb
, "'orion', 'andromeda'" );
7271 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7273 r
= add_feature_components_entry( hdb
, "'orion', 'canis'" );
7274 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7276 r
= add_feature_components_entry( hdb
, "'orion', 'monoceros'" );
7277 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7279 r
= add_feature_components_entry( hdb
, "'orion', 'lepus'" );
7280 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7282 r
= add_feature_components_entry( hdb
, "'waters', 'delphinus'" );
7283 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7285 r
= add_feature_components_entry( hdb
, "'bayer', 'hydrus'" );
7286 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7288 r
= add_file_entry( hdb
, "'leo_file', 'leo', 'leo.txt', 100, '', '1033', 8192, 1" );
7289 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7291 r
= add_file_entry( hdb
, "'virgo_file', 'virgo', 'virgo.txt', 0, '', '1033', 8192, 1" );
7292 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7294 r
= add_file_entry( hdb
, "'libra_file', 'libra', 'libra.txt', 0, '', '1033', 8192, 1" );
7295 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7297 r
= add_file_entry( hdb
, "'cassiopeia_file', 'cassiopeia', 'cassiopeia.txt', 0, '', '1033', 8192, 1" );
7298 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7300 r
= add_file_entry( hdb
, "'cepheus_file', 'cepheus', 'cepheus.txt', 0, '', '1033', 8192, 1" );
7301 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7303 r
= add_file_entry( hdb
, "'andromeda_file', 'andromeda', 'andromeda.txt', 0, '', '1033', 8192, 1" );
7304 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7306 r
= add_file_entry( hdb
, "'canis_file', 'canis', 'canis.txt', 0, '', '1033', 8192, 1" );
7307 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7309 r
= add_file_entry( hdb
, "'monoceros_file', 'monoceros', 'monoceros.txt', 0, '', '1033', 8192, 1" );
7310 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7312 r
= add_file_entry( hdb
, "'lepus_file', 'lepus', 'lepus.txt', 0, '', '1033', 8192, 1" );
7313 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7315 r
= add_file_entry( hdb
, "'delphinus_file', 'delphinus', 'delphinus.txt', 0, '', '1033', 8192, 1" );
7316 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7318 r
= add_file_entry( hdb
, "'hydrus_file', 'hydrus', 'hydrus.txt', 0, '', '1033', 8192, 1" );
7319 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7321 hpkg
= package_from_db( hdb
);
7322 ok( hpkg
, "failed to create package\n");
7324 MsiCloseHandle( hdb
);
7326 r
= MsiDoAction( hpkg
, "CostInitialize");
7327 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
7329 r
= MsiDoAction( hpkg
, "FileCost");
7330 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
7332 r
= MsiDoAction( hpkg
, "CostFinalize");
7333 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
7337 r
= MsiGetFeatureState(hpkg
, "zodiac", &state
, &action
);
7338 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7339 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
7340 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
7344 r
= MsiGetFeatureState(hpkg
, "perseus", &state
, &action
);
7345 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7346 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
7347 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
7351 r
= MsiGetFeatureState(hpkg
, "orion", &state
, &action
);
7352 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7353 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
7354 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
7358 r
= MsiGetFeatureState(hpkg
, "waters", &state
, &action
);
7359 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7360 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
7361 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
7365 r
= MsiGetFeatureState(hpkg
, "bayer", &state
, &action
);
7366 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7367 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
7368 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
7372 r
= MsiGetComponentState(hpkg
, "leo", &state
, &action
);
7373 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7374 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
7375 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
7379 r
= MsiGetComponentState(hpkg
, "virgo", &state
, &action
);
7380 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7381 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state
);
7382 ok( action
== INSTALLSTATE_SOURCE
, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action
);
7386 r
= MsiGetComponentState(hpkg
, "libra", &state
, &action
);
7387 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7388 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state
);
7389 ok( action
== INSTALLSTATE_LOCAL
, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action
);
7393 r
= MsiGetComponentState(hpkg
, "cassiopeia", &state
, &action
);
7394 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7395 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state
);
7396 ok( action
== INSTALLSTATE_LOCAL
, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action
);
7400 r
= MsiGetComponentState(hpkg
, "cepheus", &state
, &action
);
7401 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7402 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7403 ok( action
== INSTALLSTATE_SOURCE
, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action
);
7407 r
= MsiGetComponentState(hpkg
, "andromeda", &state
, &action
);
7408 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7409 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state
);
7410 ok( action
== INSTALLSTATE_LOCAL
, "Expected andromeda INSTALLSTATE_LOCAL, got %d\n", action
);
7414 r
= MsiGetComponentState(hpkg
, "canis", &state
, &action
);
7415 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7416 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state
);
7417 ok( action
== INSTALLSTATE_LOCAL
, "Expected canis INSTALLSTATE_LOCAL, got %d\n", action
);
7421 r
= MsiGetComponentState(hpkg
, "monoceros", &state
, &action
);
7422 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7423 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state
);
7424 ok( action
== INSTALLSTATE_SOURCE
, "Expected monoceros INSTALLSTATE_SOURCE, got %d\n", action
);
7428 r
= MsiGetComponentState(hpkg
, "lepus", &state
, &action
);
7429 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7430 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7431 ok( action
== INSTALLSTATE_LOCAL
, "Expected lepus INSTALLSTATE_LOCAL, got %d\n", action
);
7435 r
= MsiGetComponentState(hpkg
, "delphinus", &state
, &action
);
7436 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7437 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7438 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action
);
7442 r
= MsiGetComponentState(hpkg
, "hydrus", &state
, &action
);
7443 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7444 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7445 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action
);
7447 r
= MsiSetFeatureState(hpkg
, "orion", INSTALLSTATE_ABSENT
);
7448 ok( r
== ERROR_SUCCESS
, "failed to set feature state: %d\n", r
);
7452 r
= MsiGetFeatureState(hpkg
, "zodiac", &state
, &action
);
7453 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7454 ok( state
== INSTALLSTATE_ABSENT
, "Expected zodiac INSTALLSTATE_ABSENT, got %d\n", state
);
7455 ok( action
== INSTALLSTATE_LOCAL
, "Expected zodiac INSTALLSTATE_LOCAL, got %d\n", action
);
7459 r
= MsiGetFeatureState(hpkg
, "perseus", &state
, &action
);
7460 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7461 ok( state
== INSTALLSTATE_ABSENT
, "Expected perseus INSTALLSTATE_ABSENT, got %d\n", state
);
7462 ok( action
== INSTALLSTATE_SOURCE
, "Expected perseus INSTALLSTATE_SOURCE, got %d\n", action
);
7466 r
= MsiGetFeatureState(hpkg
, "orion", &state
, &action
);
7467 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7468 ok( state
== INSTALLSTATE_ABSENT
, "Expected orion INSTALLSTATE_ABSENT, got %d\n", state
);
7469 ok( action
== INSTALLSTATE_ABSENT
, "Expected orion INSTALLSTATE_ABSENT, got %d\n", action
);
7473 r
= MsiGetComponentState(hpkg
, "leo", &state
, &action
);
7474 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7475 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected leo INSTALLSTATE_UNKNOWN, got %d\n", state
);
7476 ok( action
== INSTALLSTATE_LOCAL
, "Expected leo INSTALLSTATE_LOCAL, got %d\n", action
);
7480 r
= MsiGetComponentState(hpkg
, "virgo", &state
, &action
);
7481 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7482 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state
);
7483 ok( action
== INSTALLSTATE_SOURCE
, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action
);
7487 r
= MsiGetComponentState(hpkg
, "libra", &state
, &action
);
7488 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7489 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state
);
7490 ok( action
== INSTALLSTATE_LOCAL
, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action
);
7494 r
= MsiGetComponentState(hpkg
, "cassiopeia", &state
, &action
);
7495 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7496 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state
);
7497 ok( action
== INSTALLSTATE_LOCAL
, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action
);
7501 r
= MsiGetComponentState(hpkg
, "cepheus", &state
, &action
);
7502 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7503 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7504 ok( action
== INSTALLSTATE_SOURCE
, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action
);
7508 r
= MsiGetComponentState(hpkg
, "andromeda", &state
, &action
);
7509 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7510 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state
);
7511 ok( action
== INSTALLSTATE_SOURCE
, "Expected andromeda INSTALLSTATE_SOURCE, got %d\n", action
);
7515 r
= MsiGetComponentState(hpkg
, "canis", &state
, &action
);
7516 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7517 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state
);
7518 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", action
);
7522 r
= MsiGetComponentState(hpkg
, "monoceros", &state
, &action
);
7523 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7524 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state
);
7525 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", action
);
7529 r
= MsiGetComponentState(hpkg
, "lepus", &state
, &action
);
7530 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7531 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7532 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", action
);
7536 r
= MsiGetComponentState(hpkg
, "delphinus", &state
, &action
);
7537 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7538 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7539 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action
);
7543 r
= MsiGetComponentState(hpkg
, "hydrus", &state
, &action
);
7544 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7545 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7546 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action
);
7548 MsiCloseHandle(hpkg
);
7549 DeleteFileA(msifile
);
7552 static void test_installprops(void)
7554 MSIHANDLE hpkg
, hdb
;
7555 CHAR path
[MAX_PATH
];
7563 GetCurrentDirectory(MAX_PATH
, path
);
7564 lstrcat(path
, "\\");
7565 lstrcat(path
, msifile
);
7567 hdb
= create_package_db();
7568 ok( hdb
, "failed to create database\n");
7570 hpkg
= package_from_db(hdb
);
7571 ok( hpkg
, "failed to create package\n");
7573 MsiCloseHandle(hdb
);
7576 r
= MsiGetProperty(hpkg
, "DATABASE", buf
, &size
);
7577 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7578 ok( !lstrcmp(buf
, path
), "Expected %s, got %s\n", path
, buf
);
7580 RegOpenKey(HKEY_CURRENT_USER
, "SOFTWARE\\Microsoft\\MS Setup (ACME)\\User Info", &hkey1
);
7582 RegOpenKey(HKEY_LOCAL_MACHINE
, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", &hkey2
);
7587 if (RegQueryValueEx(hkey1
, "DefName", NULL
, &type
, (LPBYTE
)path
, &size
) != ERROR_SUCCESS
)
7591 RegQueryValueEx(hkey2
, "RegisteredOwner", NULL
, &type
, (LPBYTE
)path
, &size
);
7594 /* win9x doesn't set this */
7598 r
= MsiGetProperty(hpkg
, "USERNAME", buf
, &size
);
7599 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7600 ok( !lstrcmp(buf
, path
), "Expected %s, got %s\n", path
, buf
);
7606 if (RegQueryValueEx(hkey1
, "DefCompany", NULL
, &type
, (LPBYTE
)path
, &size
) != ERROR_SUCCESS
)
7610 RegQueryValueEx(hkey2
, "RegisteredOrganization", NULL
, &type
, (LPBYTE
)path
, &size
);
7616 r
= MsiGetProperty(hpkg
, "COMPANYNAME", buf
, &size
);
7617 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7618 ok( !lstrcmp(buf
, path
), "Expected %s, got %s\n", path
, buf
);
7622 r
= MsiGetProperty(hpkg
, "VersionDatabase", buf
, &size
);
7623 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7624 trace("VersionDatabase = %s\n", buf
);
7627 r
= MsiGetProperty(hpkg
, "VersionMsi", buf
, &size
);
7628 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7629 trace("VersionMsi = %s\n", buf
);
7632 r
= MsiGetProperty(hpkg
, "Date", buf
, &size
);
7633 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7634 trace("Date = %s\n", buf
);
7637 r
= MsiGetProperty(hpkg
, "Time", buf
, &size
);
7638 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7639 trace("Time = %s\n", buf
);
7642 r
= MsiGetProperty(hpkg
, "PackageCode", buf
, &size
);
7643 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7644 trace("PackageCode = %s\n", buf
);
7646 langid
= GetUserDefaultLangID();
7647 sprintf(path
, "%d", langid
);
7650 r
= MsiGetProperty(hpkg
, "UserLanguageID", buf
, &size
);
7651 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS< got %d\n", r
);
7652 ok( !lstrcmpA(buf
, path
), "Expected \"%s\", got \"%s\"\n", path
, buf
);
7654 res
= GetSystemMetrics(SM_CXSCREEN
);
7656 r
= MsiGetProperty(hpkg
, "ScreenX", buf
, &size
);
7657 ok(atol(buf
) == res
, "Expected %d, got %ld\n", res
, atol(buf
));
7659 res
= GetSystemMetrics(SM_CYSCREEN
);
7661 r
= MsiGetProperty(hpkg
, "ScreenY", buf
, &size
);
7662 ok(atol(buf
) == res
, "Expected %d, got %ld\n", res
, atol(buf
));
7666 MsiCloseHandle(hpkg
);
7667 DeleteFile(msifile
);
7670 static void test_launchconditions(void)
7676 MsiSetInternalUI(INSTALLUILEVEL_NONE
, NULL
);
7678 hdb
= create_package_db();
7679 ok( hdb
, "failed to create package database\n" );
7681 r
= create_launchcondition_table( hdb
);
7682 ok( r
== ERROR_SUCCESS
, "cannot create LaunchCondition table: %d\n", r
);
7684 r
= add_launchcondition_entry( hdb
, "'X = \"1\"', 'one'" );
7685 ok( r
== ERROR_SUCCESS
, "cannot add launch condition: %d\n", r
);
7687 /* invalid condition */
7688 r
= add_launchcondition_entry( hdb
, "'X != \"1\"', 'one'" );
7689 ok( r
== ERROR_SUCCESS
, "cannot add launch condition: %d\n", r
);
7691 hpkg
= package_from_db( hdb
);
7692 ok( hpkg
, "failed to create package\n");
7694 MsiCloseHandle( hdb
);
7696 r
= MsiSetProperty( hpkg
, "X", "1" );
7697 ok( r
== ERROR_SUCCESS
, "failed to set property\n" );
7699 /* invalid conditions are ignored */
7700 r
= MsiDoAction( hpkg
, "LaunchConditions" );
7701 ok( r
== ERROR_SUCCESS
, "cost init failed\n" );
7703 /* verify LaunchConditions still does some verification */
7704 r
= MsiSetProperty( hpkg
, "X", "2" );
7705 ok( r
== ERROR_SUCCESS
, "failed to set property\n" );
7707 r
= MsiDoAction( hpkg
, "LaunchConditions" );
7708 ok( r
== ERROR_INSTALL_FAILURE
, "Expected ERROR_INSTALL_FAILURE, got %d\n", r
);
7710 MsiCloseHandle( hpkg
);
7711 DeleteFile( msifile
);
7714 static void test_ccpsearch(void)
7716 MSIHANDLE hdb
, hpkg
;
7717 CHAR prop
[MAX_PATH
];
7718 DWORD size
= MAX_PATH
;
7721 MsiSetInternalUI(INSTALLUILEVEL_NONE
, NULL
);
7723 hdb
= create_package_db();
7724 ok(hdb
, "failed to create package database\n");
7726 r
= create_ccpsearch_table(hdb
);
7727 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7729 r
= add_ccpsearch_entry(hdb
, "'CCP_random'");
7730 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7732 r
= add_ccpsearch_entry(hdb
, "'RMCCP_random'");
7733 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7735 r
= create_reglocator_table(hdb
);
7736 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7738 r
= add_reglocator_entry(hdb
, "'CCP_random', 0, 'htmlfile\\shell\\open\\nonexistent', '', 1");
7739 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7741 r
= create_drlocator_table(hdb
);
7742 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7744 r
= add_drlocator_entry(hdb
, "'RMCCP_random', '', 'C:\\', '0'");
7745 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7747 r
= create_signature_table(hdb
);
7748 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7750 hpkg
= package_from_db(hdb
);
7751 ok(hpkg
, "failed to create package\n");
7753 MsiCloseHandle(hdb
);
7755 r
= MsiDoAction(hpkg
, "CCPSearch");
7756 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7758 r
= MsiGetPropertyA(hpkg
, "CCP_Success", prop
, &size
);
7759 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7760 ok(!lstrcmpA(prop
, "1"), "Expected 1, got %s\n", prop
);
7762 MsiCloseHandle(hpkg
);
7763 DeleteFileA(msifile
);
7766 static void test_complocator(void)
7768 MSIHANDLE hdb
, hpkg
;
7770 CHAR prop
[MAX_PATH
];
7771 CHAR expected
[MAX_PATH
];
7772 DWORD size
= MAX_PATH
;
7774 hdb
= create_package_db();
7775 ok(hdb
, "failed to create package database\n");
7777 r
= create_appsearch_table(hdb
);
7778 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7780 r
= add_appsearch_entry(hdb
, "'ABELISAURUS', 'abelisaurus'");
7781 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7783 r
= add_appsearch_entry(hdb
, "'BACTROSAURUS', 'bactrosaurus'");
7784 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7786 r
= add_appsearch_entry(hdb
, "'CAMELOTIA', 'camelotia'");
7787 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7789 r
= add_appsearch_entry(hdb
, "'DICLONIUS', 'diclonius'");
7790 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7792 r
= add_appsearch_entry(hdb
, "'ECHINODON', 'echinodon'");
7793 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7795 r
= add_appsearch_entry(hdb
, "'FALCARIUS', 'falcarius'");
7796 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7798 r
= add_appsearch_entry(hdb
, "'GALLIMIMUS', 'gallimimus'");
7799 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7801 r
= add_appsearch_entry(hdb
, "'HAGRYPHUS', 'hagryphus'");
7802 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7804 r
= add_appsearch_entry(hdb
, "'IGUANODON', 'iguanodon'");
7805 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7807 r
= add_appsearch_entry(hdb
, "'JOBARIA', 'jobaria'");
7808 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7810 r
= add_appsearch_entry(hdb
, "'KAKURU', 'kakuru'");
7811 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7813 r
= add_appsearch_entry(hdb
, "'LABOCANIA', 'labocania'");
7814 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7816 r
= add_appsearch_entry(hdb
, "'MEGARAPTOR', 'megaraptor'");
7817 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7819 r
= add_appsearch_entry(hdb
, "'NEOSODON', 'neosodon'");
7820 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7822 r
= add_appsearch_entry(hdb
, "'OLOROTITAN', 'olorotitan'");
7823 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7825 r
= add_appsearch_entry(hdb
, "'PANTYDRACO', 'pantydraco'");
7826 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7828 r
= create_complocator_table(hdb
);
7829 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7831 r
= add_complocator_entry(hdb
, "'abelisaurus', '{E3619EED-305A-418C-B9C7-F7D7377F0934}', 1");
7832 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7834 r
= add_complocator_entry(hdb
, "'bactrosaurus', '{D56B688D-542F-42Ef-90FD-B6DA76EE8119}', 0");
7835 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7837 r
= add_complocator_entry(hdb
, "'camelotia', '{8211BE36-2466-47E3-AFB7-6AC72E51AED2}', 1");
7838 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7840 r
= add_complocator_entry(hdb
, "'diclonius', '{5C767B20-A33C-45A4-B80B-555E512F01AE}', 0");
7841 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7843 r
= add_complocator_entry(hdb
, "'echinodon', '{A19E16C5-C75D-4699-8111-C4338C40C3CB}', 1");
7844 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7846 r
= add_complocator_entry(hdb
, "'falcarius', '{17762FA1-A7AE-4CC6-8827-62873C35361D}', 0");
7847 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7849 r
= add_complocator_entry(hdb
, "'gallimimus', '{75EBF568-C959-41E0-A99E-9050638CF5FB}', 1");
7850 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7852 r
= add_complocator_entry(hdb
, "'hagrphus', '{D4969B72-17D9-4AB6-BE49-78F2FEE857AC}', 0");
7853 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7855 r
= add_complocator_entry(hdb
, "'iguanodon', '{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}', 1");
7856 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7858 r
= add_complocator_entry(hdb
, "'jobaria', '{243C22B1-8C51-4151-B9D1-1AE5265E079E}', 0");
7859 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7861 r
= add_complocator_entry(hdb
, "'kakuru', '{5D0F03BA-50BC-44F2-ABB1-72C972F4E514}', 1");
7862 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7864 r
= add_complocator_entry(hdb
, "'labocania', '{C7DDB60C-7828-4046-A6F8-699D5E92F1ED}', 0");
7865 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7867 r
= add_complocator_entry(hdb
, "'megaraptor', '{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}', 1");
7868 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7870 r
= add_complocator_entry(hdb
, "'neosodon', '{0B499649-197A-48EF-93D2-AF1C17ED6E90}', 0");
7871 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7873 r
= add_complocator_entry(hdb
, "'olorotitan', '{54E9E91F-AED2-46D5-A25A-7E50AFA24513}', 1");
7874 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7876 r
= add_complocator_entry(hdb
, "'pantydraco', '{2A989951-5565-4FA7-93A7-E800A3E67D71}', 0");
7877 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7879 r
= create_signature_table(hdb
);
7880 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7882 r
= add_signature_entry(hdb
, "'abelisaurus', 'abelisaurus', '', '', '', '', '', '', ''");
7883 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7885 r
= add_signature_entry(hdb
, "'bactrosaurus', 'bactrosaurus', '', '', '', '', '', '', ''");
7886 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7888 r
= add_signature_entry(hdb
, "'camelotia', 'camelotia', '', '', '', '', '', '', ''");
7889 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7891 r
= add_signature_entry(hdb
, "'diclonius', 'diclonius', '', '', '', '', '', '', ''");
7892 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7894 r
= add_signature_entry(hdb
, "'iguanodon', 'iguanodon', '', '', '', '', '', '', ''");
7895 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7897 r
= add_signature_entry(hdb
, "'jobaria', 'jobaria', '', '', '', '', '', '', ''");
7898 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7900 r
= add_signature_entry(hdb
, "'kakuru', 'kakuru', '', '', '', '', '', '', ''");
7901 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7903 r
= add_signature_entry(hdb
, "'labocania', 'labocania', '', '', '', '', '', '', ''");
7904 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7906 hpkg
= package_from_db(hdb
);
7907 ok(hpkg
, "failed to create package\n");
7909 MsiCloseHandle(hdb
);
7911 create_test_file("abelisaurus");
7912 create_test_file("bactrosaurus");
7913 create_test_file("camelotia");
7914 create_test_file("diclonius");
7915 create_test_file("echinodon");
7916 create_test_file("falcarius");
7917 create_test_file("gallimimus");
7918 create_test_file("hagryphus");
7919 CreateDirectoryA("iguanodon", NULL
);
7920 CreateDirectoryA("jobaria", NULL
);
7921 CreateDirectoryA("kakuru", NULL
);
7922 CreateDirectoryA("labocania", NULL
);
7923 CreateDirectoryA("megaraptor", NULL
);
7924 CreateDirectoryA("neosodon", NULL
);
7925 CreateDirectoryA("olorotitan", NULL
);
7926 CreateDirectoryA("pantydraco", NULL
);
7928 set_component_path("abelisaurus", MSIINSTALLCONTEXT_MACHINE
,
7929 "{E3619EED-305A-418C-B9C7-F7D7377F0934}", NULL
, FALSE
);
7930 set_component_path("bactrosaurus", MSIINSTALLCONTEXT_MACHINE
,
7931 "{D56B688D-542F-42Ef-90FD-B6DA76EE8119}", NULL
, FALSE
);
7932 set_component_path("echinodon", MSIINSTALLCONTEXT_MACHINE
,
7933 "{A19E16C5-C75D-4699-8111-C4338C40C3CB}", NULL
, FALSE
);
7934 set_component_path("falcarius", MSIINSTALLCONTEXT_MACHINE
,
7935 "{17762FA1-A7AE-4CC6-8827-62873C35361D}", NULL
, FALSE
);
7936 set_component_path("iguanodon", MSIINSTALLCONTEXT_MACHINE
,
7937 "{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}", NULL
, FALSE
);
7938 set_component_path("jobaria", MSIINSTALLCONTEXT_MACHINE
,
7939 "{243C22B1-8C51-4151-B9D1-1AE5265E079E}", NULL
, FALSE
);
7940 set_component_path("megaraptor", MSIINSTALLCONTEXT_MACHINE
,
7941 "{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}", NULL
, FALSE
);
7942 set_component_path("neosodon", MSIINSTALLCONTEXT_MACHINE
,
7943 "{0B499649-197A-48EF-93D2-AF1C17ED6E90}", NULL
, FALSE
);
7945 r
= MsiDoAction(hpkg
, "AppSearch");
7946 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7949 r
= MsiGetPropertyA(hpkg
, "ABELISAURUS", prop
, &size
);
7950 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7952 lstrcpyA(expected
, CURR_DIR
);
7953 lstrcatA(expected
, "\\abelisaurus");
7954 ok(!lstrcmpA(prop
, expected
) || !lstrcmpA(prop
, ""),
7955 "Expected %s or empty string, got %s\n", expected
, prop
);
7958 r
= MsiGetPropertyA(hpkg
, "BACTROSAURUS", prop
, &size
);
7959 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7960 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
7963 r
= MsiGetPropertyA(hpkg
, "CAMELOTIA", prop
, &size
);
7964 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7965 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
7968 r
= MsiGetPropertyA(hpkg
, "DICLONIUS", prop
, &size
);
7969 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7970 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
7973 r
= MsiGetPropertyA(hpkg
, "ECHINODON", prop
, &size
);
7974 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7976 lstrcpyA(expected
, CURR_DIR
);
7977 lstrcatA(expected
, "\\");
7978 ok(!lstrcmpA(prop
, expected
) || !lstrcmpA(prop
, ""),
7979 "Expected %s or empty string, got %s\n", expected
, prop
);
7982 r
= MsiGetPropertyA(hpkg
, "FALCARIUS", prop
, &size
);
7983 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7984 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
7987 r
= MsiGetPropertyA(hpkg
, "GALLIMIMUS", prop
, &size
);
7988 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7989 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
7992 r
= MsiGetPropertyA(hpkg
, "HAGRYPHUS", prop
, &size
);
7993 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7994 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
7997 r
= MsiGetPropertyA(hpkg
, "IGUANODON", prop
, &size
);
7998 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7999 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
8002 r
= MsiGetPropertyA(hpkg
, "JOBARIA", prop
, &size
);
8003 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8004 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
8007 r
= MsiGetPropertyA(hpkg
, "KAKURU", prop
, &size
);
8008 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8009 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
8012 r
= MsiGetPropertyA(hpkg
, "LABOCANIA", prop
, &size
);
8013 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8014 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
8017 r
= MsiGetPropertyA(hpkg
, "MEGARAPTOR", prop
, &size
);
8018 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8020 lstrcpyA(expected
, CURR_DIR
);
8021 lstrcatA(expected
, "\\");
8022 ok(!lstrcmpA(prop
, expected
) || !lstrcmpA(prop
, ""),
8023 "Expected %s or empty string, got %s\n", expected
, prop
);
8026 r
= MsiGetPropertyA(hpkg
, "NEOSODON", prop
, &size
);
8027 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8029 lstrcpyA(expected
, CURR_DIR
);
8030 lstrcatA(expected
, "\\neosodon\\");
8031 ok(!lstrcmpA(prop
, expected
) || !lstrcmpA(prop
, ""),
8032 "Expected %s or empty string, got %s\n", expected
, prop
);
8035 r
= MsiGetPropertyA(hpkg
, "OLOROTITAN", prop
, &size
);
8036 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8037 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
8040 r
= MsiGetPropertyA(hpkg
, "PANTYDRACO", prop
, &size
);
8041 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8042 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
8044 MsiCloseHandle(hpkg
);
8045 DeleteFileA("abelisaurus");
8046 DeleteFileA("bactrosaurus");
8047 DeleteFileA("camelotia");
8048 DeleteFileA("diclonius");
8049 DeleteFileA("echinodon");
8050 DeleteFileA("falcarius");
8051 DeleteFileA("gallimimus");
8052 DeleteFileA("hagryphus");
8053 RemoveDirectoryA("iguanodon");
8054 RemoveDirectoryA("jobaria");
8055 RemoveDirectoryA("kakuru");
8056 RemoveDirectoryA("labocania");
8057 RemoveDirectoryA("megaraptor");
8058 RemoveDirectoryA("neosodon");
8059 RemoveDirectoryA("olorotitan");
8060 RemoveDirectoryA("pantydraco");
8061 delete_component_path("{E3619EED-305A-418C-B9C7-F7D7377F0934}",
8062 MSIINSTALLCONTEXT_MACHINE
, NULL
);
8063 delete_component_path("{D56B688D-542F-42Ef-90FD-B6DA76EE8119}",
8064 MSIINSTALLCONTEXT_MACHINE
, NULL
);
8065 delete_component_path("{A19E16C5-C75D-4699-8111-C4338C40C3CB}",
8066 MSIINSTALLCONTEXT_MACHINE
, NULL
);
8067 delete_component_path("{17762FA1-A7AE-4CC6-8827-62873C35361D}",
8068 MSIINSTALLCONTEXT_MACHINE
, NULL
);
8069 delete_component_path("{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}",
8070 MSIINSTALLCONTEXT_MACHINE
, NULL
);
8071 delete_component_path("{243C22B1-8C51-4151-B9D1-1AE5265E079E}",
8072 MSIINSTALLCONTEXT_MACHINE
, NULL
);
8073 delete_component_path("{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}",
8074 MSIINSTALLCONTEXT_MACHINE
, NULL
);
8075 delete_component_path("{0B499649-197A-48EF-93D2-AF1C17ED6E90}",
8076 MSIINSTALLCONTEXT_MACHINE
, NULL
);
8077 DeleteFileA(msifile
);
8080 static void set_suminfo_prop(MSIHANDLE db
, DWORD prop
, DWORD val
)
8085 r
= MsiGetSummaryInformationA(db
, NULL
, 1, &summary
);
8086 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8088 r
= MsiSummaryInfoSetPropertyA(summary
, prop
, VT_I4
, val
, NULL
, NULL
);
8089 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8091 r
= MsiSummaryInfoPersist(summary
);
8092 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
8094 MsiCloseHandle(summary
);
8097 static void test_MsiGetSourcePath(void)
8099 MSIHANDLE hdb
, hpkg
;
8100 CHAR path
[MAX_PATH
];
8102 CHAR subsrc
[MAX_PATH
];
8103 CHAR sub2
[MAX_PATH
];
8107 lstrcpyA(cwd
, CURR_DIR
);
8108 lstrcatA(cwd
, "\\");
8110 lstrcpyA(subsrc
, cwd
);
8111 lstrcatA(subsrc
, "subsource");
8112 lstrcatA(subsrc
, "\\");
8114 lstrcpyA(sub2
, subsrc
);
8115 lstrcatA(sub2
, "sub2");
8116 lstrcatA(sub2
, "\\");
8118 /* uncompressed source */
8120 hdb
= create_package_db();
8121 ok( hdb
, "failed to create database\n");
8123 set_suminfo_prop(hdb
, PID_WORDCOUNT
, 0);
8125 r
= add_directory_entry(hdb
, "'TARGETDIR', '', 'SourceDir'");
8126 ok(r
== S_OK
, "failed\n");
8128 r
= add_directory_entry(hdb
, "'SubDir', 'TARGETDIR', 'subtarget:subsource'");
8129 ok(r
== S_OK
, "failed\n");
8131 r
= add_directory_entry(hdb
, "'SubDir2', 'SubDir', 'sub2'");
8132 ok(r
== S_OK
, "failed\n");
8134 r
= MsiDatabaseCommit(hdb
);
8135 ok(r
== ERROR_SUCCESS
, "Failed to commit database\n");
8137 hpkg
= package_from_db(hdb
);
8138 ok(hpkg
, "failed to create package\n");
8140 MsiCloseHandle(hdb
);
8142 /* invalid database handle */
8144 lstrcpyA(path
, "kiwi");
8145 r
= MsiGetSourcePath(-1, "TARGETDIR", path
, &size
);
8146 ok(r
== ERROR_INVALID_HANDLE
,
8147 "Expected ERROR_INVALID_HANDLE, got %d\n", r
);
8148 ok(!lstrcmpA(path
, "kiwi"),
8149 "Expected path to be unchanged, got \"%s\"\n", path
);
8150 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8154 lstrcpyA(path
, "kiwi");
8155 r
= MsiGetSourcePath(hpkg
, NULL
, path
, &size
);
8156 ok(r
== ERROR_INVALID_PARAMETER
,
8157 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
8158 ok(!lstrcmpA(path
, "kiwi"),
8159 "Expected path to be unchanged, got \"%s\"\n", path
);
8160 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8162 /* empty szFolder */
8164 lstrcpyA(path
, "kiwi");
8165 r
= MsiGetSourcePath(hpkg
, "", path
, &size
);
8166 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8167 ok(!lstrcmpA(path
, "kiwi"),
8168 "Expected path to be unchanged, got \"%s\"\n", path
);
8169 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8173 lstrcpyA(path
, "kiwi");
8174 r
= MsiGetSourcePath(hpkg
, "TARGETDIR", path
, &size
);
8175 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8176 ok(!lstrcmpA(path
, "kiwi"),
8177 "Expected path to be unchanged, got \"%s\"\n", path
);
8178 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8182 lstrcpyA(path
, "kiwi");
8183 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8184 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8185 ok(!lstrcmpA(path
, "kiwi"),
8186 "Expected path to be unchanged, got \"%s\"\n", path
);
8187 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8191 lstrcpyA(path
, "kiwi");
8192 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
8193 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8194 ok(!lstrcmpA(path
, "kiwi"),
8195 "Expected path to be unchanged, got \"%s\"\n", path
);
8196 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8198 /* source path does not exist, but the property exists */
8200 lstrcpyA(path
, "kiwi");
8201 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8202 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8203 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8204 ok(size
== 0, "Expected 0, got %d\n", size
);
8208 lstrcpyA(path
, "kiwi");
8209 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8210 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8211 ok(!lstrcmpA(path
, "kiwi"),
8212 "Expected path to be unchanged, got \"%s\"\n", path
);
8213 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8217 lstrcpyA(path
, "kiwi");
8218 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
8219 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8220 ok(!lstrcmpA(path
, "kiwi"),
8221 "Expected path to be unchanged, got \"%s\"\n", path
);
8222 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8224 r
= MsiDoAction(hpkg
, "CostInitialize");
8225 ok(r
== ERROR_SUCCESS
, "cost init failed\n");
8227 /* try TARGETDIR after CostInitialize */
8229 lstrcpyA(path
, "kiwi");
8230 r
= MsiGetSourcePath(hpkg
, "TARGETDIR", path
, &size
);
8231 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8232 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8233 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8235 /* try SourceDir after CostInitialize */
8237 lstrcpyA(path
, "kiwi");
8238 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8239 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8240 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8241 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8243 /* try SOURCEDIR after CostInitialize */
8245 lstrcpyA(path
, "kiwi");
8246 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
8247 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8248 ok(!lstrcmpA(path
, "kiwi"),
8249 "Expected path to be unchanged, got \"%s\"\n", path
);
8250 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8252 /* source path does not exist, but the property exists */
8254 lstrcpyA(path
, "kiwi");
8255 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8256 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8259 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8260 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8263 /* try SubDir after CostInitialize */
8265 lstrcpyA(path
, "kiwi");
8266 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8267 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8268 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8269 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8271 /* try SubDir2 after CostInitialize */
8273 lstrcpyA(path
, "kiwi");
8274 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
8275 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8276 ok(!lstrcmpA(path
, sub2
), "Expected \"%s\", got \"%s\"\n", sub2
, path
);
8277 ok(size
== lstrlenA(sub2
), "Expected %d, got %d\n", lstrlenA(sub2
), size
);
8279 r
= MsiDoAction(hpkg
, "ResolveSource");
8280 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8282 /* try TARGETDIR after ResolveSource */
8284 lstrcpyA(path
, "kiwi");
8285 r
= MsiGetSourcePath(hpkg
, "TARGETDIR", path
, &size
);
8286 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8287 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8288 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8290 /* try SourceDir after ResolveSource */
8292 lstrcpyA(path
, "kiwi");
8293 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8294 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8295 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8296 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8298 /* try SOURCEDIR after ResolveSource */
8300 lstrcpyA(path
, "kiwi");
8301 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
8302 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8303 ok(!lstrcmpA(path
, "kiwi"),
8304 "Expected path to be unchanged, got \"%s\"\n", path
);
8305 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8307 /* source path does not exist, but the property exists */
8309 lstrcpyA(path
, "kiwi");
8310 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8311 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8312 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8313 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8315 /* try SubDir after ResolveSource */
8317 lstrcpyA(path
, "kiwi");
8318 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8319 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8320 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8321 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8323 /* try SubDir2 after ResolveSource */
8325 lstrcpyA(path
, "kiwi");
8326 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
8327 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8328 ok(!lstrcmpA(path
, sub2
), "Expected \"%s\", got \"%s\"\n", sub2
, path
);
8329 ok(size
== lstrlenA(sub2
), "Expected %d, got %d\n", lstrlenA(sub2
), size
);
8331 r
= MsiDoAction(hpkg
, "FileCost");
8332 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8334 /* try TARGETDIR after FileCost */
8336 lstrcpyA(path
, "kiwi");
8337 r
= MsiGetSourcePath(hpkg
, "TARGETDIR", path
, &size
);
8338 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8339 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8340 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8342 /* try SourceDir after FileCost */
8344 lstrcpyA(path
, "kiwi");
8345 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8346 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8347 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8348 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8350 /* try SOURCEDIR after FileCost */
8352 lstrcpyA(path
, "kiwi");
8353 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
8354 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8355 ok(!lstrcmpA(path
, "kiwi"),
8356 "Expected path to be unchanged, got \"%s\"\n", path
);
8357 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8359 /* try SubDir after FileCost */
8361 lstrcpyA(path
, "kiwi");
8362 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8363 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8364 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8365 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8367 /* try SubDir2 after FileCost */
8369 lstrcpyA(path
, "kiwi");
8370 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
8371 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8372 ok(!lstrcmpA(path
, sub2
), "Expected \"%s\", got \"%s\"\n", sub2
, path
);
8373 ok(size
== lstrlenA(sub2
), "Expected %d, got %d\n", lstrlenA(sub2
), size
);
8375 r
= MsiDoAction(hpkg
, "CostFinalize");
8376 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8378 /* try TARGETDIR after CostFinalize */
8380 lstrcpyA(path
, "kiwi");
8381 r
= MsiGetSourcePath(hpkg
, "TARGETDIR", path
, &size
);
8382 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8383 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8384 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8386 /* try SourceDir after CostFinalize */
8388 lstrcpyA(path
, "kiwi");
8389 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8390 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8391 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8392 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8394 /* try SOURCEDIR after CostFinalize */
8396 lstrcpyA(path
, "kiwi");
8397 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
8398 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8399 ok(!lstrcmpA(path
, "kiwi"),
8400 "Expected path to be unchanged, got \"%s\"\n", path
);
8401 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8403 /* try SubDir after CostFinalize */
8405 lstrcpyA(path
, "kiwi");
8406 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8407 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8408 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8409 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8411 /* try SubDir2 after CostFinalize */
8413 lstrcpyA(path
, "kiwi");
8414 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
8415 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8416 ok(!lstrcmpA(path
, sub2
), "Expected \"%s\", got \"%s\"\n", sub2
, path
);
8417 ok(size
== lstrlenA(sub2
), "Expected %d, got %d\n", lstrlenA(sub2
), size
);
8419 /* nonexistent directory */
8421 lstrcpyA(path
, "kiwi");
8422 r
= MsiGetSourcePath(hpkg
, "IDontExist", path
, &size
);
8423 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8424 ok(!lstrcmpA(path
, "kiwi"),
8425 "Expected path to be unchanged, got \"%s\"\n", path
);
8426 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8428 /* NULL szPathBuf */
8430 r
= MsiGetSourcePath(hpkg
, "SourceDir", NULL
, &size
);
8431 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8432 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8434 /* NULL pcchPathBuf */
8435 lstrcpyA(path
, "kiwi");
8436 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, NULL
);
8437 ok(r
== ERROR_INVALID_PARAMETER
,
8438 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
8439 ok(!lstrcmpA(path
, "kiwi"),
8440 "Expected path to be unchanged, got \"%s\"\n", path
);
8442 /* pcchPathBuf is 0 */
8444 lstrcpyA(path
, "kiwi");
8445 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8446 ok(r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
8447 ok(!lstrcmpA(path
, "kiwi"),
8448 "Expected path to be unchanged, got \"%s\"\n", path
);
8449 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8451 /* pcchPathBuf does not have room for NULL terminator */
8452 size
= lstrlenA(cwd
);
8453 lstrcpyA(path
, "kiwi");
8454 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8455 ok(r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
8456 ok(!strncmp(path
, cwd
, lstrlenA(cwd
) - 1),
8457 "Expected path with no backslash, got \"%s\"\n", path
);
8458 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8460 /* pcchPathBuf has room for NULL terminator */
8461 size
= lstrlenA(cwd
) + 1;
8462 lstrcpyA(path
, "kiwi");
8463 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8464 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8465 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8466 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8468 MsiCloseHandle(hpkg
);
8470 /* compressed source */
8472 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_DIRECT
, &hdb
);
8473 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8475 set_suminfo_prop(hdb
, PID_WORDCOUNT
, msidbSumInfoSourceTypeCompressed
);
8477 hpkg
= package_from_db(hdb
);
8478 ok(hpkg
, "failed to create package\n");
8480 r
= MsiDoAction(hpkg
, "CostInitialize");
8481 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8482 r
= MsiDoAction(hpkg
, "FileCost");
8483 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8484 r
= MsiDoAction(hpkg
, "CostFinalize");
8485 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8487 /* try TARGETDIR after CostFinalize */
8489 lstrcpyA(path
, "kiwi");
8490 r
= MsiGetSourcePath(hpkg
, "TARGETDIR", path
, &size
);
8491 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8492 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8493 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8495 /* try SourceDir after CostFinalize */
8497 lstrcpyA(path
, "kiwi");
8498 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8499 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8500 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8501 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8503 /* try SOURCEDIR after CostFinalize */
8505 lstrcpyA(path
, "kiwi");
8506 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
8509 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8510 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8511 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8514 /* try SubDir after CostFinalize */
8516 lstrcpyA(path
, "kiwi");
8517 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8518 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8519 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8520 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8522 /* try SubDir2 after CostFinalize */
8524 lstrcpyA(path
, "kiwi");
8525 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
8526 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8527 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8528 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8530 MsiCloseHandle(hpkg
);
8531 DeleteFile(msifile
);
8534 static void test_shortlongsource(void)
8536 MSIHANDLE hdb
, hpkg
;
8537 CHAR path
[MAX_PATH
];
8539 CHAR subsrc
[MAX_PATH
];
8543 lstrcpyA(cwd
, CURR_DIR
);
8544 lstrcatA(cwd
, "\\");
8546 lstrcpyA(subsrc
, cwd
);
8547 lstrcatA(subsrc
, "long");
8548 lstrcatA(subsrc
, "\\");
8550 /* long file names */
8552 hdb
= create_package_db();
8553 ok( hdb
, "failed to create database\n");
8555 set_suminfo_prop(hdb
, PID_WORDCOUNT
, 0);
8557 r
= add_directory_entry(hdb
, "'TARGETDIR', '', 'SourceDir'");
8558 ok(r
== S_OK
, "failed\n");
8560 r
= add_directory_entry(hdb
, "'SubDir', 'TARGETDIR', 'short|long'");
8561 ok(r
== S_OK
, "failed\n");
8563 /* CostInitialize:short */
8564 r
= add_directory_entry(hdb
, "'SubDir2', 'TARGETDIR', 'one|two'");
8565 ok(r
== S_OK
, "failed\n");
8567 /* CostInitialize:long */
8568 r
= add_directory_entry(hdb
, "'SubDir3', 'TARGETDIR', 'three|four'");
8569 ok(r
== S_OK
, "failed\n");
8571 /* FileCost:short */
8572 r
= add_directory_entry(hdb
, "'SubDir4', 'TARGETDIR', 'five|six'");
8573 ok(r
== S_OK
, "failed\n");
8576 r
= add_directory_entry(hdb
, "'SubDir5', 'TARGETDIR', 'seven|eight'");
8577 ok(r
== S_OK
, "failed\n");
8579 /* CostFinalize:short */
8580 r
= add_directory_entry(hdb
, "'SubDir6', 'TARGETDIR', 'nine|ten'");
8581 ok(r
== S_OK
, "failed\n");
8583 /* CostFinalize:long */
8584 r
= add_directory_entry(hdb
, "'SubDir7', 'TARGETDIR', 'eleven|twelve'");
8585 ok(r
== S_OK
, "failed\n");
8587 MsiDatabaseCommit(hdb
);
8589 hpkg
= package_from_db(hdb
);
8590 ok(hpkg
, "failed to create package\n");
8592 MsiCloseHandle(hdb
);
8594 CreateDirectoryA("one", NULL
);
8595 CreateDirectoryA("four", NULL
);
8597 r
= MsiDoAction(hpkg
, "CostInitialize");
8598 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8600 CreateDirectory("five", NULL
);
8601 CreateDirectory("eight", NULL
);
8603 r
= MsiDoAction(hpkg
, "FileCost");
8604 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8606 CreateDirectory("nine", NULL
);
8607 CreateDirectory("twelve", NULL
);
8609 r
= MsiDoAction(hpkg
, "CostFinalize");
8610 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8612 /* neither short nor long source directories exist */
8614 lstrcpyA(path
, "kiwi");
8615 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8616 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8617 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8618 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8620 CreateDirectoryA("short", NULL
);
8622 /* short source directory exists */
8624 lstrcpyA(path
, "kiwi");
8625 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8626 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8627 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8628 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8630 CreateDirectoryA("long", NULL
);
8632 /* both short and long source directories exist */
8634 lstrcpyA(path
, "kiwi");
8635 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8636 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8637 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8638 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8640 lstrcpyA(subsrc
, cwd
);
8641 lstrcatA(subsrc
, "two");
8642 lstrcatA(subsrc
, "\\");
8644 /* short dir exists before CostInitialize */
8646 lstrcpyA(path
, "kiwi");
8647 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
8648 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8649 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8650 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8652 lstrcpyA(subsrc
, cwd
);
8653 lstrcatA(subsrc
, "four");
8654 lstrcatA(subsrc
, "\\");
8656 /* long dir exists before CostInitialize */
8658 lstrcpyA(path
, "kiwi");
8659 r
= MsiGetSourcePath(hpkg
, "SubDir3", path
, &size
);
8660 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8661 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8662 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8664 lstrcpyA(subsrc
, cwd
);
8665 lstrcatA(subsrc
, "six");
8666 lstrcatA(subsrc
, "\\");
8668 /* short dir exists before FileCost */
8670 lstrcpyA(path
, "kiwi");
8671 r
= MsiGetSourcePath(hpkg
, "SubDir4", path
, &size
);
8672 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8673 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8674 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8676 lstrcpyA(subsrc
, cwd
);
8677 lstrcatA(subsrc
, "eight");
8678 lstrcatA(subsrc
, "\\");
8680 /* long dir exists before FileCost */
8682 lstrcpyA(path
, "kiwi");
8683 r
= MsiGetSourcePath(hpkg
, "SubDir5", path
, &size
);
8684 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8685 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8686 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8688 lstrcpyA(subsrc
, cwd
);
8689 lstrcatA(subsrc
, "ten");
8690 lstrcatA(subsrc
, "\\");
8692 /* short dir exists before CostFinalize */
8694 lstrcpyA(path
, "kiwi");
8695 r
= MsiGetSourcePath(hpkg
, "SubDir6", path
, &size
);
8696 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8697 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8698 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8700 lstrcpyA(subsrc
, cwd
);
8701 lstrcatA(subsrc
, "twelve");
8702 lstrcatA(subsrc
, "\\");
8704 /* long dir exists before CostFinalize */
8706 lstrcpyA(path
, "kiwi");
8707 r
= MsiGetSourcePath(hpkg
, "SubDir7", path
, &size
);
8708 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8709 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8710 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8712 MsiCloseHandle(hpkg
);
8713 RemoveDirectoryA("short");
8714 RemoveDirectoryA("long");
8715 RemoveDirectoryA("one");
8716 RemoveDirectoryA("four");
8717 RemoveDirectoryA("five");
8718 RemoveDirectoryA("eight");
8719 RemoveDirectoryA("nine");
8720 RemoveDirectoryA("twelve");
8722 /* short file names */
8724 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_DIRECT
, &hdb
);
8725 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8727 set_suminfo_prop(hdb
, PID_WORDCOUNT
, msidbSumInfoSourceTypeSFN
);
8729 hpkg
= package_from_db(hdb
);
8730 ok(hpkg
, "failed to create package\n");
8732 MsiCloseHandle(hdb
);
8734 CreateDirectoryA("one", NULL
);
8735 CreateDirectoryA("four", NULL
);
8737 r
= MsiDoAction(hpkg
, "CostInitialize");
8738 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8740 CreateDirectory("five", NULL
);
8741 CreateDirectory("eight", NULL
);
8743 r
= MsiDoAction(hpkg
, "FileCost");
8744 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8746 CreateDirectory("nine", NULL
);
8747 CreateDirectory("twelve", NULL
);
8749 r
= MsiDoAction(hpkg
, "CostFinalize");
8750 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8752 lstrcpyA(subsrc
, cwd
);
8753 lstrcatA(subsrc
, "short");
8754 lstrcatA(subsrc
, "\\");
8756 /* neither short nor long source directories exist */
8758 lstrcpyA(path
, "kiwi");
8759 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8760 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8761 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8762 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8764 CreateDirectoryA("short", NULL
);
8766 /* short source directory exists */
8768 lstrcpyA(path
, "kiwi");
8769 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8770 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8771 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8772 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8774 CreateDirectoryA("long", NULL
);
8776 /* both short and long source directories exist */
8778 lstrcpyA(path
, "kiwi");
8779 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8780 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8781 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8782 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8784 lstrcpyA(subsrc
, cwd
);
8785 lstrcatA(subsrc
, "one");
8786 lstrcatA(subsrc
, "\\");
8788 /* short dir exists before CostInitialize */
8790 lstrcpyA(path
, "kiwi");
8791 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
8792 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8793 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8794 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8796 lstrcpyA(subsrc
, cwd
);
8797 lstrcatA(subsrc
, "three");
8798 lstrcatA(subsrc
, "\\");
8800 /* long dir exists before CostInitialize */
8802 lstrcpyA(path
, "kiwi");
8803 r
= MsiGetSourcePath(hpkg
, "SubDir3", path
, &size
);
8804 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8805 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8806 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8808 lstrcpyA(subsrc
, cwd
);
8809 lstrcatA(subsrc
, "five");
8810 lstrcatA(subsrc
, "\\");
8812 /* short dir exists before FileCost */
8814 lstrcpyA(path
, "kiwi");
8815 r
= MsiGetSourcePath(hpkg
, "SubDir4", path
, &size
);
8816 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8817 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8818 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8820 lstrcpyA(subsrc
, cwd
);
8821 lstrcatA(subsrc
, "seven");
8822 lstrcatA(subsrc
, "\\");
8824 /* long dir exists before FileCost */
8826 lstrcpyA(path
, "kiwi");
8827 r
= MsiGetSourcePath(hpkg
, "SubDir5", path
, &size
);
8828 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8829 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8830 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8832 lstrcpyA(subsrc
, cwd
);
8833 lstrcatA(subsrc
, "nine");
8834 lstrcatA(subsrc
, "\\");
8836 /* short dir exists before CostFinalize */
8838 lstrcpyA(path
, "kiwi");
8839 r
= MsiGetSourcePath(hpkg
, "SubDir6", path
, &size
);
8840 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8841 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8842 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8844 lstrcpyA(subsrc
, cwd
);
8845 lstrcatA(subsrc
, "eleven");
8846 lstrcatA(subsrc
, "\\");
8848 /* long dir exists before CostFinalize */
8850 lstrcpyA(path
, "kiwi");
8851 r
= MsiGetSourcePath(hpkg
, "SubDir7", path
, &size
);
8852 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8853 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8854 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8856 MsiCloseHandle(hpkg
);
8857 RemoveDirectoryA("short");
8858 RemoveDirectoryA("long");
8859 RemoveDirectoryA("one");
8860 RemoveDirectoryA("four");
8861 RemoveDirectoryA("five");
8862 RemoveDirectoryA("eight");
8863 RemoveDirectoryA("nine");
8864 RemoveDirectoryA("twelve");
8865 DeleteFileA(msifile
);
8868 static void test_sourcedir(void)
8870 MSIHANDLE hdb
, hpkg
;
8872 CHAR path
[MAX_PATH
];
8874 CHAR subsrc
[MAX_PATH
];
8878 lstrcpyA(cwd
, CURR_DIR
);
8879 lstrcatA(cwd
, "\\");
8881 lstrcpyA(subsrc
, cwd
);
8882 lstrcatA(subsrc
, "long");
8883 lstrcatA(subsrc
, "\\");
8885 hdb
= create_package_db();
8886 ok( hdb
, "failed to create database\n");
8888 r
= add_directory_entry(hdb
, "'TARGETDIR', '', 'SourceDir'");
8889 ok(r
== S_OK
, "failed\n");
8891 sprintf(package
, "#%li", hdb
);
8892 r
= MsiOpenPackage(package
, &hpkg
);
8893 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8895 /* properties only */
8897 /* SourceDir prop */
8899 lstrcpyA(path
, "kiwi");
8900 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
8901 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8902 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8903 ok(size
== 0, "Expected 0, got %d\n", size
);
8905 /* SOURCEDIR prop */
8907 lstrcpyA(path
, "kiwi");
8908 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8909 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8910 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8911 ok(size
== 0, "Expected 0, got %d\n", size
);
8913 r
= MsiDoAction(hpkg
, "CostInitialize");
8914 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8916 /* SourceDir after CostInitialize */
8918 lstrcpyA(path
, "kiwi");
8919 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
8920 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8921 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8922 ok(size
== 0, "Expected 0, got %d\n", size
);
8924 /* SOURCEDIR after CostInitialize */
8926 lstrcpyA(path
, "kiwi");
8927 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8928 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8929 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8930 ok(size
== 0, "Expected 0, got %d\n", size
);
8932 r
= MsiDoAction(hpkg
, "FileCost");
8933 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8935 /* SourceDir after FileCost */
8937 lstrcpyA(path
, "kiwi");
8938 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
8939 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8940 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8941 ok(size
== 0, "Expected 0, got %d\n", size
);
8943 /* SOURCEDIR after FileCost */
8945 lstrcpyA(path
, "kiwi");
8946 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8947 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8948 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8949 ok(size
== 0, "Expected 0, got %d\n", size
);
8951 r
= MsiDoAction(hpkg
, "CostFinalize");
8952 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8954 /* SourceDir after CostFinalize */
8956 lstrcpyA(path
, "kiwi");
8957 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
8958 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8959 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8960 ok(size
== 0, "Expected 0, got %d\n", size
);
8962 /* SOURCEDIR after CostFinalize */
8964 lstrcpyA(path
, "kiwi");
8965 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8966 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8967 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8968 ok(size
== 0, "Expected 0, got %d\n", size
);
8970 r
= MsiDoAction(hpkg
, "ResolveSource");
8971 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8973 /* SourceDir after ResolveSource */
8975 lstrcpyA(path
, "kiwi");
8976 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
8977 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8978 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8979 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8981 /* SOURCEDIR after ResolveSource */
8983 lstrcpyA(path
, "kiwi");
8984 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8985 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8986 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8987 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8991 lstrcpyA(path
, "kiwi");
8992 r
= MsiGetProperty(hpkg
, "SoUrCeDiR", path
, &size
);
8993 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8994 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8995 ok(size
== 0, "Expected 0, got %d\n", size
);
8997 MsiCloseHandle(hpkg
);
8999 /* reset the package state */
9000 sprintf(package
, "#%li", hdb
);
9001 r
= MsiOpenPackage(package
, &hpkg
);
9002 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9004 /* test how MsiGetSourcePath affects the properties */
9006 /* SourceDir prop */
9008 lstrcpyA(path
, "kiwi");
9009 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
9010 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9013 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
9014 ok(size
== 0, "Expected 0, got %d\n", size
);
9018 lstrcpyA(path
, "kiwi");
9019 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
9020 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
9021 ok(!lstrcmpA(path
, "kiwi"),
9022 "Expected path to be unchanged, got \"%s\"\n", path
);
9023 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
9025 /* SourceDir after MsiGetSourcePath */
9027 lstrcpyA(path
, "kiwi");
9028 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
9029 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9032 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
9033 ok(size
== 0, "Expected 0, got %d\n", size
);
9036 /* SOURCEDIR prop */
9038 lstrcpyA(path
, "kiwi");
9039 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
9040 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9043 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
9044 ok(size
== 0, "Expected 0, got %d\n", size
);
9048 lstrcpyA(path
, "kiwi");
9049 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
9050 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
9051 ok(!lstrcmpA(path
, "kiwi"),
9052 "Expected path to be unchanged, got \"%s\"\n", path
);
9053 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
9055 /* SOURCEDIR prop after MsiGetSourcePath */
9057 lstrcpyA(path
, "kiwi");
9058 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
9059 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9062 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
9063 ok(size
== 0, "Expected 0, got %d\n", size
);
9066 r
= MsiDoAction(hpkg
, "CostInitialize");
9067 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
9069 /* SourceDir after CostInitialize */
9071 lstrcpyA(path
, "kiwi");
9072 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
9073 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9076 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
9077 ok(size
== 0, "Expected 0, got %d\n", size
);
9081 lstrcpyA(path
, "kiwi");
9082 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
9083 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9084 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
9085 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
9087 /* SourceDir after MsiGetSourcePath */
9089 lstrcpyA(path
, "kiwi");
9090 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
9091 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9092 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
9093 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
9095 /* SOURCEDIR after CostInitialize */
9097 lstrcpyA(path
, "kiwi");
9098 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
9099 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9100 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
9101 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
9103 /* SOURCEDIR source path still does not exist */
9105 lstrcpyA(path
, "kiwi");
9106 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
9107 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
9108 ok(!lstrcmpA(path
, "kiwi"),
9109 "Expected path to be unchanged, got \"%s\"\n", path
);
9110 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
9112 r
= MsiDoAction(hpkg
, "FileCost");
9113 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
9115 /* SourceDir after FileCost */
9117 lstrcpyA(path
, "kiwi");
9118 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
9119 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9120 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
9121 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
9123 /* SOURCEDIR after FileCost */
9125 lstrcpyA(path
, "kiwi");
9126 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
9127 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9128 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
9129 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
9131 /* SOURCEDIR source path still does not exist */
9133 lstrcpyA(path
, "kiwi");
9134 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
9135 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
9136 ok(!lstrcmpA(path
, "kiwi"),
9137 "Expected path to be unchanged, got \"%s\"\n", path
);
9138 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
9140 r
= MsiDoAction(hpkg
, "CostFinalize");
9141 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
9143 /* SourceDir after CostFinalize */
9145 lstrcpyA(path
, "kiwi");
9146 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
9147 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9148 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
9149 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
9151 /* SOURCEDIR after CostFinalize */
9153 lstrcpyA(path
, "kiwi");
9154 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
9155 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9156 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
9157 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
9159 /* SOURCEDIR source path still does not exist */
9161 lstrcpyA(path
, "kiwi");
9162 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
9163 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
9164 ok(!lstrcmpA(path
, "kiwi"),
9165 "Expected path to be unchanged, got \"%s\"\n", path
);
9166 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
9168 r
= MsiDoAction(hpkg
, "ResolveSource");
9169 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
9171 /* SourceDir after ResolveSource */
9173 lstrcpyA(path
, "kiwi");
9174 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
9175 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9176 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
9177 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
9179 /* SOURCEDIR after ResolveSource */
9181 lstrcpyA(path
, "kiwi");
9182 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
9183 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9184 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
9185 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
9187 /* SOURCEDIR source path still does not exist */
9189 lstrcpyA(path
, "kiwi");
9190 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
9191 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
9192 ok(!lstrcmpA(path
, "kiwi"),
9193 "Expected path to be unchanged, got \"%s\"\n", path
);
9194 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
9196 MsiCloseHandle(hdb
);
9197 MsiCloseHandle(hpkg
);
9198 DeleteFileA(msifile
);
9208 static const struct access_res create
[16] =
9210 { TRUE
, ERROR_SUCCESS
, TRUE
},
9211 { TRUE
, ERROR_SUCCESS
, TRUE
},
9212 { TRUE
, ERROR_SUCCESS
, FALSE
},
9213 { TRUE
, ERROR_SUCCESS
, FALSE
},
9214 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9215 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9216 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9217 { TRUE
, ERROR_SUCCESS
, FALSE
},
9218 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9219 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9220 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9221 { TRUE
, ERROR_SUCCESS
, TRUE
},
9222 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9223 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9224 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9225 { TRUE
, ERROR_SUCCESS
, TRUE
}
9228 static const struct access_res create_commit
[16] =
9230 { TRUE
, ERROR_SUCCESS
, TRUE
},
9231 { TRUE
, ERROR_SUCCESS
, TRUE
},
9232 { TRUE
, ERROR_SUCCESS
, FALSE
},
9233 { TRUE
, ERROR_SUCCESS
, FALSE
},
9234 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9235 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9236 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9237 { TRUE
, ERROR_SUCCESS
, FALSE
},
9238 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9239 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9240 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9241 { TRUE
, ERROR_SUCCESS
, TRUE
},
9242 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9243 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9244 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9245 { TRUE
, ERROR_SUCCESS
, TRUE
}
9248 static const struct access_res create_close
[16] =
9250 { TRUE
, ERROR_SUCCESS
, FALSE
},
9251 { TRUE
, ERROR_SUCCESS
, FALSE
},
9252 { TRUE
, ERROR_SUCCESS
, FALSE
},
9253 { TRUE
, ERROR_SUCCESS
, FALSE
},
9254 { TRUE
, ERROR_SUCCESS
, FALSE
},
9255 { TRUE
, ERROR_SUCCESS
, FALSE
},
9256 { TRUE
, ERROR_SUCCESS
, FALSE
},
9257 { TRUE
, ERROR_SUCCESS
, FALSE
},
9258 { TRUE
, ERROR_SUCCESS
, FALSE
},
9259 { TRUE
, ERROR_SUCCESS
, FALSE
},
9260 { TRUE
, ERROR_SUCCESS
, FALSE
},
9261 { TRUE
, ERROR_SUCCESS
, FALSE
},
9262 { TRUE
, ERROR_SUCCESS
, FALSE
},
9263 { TRUE
, ERROR_SUCCESS
, FALSE
},
9264 { TRUE
, ERROR_SUCCESS
, FALSE
},
9265 { TRUE
, ERROR_SUCCESS
}
9268 static void _test_file_access(LPCSTR file
, const struct access_res
*ares
, DWORD line
)
9270 DWORD access
= 0, share
= 0;
9275 for (i
= 0; i
< 4; i
++)
9277 if (i
== 0) access
= 0;
9278 if (i
== 1) access
= GENERIC_READ
;
9279 if (i
== 2) access
= GENERIC_WRITE
;
9280 if (i
== 3) access
= GENERIC_READ
| GENERIC_WRITE
;
9282 for (j
= 0; j
< 4; j
++)
9284 if (ares
[idx
].ignore
)
9287 if (j
== 0) share
= 0;
9288 if (j
== 1) share
= FILE_SHARE_READ
;
9289 if (j
== 2) share
= FILE_SHARE_WRITE
;
9290 if (j
== 3) share
= FILE_SHARE_READ
| FILE_SHARE_WRITE
;
9292 SetLastError(0xdeadbeef);
9293 hfile
= CreateFileA(file
, access
, share
, NULL
, OPEN_EXISTING
,
9294 FILE_ATTRIBUTE_NORMAL
, 0);
9295 lasterr
= GetLastError();
9297 ok((hfile
!= INVALID_HANDLE_VALUE
) == ares
[idx
].gothandle
,
9298 "(%d, handle, %d): Expected %d, got %d\n",
9299 line
, idx
, ares
[idx
].gothandle
,
9300 (hfile
!= INVALID_HANDLE_VALUE
));
9302 ok(lasterr
== ares
[idx
].lasterr
||
9303 lasterr
== 0xdeadbeef, /* win9x */
9304 "(%d, lasterr, %d): Expected %d, got %d\n",
9305 line
, idx
, ares
[idx
].lasterr
, lasterr
);
9313 #define test_file_access(file, ares) _test_file_access(file, ares, __LINE__)
9315 static void test_access(void)
9320 r
= MsiOpenDatabaseA(msifile
, MSIDBOPEN_CREATE
, &hdb
);
9321 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9323 test_file_access(msifile
, create
);
9325 r
= MsiDatabaseCommit(hdb
);
9326 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9328 test_file_access(msifile
, create_commit
);
9330 MsiCloseHandle(hdb
);
9332 test_file_access(msifile
, create_close
);
9334 DeleteFileA(msifile
);
9336 r
= MsiOpenDatabaseA(msifile
, MSIDBOPEN_CREATEDIRECT
, &hdb
);
9337 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9339 test_file_access(msifile
, create
);
9341 r
= MsiDatabaseCommit(hdb
);
9342 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9344 test_file_access(msifile
, create_commit
);
9346 MsiCloseHandle(hdb
);
9348 test_file_access(msifile
, create_close
);
9350 DeleteFileA(msifile
);
9353 static void test_emptypackage(void)
9355 MSIHANDLE hpkg
, hdb
, hsuminfo
;
9356 MSIHANDLE hview
, hrec
;
9357 MSICONDITION condition
;
9358 CHAR buffer
[MAX_PATH
];
9362 r
= MsiOpenPackageA("", &hpkg
);
9365 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9368 hdb
= MsiGetActiveDatabase(hpkg
);
9371 ok(hdb
!= 0, "Expected a valid database handle\n");
9374 r
= MsiDatabaseOpenView(hdb
, "SELECT * FROM `_Tables`", &hview
);
9377 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9379 r
= MsiViewExecute(hview
, 0);
9382 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9385 r
= MsiViewFetch(hview
, &hrec
);
9388 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9392 r
= MsiRecordGetString(hrec
, 1, buffer
, &size
);
9395 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9396 ok(!lstrcmpA(buffer
, "_Property"),
9397 "Expected \"_Property\", got \"%s\"\n", buffer
);
9400 MsiCloseHandle(hrec
);
9402 r
= MsiViewFetch(hview
, &hrec
);
9405 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9409 r
= MsiRecordGetString(hrec
, 1, buffer
, &size
);
9412 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9413 ok(!lstrcmpA(buffer
, "#_FolderCache"),
9414 "Expected \"_Property\", got \"%s\"\n", buffer
);
9417 MsiCloseHandle(hrec
);
9418 MsiViewClose(hview
);
9419 MsiCloseHandle(hview
);
9421 condition
= MsiDatabaseIsTablePersistentA(hdb
, "_Property");
9424 ok(condition
== MSICONDITION_FALSE
,
9425 "Expected MSICONDITION_FALSE, got %d\n", condition
);
9428 r
= MsiDatabaseOpenView(hdb
, "SELECT * FROM `_Property`", &hview
);
9431 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9433 r
= MsiViewExecute(hview
, 0);
9436 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9439 /* _Property table is not empty */
9440 r
= MsiViewFetch(hview
, &hrec
);
9443 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9446 MsiCloseHandle(hrec
);
9447 MsiViewClose(hview
);
9448 MsiCloseHandle(hview
);
9450 condition
= MsiDatabaseIsTablePersistentA(hdb
, "#_FolderCache");
9453 ok(condition
== MSICONDITION_FALSE
,
9454 "Expected MSICONDITION_FALSE, got %d\n", condition
);
9457 r
= MsiDatabaseOpenView(hdb
, "SELECT * FROM `#_FolderCache`", &hview
);
9460 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9462 r
= MsiViewExecute(hview
, 0);
9465 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9468 /* #_FolderCache is not empty */
9469 r
= MsiViewFetch(hview
, &hrec
);
9472 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9475 MsiCloseHandle(hrec
);
9476 MsiViewClose(hview
);
9477 MsiCloseHandle(hview
);
9479 r
= MsiDatabaseOpenView(hdb
, "SELECT * FROM `_Streams`", &hview
);
9482 ok(r
== ERROR_BAD_QUERY_SYNTAX
,
9483 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r
);
9486 r
= MsiDatabaseOpenView(hdb
, "SELECT * FROM `_Storages`", &hview
);
9489 ok(r
== ERROR_BAD_QUERY_SYNTAX
,
9490 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r
);
9493 r
= MsiGetSummaryInformationA(hdb
, NULL
, 0, &hsuminfo
);
9496 ok(r
== ERROR_INSTALL_PACKAGE_INVALID
,
9497 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r
);
9500 MsiCloseHandle(hsuminfo
);
9502 r
= MsiDatabaseCommit(hdb
);
9505 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9508 MsiCloseHandle(hdb
);
9509 MsiCloseHandle(hpkg
);
9512 static void test_MsiGetProductProperty(void)
9514 MSIHANDLE hprod
, hdb
;
9516 CHAR path
[MAX_PATH
];
9517 CHAR query
[MAX_PATH
];
9518 CHAR keypath
[MAX_PATH
*2];
9519 CHAR prodcode
[MAX_PATH
];
9520 CHAR prod_squashed
[MAX_PATH
];
9521 HKEY prodkey
, userkey
, props
;
9528 scm
= OpenSCManager(NULL
, NULL
, SC_MANAGER_CONNECT
);
9529 if (!scm
&& (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED
))
9531 win_skip("Different registry keys on Win9x and WinMe\n");
9534 CloseServiceHandle(scm
);
9536 GetCurrentDirectoryA(MAX_PATH
, path
);
9537 lstrcatA(path
, "\\");
9539 create_test_guid(prodcode
, prod_squashed
);
9540 get_user_sid(&usersid
);
9542 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_CREATE
, &hdb
);
9543 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9545 r
= MsiDatabaseCommit(hdb
);
9546 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9548 r
= set_summary_info(hdb
);
9549 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9552 "CREATE TABLE `Directory` ( "
9553 "`Directory` CHAR(255) NOT NULL, "
9554 "`Directory_Parent` CHAR(255), "
9555 "`DefaultDir` CHAR(255) NOT NULL "
9556 "PRIMARY KEY `Directory`)");
9557 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9560 "CREATE TABLE `Property` ( "
9561 "`Property` CHAR(72) NOT NULL, "
9562 "`Value` CHAR(255) "
9563 "PRIMARY KEY `Property`)");
9564 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9566 sprintf(query
, "INSERT INTO `Property` "
9567 "(`Property`, `Value`) "
9568 "VALUES( 'ProductCode', '%s' )", prodcode
);
9569 r
= run_query(hdb
, query
);
9570 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9572 r
= MsiDatabaseCommit(hdb
);
9573 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9575 MsiCloseHandle(hdb
);
9577 lstrcpyA(keypath
, "Software\\Classes\\Installer\\Products\\");
9578 lstrcatA(keypath
, prod_squashed
);
9580 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
9581 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
9583 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
9584 lstrcatA(keypath
, "Installer\\UserData\\S-1-5-18\\Products\\");
9585 lstrcatA(keypath
, prod_squashed
);
9587 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &userkey
);
9588 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
9590 res
= RegCreateKeyA(userkey
, "InstallProperties", &props
);
9591 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
9593 lstrcpyA(val
, path
);
9594 lstrcatA(val
, "\\winetest.msi");
9595 res
= RegSetValueExA(props
, "LocalPackage", 0, REG_SZ
,
9596 (const BYTE
*)val
, lstrlenA(val
) + 1);
9597 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
9600 r
= MsiOpenProductA(prodcode
, &hprod
);
9601 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9602 ok(hprod
!= 0 && hprod
!= 0xdeadbeef, "Expected a valid product handle\n");
9604 /* hProduct is invalid */
9606 lstrcpyA(val
, "apple");
9607 r
= MsiGetProductPropertyA(0xdeadbeef, "ProductCode", val
, &size
);
9608 ok(r
== ERROR_INVALID_HANDLE
,
9609 "Expected ERROR_INVALID_HANDLE, got %d\n", r
);
9610 ok(!lstrcmpA(val
, "apple"),
9611 "Expected val to be unchanged, got \"%s\"\n", val
);
9612 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
9614 /* szProperty is NULL */
9616 lstrcpyA(val
, "apple");
9617 r
= MsiGetProductPropertyA(hprod
, NULL
, val
, &size
);
9618 ok(r
== ERROR_INVALID_PARAMETER
,
9619 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
9620 ok(!lstrcmpA(val
, "apple"),
9621 "Expected val to be unchanged, got \"%s\"\n", val
);
9622 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
9624 /* szProperty is empty */
9626 lstrcpyA(val
, "apple");
9627 r
= MsiGetProductPropertyA(hprod
, "", val
, &size
);
9628 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9629 ok(!lstrcmpA(val
, ""), "Expected \"\", got \"%s\"\n", val
);
9630 ok(size
== 0, "Expected 0, got %d\n", size
);
9632 /* get the property */
9634 lstrcpyA(val
, "apple");
9635 r
= MsiGetProductPropertyA(hprod
, "ProductCode", val
, &size
);
9636 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9637 ok(!lstrcmpA(val
, prodcode
),
9638 "Expected \"%s\", got \"%s\"\n", prodcode
, val
);
9639 ok(size
== lstrlenA(prodcode
),
9640 "Expected %d, got %d\n", lstrlenA(prodcode
), size
);
9642 /* lpValueBuf is NULL */
9644 r
= MsiGetProductPropertyA(hprod
, "ProductCode", NULL
, &size
);
9645 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9646 ok(size
== lstrlenA(prodcode
),
9647 "Expected %d, got %d\n", lstrlenA(prodcode
), size
);
9649 /* pcchValueBuf is NULL */
9650 lstrcpyA(val
, "apple");
9651 r
= MsiGetProductPropertyA(hprod
, "ProductCode", val
, NULL
);
9652 ok(r
== ERROR_INVALID_PARAMETER
,
9653 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
9654 ok(!lstrcmpA(val
, "apple"),
9655 "Expected val to be unchanged, got \"%s\"\n", val
);
9656 ok(size
== lstrlenA(prodcode
),
9657 "Expected %d, got %d\n", lstrlenA(prodcode
), size
);
9659 /* pcchValueBuf is too small */
9661 lstrcpyA(val
, "apple");
9662 r
= MsiGetProductPropertyA(hprod
, "ProductCode", val
, &size
);
9663 ok(r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
9664 ok(!strncmp(val
, prodcode
, 3),
9665 "Expected first 3 chars of \"%s\", got \"%s\"\n", prodcode
, val
);
9666 ok(size
== lstrlenA(prodcode
),
9667 "Expected %d, got %d\n", lstrlenA(prodcode
), size
);
9669 /* pcchValueBuf does not leave room for NULL terminator */
9670 size
= lstrlenA(prodcode
);
9671 lstrcpyA(val
, "apple");
9672 r
= MsiGetProductPropertyA(hprod
, "ProductCode", val
, &size
);
9673 ok(r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
9674 ok(!strncmp(val
, prodcode
, lstrlenA(prodcode
) - 1),
9675 "Expected first 37 chars of \"%s\", got \"%s\"\n", prodcode
, val
);
9676 ok(size
== lstrlenA(prodcode
),
9677 "Expected %d, got %d\n", lstrlenA(prodcode
), size
);
9679 /* pcchValueBuf has enough room for NULL terminator */
9680 size
= lstrlenA(prodcode
) + 1;
9681 lstrcpyA(val
, "apple");
9682 r
= MsiGetProductPropertyA(hprod
, "ProductCode", val
, &size
);
9683 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9684 ok(!lstrcmpA(val
, prodcode
),
9685 "Expected \"%s\", got \"%s\"\n", prodcode
, val
);
9686 ok(size
== lstrlenA(prodcode
),
9687 "Expected %d, got %d\n", lstrlenA(prodcode
), size
);
9689 /* nonexistent property */
9691 lstrcpyA(val
, "apple");
9692 r
= MsiGetProductPropertyA(hprod
, "IDontExist", val
, &size
);
9693 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9694 ok(!lstrcmpA(val
, ""), "Expected \"\", got \"%s\"\n", val
);
9695 ok(size
== 0, "Expected 0, got %d\n", size
);
9697 r
= MsiSetPropertyA(hprod
, "NewProperty", "value");
9698 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9700 /* non-product property set */
9702 lstrcpyA(val
, "apple");
9703 r
= MsiGetProductPropertyA(hprod
, "NewProperty", val
, &size
);
9704 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9705 ok(!lstrcmpA(val
, ""), "Expected \"\", got \"%s\"\n", val
);
9706 ok(size
== 0, "Expected 0, got %d\n", size
);
9708 r
= MsiSetPropertyA(hprod
, "ProductCode", "value");
9709 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9711 /* non-product property that is also a product property set */
9713 lstrcpyA(val
, "apple");
9714 r
= MsiGetProductPropertyA(hprod
, "ProductCode", val
, &size
);
9715 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9716 ok(!lstrcmpA(val
, prodcode
),
9717 "Expected \"%s\", got \"%s\"\n", prodcode
, val
);
9718 ok(size
== lstrlenA(prodcode
),
9719 "Expected %d, got %d\n", lstrlenA(prodcode
), size
);
9721 MsiCloseHandle(hprod
);
9723 RegDeleteValueA(props
, "LocalPackage");
9724 RegDeleteKeyA(props
, "");
9726 RegDeleteKeyA(userkey
, "");
9727 RegCloseKey(userkey
);
9728 RegDeleteKeyA(prodkey
, "");
9729 RegCloseKey(prodkey
);
9730 DeleteFileA(msifile
);
9735 GetCurrentDirectoryA(MAX_PATH
, CURR_DIR
);
9737 test_createpackage();
9739 test_gettargetpath_bad();
9740 test_settargetpath();
9742 test_property_table();
9745 test_formatrecord2();
9750 test_appsearch_complocator();
9751 test_appsearch_reglocator();
9752 test_appsearch_inilocator();
9753 test_appsearch_drlocator();
9754 test_featureparents();
9755 test_installprops();
9756 test_launchconditions();
9759 test_MsiGetSourcePath();
9760 test_shortlongsource();
9763 test_emptypackage();
9764 test_MsiGetProductProperty();