2 * tests for Microsoft Installer functionality
4 * Copyright 2005 Mike McCormack for CodeWeavers
5 * Copyright 2005 Aric Stewart for CodeWeavers
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
30 #include "wine/test.h"
32 static const char msifile
[] = "winetest.msi";
33 char CURR_DIR
[MAX_PATH
];
35 static void get_user_sid(LPSTR
*usersid
)
41 HMODULE hadvapi32
= GetModuleHandleA("advapi32.dll");
42 static BOOL (WINAPI
*pConvertSidToStringSidA
)(PSID
, LPSTR
*);
45 pConvertSidToStringSidA
= (void *)GetProcAddress(hadvapi32
, "ConvertSidToStringSidA");
46 if (!pConvertSidToStringSidA
)
49 OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY
, &token
);
51 GetTokenInformation(token
, TokenUser
, (void *)buf
, size
, &size
);
52 user
= (PTOKEN_USER
)buf
;
53 pConvertSidToStringSidA(user
->User
.Sid
, usersid
);
56 /* RegDeleteTreeW from dlls/advapi32/registry.c */
57 LSTATUS WINAPI
package_RegDeleteTreeW(HKEY hKey
, LPCWSTR lpszSubKey
)
60 DWORD dwMaxSubkeyLen
, dwMaxValueLen
;
61 DWORD dwMaxLen
, dwSize
;
62 WCHAR szNameBuf
[MAX_PATH
], *lpszName
= szNameBuf
;
67 ret
= RegOpenKeyExW(hKey
, lpszSubKey
, 0, KEY_READ
, &hSubKey
);
71 ret
= RegQueryInfoKeyW(hSubKey
, NULL
, NULL
, NULL
, NULL
,
72 &dwMaxSubkeyLen
, NULL
, NULL
, &dwMaxValueLen
, NULL
, NULL
, NULL
);
73 if (ret
) goto cleanup
;
77 dwMaxLen
= max(dwMaxSubkeyLen
, dwMaxValueLen
);
78 if (dwMaxLen
> sizeof(szNameBuf
)/sizeof(WCHAR
))
80 /* Name too big: alloc a buffer for it */
81 if (!(lpszName
= HeapAlloc( GetProcessHeap(), 0, dwMaxLen
*sizeof(WCHAR
))))
83 ret
= ERROR_NOT_ENOUGH_MEMORY
;
88 /* Recursively delete all the subkeys */
92 if (RegEnumKeyExW(hSubKey
, 0, lpszName
, &dwSize
, NULL
,
93 NULL
, NULL
, NULL
)) break;
95 ret
= package_RegDeleteTreeW(hSubKey
, lpszName
);
96 if (ret
) goto cleanup
;
100 ret
= RegDeleteKeyW(hKey
, lpszSubKey
);
105 if (RegEnumValueW(hKey
, 0, lpszName
, &dwSize
,
106 NULL
, NULL
, NULL
, NULL
)) break;
108 ret
= RegDeleteValueW(hKey
, lpszName
);
109 if (ret
) goto cleanup
;
113 if (lpszName
!= szNameBuf
)
114 HeapFree(GetProcessHeap(), 0, lpszName
);
116 RegCloseKey(hSubKey
);
120 static BOOL
squash_guid(LPCWSTR in
, LPWSTR out
)
125 if (FAILED(CLSIDFromString((LPOLESTR
)in
, &guid
)))
139 out
[17+i
*2] = in
[n
++];
140 out
[16+i
*2] = in
[n
++];
145 out
[17+i
*2] = in
[n
++];
146 out
[16+i
*2] = in
[n
++];
152 static void set_component_path(LPCSTR filename
, MSIINSTALLCONTEXT context
,
153 LPCSTR guid
, LPSTR usersid
, BOOL dir
)
155 WCHAR guidW
[MAX_PATH
];
156 WCHAR squashedW
[MAX_PATH
];
157 CHAR squashed
[MAX_PATH
];
158 CHAR comppath
[MAX_PATH
];
159 CHAR prodpath
[MAX_PATH
];
164 MultiByteToWideChar(CP_ACP
, 0, guid
, -1, guidW
, MAX_PATH
);
165 squash_guid(guidW
, squashedW
);
166 WideCharToMultiByte(CP_ACP
, 0, squashedW
, -1, squashed
, MAX_PATH
, NULL
, NULL
);
168 if (context
== MSIINSTALLCONTEXT_MACHINE
)
170 prod
= "3D0DAE300FACA1300AD792060BCDAA92";
172 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
173 "Installer\\UserData\\S-1-5-18\\Components\\%s", squashed
);
175 "SOFTWARE\\Classes\\Installer\\"
176 "Products\\3D0DAE300FACA1300AD792060BCDAA92");
178 else if (context
== MSIINSTALLCONTEXT_USERUNMANAGED
)
180 prod
= "7D2F387510109040002000060BECB6AB";
182 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
183 "Installer\\UserData\\%s\\Components\\%s", usersid
, squashed
);
185 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
186 "Installer\\%s\\Installer\\Products\\"
187 "7D2F387510109040002000060BECB6AB", usersid
);
189 else if (context
== MSIINSTALLCONTEXT_USERMANAGED
)
191 prod
= "7D2F387510109040002000060BECB6AB";
193 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
194 "Installer\\UserData\\%s\\Components\\%s", usersid
, squashed
);
196 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
197 "Installer\\Managed\\%s\\Installer\\Products\\"
198 "7D2F387510109040002000060BECB6AB", usersid
);
201 RegCreateKeyA(HKEY_LOCAL_MACHINE
, comppath
, &hkey
);
203 lstrcpyA(path
, CURR_DIR
);
204 lstrcatA(path
, "\\");
205 if (!dir
) lstrcatA(path
, filename
);
207 RegSetValueExA(hkey
, prod
, 0, REG_SZ
, (LPBYTE
)path
, lstrlenA(path
));
210 RegCreateKeyA(HKEY_LOCAL_MACHINE
, prodpath
, &hkey
);
214 static void delete_component_path(LPCSTR guid
, MSIINSTALLCONTEXT context
, LPSTR usersid
)
216 WCHAR guidW
[MAX_PATH
];
217 WCHAR squashedW
[MAX_PATH
];
218 WCHAR substrW
[MAX_PATH
];
219 CHAR squashed
[MAX_PATH
];
220 CHAR comppath
[MAX_PATH
];
221 CHAR prodpath
[MAX_PATH
];
223 MultiByteToWideChar(CP_ACP
, 0, guid
, -1, guidW
, MAX_PATH
);
224 squash_guid(guidW
, squashedW
);
225 WideCharToMultiByte(CP_ACP
, 0, squashedW
, -1, squashed
, MAX_PATH
, NULL
, NULL
);
227 if (context
== MSIINSTALLCONTEXT_MACHINE
)
230 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
231 "Installer\\UserData\\S-1-5-18\\Components\\%s", squashed
);
233 "SOFTWARE\\Classes\\Installer\\"
234 "Products\\3D0DAE300FACA1300AD792060BCDAA92");
236 else if (context
== MSIINSTALLCONTEXT_USERUNMANAGED
)
239 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
240 "Installer\\UserData\\%s\\Components\\%s", usersid
, squashed
);
242 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
243 "Installer\\%s\\Installer\\Products\\"
244 "7D2F387510109040002000060BECB6AB", usersid
);
246 else if (context
== MSIINSTALLCONTEXT_USERMANAGED
)
249 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
250 "Installer\\UserData\\%s\\Components\\%s", usersid
, squashed
);
252 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
253 "Installer\\Managed\\%s\\Installer\\Products\\"
254 "7D2F387510109040002000060BECB6AB", usersid
);
257 MultiByteToWideChar(CP_ACP
, 0, comppath
, -1, substrW
, MAX_PATH
);
258 package_RegDeleteTreeW(HKEY_LOCAL_MACHINE
, substrW
);
260 MultiByteToWideChar(CP_ACP
, 0, prodpath
, -1, substrW
, MAX_PATH
);
261 package_RegDeleteTreeW(HKEY_LOCAL_MACHINE
, substrW
);
264 static UINT
do_query(MSIHANDLE hdb
, const char *query
, MSIHANDLE
*phrec
)
269 /* open a select query */
270 r
= MsiDatabaseOpenView(hdb
, query
, &hview
);
271 if (r
!= ERROR_SUCCESS
)
273 r
= MsiViewExecute(hview
, 0);
274 if (r
!= ERROR_SUCCESS
)
276 ret
= MsiViewFetch(hview
, phrec
);
277 r
= MsiViewClose(hview
);
278 if (r
!= ERROR_SUCCESS
)
280 r
= MsiCloseHandle(hview
);
281 if (r
!= ERROR_SUCCESS
)
286 static UINT
run_query( MSIHANDLE hdb
, const char *query
)
291 r
= MsiDatabaseOpenView(hdb
, query
, &hview
);
292 if( r
!= ERROR_SUCCESS
)
295 r
= MsiViewExecute(hview
, 0);
296 if( r
== ERROR_SUCCESS
)
297 r
= MsiViewClose(hview
);
298 MsiCloseHandle(hview
);
302 static UINT
create_component_table( MSIHANDLE hdb
)
304 return run_query( hdb
,
305 "CREATE TABLE `Component` ( "
306 "`Component` CHAR(72) NOT NULL, "
307 "`ComponentId` CHAR(38), "
308 "`Directory_` CHAR(72) NOT NULL, "
309 "`Attributes` SHORT NOT NULL, "
310 "`Condition` CHAR(255), "
311 "`KeyPath` CHAR(72) "
312 "PRIMARY KEY `Component`)" );
315 static UINT
create_feature_table( MSIHANDLE hdb
)
317 return run_query( hdb
,
318 "CREATE TABLE `Feature` ( "
319 "`Feature` CHAR(38) NOT NULL, "
320 "`Feature_Parent` CHAR(38), "
322 "`Description` CHAR(255), "
323 "`Display` SHORT NOT NULL, "
324 "`Level` SHORT NOT NULL, "
325 "`Directory_` CHAR(72), "
326 "`Attributes` SHORT NOT NULL "
327 "PRIMARY KEY `Feature`)" );
330 static UINT
create_feature_components_table( MSIHANDLE hdb
)
332 return run_query( hdb
,
333 "CREATE TABLE `FeatureComponents` ( "
334 "`Feature_` CHAR(38) NOT NULL, "
335 "`Component_` CHAR(72) NOT NULL "
336 "PRIMARY KEY `Feature_`, `Component_` )" );
339 static UINT
create_file_table( MSIHANDLE hdb
)
341 return run_query( hdb
,
342 "CREATE TABLE `File` ("
343 "`File` CHAR(72) NOT NULL, "
344 "`Component_` CHAR(72) NOT NULL, "
345 "`FileName` CHAR(255) NOT NULL, "
346 "`FileSize` LONG NOT NULL, "
347 "`Version` CHAR(72), "
348 "`Language` CHAR(20), "
349 "`Attributes` SHORT, "
350 "`Sequence` SHORT NOT NULL "
351 "PRIMARY KEY `File`)" );
354 static UINT
create_remove_file_table( MSIHANDLE hdb
)
356 return run_query( hdb
,
357 "CREATE TABLE `RemoveFile` ("
358 "`FileKey` CHAR(72) NOT NULL, "
359 "`Component_` CHAR(72) NOT NULL, "
360 "`FileName` CHAR(255) LOCALIZABLE, "
361 "`DirProperty` CHAR(72) NOT NULL, "
362 "`InstallMode` SHORT NOT NULL "
363 "PRIMARY KEY `FileKey`)" );
366 static UINT
create_appsearch_table( MSIHANDLE hdb
)
368 return run_query( hdb
,
369 "CREATE TABLE `AppSearch` ("
370 "`Property` CHAR(72) NOT NULL, "
371 "`Signature_` CHAR(72) NOT NULL "
372 "PRIMARY KEY `Property`, `Signature_`)" );
375 static UINT
create_reglocator_table( MSIHANDLE hdb
)
377 return run_query( hdb
,
378 "CREATE TABLE `RegLocator` ("
379 "`Signature_` CHAR(72) NOT NULL, "
380 "`Root` SHORT NOT NULL, "
381 "`Key` CHAR(255) NOT NULL, "
384 "PRIMARY KEY `Signature_`)" );
387 static UINT
create_signature_table( MSIHANDLE hdb
)
389 return run_query( hdb
,
390 "CREATE TABLE `Signature` ("
391 "`Signature` CHAR(72) NOT NULL, "
392 "`FileName` CHAR(255) NOT NULL, "
393 "`MinVersion` CHAR(20), "
394 "`MaxVersion` CHAR(20), "
399 "`Languages` CHAR(255) "
400 "PRIMARY KEY `Signature`)" );
403 static UINT
create_launchcondition_table( MSIHANDLE hdb
)
405 return run_query( hdb
,
406 "CREATE TABLE `LaunchCondition` ("
407 "`Condition` CHAR(255) NOT NULL, "
408 "`Description` CHAR(255) NOT NULL "
409 "PRIMARY KEY `Condition`)" );
412 static UINT
create_property_table( MSIHANDLE hdb
)
414 return run_query( hdb
,
415 "CREATE TABLE `Property` ("
416 "`Property` CHAR(72) NOT NULL, "
418 "PRIMARY KEY `Property`)" );
421 static UINT
create_install_execute_sequence_table( MSIHANDLE hdb
)
423 return run_query( hdb
,
424 "CREATE TABLE `InstallExecuteSequence` ("
425 "`Action` CHAR(72) NOT NULL, "
426 "`Condition` CHAR(255), "
428 "PRIMARY KEY `Action`)" );
431 static UINT
create_media_table( MSIHANDLE hdb
)
433 return run_query( hdb
,
434 "CREATE TABLE `Media` ("
435 "`DiskId` SHORT NOT NULL, "
436 "`LastSequence` SHORT NOT NULL, "
437 "`DiskPrompt` CHAR(64), "
438 "`Cabinet` CHAR(255), "
439 "`VolumeLabel` CHAR(32), "
441 "PRIMARY KEY `DiskId`)" );
444 static UINT
create_ccpsearch_table( MSIHANDLE hdb
)
446 return run_query( hdb
,
447 "CREATE TABLE `CCPSearch` ("
448 "`Signature_` CHAR(72) NOT NULL "
449 "PRIMARY KEY `Signature_`)" );
452 static UINT
create_drlocator_table( MSIHANDLE hdb
)
454 return run_query( hdb
,
455 "CREATE TABLE `DrLocator` ("
456 "`Signature_` CHAR(72) NOT NULL, "
457 "`Parent` CHAR(72), "
460 "PRIMARY KEY `Signature_`, `Parent`, `Path`)" );
463 static UINT
create_complocator_table( MSIHANDLE hdb
)
465 return run_query( hdb
,
466 "CREATE TABLE `CompLocator` ("
467 "`Signature_` CHAR(72) NOT NULL, "
468 "`ComponentId` CHAR(38) NOT NULL, "
470 "PRIMARY KEY `Signature_`)" );
473 static UINT
create_inilocator_table( MSIHANDLE hdb
)
475 return run_query( hdb
,
476 "CREATE TABLE `IniLocator` ("
477 "`Signature_` CHAR(72) NOT NULL, "
478 "`FileName` CHAR(255) NOT NULL, "
479 "`Section` CHAR(96)NOT NULL, "
480 "`Key` CHAR(128)NOT NULL, "
483 "PRIMARY KEY `Signature_`)" );
486 #define make_add_entry(type, qtext) \
487 static UINT add##_##type##_##entry( MSIHANDLE hdb, const char *values ) \
489 char insert[] = qtext; \
492 sz = strlen(values) + sizeof insert; \
493 query = HeapAlloc(GetProcessHeap(),0,sz); \
494 sprintf(query,insert,values); \
495 r = run_query( hdb, query ); \
496 HeapFree(GetProcessHeap(), 0, query); \
500 make_add_entry(component
,
501 "INSERT INTO `Component` "
502 "(`Component`, `ComponentId`, `Directory_`, "
503 "`Attributes`, `Condition`, `KeyPath`) VALUES( %s )")
505 make_add_entry(directory
,
506 "INSERT INTO `Directory` "
507 "(`Directory`,`Directory_Parent`,`DefaultDir`) VALUES( %s )")
509 make_add_entry(feature
,
510 "INSERT INTO `Feature` "
511 "(`Feature`, `Feature_Parent`, `Title`, `Description`, "
512 "`Display`, `Level`, `Directory_`, `Attributes`) VALUES( %s )")
514 make_add_entry(feature_components
,
515 "INSERT INTO `FeatureComponents` "
516 "(`Feature_`, `Component_`) VALUES( %s )")
519 "INSERT INTO `File` "
520 "(`File`, `Component_`, `FileName`, `FileSize`, "
521 "`Version`, `Language`, `Attributes`, `Sequence`) VALUES( %s )")
523 make_add_entry(appsearch
,
524 "INSERT INTO `AppSearch` "
525 "(`Property`, `Signature_`) VALUES( %s )")
527 make_add_entry(reglocator
,
528 "INSERT INTO `RegLocator` "
529 "(`Signature_`, `Root`, `Key`, `Name`, `Type`) VALUES( %s )")
531 make_add_entry(signature
,
532 "INSERT INTO `Signature` "
533 "(`Signature`, `FileName`, `MinVersion`, `MaxVersion`,"
534 " `MinSize`, `MaxSize`, `MinDate`, `MaxDate`, `Languages`) "
537 make_add_entry(launchcondition
,
538 "INSERT INTO `LaunchCondition` "
539 "(`Condition`, `Description`) VALUES( %s )")
541 make_add_entry(property
,
542 "INSERT INTO `Property` (`Property`, `Value`) VALUES( %s )")
544 make_add_entry(install_execute_sequence
,
545 "INSERT INTO `InstallExecuteSequence` "
546 "(`Action`, `Condition`, `Sequence`) VALUES( %s )")
548 make_add_entry(media
,
549 "INSERT INTO `Media` "
550 "(`DiskId`, `LastSequence`, `DiskPrompt`, "
551 "`Cabinet`, `VolumeLabel`, `Source`) VALUES( %s )")
553 make_add_entry(ccpsearch
,
554 "INSERT INTO `CCPSearch` (`Signature_`) VALUES( %s )")
556 make_add_entry(drlocator
,
557 "INSERT INTO `DrLocator` "
558 "(`Signature_`, `Parent`, `Path`, `Depth`) VALUES( %s )")
560 make_add_entry(complocator
,
561 "INSERT INTO `CompLocator` "
562 "(`Signature_`, `ComponentId`, `Type`) VALUES( %s )")
564 make_add_entry(inilocator
,
565 "INSERT INTO `IniLocator` "
566 "(`Signature_`, `FileName`, `Section`, `Key`, `Field`, `Type`) "
569 static UINT
set_summary_info(MSIHANDLE hdb
)
574 /* build summary info */
575 res
= MsiGetSummaryInformation(hdb
, NULL
, 7, &suminfo
);
576 ok( res
== ERROR_SUCCESS
, "Failed to open summaryinfo\n" );
578 res
= MsiSummaryInfoSetProperty(suminfo
,2, VT_LPSTR
, 0,NULL
,
579 "Installation Database");
580 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
582 res
= MsiSummaryInfoSetProperty(suminfo
,3, VT_LPSTR
, 0,NULL
,
583 "Installation Database");
584 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
586 res
= MsiSummaryInfoSetProperty(suminfo
,4, VT_LPSTR
, 0,NULL
,
588 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
590 res
= MsiSummaryInfoSetProperty(suminfo
,7, VT_LPSTR
, 0,NULL
,
592 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
594 res
= MsiSummaryInfoSetProperty(suminfo
,9, VT_LPSTR
, 0,NULL
,
595 "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}");
596 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
598 res
= MsiSummaryInfoSetProperty(suminfo
, 14, VT_I4
, 100, NULL
, NULL
);
599 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
601 res
= MsiSummaryInfoSetProperty(suminfo
, 15, VT_I4
, 0, NULL
, NULL
);
602 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
604 res
= MsiSummaryInfoPersist(suminfo
);
605 ok( res
== ERROR_SUCCESS
, "Failed to make summary info persist\n" );
607 res
= MsiCloseHandle( suminfo
);
608 ok( res
== ERROR_SUCCESS
, "Failed to close suminfo\n" );
614 static MSIHANDLE
create_package_db(void)
621 /* create an empty database */
622 res
= MsiOpenDatabase(msifile
, MSIDBOPEN_CREATE
, &hdb
);
623 ok( res
== ERROR_SUCCESS
, "Failed to create database\n" );
624 if( res
!= ERROR_SUCCESS
)
627 res
= MsiDatabaseCommit( hdb
);
628 ok( res
== ERROR_SUCCESS
, "Failed to commit database\n" );
630 res
= set_summary_info(hdb
);
632 res
= run_query( hdb
,
633 "CREATE TABLE `Directory` ( "
634 "`Directory` CHAR(255) NOT NULL, "
635 "`Directory_Parent` CHAR(255), "
636 "`DefaultDir` CHAR(255) NOT NULL "
637 "PRIMARY KEY `Directory`)" );
638 ok( res
== ERROR_SUCCESS
, "Failed to create directory table\n" );
643 static MSIHANDLE
package_from_db(MSIHANDLE hdb
)
649 sprintf(szPackage
,"#%li",hdb
);
650 res
= MsiOpenPackage(szPackage
,&hPackage
);
651 if (res
!= ERROR_SUCCESS
)
654 res
= MsiCloseHandle(hdb
);
655 if (res
!= ERROR_SUCCESS
)
661 static void create_test_file(const CHAR
*name
)
666 file
= CreateFileA(name
, GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
, 0, NULL
);
667 ok(file
!= INVALID_HANDLE_VALUE
, "Failure to open file %s\n", name
);
668 WriteFile(file
, name
, strlen(name
), &written
, NULL
);
669 WriteFile(file
, "\n", strlen("\n"), &written
, NULL
);
673 typedef struct _tagVS_VERSIONINFO
680 VS_FIXEDFILEINFO Value
;
685 #define roundoffs(a, b, r) (((BYTE *)(b) - (BYTE *)(a) + ((r) - 1)) & ~((r) - 1))
686 #define roundpos(a, b, r) (((BYTE *)(a)) + roundoffs(a, b, r))
688 static BOOL
create_file_with_version(const CHAR
*name
, LONG ms
, LONG ls
)
690 VS_VERSIONINFO
*pVerInfo
;
691 VS_FIXEDFILEINFO
*pFixedInfo
;
698 GetSystemDirectory(path
, MAX_PATH
);
699 lstrcatA(path
, "\\kernel32.dll");
701 CopyFileA(path
, name
, FALSE
);
703 size
= GetFileVersionInfoSize(path
, &handle
);
704 buffer
= HeapAlloc(GetProcessHeap(), 0, size
);
706 GetFileVersionInfoA(path
, 0, size
, buffer
);
708 pVerInfo
= (VS_VERSIONINFO
*)buffer
;
709 ofs
= (BYTE
*)&pVerInfo
->szKey
[lstrlenW(pVerInfo
->szKey
) + 1];
710 pFixedInfo
= (VS_FIXEDFILEINFO
*)roundpos(pVerInfo
, ofs
, 4);
712 pFixedInfo
->dwFileVersionMS
= ms
;
713 pFixedInfo
->dwFileVersionLS
= ls
;
714 pFixedInfo
->dwProductVersionMS
= ms
;
715 pFixedInfo
->dwProductVersionLS
= ls
;
717 resource
= BeginUpdateResource(name
, FALSE
);
721 if (!UpdateResource(resource
, RT_VERSION
, MAKEINTRESOURCE(VS_VERSION_INFO
),
722 MAKELANGID(LANG_NEUTRAL
, SUBLANG_NEUTRAL
), buffer
, size
))
725 if (!EndUpdateResource(resource
, FALSE
))
731 HeapFree(GetProcessHeap(), 0, buffer
);
735 static void test_createpackage(void)
737 MSIHANDLE hPackage
= 0;
740 hPackage
= package_from_db(create_package_db());
741 ok( hPackage
!= 0, " Failed to create package\n");
743 res
= MsiCloseHandle( hPackage
);
744 ok( res
== ERROR_SUCCESS
, "Failed to close package\n" );
748 static void test_doaction( void )
753 r
= MsiDoAction( -1, NULL
);
754 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
756 hpkg
= package_from_db(create_package_db());
757 ok( hpkg
, "failed to create package\n");
759 r
= MsiDoAction(hpkg
, NULL
);
760 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
762 r
= MsiDoAction(0, "boo");
763 ok( r
== ERROR_INVALID_HANDLE
, "wrong return val\n");
765 r
= MsiDoAction(hpkg
, "boo");
766 ok( r
== ERROR_FUNCTION_NOT_CALLED
, "wrong return val\n");
768 MsiCloseHandle( hpkg
);
772 static void test_gettargetpath_bad(void)
779 hpkg
= package_from_db(create_package_db());
780 ok( hpkg
, "failed to create package\n");
782 r
= MsiGetTargetPath( 0, NULL
, NULL
, NULL
);
783 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
785 r
= MsiGetTargetPath( 0, NULL
, NULL
, &sz
);
786 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
788 r
= MsiGetTargetPath( 0, "boo", NULL
, NULL
);
789 ok( r
== ERROR_INVALID_HANDLE
, "wrong return val\n");
791 r
= MsiGetTargetPath( 0, "boo", NULL
, NULL
);
792 ok( r
== ERROR_INVALID_HANDLE
, "wrong return val\n");
794 r
= MsiGetTargetPath( hpkg
, "boo", NULL
, NULL
);
795 ok( r
== ERROR_DIRECTORY
, "wrong return val\n");
797 r
= MsiGetTargetPath( hpkg
, "boo", buffer
, NULL
);
798 ok( r
== ERROR_DIRECTORY
, "wrong return val\n");
800 MsiCloseHandle( hpkg
);
804 static void query_file_path(MSIHANDLE hpkg
, LPCSTR file
, LPSTR buff
)
810 rec
= MsiCreateRecord( 1 );
811 ok(rec
, "MsiCreate record failed\n");
813 r
= MsiRecordSetString( rec
, 0, file
);
814 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
817 r
= MsiFormatRecord( hpkg
, rec
, buff
, &size
);
818 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
820 MsiCloseHandle( rec
);
823 static void test_settargetpath(void)
825 char tempdir
[MAX_PATH
+8], buffer
[MAX_PATH
], file
[MAX_PATH
];
831 hdb
= create_package_db();
832 ok ( hdb
, "failed to create package database\n" );
834 r
= add_directory_entry( hdb
, "'TARGETDIR', '', 'SourceDir'" );
835 ok( r
== S_OK
, "failed to add directory entry: %d\n" , r
);
837 r
= create_component_table( hdb
);
838 ok( r
== S_OK
, "cannot create Component table: %d\n", r
);
840 r
= add_component_entry( hdb
, "'RootComp', '{83e2694d-0864-4124-9323-6d37630912a1}', 'TARGETDIR', 8, '', 'RootFile'" );
841 ok( r
== S_OK
, "cannot add dummy component: %d\n", r
);
843 r
= add_component_entry( hdb
, "'TestComp', '{A3FB59C8-C293-4F7E-B8C5-F0E1D8EEE4E5}', 'TestDir', 0, '', 'TestFile'" );
844 ok( r
== S_OK
, "cannot add test component: %d\n", r
);
846 r
= create_feature_table( hdb
);
847 ok( r
== S_OK
, "cannot create Feature table: %d\n", r
);
849 r
= add_feature_entry( hdb
, "'TestFeature', '', '', '', 0, 1, '', 0" );
850 ok( r
== ERROR_SUCCESS
, "cannot add TestFeature to Feature table: %d\n", r
);
852 r
= create_feature_components_table( hdb
);
853 ok( r
== S_OK
, "cannot create FeatureComponents table: %d\n", r
);
855 r
= add_feature_components_entry( hdb
, "'TestFeature', 'RootComp'" );
856 ok( r
== S_OK
, "cannot insert component into FeatureComponents table: %d\n", r
);
858 r
= add_feature_components_entry( hdb
, "'TestFeature', 'TestComp'" );
859 ok( r
== S_OK
, "cannot insert component into FeatureComponents table: %d\n", r
);
861 add_directory_entry( hdb
, "'TestParent', 'TARGETDIR', 'TestParent'" );
862 add_directory_entry( hdb
, "'TestDir', 'TestParent', 'TestDir'" );
864 r
= create_file_table( hdb
);
865 ok( r
== S_OK
, "cannot create File table: %d\n", r
);
867 r
= add_file_entry( hdb
, "'RootFile', 'RootComp', 'rootfile.txt', 0, '', '1033', 8192, 1" );
868 ok( r
== S_OK
, "cannot add file to the File table: %d\n", r
);
870 r
= add_file_entry( hdb
, "'TestFile', 'TestComp', 'testfile.txt', 0, '', '1033', 8192, 1" );
871 ok( r
== S_OK
, "cannot add file to the File table: %d\n", r
);
873 hpkg
= package_from_db( hdb
);
874 ok( hpkg
, "failed to create package\n");
876 r
= MsiDoAction( hpkg
, "CostInitialize");
877 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
879 r
= MsiDoAction( hpkg
, "FileCost");
880 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
882 r
= MsiDoAction( hpkg
, "CostFinalize");
883 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
885 r
= MsiSetTargetPath( 0, NULL
, NULL
);
886 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
888 r
= MsiSetTargetPath( 0, "boo", "C:\\bogusx" );
889 ok( r
== ERROR_INVALID_HANDLE
, "wrong return val\n");
891 r
= MsiSetTargetPath( hpkg
, "boo", NULL
);
892 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
894 r
= MsiSetTargetPath( hpkg
, "boo", "c:\\bogusx" );
895 ok( r
== ERROR_DIRECTORY
, "wrong return val\n");
897 sz
= sizeof tempdir
- 1;
898 r
= MsiGetTargetPath( hpkg
, "TARGETDIR", tempdir
, &sz
);
899 sprintf( file
, "%srootfile.txt", tempdir
);
900 query_file_path( hpkg
, "[#RootFile]", buffer
);
901 ok( r
== ERROR_SUCCESS
, "failed to get target path: %d\n", r
);
902 ok( !lstrcmp(buffer
, file
), "Expected %s, got %s\n", file
, buffer
);
904 GetTempFileName( tempdir
, "_wt", 0, buffer
);
905 sprintf( tempdir
, "%s\\subdir", buffer
);
907 r
= MsiSetTargetPath( hpkg
, "TARGETDIR", buffer
);
908 ok( r
== ERROR_SUCCESS
|| r
== ERROR_DIRECTORY
,
909 "MsiSetTargetPath on file returned %d\n", r
);
911 r
= MsiSetTargetPath( hpkg
, "TARGETDIR", tempdir
);
912 ok( r
== ERROR_SUCCESS
|| r
== ERROR_DIRECTORY
,
913 "MsiSetTargetPath on 'subdir' of file returned %d\n", r
);
915 DeleteFile( buffer
);
917 r
= MsiSetTargetPath( hpkg
, "TARGETDIR", buffer
);
918 ok( r
== ERROR_SUCCESS
, "MsiSetTargetPath returned %d\n", r
);
920 r
= GetFileAttributes( buffer
);
921 ok ( r
== INVALID_FILE_ATTRIBUTES
, "file/directory exists after MsiSetTargetPath. Attributes: %08X\n", r
);
923 r
= MsiSetTargetPath( hpkg
, "TARGETDIR", tempdir
);
924 ok( r
== ERROR_SUCCESS
, "MsiSetTargetPath on subsubdir returned %d\n", r
);
926 sz
= sizeof buffer
- 1;
927 lstrcat( tempdir
, "\\" );
928 r
= MsiGetTargetPath( hpkg
, "TARGETDIR", buffer
, &sz
);
929 ok( r
== ERROR_SUCCESS
, "failed to get target path: %d\n", r
);
930 ok( !lstrcmp(buffer
, tempdir
), "Expected %s, got %s\n", tempdir
, buffer
);
932 sprintf( file
, "%srootfile.txt", tempdir
);
933 query_file_path( hpkg
, "[#RootFile]", buffer
);
934 ok( !lstrcmp(buffer
, file
), "Expected %s, got %s\n", file
, buffer
);
936 r
= MsiSetTargetPath( hpkg
, "TestParent", "C:\\one\\two" );
937 ok( r
== ERROR_SUCCESS
, "MsiSetTargetPath returned %d\n", r
);
939 query_file_path( hpkg
, "[#TestFile]", buffer
);
940 ok( !lstrcmp(buffer
, "C:\\one\\two\\TestDir\\testfile.txt"),
941 "Expected C:\\one\\two\\TestDir\\testfile.txt, got %s\n", buffer
);
943 sz
= sizeof buffer
- 1;
944 r
= MsiGetTargetPath( hpkg
, "TestParent", buffer
, &sz
);
945 ok( r
== ERROR_SUCCESS
, "failed to get target path: %d\n", r
);
946 ok( !lstrcmp(buffer
, "C:\\one\\two\\"), "Expected C:\\one\\two\\, got %s\n", buffer
);
948 MsiCloseHandle( hpkg
);
951 static void test_condition(void)
956 hpkg
= package_from_db(create_package_db());
957 ok( hpkg
, "failed to create package\n");
959 r
= MsiEvaluateCondition(0, NULL
);
960 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
962 r
= MsiEvaluateCondition(hpkg
, NULL
);
963 ok( r
== MSICONDITION_NONE
, "wrong return val\n");
965 r
= MsiEvaluateCondition(hpkg
, "");
966 ok( r
== MSICONDITION_NONE
, "wrong return val\n");
968 r
= MsiEvaluateCondition(hpkg
, "1");
969 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
971 r
= MsiEvaluateCondition(hpkg
, "0");
972 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
974 r
= MsiEvaluateCondition(hpkg
, "-1");
975 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
977 r
= MsiEvaluateCondition(hpkg
, "0 = 0");
978 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
980 r
= MsiEvaluateCondition(hpkg
, "0 <> 0");
981 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
983 r
= MsiEvaluateCondition(hpkg
, "0 = 1");
984 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
986 r
= MsiEvaluateCondition(hpkg
, "0 > 1");
987 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
989 r
= MsiEvaluateCondition(hpkg
, "0 ~> 1");
990 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
992 r
= MsiEvaluateCondition(hpkg
, "1 > 1");
993 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
995 r
= MsiEvaluateCondition(hpkg
, "1 ~> 1");
996 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
998 r
= MsiEvaluateCondition(hpkg
, "0 >= 1");
999 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1001 r
= MsiEvaluateCondition(hpkg
, "0 ~>= 1");
1002 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1004 r
= MsiEvaluateCondition(hpkg
, "1 >= 1");
1005 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1007 r
= MsiEvaluateCondition(hpkg
, "1 ~>= 1");
1008 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1010 r
= MsiEvaluateCondition(hpkg
, "0 < 1");
1011 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1013 r
= MsiEvaluateCondition(hpkg
, "0 ~< 1");
1014 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1016 r
= MsiEvaluateCondition(hpkg
, "1 < 1");
1017 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1019 r
= MsiEvaluateCondition(hpkg
, "1 ~< 1");
1020 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1022 r
= MsiEvaluateCondition(hpkg
, "0 <= 1");
1023 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1025 r
= MsiEvaluateCondition(hpkg
, "0 ~<= 1");
1026 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1028 r
= MsiEvaluateCondition(hpkg
, "1 <= 1");
1029 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1031 r
= MsiEvaluateCondition(hpkg
, "1 ~<= 1");
1032 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1034 r
= MsiEvaluateCondition(hpkg
, "0 >=");
1035 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1037 r
= MsiEvaluateCondition(hpkg
, " ");
1038 ok( r
== MSICONDITION_NONE
, "wrong return val\n");
1040 r
= MsiEvaluateCondition(hpkg
, "LicView <> \"1\"");
1041 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1043 r
= MsiEvaluateCondition(hpkg
, "LicView <> \"0\"");
1044 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1046 r
= MsiEvaluateCondition(hpkg
, "LicView <> LicView");
1047 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1049 r
= MsiEvaluateCondition(hpkg
, "not 0");
1050 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1052 r
= MsiEvaluateCondition(hpkg
, "not LicView");
1053 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1055 r
= MsiEvaluateCondition(hpkg
, "not \"A\"");
1056 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1058 r
= MsiEvaluateCondition(hpkg
, "~not \"A\"");
1059 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1061 r
= MsiEvaluateCondition(hpkg
, "\"0\"");
1062 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1064 r
= MsiEvaluateCondition(hpkg
, "1 and 2");
1065 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1067 r
= MsiEvaluateCondition(hpkg
, "not 0 and 3");
1068 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1070 r
= MsiEvaluateCondition(hpkg
, "not 0 and 0");
1071 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1073 r
= MsiEvaluateCondition(hpkg
, "not 0 or 1");
1074 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1076 r
= MsiEvaluateCondition(hpkg
, "(0)");
1077 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1079 r
= MsiEvaluateCondition(hpkg
, "(((((1))))))");
1080 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1082 r
= MsiEvaluateCondition(hpkg
, "(((((1)))))");
1083 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1085 r
= MsiEvaluateCondition(hpkg
, " \"A\" < \"B\" ");
1086 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1088 r
= MsiEvaluateCondition(hpkg
, " \"A\" > \"B\" ");
1089 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1091 r
= MsiEvaluateCondition(hpkg
, " \"1\" > \"12\" ");
1092 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1094 r
= MsiEvaluateCondition(hpkg
, " \"100\" < \"21\" ");
1095 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1097 r
= MsiEvaluateCondition(hpkg
, "0 < > 0");
1098 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1100 r
= MsiEvaluateCondition(hpkg
, "(1<<1) == 2");
1101 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1103 r
= MsiEvaluateCondition(hpkg
, " \"A\" = \"a\" ");
1104 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1106 r
= MsiEvaluateCondition(hpkg
, " \"A\" ~ = \"a\" ");
1107 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1109 r
= MsiEvaluateCondition(hpkg
, " \"A\" ~= \"a\" ");
1110 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1112 r
= MsiEvaluateCondition(hpkg
, " \"A\" ~= 1 ");
1113 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1115 r
= MsiEvaluateCondition(hpkg
, " \"A\" = 1 ");
1116 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1118 r
= MsiEvaluateCondition(hpkg
, " 1 ~= 1 ");
1119 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1121 r
= MsiEvaluateCondition(hpkg
, " 1 ~= \"1\" ");
1122 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1124 r
= MsiEvaluateCondition(hpkg
, " 1 = \"1\" ");
1125 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1127 r
= MsiEvaluateCondition(hpkg
, " 0 = \"1\" ");
1128 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1130 r
= MsiEvaluateCondition(hpkg
, " 0 < \"100\" ");
1131 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1133 r
= MsiEvaluateCondition(hpkg
, " 100 > \"0\" ");
1134 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1136 r
= MsiEvaluateCondition(hpkg
, "1 XOR 1");
1137 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1139 r
= MsiEvaluateCondition(hpkg
, "1 IMP 1");
1140 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1142 r
= MsiEvaluateCondition(hpkg
, "1 IMP 0");
1143 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1145 r
= MsiEvaluateCondition(hpkg
, "0 IMP 0");
1146 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1148 r
= MsiEvaluateCondition(hpkg
, "0 EQV 0");
1149 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1151 r
= MsiEvaluateCondition(hpkg
, "0 EQV 1");
1152 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1154 r
= MsiEvaluateCondition(hpkg
, "1 IMP 1 OR 0");
1155 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1157 r
= MsiEvaluateCondition(hpkg
, "1 IMPL 1");
1158 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1160 r
= MsiEvaluateCondition(hpkg
, "\"ASFD\" >< \"S\" ");
1161 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1163 r
= MsiEvaluateCondition(hpkg
, "\"ASFD\" ~>< \"s\" ");
1164 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1166 r
= MsiEvaluateCondition(hpkg
, "\"ASFD\" ~>< \"\" ");
1167 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1169 r
= MsiEvaluateCondition(hpkg
, "\"ASFD\" ~>< \"sss\" ");
1170 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1172 MsiSetProperty(hpkg
, "mm", "5" );
1174 r
= MsiEvaluateCondition(hpkg
, "mm = 5");
1175 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1177 r
= MsiEvaluateCondition(hpkg
, "mm < 6");
1178 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1180 r
= MsiEvaluateCondition(hpkg
, "mm <= 5");
1181 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1183 r
= MsiEvaluateCondition(hpkg
, "mm > 4");
1184 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1186 r
= MsiEvaluateCondition(hpkg
, "mm < 12");
1187 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1189 r
= MsiEvaluateCondition(hpkg
, "mm = \"5\"");
1190 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1192 r
= MsiEvaluateCondition(hpkg
, "0 = \"\"");
1193 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1195 r
= MsiEvaluateCondition(hpkg
, "0 AND \"\"");
1196 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1198 r
= MsiEvaluateCondition(hpkg
, "1 AND \"\"");
1199 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1201 r
= MsiEvaluateCondition(hpkg
, "1 AND \"1\"");
1202 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1204 r
= MsiEvaluateCondition(hpkg
, "3 >< 1");
1205 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1207 r
= MsiEvaluateCondition(hpkg
, "3 >< 4");
1208 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1210 r
= MsiEvaluateCondition(hpkg
, "NOT 0 AND 0");
1211 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1213 r
= MsiEvaluateCondition(hpkg
, "NOT 0 AND 1");
1214 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1216 r
= MsiEvaluateCondition(hpkg
, "NOT 1 OR 0");
1217 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1219 r
= MsiEvaluateCondition(hpkg
, "0 AND 1 OR 1");
1220 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1222 r
= MsiEvaluateCondition(hpkg
, "0 AND 0 OR 1");
1223 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1225 r
= MsiEvaluateCondition(hpkg
, "NOT 0 AND 1 OR 0");
1226 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1228 r
= MsiEvaluateCondition(hpkg
, "_1 = _1");
1229 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1231 r
= MsiEvaluateCondition(hpkg
, "( 1 AND 1 ) = 2");
1232 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1234 r
= MsiEvaluateCondition(hpkg
, "NOT ( 1 AND 1 )");
1235 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1237 r
= MsiEvaluateCondition(hpkg
, "NOT A AND (BBBBBBBBBB=2 OR CCC=1) AND Ddddddddd");
1238 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1240 r
= MsiEvaluateCondition(hpkg
, "Installed<>\"\"");
1241 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1243 r
= MsiEvaluateCondition(hpkg
, "NOT 1 AND 0");
1244 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1246 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1247 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1249 r
= MsiEvaluateCondition(hpkg
, "bandalmael<>0");
1250 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1252 r
= MsiEvaluateCondition(hpkg
, "bandalmael<0");
1253 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1255 r
= MsiEvaluateCondition(hpkg
, "bandalmael>0");
1256 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1258 r
= MsiEvaluateCondition(hpkg
, "bandalmael>=0");
1259 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1261 r
= MsiEvaluateCondition(hpkg
, "bandalmael<=0");
1262 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1264 r
= MsiEvaluateCondition(hpkg
, "bandalmael~<>0");
1265 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1267 MsiSetProperty(hpkg
, "bandalmael", "0" );
1268 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1269 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1271 MsiSetProperty(hpkg
, "bandalmael", "" );
1272 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1273 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1275 MsiSetProperty(hpkg
, "bandalmael", "asdf" );
1276 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1277 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1279 MsiSetProperty(hpkg
, "bandalmael", "0asdf" );
1280 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1281 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1283 MsiSetProperty(hpkg
, "bandalmael", "0 " );
1284 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1285 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1287 MsiSetProperty(hpkg
, "bandalmael", "-0" );
1288 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1289 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1291 MsiSetProperty(hpkg
, "bandalmael", "0000000000000" );
1292 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1293 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1295 MsiSetProperty(hpkg
, "bandalmael", "--0" );
1296 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1297 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1299 MsiSetProperty(hpkg
, "bandalmael", "0x00" );
1300 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1301 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1303 MsiSetProperty(hpkg
, "bandalmael", "-" );
1304 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1305 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1307 MsiSetProperty(hpkg
, "bandalmael", "+0" );
1308 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1309 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1311 MsiSetProperty(hpkg
, "bandalmael", "0.0" );
1312 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1313 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1314 r
= MsiEvaluateCondition(hpkg
, "bandalmael<>0");
1315 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1317 MsiSetProperty(hpkg
, "one", "hi");
1318 MsiSetProperty(hpkg
, "two", "hithere");
1319 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1320 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1322 MsiSetProperty(hpkg
, "one", "hithere");
1323 MsiSetProperty(hpkg
, "two", "hi");
1324 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1325 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1327 MsiSetProperty(hpkg
, "one", "hello");
1328 MsiSetProperty(hpkg
, "two", "hi");
1329 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1330 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1332 MsiSetProperty(hpkg
, "one", "hellohithere");
1333 MsiSetProperty(hpkg
, "two", "hi");
1334 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1335 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1337 MsiSetProperty(hpkg
, "one", "");
1338 MsiSetProperty(hpkg
, "two", "hi");
1339 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1340 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1342 MsiSetProperty(hpkg
, "one", "hi");
1343 MsiSetProperty(hpkg
, "two", "");
1344 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1345 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1347 MsiSetProperty(hpkg
, "one", "");
1348 MsiSetProperty(hpkg
, "two", "");
1349 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1350 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1352 MsiSetProperty(hpkg
, "one", "1234");
1353 MsiSetProperty(hpkg
, "two", "1");
1354 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1355 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1357 MsiSetProperty(hpkg
, "one", "one 1234");
1358 MsiSetProperty(hpkg
, "two", "1");
1359 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1360 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1362 MsiSetProperty(hpkg
, "one", "hithere");
1363 MsiSetProperty(hpkg
, "two", "hi");
1364 r
= MsiEvaluateCondition(hpkg
, "one << two");
1365 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1367 MsiSetProperty(hpkg
, "one", "hi");
1368 MsiSetProperty(hpkg
, "two", "hithere");
1369 r
= MsiEvaluateCondition(hpkg
, "one << two");
1370 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1372 MsiSetProperty(hpkg
, "one", "hi");
1373 MsiSetProperty(hpkg
, "two", "hi");
1374 r
= MsiEvaluateCondition(hpkg
, "one << two");
1375 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1377 MsiSetProperty(hpkg
, "one", "abcdhithere");
1378 MsiSetProperty(hpkg
, "two", "hi");
1379 r
= MsiEvaluateCondition(hpkg
, "one << two");
1380 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1382 MsiSetProperty(hpkg
, "one", "");
1383 MsiSetProperty(hpkg
, "two", "hi");
1384 r
= MsiEvaluateCondition(hpkg
, "one << two");
1385 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1387 MsiSetProperty(hpkg
, "one", "hithere");
1388 MsiSetProperty(hpkg
, "two", "");
1389 r
= MsiEvaluateCondition(hpkg
, "one << two");
1390 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1392 MsiSetProperty(hpkg
, "one", "");
1393 MsiSetProperty(hpkg
, "two", "");
1394 r
= MsiEvaluateCondition(hpkg
, "one << two");
1395 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1397 MsiSetProperty(hpkg
, "one", "1234");
1398 MsiSetProperty(hpkg
, "two", "1");
1399 r
= MsiEvaluateCondition(hpkg
, "one << two");
1400 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1402 MsiSetProperty(hpkg
, "one", "1234 one");
1403 MsiSetProperty(hpkg
, "two", "1");
1404 r
= MsiEvaluateCondition(hpkg
, "one << two");
1405 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1407 MsiSetProperty(hpkg
, "one", "hithere");
1408 MsiSetProperty(hpkg
, "two", "there");
1409 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1410 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1412 MsiSetProperty(hpkg
, "one", "hithere");
1413 MsiSetProperty(hpkg
, "two", "hi");
1414 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1415 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1417 MsiSetProperty(hpkg
, "one", "there");
1418 MsiSetProperty(hpkg
, "two", "hithere");
1419 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1420 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1422 MsiSetProperty(hpkg
, "one", "there");
1423 MsiSetProperty(hpkg
, "two", "there");
1424 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1425 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1427 MsiSetProperty(hpkg
, "one", "abcdhithere");
1428 MsiSetProperty(hpkg
, "two", "hi");
1429 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1430 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1432 MsiSetProperty(hpkg
, "one", "");
1433 MsiSetProperty(hpkg
, "two", "there");
1434 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1435 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1437 MsiSetProperty(hpkg
, "one", "there");
1438 MsiSetProperty(hpkg
, "two", "");
1439 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1440 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1442 MsiSetProperty(hpkg
, "one", "");
1443 MsiSetProperty(hpkg
, "two", "");
1444 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1445 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1447 MsiSetProperty(hpkg
, "one", "1234");
1448 MsiSetProperty(hpkg
, "two", "4");
1449 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1450 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1452 MsiSetProperty(hpkg
, "one", "one 1234");
1453 MsiSetProperty(hpkg
, "two", "4");
1454 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1455 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1457 MsiSetProperty(hpkg
, "MsiNetAssemblySupport", NULL
); /* make sure it's empty */
1459 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322\"");
1460 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1462 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport > \"1.1.4322\"");
1463 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1465 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport >= \"1.1.4322\"");
1466 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1468 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport <= \"1.1.4322\"");
1469 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1471 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport <> \"1.1.4322\"");
1472 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1474 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport ~< \"1.1.4322\"");
1475 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1477 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"abcd\"");
1478 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1480 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a1.1.4322\"");
1481 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1483 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322a\"");
1484 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1486 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"0000001.1.4322\"");
1487 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1489 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322.1\"");
1490 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1492 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322.1.1\"");
1493 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1495 r
= MsiEvaluateCondition(hpkg
, "\"2\" < \"1.1");
1496 ok( r
== MSICONDITION_ERROR
, "wrong return val (%d)\n", r
);
1498 r
= MsiEvaluateCondition(hpkg
, "\"2\" < \"1.1\"");
1499 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1501 r
= MsiEvaluateCondition(hpkg
, "\"2\" < \"12.1\"");
1502 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1504 r
= MsiEvaluateCondition(hpkg
, "\"02.1\" < \"2.11\"");
1505 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1507 r
= MsiEvaluateCondition(hpkg
, "\"02.1.1\" < \"2.1\"");
1508 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1510 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1\"");
1511 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1513 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1\"");
1514 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1516 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"0\"");
1517 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1519 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"-1\"");
1520 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1522 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a\"");
1523 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1525 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"!\"");
1526 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1528 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"!\"");
1529 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1531 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"/\"");
1532 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1534 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \" \"");
1535 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1537 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"azAZ_\"");
1538 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1540 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a[a]\"");
1541 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1543 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a[a]a\"");
1544 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1546 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"[a]\"");
1547 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1549 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"[a]a\"");
1550 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1552 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"{a}\"");
1553 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1555 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"{a\"");
1556 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1558 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"[a\"");
1559 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1561 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a{\"");
1562 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1564 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a]\"");
1565 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1567 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"A\"");
1568 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1570 MsiSetProperty(hpkg
, "MsiNetAssemblySupport", "1.1.4322");
1571 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322\"");
1572 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1574 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.14322\"");
1575 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1577 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.5\"");
1578 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1580 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1\"");
1581 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1583 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1\"");
1584 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1586 MsiSetProperty(hpkg
, "one", "1");
1587 r
= MsiEvaluateCondition(hpkg
, "one < \"1\"");
1588 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1590 MsiSetProperty(hpkg
, "X", "5.0");
1592 r
= MsiEvaluateCondition(hpkg
, "X != \"\"");
1593 ok( r
== MSICONDITION_ERROR
, "wrong return val (%d)\n", r
);
1595 r
= MsiEvaluateCondition(hpkg
, "X =\"5.0\"");
1596 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1598 r
= MsiEvaluateCondition(hpkg
, "X =\"5.1\"");
1599 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1601 r
= MsiEvaluateCondition(hpkg
, "X =\"6.0\"");
1602 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1604 r
= MsiEvaluateCondition(hpkg
, "X =\"5.0\" or X =\"5.1\" or X =\"6.0\"");
1605 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1607 r
= MsiEvaluateCondition(hpkg
, "(X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1608 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1610 r
= MsiEvaluateCondition(hpkg
, "X !=\"\" and (X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1611 ok( r
== MSICONDITION_ERROR
, "wrong return val (%d)\n", r
);
1613 /* feature doesn't exist */
1614 r
= MsiEvaluateCondition(hpkg
, "&nofeature");
1615 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1617 MsiSetProperty(hpkg
, "A", "2");
1618 MsiSetProperty(hpkg
, "X", "50");
1620 r
= MsiEvaluateCondition(hpkg
, "2 <= X");
1621 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1623 r
= MsiEvaluateCondition(hpkg
, "A <= X");
1624 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1626 r
= MsiEvaluateCondition(hpkg
, "A <= 50");
1627 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1629 MsiSetProperty(hpkg
, "X", "50val");
1631 r
= MsiEvaluateCondition(hpkg
, "2 <= X");
1632 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1634 r
= MsiEvaluateCondition(hpkg
, "A <= X");
1635 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1637 MsiSetProperty(hpkg
, "A", "7");
1638 MsiSetProperty(hpkg
, "X", "50");
1640 r
= MsiEvaluateCondition(hpkg
, "7 <= X");
1641 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1643 r
= MsiEvaluateCondition(hpkg
, "A <= X");
1644 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1646 r
= MsiEvaluateCondition(hpkg
, "A <= 50");
1647 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1649 MsiSetProperty(hpkg
, "X", "50val");
1651 r
= MsiEvaluateCondition(hpkg
, "2 <= X");
1652 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1654 r
= MsiEvaluateCondition(hpkg
, "A <= X");
1655 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1657 MsiCloseHandle( hpkg
);
1658 DeleteFile(msifile
);
1661 static BOOL
check_prop_empty( MSIHANDLE hpkg
, const char * prop
)
1669 r
= MsiGetProperty( hpkg
, prop
, buffer
, &sz
);
1670 return r
== ERROR_SUCCESS
&& buffer
[0] == 0 && sz
== 0;
1673 static void test_props(void)
1675 MSIHANDLE hpkg
, hdb
;
1680 hdb
= create_package_db();
1682 "CREATE TABLE `Property` ( "
1683 "`Property` CHAR(255) NOT NULL, "
1684 "`Value` CHAR(255) "
1685 "PRIMARY KEY `Property`)" );
1686 ok( r
== ERROR_SUCCESS
, "Failed\n" );
1689 "INSERT INTO `Property` "
1690 "(`Property`, `Value`) "
1691 "VALUES( 'MetadataCompName', 'Photoshop.dll' )");
1692 ok( r
== ERROR_SUCCESS
, "Failed\n" );
1694 hpkg
= package_from_db( hdb
);
1695 ok( hpkg
, "failed to create package\n");
1697 /* test invalid values */
1698 r
= MsiGetProperty( 0, NULL
, NULL
, NULL
);
1699 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
1701 r
= MsiGetProperty( hpkg
, NULL
, NULL
, NULL
);
1702 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
1704 r
= MsiGetProperty( hpkg
, "boo", NULL
, NULL
);
1705 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1707 r
= MsiGetProperty( hpkg
, "boo", buffer
, NULL
);
1708 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
1710 /* test retrieving an empty/nonexistent property */
1712 r
= MsiGetProperty( hpkg
, "boo", NULL
, &sz
);
1713 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1714 ok( sz
== 0, "wrong size returned\n");
1716 check_prop_empty( hpkg
, "boo");
1719 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1720 ok( r
== ERROR_MORE_DATA
, "wrong return val\n");
1721 ok( !strcmp(buffer
,"x"), "buffer was changed\n");
1722 ok( sz
== 0, "wrong size returned\n");
1726 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1727 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1728 ok( buffer
[0] == 0, "buffer was not changed\n");
1729 ok( sz
== 0, "wrong size returned\n");
1731 /* set the property to something */
1732 r
= MsiSetProperty( 0, NULL
, NULL
);
1733 ok( r
== ERROR_INVALID_HANDLE
, "wrong return val\n");
1735 r
= MsiSetProperty( hpkg
, NULL
, NULL
);
1736 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
1738 r
= MsiSetProperty( hpkg
, "", NULL
);
1739 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1741 /* try set and get some illegal property identifiers */
1742 r
= MsiSetProperty( hpkg
, "", "asdf" );
1743 ok( r
== ERROR_FUNCTION_FAILED
, "wrong return val\n");
1745 r
= MsiSetProperty( hpkg
, "=", "asdf" );
1746 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1748 r
= MsiSetProperty( hpkg
, " ", "asdf" );
1749 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1751 r
= MsiSetProperty( hpkg
, "'", "asdf" );
1752 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1756 r
= MsiGetProperty( hpkg
, "'", buffer
, &sz
);
1757 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1758 ok( !strcmp(buffer
,"asdf"), "buffer was not changed\n");
1760 /* set empty values */
1761 r
= MsiSetProperty( hpkg
, "boo", NULL
);
1762 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1763 ok( check_prop_empty( hpkg
, "boo"), "prop wasn't empty\n");
1765 r
= MsiSetProperty( hpkg
, "boo", "" );
1766 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1767 ok( check_prop_empty( hpkg
, "boo"), "prop wasn't empty\n");
1769 /* set a non-empty value */
1770 r
= MsiSetProperty( hpkg
, "boo", "xyz" );
1771 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1775 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1776 ok( r
== ERROR_MORE_DATA
, "wrong return val\n");
1777 ok( buffer
[0] == 0, "buffer was not changed\n");
1778 ok( sz
== 3, "wrong size returned\n");
1782 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1783 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1784 ok( !strcmp(buffer
,"xyz"), "buffer was not changed\n");
1785 ok( sz
== 3, "wrong size returned\n");
1789 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1790 ok( r
== ERROR_MORE_DATA
, "wrong return val\n");
1791 ok( !strcmp(buffer
,"xy"), "buffer was not changed\n");
1792 ok( sz
== 3, "wrong size returned\n");
1794 r
= MsiSetProperty(hpkg
, "SourceDir", "foo");
1795 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1798 r
= MsiGetProperty(hpkg
, "SOURCEDIR", buffer
, &sz
);
1799 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1800 ok( !strcmp(buffer
,""), "buffer wrong\n");
1801 ok( sz
== 0, "wrong size returned\n");
1804 r
= MsiGetProperty(hpkg
, "SOMERANDOMNAME", buffer
, &sz
);
1805 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1806 ok( !strcmp(buffer
,""), "buffer wrong\n");
1807 ok( sz
== 0, "wrong size returned\n");
1810 r
= MsiGetProperty(hpkg
, "SourceDir", buffer
, &sz
);
1811 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1812 ok( !strcmp(buffer
,"foo"), "buffer wrong\n");
1813 ok( sz
== 3, "wrong size returned\n");
1815 r
= MsiSetProperty(hpkg
, "MetadataCompName", "Photoshop.dll");
1816 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1819 r
= MsiGetProperty(hpkg
, "MetadataCompName", NULL
, &sz
);
1820 ok( r
== ERROR_SUCCESS
, "return wrong\n");
1821 ok( sz
== 13, "size wrong (%d)\n", sz
);
1824 r
= MsiGetProperty(hpkg
, "MetadataCompName", buffer
, &sz
);
1825 ok( r
== ERROR_MORE_DATA
, "return wrong\n");
1826 ok( !strcmp(buffer
,"Photoshop.dl"), "buffer wrong\n");
1828 r
= MsiSetProperty(hpkg
, "property", "value");
1829 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1832 r
= MsiGetProperty(hpkg
, "property", buffer
, &sz
);
1833 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1834 ok( !strcmp(buffer
, "value"), "Expected value, got %s\n", buffer
);
1836 r
= MsiSetProperty(hpkg
, "property", NULL
);
1837 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1840 r
= MsiGetProperty(hpkg
, "property", buffer
, &sz
);
1841 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1842 ok( !strlen(buffer
), "Expected empty string, got %s\n", buffer
);
1844 MsiCloseHandle( hpkg
);
1845 DeleteFile(msifile
);
1848 static BOOL
find_prop_in_property(MSIHANDLE hdb
, LPCSTR prop
, LPCSTR val
)
1850 MSIHANDLE hview
, hrec
;
1852 CHAR buffer
[MAX_PATH
];
1856 r
= MsiDatabaseOpenView(hdb
, "SELECT * FROM `_Property`", &hview
);
1857 ok(r
== ERROR_SUCCESS
, "MsiDatabaseOpenView failed\n");
1858 r
= MsiViewExecute(hview
, 0);
1859 ok(r
== ERROR_SUCCESS
, "MsiViewExecute failed\n");
1862 while (r
== ERROR_SUCCESS
&& !found
)
1864 r
= MsiViewFetch(hview
, &hrec
);
1865 if (r
!= ERROR_SUCCESS
) break;
1868 r
= MsiRecordGetString(hrec
, 1, buffer
, &sz
);
1869 if (r
== ERROR_SUCCESS
&& !lstrcmpA(buffer
, prop
))
1872 r
= MsiRecordGetString(hrec
, 2, buffer
, &sz
);
1873 if (r
== ERROR_SUCCESS
&& !lstrcmpA(buffer
, val
))
1877 MsiCloseHandle(hrec
);
1880 MsiViewClose(hview
);
1881 MsiCloseHandle(hview
);
1886 static void test_property_table(void)
1890 MSIHANDLE hpkg
, hdb
, hrec
;
1891 char buffer
[MAX_PATH
];
1895 hdb
= create_package_db();
1896 ok( hdb
, "failed to create package\n");
1898 hpkg
= package_from_db(hdb
);
1899 ok( hpkg
, "failed to create package\n");
1901 MsiCloseHandle(hdb
);
1903 hdb
= MsiGetActiveDatabase(hpkg
);
1905 query
= "CREATE TABLE `_Property` ( "
1906 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
1907 r
= run_query(hdb
, query
);
1908 ok(r
== ERROR_BAD_QUERY_SYNTAX
, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r
);
1910 MsiCloseHandle(hdb
);
1911 MsiCloseHandle(hpkg
);
1912 DeleteFile(msifile
);
1914 hdb
= create_package_db();
1915 ok( hdb
, "failed to create package\n");
1917 query
= "CREATE TABLE `_Property` ( "
1918 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
1919 r
= run_query(hdb
, query
);
1920 ok(r
== ERROR_SUCCESS
, "failed to create table\n");
1922 query
= "ALTER `_Property` ADD `foo` INTEGER";
1923 r
= run_query(hdb
, query
);
1924 ok(r
== ERROR_BAD_QUERY_SYNTAX
, "failed to add column\n");
1926 query
= "ALTER TABLE `_Property` ADD `foo` INTEGER";
1927 r
= run_query(hdb
, query
);
1928 ok(r
== ERROR_BAD_QUERY_SYNTAX
, "failed to add column\n");
1930 query
= "ALTER TABLE `_Property` ADD `extra` INTEGER";
1931 r
= run_query(hdb
, query
);
1932 ok(r
== ERROR_SUCCESS
, "failed to add column\n");
1934 hpkg
= package_from_db(hdb
);
1937 ok(!hpkg
, "package should not be created\n");
1940 MsiCloseHandle(hdb
);
1941 MsiCloseHandle(hpkg
);
1942 DeleteFile(msifile
);
1944 hdb
= create_package_db();
1945 ok (hdb
, "failed to create package database\n");
1947 r
= create_property_table(hdb
);
1948 ok(r
== ERROR_SUCCESS
, "cannot create Property table: %d\n", r
);
1950 r
= add_property_entry(hdb
, "'prop', 'val'");
1951 ok(r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
1953 hpkg
= package_from_db(hdb
);
1954 ok(hpkg
, "failed to create package\n");
1956 MsiCloseHandle(hdb
);
1959 r
= MsiGetProperty(hpkg
, "prop", buffer
, &sz
);
1960 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1961 ok(!lstrcmp(buffer
, "val"), "Expected val, got %s\n", buffer
);
1963 hdb
= MsiGetActiveDatabase(hpkg
);
1965 found
= find_prop_in_property(hdb
, "prop", "val");
1966 ok(found
, "prop should be in the _Property table\n");
1968 r
= add_property_entry(hdb
, "'dantes', 'mercedes'");
1969 ok(r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
1971 query
= "SELECT * FROM `_Property` WHERE `Property` = 'dantes'";
1972 r
= do_query(hdb
, query
, &hrec
);
1973 ok(r
== ERROR_BAD_QUERY_SYNTAX
, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r
);
1975 found
= find_prop_in_property(hdb
, "dantes", "mercedes");
1976 ok(found
== FALSE
, "dantes should not be in the _Property table\n");
1979 lstrcpy(buffer
, "aaa");
1980 r
= MsiGetProperty(hpkg
, "dantes", buffer
, &sz
);
1981 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1982 ok(lstrlenA(buffer
) == 0, "Expected empty string, got %s\n", buffer
);
1984 r
= MsiSetProperty(hpkg
, "dantes", "mercedes");
1985 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1987 found
= find_prop_in_property(hdb
, "dantes", "mercedes");
1988 ok(found
== TRUE
, "dantes should be in the _Property table\n");
1990 MsiCloseHandle(hdb
);
1991 MsiCloseHandle(hpkg
);
1992 DeleteFile(msifile
);
1995 static UINT
try_query_param( MSIHANDLE hdb
, LPCSTR szQuery
, MSIHANDLE hrec
)
2000 res
= MsiDatabaseOpenView( hdb
, szQuery
, &htab
);
2001 if( res
== ERROR_SUCCESS
)
2005 r
= MsiViewExecute( htab
, hrec
);
2006 if( r
!= ERROR_SUCCESS
)
2009 fprintf(stderr
,"MsiViewExecute failed %08x\n", res
);
2012 r
= MsiViewClose( htab
);
2013 if( r
!= ERROR_SUCCESS
)
2016 r
= MsiCloseHandle( htab
);
2017 if( r
!= ERROR_SUCCESS
)
2023 static UINT
try_query( MSIHANDLE hdb
, LPCSTR szQuery
)
2025 return try_query_param( hdb
, szQuery
, 0 );
2028 static void set_summary_str(MSIHANDLE hdb
, DWORD pid
, LPCSTR value
)
2033 r
= MsiGetSummaryInformationA(hdb
, NULL
, 1, &summary
);
2034 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2036 r
= MsiSummaryInfoSetPropertyA(summary
, pid
, VT_LPSTR
, 0, NULL
, value
);
2037 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
2039 r
= MsiSummaryInfoPersist(summary
);
2040 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
2042 MsiCloseHandle(summary
);
2045 static void set_summary_dword(MSIHANDLE hdb
, DWORD pid
, DWORD value
)
2050 r
= MsiGetSummaryInformationA(hdb
, NULL
, 1, &summary
);
2051 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2053 r
= MsiSummaryInfoSetPropertyA(summary
, pid
, VT_I4
, value
, NULL
, NULL
);
2054 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
2056 r
= MsiSummaryInfoPersist(summary
);
2057 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
2059 MsiCloseHandle(summary
);
2062 static void test_msipackage(void)
2064 MSIHANDLE hdb
= 0, hpack
= 100;
2069 /* NULL szPackagePath */
2070 r
= MsiOpenPackage(NULL
, &hpack
);
2071 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2073 /* empty szPackagePath */
2074 r
= MsiOpenPackage("", &hpack
);
2077 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2080 if (r
== ERROR_SUCCESS
)
2081 MsiCloseHandle(hpack
);
2083 /* nonexistent szPackagePath */
2084 r
= MsiOpenPackage("nonexistent", &hpack
);
2085 ok(r
== ERROR_FILE_NOT_FOUND
, "Expected ERROR_FILE_NOT_FOUND, got %d\n", r
);
2088 r
= MsiOpenPackage(msifile
, NULL
);
2089 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2093 r
= MsiOpenPackage(name
, &hpack
);
2094 ok(r
== ERROR_INVALID_HANDLE
, "Expected ERROR_INVALID_HANDLE, got %d\n", r
);
2096 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_CREATE
, &hdb
);
2097 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2099 /* database exists, but is emtpy */
2100 sprintf(name
, "#%ld", hdb
);
2101 r
= MsiOpenPackage(name
, &hpack
);
2102 ok(r
== ERROR_INSTALL_PACKAGE_INVALID
,
2103 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r
);
2105 query
= "CREATE TABLE `Property` ( "
2106 "`Property` CHAR(72), `Value` CHAR(0) "
2107 "PRIMARY KEY `Property`)";
2108 r
= try_query(hdb
, query
);
2109 ok(r
== ERROR_SUCCESS
, "failed to create Properties table\n");
2111 query
= "CREATE TABLE `InstallExecuteSequence` ("
2112 "`Action` CHAR(72), `Condition` CHAR(0), `Sequence` INTEGER "
2113 "PRIMARY KEY `Action`)";
2114 r
= try_query(hdb
, query
);
2115 ok(r
== ERROR_SUCCESS
, "failed to create InstallExecuteSequence table\n");
2117 /* a few key tables exist */
2118 sprintf(name
, "#%ld", hdb
);
2119 r
= MsiOpenPackage(name
, &hpack
);
2120 ok(r
== ERROR_INSTALL_PACKAGE_INVALID
,
2121 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r
);
2123 MsiCloseHandle(hdb
);
2124 DeleteFile(msifile
);
2126 /* start with a clean database to show what constitutes a valid package */
2127 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_CREATE
, &hdb
);
2128 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2130 sprintf(name
, "#%ld", hdb
);
2132 /* The following summary information props must exist:
2137 set_summary_dword(hdb
, PID_PAGECOUNT
, 100);
2138 r
= MsiOpenPackage(name
, &hpack
);
2139 ok(r
== ERROR_INSTALL_PACKAGE_INVALID
,
2140 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r
);
2142 set_summary_str(hdb
, PID_REVNUMBER
, "{004757CD-5092-49c2-AD20-28E1CE0DF5F2}");
2143 r
= MsiOpenPackage(name
, &hpack
);
2144 ok(r
== ERROR_SUCCESS
,
2145 "Expected ERROR_SUCCESS, got %d\n", r
);
2147 MsiCloseHandle(hpack
);
2148 MsiCloseHandle(hdb
);
2149 DeleteFile(msifile
);
2152 static void test_formatrecord2(void)
2154 MSIHANDLE hpkg
, hrec
;
2159 hpkg
= package_from_db(create_package_db());
2160 ok( hpkg
, "failed to create package\n");
2162 r
= MsiSetProperty(hpkg
, "Manufacturer", " " );
2163 ok( r
== ERROR_SUCCESS
, "set property failed\n");
2165 hrec
= MsiCreateRecord(2);
2166 ok(hrec
, "create record failed\n");
2168 r
= MsiRecordSetString( hrec
, 0, "[ProgramFilesFolder][Manufacturer]\\asdf");
2169 ok( r
== ERROR_SUCCESS
, "format record failed\n");
2173 r
= MsiFormatRecord( hpkg
, hrec
, buffer
, &sz
);
2175 r
= MsiRecordSetString(hrec
, 0, "[foo][1]");
2176 r
= MsiRecordSetString(hrec
, 1, "hoo");
2178 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2179 ok( sz
== 3, "size wrong\n");
2180 ok( 0 == strcmp(buffer
,"hoo"), "wrong output %s\n",buffer
);
2181 ok( r
== ERROR_SUCCESS
, "format failed\n");
2183 r
= MsiRecordSetString(hrec
, 0, "x[~]x");
2185 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2186 ok( sz
== 3, "size wrong\n");
2187 ok( 0 == strcmp(buffer
,"x"), "wrong output %s\n",buffer
);
2188 ok( r
== ERROR_SUCCESS
, "format failed\n");
2190 r
= MsiRecordSetString(hrec
, 0, "[foo.$%}][1]");
2191 r
= MsiRecordSetString(hrec
, 1, "hoo");
2193 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2194 ok( sz
== 3, "size wrong\n");
2195 ok( 0 == strcmp(buffer
,"hoo"), "wrong output %s\n",buffer
);
2196 ok( r
== ERROR_SUCCESS
, "format failed\n");
2198 r
= MsiRecordSetString(hrec
, 0, "[\\[]");
2200 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2201 ok( sz
== 1, "size wrong\n");
2202 ok( 0 == strcmp(buffer
,"["), "wrong output %s\n",buffer
);
2203 ok( r
== ERROR_SUCCESS
, "format failed\n");
2205 SetEnvironmentVariable("FOO", "BAR");
2206 r
= MsiRecordSetString(hrec
, 0, "[%FOO]");
2208 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2209 ok( sz
== 3, "size wrong\n");
2210 ok( 0 == strcmp(buffer
,"BAR"), "wrong output %s\n",buffer
);
2211 ok( r
== ERROR_SUCCESS
, "format failed\n");
2213 r
= MsiRecordSetString(hrec
, 0, "[[1]]");
2214 r
= MsiRecordSetString(hrec
, 1, "%FOO");
2216 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2217 ok( sz
== 3, "size wrong\n");
2218 ok( 0 == strcmp(buffer
,"BAR"), "wrong output %s\n",buffer
);
2219 ok( r
== ERROR_SUCCESS
, "format failed\n");
2221 MsiCloseHandle( hrec
);
2222 MsiCloseHandle( hpkg
);
2223 DeleteFile(msifile
);
2226 static void test_states(void)
2231 INSTALLSTATE state
, action
;
2233 static const CHAR msifile2
[] = "winetest2.msi";
2234 static const CHAR msifile3
[] = "winetest3.msi";
2236 hdb
= create_package_db();
2237 ok ( hdb
, "failed to create package database\n" );
2239 r
= add_directory_entry( hdb
, "'TARGETDIR', '', 'SourceDir'");
2240 ok( r
== ERROR_SUCCESS
, "cannot add directory: %d\n", r
);
2242 r
= create_property_table( hdb
);
2243 ok( r
== ERROR_SUCCESS
, "cannot create Property table: %d\n", r
);
2245 r
= add_property_entry( hdb
, "'ProductCode', '{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}'" );
2246 ok( r
== ERROR_SUCCESS
, "cannot add property entry: %d\n", r
);
2248 r
= add_property_entry( hdb
, "'ProductLanguage', '1033'" );
2249 ok( r
== ERROR_SUCCESS
, "cannot add property entry: %d\n", r
);
2251 r
= add_property_entry( hdb
, "'ProductName', 'MSITEST'" );
2252 ok( r
== ERROR_SUCCESS
, "cannot add property entry: %d\n", r
);
2254 r
= add_property_entry( hdb
, "'ProductVersion', '1.1.1'" );
2255 ok( r
== ERROR_SUCCESS
, "cannot add property entry: %d\n", r
);
2257 r
= create_install_execute_sequence_table( hdb
);
2258 ok( r
== ERROR_SUCCESS
, "cannot create InstallExecuteSequence table: %d\n", r
);
2260 r
= add_install_execute_sequence_entry( hdb
, "'CostInitialize', '', '800'" );
2261 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2263 r
= add_install_execute_sequence_entry( hdb
, "'FileCost', '', '900'" );
2264 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2266 r
= add_install_execute_sequence_entry( hdb
, "'CostFinalize', '', '1000'" );
2267 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2269 r
= add_install_execute_sequence_entry( hdb
, "'InstallValidate', '', '1400'" );
2270 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2272 r
= add_install_execute_sequence_entry( hdb
, "'InstallInitialize', '', '1500'" );
2273 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2275 r
= add_install_execute_sequence_entry( hdb
, "'ProcessComponents', '', '1600'" );
2276 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2278 r
= add_install_execute_sequence_entry( hdb
, "'UnpublishFeatures', '', '1800'" );
2279 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2281 r
= add_install_execute_sequence_entry( hdb
, "'RegisterProduct', '', '6100'" );
2282 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2284 r
= add_install_execute_sequence_entry( hdb
, "'PublishFeatures', '', '6300'" );
2285 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2287 r
= add_install_execute_sequence_entry( hdb
, "'PublishProduct', '', '6400'" );
2288 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2290 r
= add_install_execute_sequence_entry( hdb
, "'InstallFinalize', '', '6600'" );
2291 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2293 r
= create_media_table( hdb
);
2294 ok( r
== ERROR_SUCCESS
, "cannot create media table: %d\n", r
);
2296 r
= add_media_entry( hdb
, "'1', '3', '', '', 'DISK1', ''");
2297 ok( r
== ERROR_SUCCESS
, "cannot add media entry: %d\n", r
);
2299 r
= create_feature_table( hdb
);
2300 ok( r
== ERROR_SUCCESS
, "cannot create Feature table: %d\n", r
);
2302 r
= create_component_table( hdb
);
2303 ok( r
== ERROR_SUCCESS
, "cannot create Component table: %d\n", r
);
2305 /* msidbFeatureAttributesFavorLocal */
2306 r
= add_feature_entry( hdb
, "'one', '', '', '', 2, 1, '', 0" );
2307 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2309 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
2310 r
= add_component_entry( hdb
, "'alpha', '{467EC132-739D-4784-A37B-677AA43DBC94}', 'TARGETDIR', 0, '', 'alpha_file'" );
2311 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2313 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
2314 r
= add_component_entry( hdb
, "'beta', '{2C1F189C-24A6-4C34-B26B-994A6C026506}', 'TARGETDIR', 1, '', 'beta_file'" );
2315 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2317 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
2318 r
= add_component_entry( hdb
, "'gamma', '{C271E2A4-DE2E-4F70-86D1-6984AF7DE2CA}', 'TARGETDIR', 2, '', 'gamma_file'" );
2319 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2321 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSharedDllRefCount */
2322 r
= add_component_entry( hdb
, "'theta', '{4EB3129D-81A8-48D5-9801-75600FED3DD9}', 'TARGETDIR', 8, '', 'theta_file'" );
2323 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2325 /* msidbFeatureAttributesFavorSource */
2326 r
= add_feature_entry( hdb
, "'two', '', '', '', 2, 1, '', 1" );
2327 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2329 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
2330 r
= add_component_entry( hdb
, "'delta', '{938FD4F2-C648-4259-A03C-7AA3B45643F3}', 'TARGETDIR', 0, '', 'delta_file'" );
2331 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2333 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2334 r
= add_component_entry( hdb
, "'epsilon', '{D59713B6-C11D-47F2-A395-1E5321781190}', 'TARGETDIR', 1, '', 'epsilon_file'" );
2335 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2337 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
2338 r
= add_component_entry( hdb
, "'zeta', '{377D33AB-2FAA-42B9-A629-0C0DAE9B9C7A}', 'TARGETDIR', 2, '', 'zeta_file'" );
2339 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2341 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSharedDllRefCount */
2342 r
= add_component_entry( hdb
, "'iota', '{5D36F871-B5ED-4801-9E0F-C46B9E5C9669}', 'TARGETDIR', 8, '', 'iota_file'" );
2343 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2345 /* msidbFeatureAttributesFavorSource */
2346 r
= add_feature_entry( hdb
, "'three', '', '', '', 2, 1, '', 1" );
2347 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2349 /* msidbFeatureAttributesFavorLocal */
2350 r
= add_feature_entry( hdb
, "'four', '', '', '', 2, 1, '', 0" );
2351 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2354 r
= add_feature_entry( hdb
, "'five', '', '', '', 2, 0, '', 1" );
2355 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2357 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2358 r
= add_component_entry( hdb
, "'eta', '{DD89003F-0DD4-41B8-81C0-3411A7DA2695}', 'TARGETDIR', 1, '', 'eta_file'" );
2359 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2361 /* no feature parent:msidbComponentAttributesLocalOnly */
2362 r
= add_component_entry( hdb
, "'kappa', '{D6B93DC3-8DA5-4769-9888-42BFE156BB8B}', 'TARGETDIR', 1, '', 'kappa_file'" );
2363 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2365 /* msidbFeatureAttributesFavorLocal:removed */
2366 r
= add_feature_entry( hdb
, "'six', '', '', '', 2, 1, '', 0" );
2367 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2369 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesLocalOnly */
2370 r
= add_component_entry( hdb
, "'lambda', '{6528C5E4-02A4-4636-A214-7A66A6C35B64}', 'TARGETDIR', 0, '', 'lambda_file'" );
2371 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2373 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSourceOnly */
2374 r
= add_component_entry( hdb
, "'mu', '{97014BAB-6C56-4013-9A63-2BF913B42519}', 'TARGETDIR', 1, '', 'mu_file'" );
2375 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2377 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesOptional */
2378 r
= add_component_entry( hdb
, "'nu', '{943DD0D8-5808-4954-8526-3B8493FEDDCD}', 'TARGETDIR', 2, '', 'nu_file'" );
2379 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2381 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSharedDllRefCount */
2382 r
= add_component_entry( hdb
, "'xi', '{D6CF9EF7-6FCF-4930-B34B-F938AEFF9BDB}', 'TARGETDIR', 8, '', 'xi_file'" );
2383 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2385 /* msidbFeatureAttributesFavorSource:removed */
2386 r
= add_feature_entry( hdb
, "'seven', '', '', '', 2, 1, '', 1" );
2387 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2389 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesLocalOnly */
2390 r
= add_component_entry( hdb
, "'omicron', '{7B57521D-15DB-4141-9AA6-01D934A4433F}', 'TARGETDIR', 0, '', 'omicron_file'" );
2391 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2393 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSourceOnly */
2394 r
= add_component_entry( hdb
, "'pi', '{FB85346B-378E-4492-8769-792305471C81}', 'TARGETDIR', 1, '', 'pi_file'" );
2395 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2397 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesOptional */
2398 r
= add_component_entry( hdb
, "'rho', '{798F2047-7B0C-4783-8BB0-D703E554114B}', 'TARGETDIR', 2, '', 'rho_file'" );
2399 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2401 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSharedDllRefCount */
2402 r
= add_component_entry( hdb
, "'sigma', '{5CE9DDA8-B67B-4736-9D93-99D61C5B93E7}', 'TARGETDIR', 8, '', 'sigma_file'" );
2403 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2405 r
= create_feature_components_table( hdb
);
2406 ok( r
== ERROR_SUCCESS
, "cannot create FeatureComponents table: %d\n", r
);
2408 r
= add_feature_components_entry( hdb
, "'one', 'alpha'" );
2409 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2411 r
= add_feature_components_entry( hdb
, "'one', 'beta'" );
2412 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2414 r
= add_feature_components_entry( hdb
, "'one', 'gamma'" );
2415 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2417 r
= add_feature_components_entry( hdb
, "'one', 'theta'" );
2418 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2420 r
= add_feature_components_entry( hdb
, "'two', 'delta'" );
2421 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2423 r
= add_feature_components_entry( hdb
, "'two', 'epsilon'" );
2424 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2426 r
= add_feature_components_entry( hdb
, "'two', 'zeta'" );
2427 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2429 r
= add_feature_components_entry( hdb
, "'two', 'iota'" );
2430 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2432 r
= add_feature_components_entry( hdb
, "'three', 'eta'" );
2433 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2435 r
= add_feature_components_entry( hdb
, "'four', 'eta'" );
2436 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2438 r
= add_feature_components_entry( hdb
, "'five', 'eta'" );
2439 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2441 r
= add_feature_components_entry( hdb
, "'six', 'lambda'" );
2442 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2444 r
= add_feature_components_entry( hdb
, "'six', 'mu'" );
2445 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2447 r
= add_feature_components_entry( hdb
, "'six', 'nu'" );
2448 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2450 r
= add_feature_components_entry( hdb
, "'six', 'xi'" );
2451 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2453 r
= add_feature_components_entry( hdb
, "'seven', 'omicron'" );
2454 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2456 r
= add_feature_components_entry( hdb
, "'seven', 'pi'" );
2457 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2459 r
= add_feature_components_entry( hdb
, "'seven', 'rho'" );
2460 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2462 r
= add_feature_components_entry( hdb
, "'seven', 'sigma'" );
2463 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2465 r
= create_file_table( hdb
);
2466 ok( r
== ERROR_SUCCESS
, "cannot create File table: %d\n", r
);
2468 r
= add_file_entry( hdb
, "'alpha_file', 'alpha', 'alpha.txt', 100, '', '1033', 8192, 1" );
2469 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2471 r
= add_file_entry( hdb
, "'beta_file', 'beta', 'beta.txt', 0, '', '1033', 8192, 1" );
2472 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2474 r
= add_file_entry( hdb
, "'gamma_file', 'gamma', 'gamma.txt', 0, '', '1033', 8192, 1" );
2475 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2477 r
= add_file_entry( hdb
, "'theta_file', 'theta', 'theta.txt', 0, '', '1033', 8192, 1" );
2478 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2480 r
= add_file_entry( hdb
, "'delta_file', 'delta', 'delta.txt', 0, '', '1033', 8192, 1" );
2481 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2483 r
= add_file_entry( hdb
, "'epsilon_file', 'epsilon', 'epsilon.txt', 0, '', '1033', 8192, 1" );
2484 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2486 r
= add_file_entry( hdb
, "'zeta_file', 'zeta', 'zeta.txt', 0, '', '1033', 8192, 1" );
2487 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2489 r
= add_file_entry( hdb
, "'iota_file', 'iota', 'iota.txt', 0, '', '1033', 8192, 1" );
2490 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2492 /* compressed file */
2493 r
= add_file_entry( hdb
, "'eta_file', 'eta', 'eta.txt', 0, '', '1033', 16384, 1" );
2494 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2496 r
= add_file_entry( hdb
, "'kappa_file', 'kappa', 'kappa.txt', 0, '', '1033', 8192, 1" );
2497 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2499 r
= add_file_entry( hdb
, "'lambda_file', 'lambda', 'lambda.txt', 100, '', '1033', 8192, 1" );
2500 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2502 r
= add_file_entry( hdb
, "'mu_file', 'mu', 'mu.txt', 100, '', '1033', 8192, 1" );
2503 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2505 r
= add_file_entry( hdb
, "'nu_file', 'nu', 'nu.txt', 100, '', '1033', 8192, 1" );
2506 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2508 r
= add_file_entry( hdb
, "'xi_file', 'xi', 'xi.txt', 100, '', '1033', 8192, 1" );
2509 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2511 r
= add_file_entry( hdb
, "'omicron_file', 'omicron', 'omicron.txt', 100, '', '1033', 8192, 1" );
2512 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2514 r
= add_file_entry( hdb
, "'pi_file', 'pi', 'pi.txt', 100, '', '1033', 8192, 1" );
2515 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2517 r
= add_file_entry( hdb
, "'rho_file', 'rho', 'rho.txt', 100, '', '1033', 8192, 1" );
2518 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2520 r
= add_file_entry( hdb
, "'sigma_file', 'sigma', 'sigma.txt', 100, '', '1033', 8192, 1" );
2521 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2523 MsiDatabaseCommit(hdb
);
2525 /* these properties must not be in the saved msi file */
2526 r
= add_property_entry( hdb
, "'ADDLOCAL', 'one,four'");
2527 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
2529 r
= add_property_entry( hdb
, "'ADDSOURCE', 'two,three'");
2530 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
2532 r
= add_property_entry( hdb
, "'REMOVE', 'six,seven'");
2533 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
2535 hpkg
= package_from_db( hdb
);
2536 ok( hpkg
, "failed to create package\n");
2538 MsiCloseHandle(hdb
);
2540 CopyFileA(msifile
, msifile2
, FALSE
);
2541 CopyFileA(msifile
, msifile3
, FALSE
);
2545 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
2546 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2547 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2548 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2552 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
2553 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2554 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2555 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2559 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
2560 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2561 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2562 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2566 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
2567 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2568 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2569 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2573 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
2574 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2575 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2576 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2580 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
2581 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2582 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2583 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2587 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
2588 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2589 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2590 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2594 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
2595 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2596 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2597 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2601 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
2602 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2603 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2604 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2608 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
2609 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2610 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2611 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2615 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
2616 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2617 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2618 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2622 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
2623 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2624 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2625 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2629 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
2630 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2631 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2632 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2636 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
2637 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2638 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2639 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2643 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
2644 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2645 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2646 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2650 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
2651 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2652 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2653 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2657 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
2658 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2659 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2660 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2664 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
2665 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2666 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2667 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2671 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
2672 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2673 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2674 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2678 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
2679 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2680 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2681 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2685 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
2686 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2687 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2688 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2692 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
2693 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2694 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2695 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2699 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
2700 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2701 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2702 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2706 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
2707 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2708 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2709 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2713 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
2714 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2715 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2716 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2718 r
= MsiDoAction( hpkg
, "CostInitialize");
2719 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
2723 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
2724 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2725 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2726 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2730 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
2731 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2732 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2733 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2737 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
2738 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2739 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2740 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2744 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
2745 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2746 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2747 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2751 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
2752 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2753 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2754 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2758 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
2759 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2760 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2761 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2765 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
2766 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2767 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2768 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2772 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
2773 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2774 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2775 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2779 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
2780 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2781 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2782 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2786 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
2787 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2788 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2789 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2793 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
2794 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2795 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2796 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2800 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
2801 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2802 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2803 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2807 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
2808 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2809 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2810 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2814 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
2815 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2816 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2817 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2821 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
2822 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2823 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2824 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2828 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
2829 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2830 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2831 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2835 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
2836 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2837 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2838 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2842 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
2843 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2844 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2845 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2849 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
2850 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2851 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2852 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2856 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
2857 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2858 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2859 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2863 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
2864 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2865 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2866 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2870 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
2871 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2872 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2873 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2877 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
2878 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2879 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2880 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2884 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
2885 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2886 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2887 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2891 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
2892 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2893 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2894 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2896 r
= MsiDoAction( hpkg
, "FileCost");
2897 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
2901 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
2902 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2903 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2904 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2908 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
2909 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2910 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2911 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2915 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
2916 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2917 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2918 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2922 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
2923 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2924 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2925 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2929 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
2930 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2931 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2932 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2936 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
2937 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2938 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2939 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2943 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
2944 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2945 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2946 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2950 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
2951 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2952 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2953 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2957 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
2958 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2959 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2960 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2964 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
2965 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2966 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2967 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2971 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
2972 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2973 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2974 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2978 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
2979 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2980 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2981 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2985 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
2986 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2987 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2988 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2992 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
2993 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2994 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2995 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2999 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
3000 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3001 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3002 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3006 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
3007 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3008 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3009 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3013 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
3014 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3015 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3016 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3020 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
3021 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3022 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3023 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3027 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3028 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3029 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3030 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3034 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
3035 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3036 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3037 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3041 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
3042 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3043 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3044 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3048 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
3049 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3050 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3051 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3055 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
3056 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3057 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3058 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3062 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
3063 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3064 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3065 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3069 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
3070 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3071 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3072 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3074 r
= MsiDoAction( hpkg
, "CostFinalize");
3075 ok( r
== ERROR_SUCCESS
, "cost finalize failed: %d\n", r
);
3079 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3080 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3081 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3082 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3086 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
3087 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3088 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3089 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3093 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3094 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3095 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3096 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3100 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3101 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3102 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3103 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3107 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3108 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3109 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3110 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3114 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
3115 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3116 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3117 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3121 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
3122 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3123 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3124 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3128 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3129 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3130 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3131 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3135 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
3136 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3137 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3138 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3142 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
3143 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3144 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3145 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3149 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
3150 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3151 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3152 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3156 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
3157 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3158 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3159 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3163 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
3164 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3165 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3166 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3170 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
3171 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3172 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3173 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3177 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
3178 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3179 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3180 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3184 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
3185 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3186 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3187 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3191 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
3192 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3193 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3194 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3198 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
3199 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3200 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3201 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3205 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3206 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3207 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3208 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3212 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
3213 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3214 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3215 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3219 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
3220 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3221 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3222 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3226 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
3227 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3228 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3229 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3233 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
3234 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3235 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3236 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3240 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
3241 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3242 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3243 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3247 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
3248 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3249 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3250 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3252 MsiCloseHandle( hpkg
);
3254 /* publish the features and components */
3255 r
= MsiInstallProduct(msifile
, "ADDLOCAL=one,four ADDSOURCE=two,three REMOVE=six,seven");
3256 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3258 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_DIRECT
, &hdb
);
3259 ok(r
== ERROR_SUCCESS
, "failed to open database: %d\n", r
);
3261 /* these properties must not be in the saved msi file */
3262 r
= add_property_entry( hdb
, "'ADDLOCAL', 'one,four'");
3263 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
3265 r
= add_property_entry( hdb
, "'ADDSOURCE', 'two,three'");
3266 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
3268 r
= add_property_entry( hdb
, "'REMOVE', 'six,seven'");
3269 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
3271 hpkg
= package_from_db( hdb
);
3272 ok( hpkg
, "failed to create package\n");
3274 MsiCloseHandle(hdb
);
3278 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3279 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3280 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3281 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3285 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
3286 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3287 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3288 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3292 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3293 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3294 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3295 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3299 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3300 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3301 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3302 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3306 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3307 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3308 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3309 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3313 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
3314 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3315 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3316 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3320 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
3321 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3322 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3323 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3327 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3328 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3329 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3330 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3334 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
3335 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3336 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3337 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3341 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
3342 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3343 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3344 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3348 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
3349 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3350 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3351 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3355 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
3356 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3357 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3358 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3362 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
3363 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3364 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3365 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3369 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
3370 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3371 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3372 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3376 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
3377 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3378 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3379 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3383 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
3384 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3385 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3386 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3390 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
3391 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3392 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3393 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3397 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
3398 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3399 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3400 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3404 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3405 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3406 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3407 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3411 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
3412 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3413 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3414 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3418 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
3419 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3420 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3421 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3425 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
3426 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3427 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3428 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3432 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
3433 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3434 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3435 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3439 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
3440 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3441 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3442 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3446 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
3447 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3448 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3449 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3451 r
= MsiDoAction( hpkg
, "CostInitialize");
3452 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
3456 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3457 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3458 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3459 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3463 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
3464 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3465 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3466 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3470 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3471 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3472 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3473 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3477 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3478 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3479 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3480 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3484 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3485 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3486 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3487 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3491 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
3492 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3493 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3494 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3498 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
3499 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3500 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3501 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3505 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3506 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3507 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3508 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3512 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
3513 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3514 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3515 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3519 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
3520 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3521 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3522 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3526 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
3527 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3528 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3529 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3533 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
3534 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3535 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3536 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3540 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
3541 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3542 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3543 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3547 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
3548 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3549 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3550 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3554 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
3555 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3556 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3557 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3561 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
3562 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3563 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3564 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3568 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
3569 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3570 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3571 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3575 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
3576 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3577 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3578 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3582 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3583 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3584 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3585 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3589 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
3590 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3591 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3592 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3596 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
3597 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3598 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3599 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3603 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
3604 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3605 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3606 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3610 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
3611 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3612 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3613 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3617 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
3618 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3619 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3620 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3624 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
3625 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3626 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3627 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3629 r
= MsiDoAction( hpkg
, "FileCost");
3630 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
3634 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3635 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3636 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3637 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3641 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
3642 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3643 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3644 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3648 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3649 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3650 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3651 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3655 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3656 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3657 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3658 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3662 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3663 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3664 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3665 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3669 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
3670 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3671 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3672 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3676 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
3677 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3678 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3679 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3683 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3684 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3685 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3686 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3690 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
3691 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3692 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3693 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3697 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
3698 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3699 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3700 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3704 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
3705 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3706 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3707 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3711 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
3712 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3713 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3714 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3718 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
3719 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3720 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3721 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3725 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
3726 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3727 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3728 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3732 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
3733 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3734 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3735 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3739 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
3740 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3741 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3742 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3746 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
3747 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3748 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3749 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3753 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
3754 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3755 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3756 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3760 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3761 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3762 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3763 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3767 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
3768 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3769 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3770 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3774 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
3775 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3776 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3777 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3781 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
3782 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3783 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3784 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3788 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
3789 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3790 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3791 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3795 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
3796 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3797 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3798 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3802 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
3803 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3804 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3805 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3807 r
= MsiDoAction( hpkg
, "CostFinalize");
3808 ok( r
== ERROR_SUCCESS
, "cost finalize failed: %d\n", r
);
3812 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3813 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3814 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3815 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3819 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
3820 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3821 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3822 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3826 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3827 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3828 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3829 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3833 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3834 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3835 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3836 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3840 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3841 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3842 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3843 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3847 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
3848 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3849 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3850 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3854 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
3855 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3856 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3857 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3861 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3862 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3863 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3864 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3868 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
3869 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3870 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3871 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3875 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
3876 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3877 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3878 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3882 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
3883 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3884 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3885 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3889 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
3890 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3891 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3892 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3896 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
3897 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3898 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3899 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3903 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
3904 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3905 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3906 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3910 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
3911 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3912 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3913 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3917 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
3918 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3919 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3920 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3924 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
3925 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3926 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3927 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3931 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
3932 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3933 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3934 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3938 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3939 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3940 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3941 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3945 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
3946 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3947 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3948 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3952 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
3953 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3954 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3955 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3959 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
3960 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3961 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3962 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3966 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
3967 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3968 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3969 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3973 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
3974 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3975 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3976 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3980 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
3981 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3982 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3983 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3985 MsiCloseHandle(hpkg
);
3987 /* uninstall the product */
3988 r
= MsiInstallProduct(msifile
, "REMOVE=ALL");
3989 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3991 /* all features installed locally */
3992 r
= MsiInstallProduct(msifile2
, "ADDLOCAL=ALL");
3993 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3995 r
= MsiOpenDatabase(msifile2
, MSIDBOPEN_DIRECT
, &hdb
);
3996 ok(r
== ERROR_SUCCESS
, "failed to open database: %d\n", r
);
3998 /* these properties must not be in the saved msi file */
3999 r
= add_property_entry( hdb
, "'ADDLOCAL', 'one,two,three,four,five,six,seven'");
4000 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
4002 hpkg
= package_from_db( hdb
);
4003 ok( hpkg
, "failed to create package\n");
4007 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
4008 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4009 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4010 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4014 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
4015 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4016 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4017 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4021 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
4022 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4023 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4024 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4028 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
4029 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4030 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4031 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4035 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
4036 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4037 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4038 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4042 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
4043 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4044 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4045 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4049 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
4050 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4051 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4052 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4056 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
4057 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4058 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4059 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4063 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
4064 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4065 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4066 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4070 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
4071 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4072 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4073 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4077 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
4078 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4079 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4080 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4084 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
4085 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4086 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4087 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4091 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
4092 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4093 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4094 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4098 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
4099 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4100 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4101 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4105 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
4106 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4107 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4108 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4112 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
4113 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4114 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4115 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4119 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
4120 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4121 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4122 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4126 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
4127 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4128 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4129 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4133 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
4134 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4135 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4136 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4140 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
4141 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4142 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4143 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4147 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
4148 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4149 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4150 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4154 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
4155 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4156 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4157 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4161 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
4162 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4163 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4164 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4168 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
4169 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4170 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4171 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4175 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
4176 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4177 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4178 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4180 r
= MsiDoAction( hpkg
, "CostInitialize");
4181 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
4185 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
4186 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4187 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4188 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4192 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
4193 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4194 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4195 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4199 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
4200 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4201 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4202 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4206 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
4207 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4208 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4209 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4213 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
4214 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4215 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4216 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4220 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
4221 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4222 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4223 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4227 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
4228 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4229 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4230 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4234 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
4235 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4236 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4237 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4241 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
4242 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4243 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4244 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4248 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
4249 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4250 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4251 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4255 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
4256 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4257 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4258 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4262 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
4263 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4264 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4265 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4269 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
4270 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4271 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4272 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4276 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
4277 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4278 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4279 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4283 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
4284 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4285 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4286 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4290 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
4291 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4292 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4293 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4297 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
4298 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4299 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4300 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4304 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
4305 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4306 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4307 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4311 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
4312 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4313 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4314 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4318 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
4319 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4320 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4321 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4325 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
4326 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4327 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4328 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4332 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
4333 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4334 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4335 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4339 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
4340 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4341 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4342 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4346 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
4347 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4348 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4349 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4353 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
4354 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4355 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4356 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4358 r
= MsiDoAction( hpkg
, "FileCost");
4359 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
4363 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
4364 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4365 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4366 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4370 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
4371 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4372 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4373 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4377 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
4378 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4379 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4380 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4384 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
4385 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4386 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4387 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4391 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
4392 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4393 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4394 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4398 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
4399 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4400 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4401 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4405 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
4406 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4407 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4408 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4412 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
4413 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4414 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4415 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4419 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
4420 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4421 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4422 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4426 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
4427 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4428 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4429 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4433 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
4434 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4435 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4436 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4440 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
4441 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4442 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4443 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4447 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
4448 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4449 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4450 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4454 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
4455 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4456 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4457 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4461 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
4462 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4463 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4464 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4468 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
4469 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4470 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4471 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4475 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
4476 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4477 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4478 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4482 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
4483 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4484 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4485 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4489 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
4490 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4491 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4492 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4496 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
4497 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4498 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4499 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4503 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
4504 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4505 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4506 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4510 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
4511 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4512 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4513 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4517 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
4518 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4519 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4520 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4524 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
4525 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4526 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4527 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4531 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
4532 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4533 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4534 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4536 r
= MsiDoAction( hpkg
, "CostFinalize");
4537 ok( r
== ERROR_SUCCESS
, "cost finalize failed: %d\n", r
);
4541 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
4542 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4543 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4544 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4548 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
4549 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4550 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4551 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4555 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
4556 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4557 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4558 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4562 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
4563 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4564 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4565 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4569 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
4570 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4571 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4572 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4576 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
4577 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4578 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4579 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4583 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
4584 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4585 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4586 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4590 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
4591 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4592 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4593 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4597 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
4598 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4599 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4600 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4604 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
4605 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4606 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4607 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4611 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
4612 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4613 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4614 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4618 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
4619 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4620 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4621 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4625 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
4626 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4627 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4628 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
4632 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
4633 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4634 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4635 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4639 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
4640 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4641 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4642 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4646 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
4647 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4648 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4649 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4653 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
4654 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4655 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4656 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4660 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
4661 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4662 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4663 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4667 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
4668 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4669 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4670 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4674 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
4675 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4676 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4677 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4681 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
4682 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4683 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4684 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4688 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
4689 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4690 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4691 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4695 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
4696 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4697 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4698 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
4702 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
4703 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4704 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4705 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4709 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
4710 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4711 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4712 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4714 MsiCloseHandle(hpkg
);
4716 /* uninstall the product */
4717 r
= MsiInstallProduct(msifile2
, "REMOVE=ALL");
4718 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4720 /* all features installed from source */
4721 r
= MsiInstallProduct(msifile3
, "ADDSOURCE=ALL");
4722 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4724 r
= MsiOpenDatabase(msifile3
, MSIDBOPEN_DIRECT
, &hdb
);
4725 ok(r
== ERROR_SUCCESS
, "failed to open database: %d\n", r
);
4727 /* this property must not be in the saved msi file */
4728 r
= add_property_entry( hdb
, "'ADDSOURCE', 'one,two,three,four,five,six,seven'");
4729 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
4731 hpkg
= package_from_db( hdb
);
4732 ok( hpkg
, "failed to create package\n");
4736 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
4737 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4738 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4739 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4743 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
4744 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4745 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4746 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4750 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
4751 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4752 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4753 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4757 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
4758 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4759 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4760 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4764 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
4765 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4766 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4767 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4771 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
4772 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4773 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4774 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4778 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
4779 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4780 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4781 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4785 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
4786 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4787 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4788 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4792 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
4793 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4794 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4795 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4799 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
4800 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4801 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4802 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4806 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
4807 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4808 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4809 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4813 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
4814 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4815 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4816 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4820 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
4821 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4822 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4823 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4827 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
4828 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4829 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4830 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4834 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
4835 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4836 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4837 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4841 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
4842 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4843 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4844 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4848 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
4849 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4850 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4851 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4855 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
4856 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4857 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4858 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4862 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
4863 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4864 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4865 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4869 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
4870 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4871 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4872 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4876 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
4877 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4878 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4879 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4883 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
4884 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4885 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4886 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4890 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
4891 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4892 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4893 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4897 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
4898 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4899 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4900 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4904 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
4905 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4906 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4907 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4909 r
= MsiDoAction( hpkg
, "CostInitialize");
4910 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
4914 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
4915 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4916 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4917 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4921 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
4922 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4923 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4924 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4928 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
4929 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4930 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4931 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4935 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
4936 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4937 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4938 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4942 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
4943 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4944 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4945 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4949 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
4950 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4951 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4952 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4956 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
4957 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4958 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4959 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4963 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
4964 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4965 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4966 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4970 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
4971 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4972 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4973 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4977 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
4978 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4979 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4980 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4984 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
4985 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4986 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4987 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4991 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
4992 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4993 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4994 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4998 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
4999 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5000 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5001 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5005 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
5006 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5007 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5008 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5012 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
5013 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5014 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5015 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5019 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
5020 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5021 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5022 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5026 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
5027 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5028 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5029 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5033 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
5034 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5035 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5036 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5040 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
5041 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5042 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5043 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5047 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
5048 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5049 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5050 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5054 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
5055 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5056 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5057 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5061 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
5062 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5063 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5064 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5068 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
5069 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5070 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5071 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5075 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
5076 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5077 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5078 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5082 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
5083 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5084 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5085 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5087 r
= MsiDoAction( hpkg
, "FileCost");
5088 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
5092 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
5093 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5094 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5095 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5099 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
5100 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5101 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5102 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5106 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
5107 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5108 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5109 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5113 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
5114 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5115 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5116 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5120 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
5121 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5122 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5123 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5127 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
5128 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5129 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5130 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5134 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
5135 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5136 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5137 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5141 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
5142 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5143 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5144 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5148 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
5149 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5150 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5151 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5155 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
5156 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5157 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5158 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5162 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
5163 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5164 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5165 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5169 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
5170 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5171 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5172 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5176 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
5177 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5178 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5179 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5183 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
5184 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5185 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5186 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5190 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
5191 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5192 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5193 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5197 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
5198 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5199 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5200 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5204 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
5205 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5206 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5207 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5211 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
5212 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5213 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5214 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5218 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
5219 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5220 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5221 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5225 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
5226 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5227 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5228 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5232 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
5233 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5234 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5235 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5239 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
5240 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5241 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5242 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5246 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
5247 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5248 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5249 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5253 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
5254 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5255 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5256 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5260 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
5261 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5262 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5263 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5265 r
= MsiDoAction( hpkg
, "CostFinalize");
5266 ok( r
== ERROR_SUCCESS
, "cost finalize failed: %d\n", r
);
5270 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
5271 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5272 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5273 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5277 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
5278 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5279 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5280 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5284 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
5285 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5286 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5287 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
5291 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
5292 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5293 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5294 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5298 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
5299 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5300 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
5301 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5305 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
5306 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5307 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5308 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5312 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
5313 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5314 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5315 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5319 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
5320 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5321 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5322 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5326 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
5327 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5328 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5329 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5333 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
5334 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5335 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5336 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5340 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
5341 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5342 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5343 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5347 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
5348 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5349 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5350 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
5354 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
5355 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5356 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5357 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5361 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
5362 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5363 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5364 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5368 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
5369 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5370 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5371 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
5375 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
5376 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5377 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5378 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
5382 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
5383 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5384 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
5385 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5389 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
5390 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5391 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5392 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5396 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
5397 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5398 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5399 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5403 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
5404 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5405 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5406 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5410 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
5411 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5412 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5413 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5417 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
5418 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5419 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5420 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5424 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
5425 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5426 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5427 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5431 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
5432 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5433 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5434 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5438 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
5439 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5440 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5441 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5443 MsiCloseHandle(hpkg
);
5445 /* uninstall the product */
5446 r
= MsiInstallProduct(msifile3
, "REMOVE=ALL");
5447 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5449 DeleteFileA(msifile
);
5450 DeleteFileA(msifile2
);
5451 DeleteFileA(msifile3
);
5454 static void test_getproperty(void)
5456 MSIHANDLE hPackage
= 0;
5458 static CHAR empty
[] = "";
5462 hPackage
= package_from_db(create_package_db());
5463 ok( hPackage
!= 0, " Failed to create package\n");
5465 /* set the property */
5466 r
= MsiSetProperty(hPackage
, "Name", "Value");
5467 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5469 /* retrieve the size, NULL pointer */
5471 r
= MsiGetProperty(hPackage
, "Name", NULL
, &size
);
5472 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5473 ok( size
== 5, "Expected 5, got %d\n", size
);
5475 /* retrieve the size, empty string */
5477 r
= MsiGetProperty(hPackage
, "Name", empty
, &size
);
5478 ok( r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
5479 ok( size
== 5, "Expected 5, got %d\n", size
);
5481 /* don't change size */
5482 r
= MsiGetProperty(hPackage
, "Name", prop
, &size
);
5483 ok( r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
5484 ok( size
== 5, "Expected 5, got %d\n", size
);
5485 ok( !lstrcmp(prop
, "Valu"), "Expected Valu, got %s\n", prop
);
5487 /* increase the size by 1 */
5489 r
= MsiGetProperty(hPackage
, "Name", prop
, &size
);
5490 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5491 ok( size
== 5, "Expected 5, got %d\n", size
);
5492 ok( !lstrcmp(prop
, "Value"), "Expected Value, got %s\n", prop
);
5494 r
= MsiCloseHandle( hPackage
);
5495 ok( r
== ERROR_SUCCESS
, "Failed to close package\n" );
5496 DeleteFile(msifile
);
5499 static void test_removefiles(void)
5505 hdb
= create_package_db();
5506 ok ( hdb
, "failed to create package database\n" );
5508 r
= add_directory_entry( hdb
, "'TARGETDIR', '', 'SourceDir'");
5509 ok( r
== ERROR_SUCCESS
, "cannot add directory: %d\n", r
);
5511 r
= create_feature_table( hdb
);
5512 ok( r
== ERROR_SUCCESS
, "cannot create Feature table: %d\n", r
);
5514 r
= create_component_table( hdb
);
5515 ok( r
== ERROR_SUCCESS
, "cannot create Component table: %d\n", r
);
5517 r
= add_feature_entry( hdb
, "'one', '', '', '', 2, 1, '', 0" );
5518 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
5520 r
= add_component_entry( hdb
, "'hydrogen', '', 'TARGETDIR', 0, '', 'hydrogen_file'" );
5521 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
5523 r
= add_component_entry( hdb
, "'helium', '', 'TARGETDIR', 0, '', 'helium_file'" );
5524 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
5526 r
= add_component_entry( hdb
, "'lithium', '', 'TARGETDIR', 0, '', 'lithium_file'" );
5527 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
5529 r
= add_component_entry( hdb
, "'beryllium', '', 'TARGETDIR', 0, '', 'beryllium_file'" );
5530 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
5532 r
= add_component_entry( hdb
, "'boron', '', 'TARGETDIR', 0, '', 'boron_file'" );
5533 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
5535 r
= add_component_entry( hdb
, "'carbon', '', 'TARGETDIR', 0, '', 'carbon_file'" );
5536 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
5538 r
= create_feature_components_table( hdb
);
5539 ok( r
== ERROR_SUCCESS
, "cannot create FeatureComponents table: %d\n", r
);
5541 r
= add_feature_components_entry( hdb
, "'one', 'hydrogen'" );
5542 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
5544 r
= add_feature_components_entry( hdb
, "'one', 'helium'" );
5545 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
5547 r
= add_feature_components_entry( hdb
, "'one', 'lithium'" );
5548 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
5550 r
= add_feature_components_entry( hdb
, "'one', 'beryllium'" );
5551 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
5553 r
= add_feature_components_entry( hdb
, "'one', 'boron'" );
5554 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
5556 r
= add_feature_components_entry( hdb
, "'one', 'carbon'" );
5557 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
5559 r
= create_file_table( hdb
);
5560 ok( r
== ERROR_SUCCESS
, "cannot create File table: %d\n", r
);
5562 r
= add_file_entry( hdb
, "'hydrogen_file', 'hydrogen', 'hydrogen.txt', 0, '', '1033', 8192, 1" );
5563 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
5565 r
= add_file_entry( hdb
, "'helium_file', 'helium', 'helium.txt', 0, '', '1033', 8192, 1" );
5566 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
5568 r
= add_file_entry( hdb
, "'lithium_file', 'lithium', 'lithium.txt', 0, '', '1033', 8192, 1" );
5569 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
5571 r
= add_file_entry( hdb
, "'beryllium_file', 'beryllium', 'beryllium.txt', 0, '', '1033', 16384, 1" );
5572 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
5574 r
= add_file_entry( hdb
, "'boron_file', 'boron', 'boron.txt', 0, '', '1033', 16384, 1" );
5575 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
5577 r
= add_file_entry( hdb
, "'carbon_file', 'carbon', 'carbon.txt', 0, '', '1033', 16384, 1" );
5578 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
5580 r
= create_remove_file_table( hdb
);
5581 ok( r
== ERROR_SUCCESS
, "cannot create Remove File table: %d\n", r
);
5583 hpkg
= package_from_db( hdb
);
5584 ok( hpkg
, "failed to create package\n");
5586 MsiCloseHandle( hdb
);
5588 create_test_file( "hydrogen.txt" );
5589 create_test_file( "helium.txt" );
5590 create_test_file( "lithium.txt" );
5591 create_test_file( "beryllium.txt" );
5592 create_test_file( "boron.txt" );
5593 create_test_file( "carbon.txt" );
5595 r
= MsiSetProperty( hpkg
, "TARGETDIR", CURR_DIR
);
5596 ok( r
== ERROR_SUCCESS
, "set property failed\n");
5598 r
= MsiDoAction( hpkg
, "CostInitialize");
5599 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
5601 r
= MsiDoAction( hpkg
, "FileCost");
5602 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
5604 r
= MsiDoAction( hpkg
, "CostFinalize");
5605 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
5607 r
= MsiDoAction( hpkg
, "InstallValidate");
5608 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
5610 r
= MsiSetComponentState( hpkg
, "hydrogen", INSTALLSTATE_ABSENT
);
5611 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
5613 r
= MsiSetComponentState( hpkg
, "helium", INSTALLSTATE_LOCAL
);
5614 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
5616 r
= MsiSetComponentState( hpkg
, "lithium", INSTALLSTATE_SOURCE
);
5617 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
5619 r
= MsiSetComponentState( hpkg
, "beryllium", INSTALLSTATE_ABSENT
);
5620 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
5622 r
= MsiSetComponentState( hpkg
, "boron", INSTALLSTATE_LOCAL
);
5623 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
5625 r
= MsiSetComponentState( hpkg
, "carbon", INSTALLSTATE_SOURCE
);
5626 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
5628 r
= MsiDoAction( hpkg
, "RemoveFiles");
5629 ok( r
== ERROR_SUCCESS
, "remove files failed\n");
5631 ok(DeleteFileA("hydrogen.txt"), "Expected hydrogen.txt to exist\n");
5632 ok(DeleteFileA("lithium.txt"), "Expected lithium.txt to exist\n");
5633 ok(DeleteFileA("beryllium.txt"), "Expected beryllium.txt to exist\n");
5634 ok(DeleteFileA("carbon.txt"), "Expected carbon.txt to exist\n");
5635 ok(DeleteFileA("helium.txt"), "Expected helium.txt to exist\n");
5636 ok(DeleteFileA("boron.txt"), "Expected boron.txt to exist\n");
5638 MsiCloseHandle( hpkg
);
5639 DeleteFileA(msifile
);
5642 static void test_appsearch(void)
5647 CHAR prop
[MAX_PATH
];
5648 DWORD size
= MAX_PATH
;
5650 hdb
= create_package_db();
5651 ok ( hdb
, "failed to create package database\n" );
5653 r
= create_appsearch_table( hdb
);
5654 ok( r
== ERROR_SUCCESS
, "cannot create AppSearch table: %d\n", r
);
5656 r
= add_appsearch_entry( hdb
, "'WEBBROWSERPROG', 'NewSignature1'" );
5657 ok( r
== ERROR_SUCCESS
, "cannot add entry: %d\n", r
);
5659 r
= create_reglocator_table( hdb
);
5660 ok( r
== ERROR_SUCCESS
, "cannot create RegLocator table: %d\n", r
);
5662 r
= add_reglocator_entry( hdb
, "'NewSignature1', 0, 'htmlfile\\shell\\open\\command', '', 1" );
5663 ok( r
== ERROR_SUCCESS
, "cannot create RegLocator table: %d\n", r
);
5665 r
= create_signature_table( hdb
);
5666 ok( r
== ERROR_SUCCESS
, "cannot create Signature table: %d\n", r
);
5668 r
= add_signature_entry( hdb
, "'NewSignature1', 'FileName', '', '', '', '', '', '', ''" );
5669 ok( r
== ERROR_SUCCESS
, "cannot create Signature table: %d\n", r
);
5671 hpkg
= package_from_db( hdb
);
5672 ok( hpkg
, "failed to create package\n");
5674 MsiCloseHandle( hdb
);
5676 r
= MsiDoAction( hpkg
, "AppSearch" );
5677 ok( r
== ERROR_SUCCESS
, "AppSearch failed: %d\n", r
);
5679 r
= MsiGetPropertyA( hpkg
, "WEBBROWSERPROG", prop
, &size
);
5680 ok( r
== ERROR_SUCCESS
, "get property failed: %d\n", r
);
5683 ok( lstrlenA(prop
) != 0, "Expected non-zero length\n");
5686 MsiCloseHandle( hpkg
);
5687 DeleteFileA(msifile
);
5690 static void test_appsearch_complocator(void)
5692 MSIHANDLE hpkg
, hdb
;
5693 CHAR path
[MAX_PATH
];
5694 CHAR prop
[MAX_PATH
];
5699 get_user_sid(&usersid
);
5702 skip("ConvertSidToStringSidA is not available\n");
5706 create_test_file("FileName1");
5707 create_test_file("FileName4");
5708 set_component_path("FileName1", MSIINSTALLCONTEXT_MACHINE
,
5709 "{A8AE6692-96BA-4198-8399-145D7D1D0D0E}", NULL
, FALSE
);
5711 create_test_file("FileName2");
5712 set_component_path("FileName2", MSIINSTALLCONTEXT_USERUNMANAGED
,
5713 "{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}", usersid
, FALSE
);
5715 create_test_file("FileName3");
5716 set_component_path("FileName3", MSIINSTALLCONTEXT_USERMANAGED
,
5717 "{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}", usersid
, FALSE
);
5719 create_test_file("FileName5");
5720 set_component_path("FileName5", MSIINSTALLCONTEXT_MACHINE
,
5721 "{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}", NULL
, TRUE
);
5723 create_test_file("FileName6");
5724 set_component_path("FileName6", MSIINSTALLCONTEXT_MACHINE
,
5725 "{C0ECD96F-7898-4410-9667-194BD8C1B648}", NULL
, TRUE
);
5727 create_test_file("FileName7");
5728 set_component_path("FileName7", MSIINSTALLCONTEXT_MACHINE
,
5729 "{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}", NULL
, FALSE
);
5731 /* dir is FALSE, but we're pretending it's a directory */
5732 set_component_path("IDontExist\\", MSIINSTALLCONTEXT_MACHINE
,
5733 "{91B7359B-07F2-4221-AA8D-DE102BB87A5F}", NULL
, FALSE
);
5735 create_file_with_version("FileName8.dll", MAKELONG(2, 1), MAKELONG(4, 3));
5736 set_component_path("FileName8.dll", MSIINSTALLCONTEXT_MACHINE
,
5737 "{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}", NULL
, FALSE
);
5739 create_file_with_version("FileName9.dll", MAKELONG(1, 2), MAKELONG(3, 4));
5740 set_component_path("FileName9.dll", MSIINSTALLCONTEXT_MACHINE
,
5741 "{A204DF48-7346-4635-BA2E-66247DBAC9DF}", NULL
, FALSE
);
5743 create_file_with_version("FileName10.dll", MAKELONG(2, 1), MAKELONG(4, 3));
5744 set_component_path("FileName10.dll", MSIINSTALLCONTEXT_MACHINE
,
5745 "{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}", NULL
, FALSE
);
5747 hdb
= create_package_db();
5748 ok(hdb
, "Expected a valid database handle\n");
5750 r
= create_appsearch_table(hdb
);
5751 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5753 r
= add_appsearch_entry(hdb
, "'SIGPROP1', 'NewSignature1'");
5754 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5756 r
= add_appsearch_entry(hdb
, "'SIGPROP2', 'NewSignature2'");
5757 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5759 r
= add_appsearch_entry(hdb
, "'SIGPROP3', 'NewSignature3'");
5760 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5762 r
= add_appsearch_entry(hdb
, "'SIGPROP4', 'NewSignature4'");
5763 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5765 r
= add_appsearch_entry(hdb
, "'SIGPROP5', 'NewSignature5'");
5766 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5768 r
= add_appsearch_entry(hdb
, "'SIGPROP6', 'NewSignature6'");
5769 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5771 r
= add_appsearch_entry(hdb
, "'SIGPROP7', 'NewSignature7'");
5772 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5774 r
= add_appsearch_entry(hdb
, "'SIGPROP8', 'NewSignature8'");
5775 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5777 r
= add_appsearch_entry(hdb
, "'SIGPROP9', 'NewSignature9'");
5778 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5780 r
= add_appsearch_entry(hdb
, "'SIGPROP10', 'NewSignature10'");
5781 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5783 r
= add_appsearch_entry(hdb
, "'SIGPROP11', 'NewSignature11'");
5784 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5786 r
= add_appsearch_entry(hdb
, "'SIGPROP12', 'NewSignature12'");
5787 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5789 r
= create_complocator_table(hdb
);
5790 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5792 /* published component, machine, file, signature, misdbLocatorTypeFile */
5793 r
= add_complocator_entry(hdb
, "'NewSignature1', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 1");
5794 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5796 /* published component, user-unmanaged, file, signature, misdbLocatorTypeFile */
5797 r
= add_complocator_entry(hdb
, "'NewSignature2', '{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}', 1");
5798 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5800 /* published component, user-managed, file, signature, misdbLocatorTypeFile */
5801 r
= add_complocator_entry(hdb
, "'NewSignature3', '{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}', 1");
5802 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5804 /* published component, machine, file, signature, misdbLocatorTypeDirectory */
5805 r
= add_complocator_entry(hdb
, "'NewSignature4', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 0");
5806 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5808 /* published component, machine, dir, signature, misdbLocatorTypeDirectory */
5809 r
= add_complocator_entry(hdb
, "'NewSignature5', '{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}', 0");
5810 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5812 /* published component, machine, dir, no signature, misdbLocatorTypeDirectory */
5813 r
= add_complocator_entry(hdb
, "'NewSignature6', '{C0ECD96F-7898-4410-9667-194BD8C1B648}', 0");
5814 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5816 /* published component, machine, file, no signature, misdbLocatorTypeFile */
5817 r
= add_complocator_entry(hdb
, "'NewSignature7', '{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}', 1");
5818 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5820 /* unpublished component, no signature, misdbLocatorTypeDir */
5821 r
= add_complocator_entry(hdb
, "'NewSignature8', '{FB671D5B-5083-4048-90E0-481C48D8F3A5}', 0");
5822 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5824 /* published component, no signature, dir does not exist misdbLocatorTypeDir */
5825 r
= add_complocator_entry(hdb
, "'NewSignature9', '{91B7359B-07F2-4221-AA8D-DE102BB87A5F}', 0");
5826 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5828 /* published component, signature w/ ver, misdbLocatorTypeFile */
5829 r
= add_complocator_entry(hdb
, "'NewSignature10', '{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}', 1");
5830 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5832 /* published component, signature w/ ver, ver > max, misdbLocatorTypeFile */
5833 r
= add_complocator_entry(hdb
, "'NewSignature11', '{A204DF48-7346-4635-BA2E-66247DBAC9DF}', 1");
5834 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5836 /* published component, signature w/ ver, sig->name ignored, misdbLocatorTypeFile */
5837 r
= add_complocator_entry(hdb
, "'NewSignature12', '{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}', 1");
5838 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5840 r
= create_signature_table(hdb
);
5841 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5843 r
= add_signature_entry(hdb
, "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''");
5844 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5846 r
= add_signature_entry(hdb
, "'NewSignature2', 'FileName2', '', '', '', '', '', '', ''");
5847 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5849 r
= add_signature_entry(hdb
, "'NewSignature3', 'FileName3', '', '', '', '', '', '', ''");
5850 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5852 r
= add_signature_entry(hdb
, "'NewSignature4', 'FileName4', '', '', '', '', '', '', ''");
5853 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5855 r
= add_signature_entry(hdb
, "'NewSignature5', 'FileName5', '', '', '', '', '', '', ''");
5856 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5858 r
= add_signature_entry(hdb
, "'NewSignature10', 'FileName8.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
5859 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5861 r
= add_signature_entry(hdb
, "'NewSignature11', 'FileName9.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
5862 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5864 r
= add_signature_entry(hdb
, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
5865 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5867 hpkg
= package_from_db(hdb
);
5868 ok(hpkg
, "Expected a valid package handle\n");
5870 r
= MsiSetPropertyA(hpkg
, "SIGPROP8", "october");
5871 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5873 r
= MsiDoAction(hpkg
, "AppSearch");
5874 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5877 sprintf(path
, "%s\\FileName1", CURR_DIR
);
5878 r
= MsiGetPropertyA(hpkg
, "SIGPROP1", prop
, &size
);
5879 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5880 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
5883 sprintf(path
, "%s\\FileName2", CURR_DIR
);
5884 r
= MsiGetPropertyA(hpkg
, "SIGPROP2", prop
, &size
);
5885 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5886 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
5889 sprintf(path
, "%s\\FileName3", CURR_DIR
);
5890 r
= MsiGetPropertyA(hpkg
, "SIGPROP3", prop
, &size
);
5891 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5892 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
5895 sprintf(path
, "%s\\FileName4", CURR_DIR
);
5896 r
= MsiGetPropertyA(hpkg
, "SIGPROP4", prop
, &size
);
5897 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5898 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
5901 sprintf(path
, "%s\\FileName5", CURR_DIR
);
5902 r
= MsiGetPropertyA(hpkg
, "SIGPROP5", prop
, &size
);
5903 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5904 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
5907 sprintf(path
, "%s\\", CURR_DIR
);
5908 r
= MsiGetPropertyA(hpkg
, "SIGPROP6", prop
, &size
);
5909 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5910 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
5913 sprintf(path
, "%s\\", CURR_DIR
);
5914 r
= MsiGetPropertyA(hpkg
, "SIGPROP7", prop
, &size
);
5915 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5916 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
5919 r
= MsiGetPropertyA(hpkg
, "SIGPROP8", prop
, &size
);
5920 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5921 ok(!lstrcmpA(prop
, "october"), "Expected \"october\", got \"%s\"\n", prop
);
5924 r
= MsiGetPropertyA(hpkg
, "SIGPROP9", prop
, &size
);
5925 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5926 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
5929 sprintf(path
, "%s\\FileName8.dll", CURR_DIR
);
5930 r
= MsiGetPropertyA(hpkg
, "SIGPROP10", prop
, &size
);
5931 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5932 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
5935 r
= MsiGetPropertyA(hpkg
, "SIGPROP11", prop
, &size
);
5936 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5937 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
5940 sprintf(path
, "%s\\FileName10.dll", CURR_DIR
);
5941 r
= MsiGetPropertyA(hpkg
, "SIGPROP12", prop
, &size
);
5942 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5943 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
5945 delete_component_path("{A8AE6692-96BA-4198-8399-145D7D1D0D0E}",
5946 MSIINSTALLCONTEXT_MACHINE
, NULL
);
5947 delete_component_path("{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}",
5948 MSIINSTALLCONTEXT_USERUNMANAGED
, usersid
);
5949 delete_component_path("{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}",
5950 MSIINSTALLCONTEXT_USERMANAGED
, usersid
);
5951 delete_component_path("{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}",
5952 MSIINSTALLCONTEXT_MACHINE
, NULL
);
5953 delete_component_path("{C0ECD96F-7898-4410-9667-194BD8C1B648}",
5954 MSIINSTALLCONTEXT_MACHINE
, NULL
);
5955 delete_component_path("{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}",
5956 MSIINSTALLCONTEXT_MACHINE
, NULL
);
5957 delete_component_path("{91B7359B-07F2-4221-AA8D-DE102BB87A5F}",
5958 MSIINSTALLCONTEXT_MACHINE
, NULL
);
5959 delete_component_path("{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}",
5960 MSIINSTALLCONTEXT_MACHINE
, NULL
);
5961 delete_component_path("{A204DF48-7346-4635-BA2E-66247DBAC9DF}",
5962 MSIINSTALLCONTEXT_MACHINE
, NULL
);
5963 delete_component_path("{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}",
5964 MSIINSTALLCONTEXT_MACHINE
, NULL
);
5966 DeleteFileA("FileName1");
5967 DeleteFileA("FileName2");
5968 DeleteFileA("FileName3");
5969 DeleteFileA("FileName4");
5970 DeleteFileA("FileName5");
5971 DeleteFileA("FileName6");
5972 DeleteFileA("FileName7");
5973 DeleteFileA("FileName8.dll");
5974 DeleteFileA("FileName9.dll");
5975 DeleteFileA("FileName10.dll");
5976 MsiCloseHandle(hpkg
);
5977 DeleteFileA(msifile
);
5980 static void test_appsearch_reglocator(void)
5982 MSIHANDLE hpkg
, hdb
;
5983 CHAR path
[MAX_PATH
];
5984 CHAR prop
[MAX_PATH
];
5987 BOOL space
, version
;
5996 if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
5999 DeleteFileA("test.dll");
6001 res
= RegCreateKeyA(HKEY_CLASSES_ROOT
, "Software\\Wine", &classes
);
6002 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6004 res
= RegSetValueExA(classes
, "Value1", 0, REG_SZ
,
6005 (const BYTE
*)"regszdata", 10);
6006 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6008 res
= RegCreateKeyA(HKEY_CURRENT_USER
, "Software\\Wine", &hkcu
);
6009 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6011 res
= RegSetValueExA(hkcu
, "Value1", 0, REG_SZ
,
6012 (const BYTE
*)"regszdata", 10);
6013 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6016 res
= RegCreateKeyA(HKEY_USERS
, "S-1-5-18\\Software\\Wine", &users
);
6017 ok(res
== ERROR_SUCCESS
||
6018 broken(res
== ERROR_INVALID_PARAMETER
),
6019 "Expected ERROR_SUCCESS, got %d\n", res
);
6021 if (res
== ERROR_SUCCESS
)
6023 res
= RegSetValueExA(users
, "Value1", 0, REG_SZ
,
6024 (const BYTE
*)"regszdata", 10);
6025 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6028 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, "Software\\Wine", &hklm
);
6029 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6031 res
= RegSetValueA(hklm
, NULL
, REG_SZ
, "defvalue", 8);
6032 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6034 res
= RegSetValueExA(hklm
, "Value1", 0, REG_SZ
,
6035 (const BYTE
*)"regszdata", 10);
6036 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6039 res
= RegSetValueExA(hklm
, "Value2", 0, REG_DWORD
,
6040 (const BYTE
*)&val
, sizeof(DWORD
));
6041 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6044 res
= RegSetValueExA(hklm
, "Value3", 0, REG_DWORD
,
6045 (const BYTE
*)&val
, sizeof(DWORD
));
6046 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6048 res
= RegSetValueExA(hklm
, "Value4", 0, REG_EXPAND_SZ
,
6049 (const BYTE
*)"%PATH%", 7);
6050 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6052 res
= RegSetValueExA(hklm
, "Value5", 0, REG_EXPAND_SZ
,
6053 (const BYTE
*)"my%NOVAR%", 10);
6054 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6056 res
= RegSetValueExA(hklm
, "Value6", 0, REG_MULTI_SZ
,
6057 (const BYTE
*)"one\0two\0", 9);
6058 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6060 binary
[0] = 0x1234abcd;
6061 binary
[1] = 0x567890ef;
6062 res
= RegSetValueExA(hklm
, "Value7", 0, REG_BINARY
,
6063 (const BYTE
*)binary
, sizeof(binary
));
6064 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6066 res
= RegSetValueExA(hklm
, "Value8", 0, REG_SZ
,
6067 (const BYTE
*)"#regszdata", 11);
6068 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6070 create_test_file("FileName1");
6071 sprintf(path
, "%s\\FileName1", CURR_DIR
);
6072 res
= RegSetValueExA(hklm
, "Value9", 0, REG_SZ
,
6073 (const BYTE
*)path
, lstrlenA(path
) + 1);
6074 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6076 sprintf(path
, "%s\\FileName2", CURR_DIR
);
6077 res
= RegSetValueExA(hklm
, "Value10", 0, REG_SZ
,
6078 (const BYTE
*)path
, lstrlenA(path
) + 1);
6079 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6081 lstrcpyA(path
, CURR_DIR
);
6082 res
= RegSetValueExA(hklm
, "Value11", 0, REG_SZ
,
6083 (const BYTE
*)path
, lstrlenA(path
) + 1);
6084 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6086 res
= RegSetValueExA(hklm
, "Value12", 0, REG_SZ
,
6087 (const BYTE
*)"", 1);
6088 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6090 create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6091 sprintf(path
, "%s\\FileName3.dll", CURR_DIR
);
6092 res
= RegSetValueExA(hklm
, "Value13", 0, REG_SZ
,
6093 (const BYTE
*)path
, lstrlenA(path
) + 1);
6094 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6096 create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
6097 sprintf(path
, "%s\\FileName4.dll", CURR_DIR
);
6098 res
= RegSetValueExA(hklm
, "Value14", 0, REG_SZ
,
6099 (const BYTE
*)path
, lstrlenA(path
) + 1);
6100 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6102 create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6103 sprintf(path
, "%s\\FileName5.dll", CURR_DIR
);
6104 res
= RegSetValueExA(hklm
, "Value15", 0, REG_SZ
,
6105 (const BYTE
*)path
, lstrlenA(path
) + 1);
6106 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6108 sprintf(path
, "\"%s\\FileName1\" -option", CURR_DIR
);
6109 res
= RegSetValueExA(hklm
, "value16", 0, REG_SZ
,
6110 (const BYTE
*)path
, lstrlenA(path
) + 1);
6112 space
= (strchr(CURR_DIR
, ' ')) ? TRUE
: FALSE
;
6113 sprintf(path
, "%s\\FileName1 -option", CURR_DIR
);
6114 res
= RegSetValueExA(hklm
, "value17", 0, REG_SZ
,
6115 (const BYTE
*)path
, lstrlenA(path
) + 1);
6117 hdb
= create_package_db();
6118 ok(hdb
, "Expected a valid database handle\n");
6120 r
= create_appsearch_table(hdb
);
6121 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6123 r
= add_appsearch_entry(hdb
, "'SIGPROP1', 'NewSignature1'");
6124 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6126 r
= add_appsearch_entry(hdb
, "'SIGPROP2', 'NewSignature2'");
6127 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6129 r
= add_appsearch_entry(hdb
, "'SIGPROP3', 'NewSignature3'");
6130 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6132 r
= add_appsearch_entry(hdb
, "'SIGPROP4', 'NewSignature4'");
6133 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6135 r
= add_appsearch_entry(hdb
, "'SIGPROP5', 'NewSignature5'");
6136 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6138 r
= add_appsearch_entry(hdb
, "'SIGPROP6', 'NewSignature6'");
6139 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6141 r
= add_appsearch_entry(hdb
, "'SIGPROP7', 'NewSignature7'");
6142 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6144 r
= add_appsearch_entry(hdb
, "'SIGPROP8', 'NewSignature8'");
6145 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6147 r
= add_appsearch_entry(hdb
, "'SIGPROP9', 'NewSignature9'");
6148 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6150 r
= add_appsearch_entry(hdb
, "'SIGPROP10', 'NewSignature10'");
6151 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6153 r
= add_appsearch_entry(hdb
, "'SIGPROP11', 'NewSignature11'");
6154 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6156 r
= add_appsearch_entry(hdb
, "'SIGPROP12', 'NewSignature12'");
6157 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6159 r
= add_appsearch_entry(hdb
, "'SIGPROP13', 'NewSignature13'");
6160 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6162 r
= add_appsearch_entry(hdb
, "'SIGPROP14', 'NewSignature14'");
6163 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6165 r
= add_appsearch_entry(hdb
, "'SIGPROP15', 'NewSignature15'");
6166 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6168 r
= add_appsearch_entry(hdb
, "'SIGPROP16', 'NewSignature16'");
6169 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6171 r
= add_appsearch_entry(hdb
, "'SIGPROP17', 'NewSignature17'");
6172 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6174 r
= add_appsearch_entry(hdb
, "'SIGPROP18', 'NewSignature18'");
6175 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6177 r
= add_appsearch_entry(hdb
, "'SIGPROP19', 'NewSignature19'");
6178 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6180 r
= add_appsearch_entry(hdb
, "'SIGPROP20', 'NewSignature20'");
6181 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6183 r
= add_appsearch_entry(hdb
, "'SIGPROP21', 'NewSignature21'");
6184 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6186 r
= add_appsearch_entry(hdb
, "'SIGPROP22', 'NewSignature22'");
6187 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6189 r
= add_appsearch_entry(hdb
, "'SIGPROP23', 'NewSignature23'");
6190 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6192 r
= add_appsearch_entry(hdb
, "'SIGPROP24', 'NewSignature24'");
6193 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6195 r
= add_appsearch_entry(hdb
, "'SIGPROP25', 'NewSignature25'");
6196 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6198 r
= add_appsearch_entry(hdb
, "'SIGPROP26', 'NewSignature26'");
6199 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6201 r
= add_appsearch_entry(hdb
, "'SIGPROP27', 'NewSignature27'");
6202 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6204 r
= add_appsearch_entry(hdb
, "'SIGPROP28', 'NewSignature28'");
6205 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6207 r
= add_appsearch_entry(hdb
, "'SIGPROP29', 'NewSignature29'");
6208 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6210 r
= add_appsearch_entry(hdb
, "'SIGPROP30', 'NewSignature30'");
6211 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6213 r
= create_reglocator_table(hdb
);
6214 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6216 /* HKLM, msidbLocatorTypeRawValue, REG_SZ */
6217 str
= "'NewSignature1', 2, 'Software\\Wine', 'Value1', 2";
6218 r
= add_reglocator_entry(hdb
, str
);
6219 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6221 /* HKLM, msidbLocatorTypeRawValue, positive DWORD */
6222 str
= "'NewSignature2', 2, 'Software\\Wine', 'Value2', 2";
6223 r
= add_reglocator_entry(hdb
, str
);
6224 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6226 /* HKLM, msidbLocatorTypeRawValue, negative DWORD */
6227 str
= "'NewSignature3', 2, 'Software\\Wine', 'Value3', 2";
6228 r
= add_reglocator_entry(hdb
, str
);
6229 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6231 /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
6232 str
= "'NewSignature4', 2, 'Software\\Wine', 'Value4', 2";
6233 r
= add_reglocator_entry(hdb
, str
);
6234 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6236 /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
6237 str
= "'NewSignature5', 2, 'Software\\Wine', 'Value5', 2";
6238 r
= add_reglocator_entry(hdb
, str
);
6239 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6241 /* HKLM, msidbLocatorTypeRawValue, REG_MULTI_SZ */
6242 str
= "'NewSignature6', 2, 'Software\\Wine', 'Value6', 2";
6243 r
= add_reglocator_entry(hdb
, str
);
6244 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6246 /* HKLM, msidbLocatorTypeRawValue, REG_BINARY */
6247 str
= "'NewSignature7', 2, 'Software\\Wine', 'Value7', 2";
6248 r
= add_reglocator_entry(hdb
, str
);
6249 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6251 /* HKLM, msidbLocatorTypeRawValue, REG_SZ first char is # */
6252 str
= "'NewSignature8', 2, 'Software\\Wine', 'Value8', 2";
6253 r
= add_reglocator_entry(hdb
, str
);
6254 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6256 /* HKLM, msidbLocatorTypeFileName, signature, file exists */
6257 str
= "'NewSignature9', 2, 'Software\\Wine', 'Value9', 1";
6258 r
= add_reglocator_entry(hdb
, str
);
6259 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6261 /* HKLM, msidbLocatorTypeFileName, signature, file does not exist */
6262 str
= "'NewSignature10', 2, 'Software\\Wine', 'Value10', 1";
6263 r
= add_reglocator_entry(hdb
, str
);
6264 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6266 /* HKLM, msidbLocatorTypeFileName, no signature */
6267 str
= "'NewSignature11', 2, 'Software\\Wine', 'Value9', 1";
6268 r
= add_reglocator_entry(hdb
, str
);
6269 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6271 /* HKLM, msidbLocatorTypeDirectory, no signature, file exists */
6272 str
= "'NewSignature12', 2, 'Software\\Wine', 'Value9', 0";
6273 r
= add_reglocator_entry(hdb
, str
);
6274 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6276 /* HKLM, msidbLocatorTypeDirectory, no signature, directory exists */
6277 str
= "'NewSignature13', 2, 'Software\\Wine', 'Value11', 0";
6278 r
= add_reglocator_entry(hdb
, str
);
6279 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6281 /* HKLM, msidbLocatorTypeDirectory, signature, file exists */
6282 str
= "'NewSignature14', 2, 'Software\\Wine', 'Value9', 0";
6283 r
= add_reglocator_entry(hdb
, str
);
6284 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6286 /* HKCR, msidbLocatorTypeRawValue, REG_SZ */
6287 str
= "'NewSignature15', 0, 'Software\\Wine', 'Value1', 2";
6288 r
= add_reglocator_entry(hdb
, str
);
6289 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6291 /* HKCU, msidbLocatorTypeRawValue, REG_SZ */
6292 str
= "'NewSignature16', 1, 'Software\\Wine', 'Value1', 2";
6293 r
= add_reglocator_entry(hdb
, str
);
6294 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6296 /* HKU, msidbLocatorTypeRawValue, REG_SZ */
6297 str
= "'NewSignature17', 3, 'S-1-5-18\\Software\\Wine', 'Value1', 2";
6298 r
= add_reglocator_entry(hdb
, str
);
6299 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6301 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, NULL Name */
6302 str
= "'NewSignature18', 2, 'Software\\Wine', '', 2";
6303 r
= add_reglocator_entry(hdb
, str
);
6304 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6306 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, key does not exist */
6307 str
= "'NewSignature19', 2, 'Software\\IDontExist', '', 2";
6308 r
= add_reglocator_entry(hdb
, str
);
6309 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6311 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, value is empty */
6312 str
= "'NewSignature20', 2, 'Software\\Wine', 'Value12', 2";
6313 r
= add_reglocator_entry(hdb
, str
);
6314 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6316 /* HKLM, msidbLocatorTypeFileName, signature, file exists w/ version */
6317 str
= "'NewSignature21', 2, 'Software\\Wine', 'Value13', 1";
6318 r
= add_reglocator_entry(hdb
, str
);
6319 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6321 /* HKLM, msidbLocatorTypeFileName, file exists w/ version, version > max */
6322 str
= "'NewSignature22', 2, 'Software\\Wine', 'Value14', 1";
6323 r
= add_reglocator_entry(hdb
, str
);
6324 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6326 /* HKLM, msidbLocatorTypeFileName, file exists w/ version, sig->name ignored */
6327 str
= "'NewSignature23', 2, 'Software\\Wine', 'Value15', 1";
6328 r
= add_reglocator_entry(hdb
, str
);
6329 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6331 /* HKLM, msidbLocatorTypeFileName, no signature, directory exists */
6332 str
= "'NewSignature24', 2, 'Software\\Wine', 'Value11', 1";
6333 r
= add_reglocator_entry(hdb
, str
);
6334 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6336 /* HKLM, msidbLocatorTypeFileName, no signature, file does not exist */
6337 str
= "'NewSignature25', 2, 'Software\\Wine', 'Value10', 1";
6338 r
= add_reglocator_entry(hdb
, str
);
6339 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6341 /* HKLM, msidbLocatorTypeDirectory, signature, directory exists */
6342 str
= "'NewSignature26', 2, 'Software\\Wine', 'Value11', 0";
6343 r
= add_reglocator_entry(hdb
, str
);
6344 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6346 /* HKLM, msidbLocatorTypeDirectory, signature, file does not exist */
6347 str
= "'NewSignature27', 2, 'Software\\Wine', 'Value10', 0";
6348 r
= add_reglocator_entry(hdb
, str
);
6349 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6351 /* HKLM, msidbLocatorTypeDirectory, no signature, file does not exist */
6352 str
= "'NewSignature28', 2, 'Software\\Wine', 'Value10', 0";
6353 r
= add_reglocator_entry(hdb
, str
);
6354 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6356 /* HKLM, msidbLocatorTypeFile, file exists, in quotes */
6357 str
= "'NewSignature29', 2, 'Software\\Wine', 'Value16', 1";
6358 r
= add_reglocator_entry(hdb
, str
);
6359 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6361 /* HKLM, msidbLocatorTypeFile, file exists, no quotes */
6362 str
= "'NewSignature30', 2, 'Software\\Wine', 'Value17', 1";
6363 r
= add_reglocator_entry(hdb
, str
);
6364 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6366 r
= create_signature_table(hdb
);
6367 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6369 str
= "'NewSignature9', 'FileName1', '', '', '', '', '', '', ''";
6370 r
= add_signature_entry(hdb
, str
);
6371 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6373 str
= "'NewSignature10', 'FileName2', '', '', '', '', '', '', ''";
6374 r
= add_signature_entry(hdb
, str
);
6375 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6377 str
= "'NewSignature14', 'FileName1', '', '', '', '', '', '', ''";
6378 r
= add_signature_entry(hdb
, str
);
6379 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6381 str
= "'NewSignature21', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
6382 r
= add_signature_entry(hdb
, str
);
6383 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6385 str
= "'NewSignature22', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
6386 r
= add_signature_entry(hdb
, str
);
6387 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6389 str
= "'NewSignature23', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
6390 r
= add_signature_entry(hdb
, str
);
6391 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6393 ptr
= strrchr(CURR_DIR
, '\\') + 1;
6394 sprintf(path
, "'NewSignature26', '%s', '', '', '', '', '', '', ''", ptr
);
6395 r
= add_signature_entry(hdb
, path
);
6396 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6398 str
= "'NewSignature27', 'FileName2', '', '', '', '', '', '', ''";
6399 r
= add_signature_entry(hdb
, str
);
6400 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6402 str
= "'NewSignature29', 'FileName1', '', '', '', '', '', '', ''";
6403 r
= add_signature_entry(hdb
, str
);
6404 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6406 str
= "'NewSignature30', 'FileName1', '', '', '', '', '', '', ''";
6407 r
= add_signature_entry(hdb
, str
);
6408 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6410 hpkg
= package_from_db(hdb
);
6411 ok(hpkg
, "Expected a valid package handle\n");
6413 r
= MsiDoAction(hpkg
, "AppSearch");
6414 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6417 r
= MsiGetPropertyA(hpkg
, "SIGPROP1", prop
, &size
);
6418 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6419 ok(!lstrcmpA(prop
, "regszdata"),
6420 "Expected \"regszdata\", got \"%s\"\n", prop
);
6423 r
= MsiGetPropertyA(hpkg
, "SIGPROP2", prop
, &size
);
6424 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6425 ok(!lstrcmpA(prop
, "#42"), "Expected \"#42\", got \"%s\"\n", prop
);
6428 r
= MsiGetPropertyA(hpkg
, "SIGPROP3", prop
, &size
);
6429 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6430 ok(!lstrcmpA(prop
, "#-42"), "Expected \"#-42\", got \"%s\"\n", prop
);
6432 ExpandEnvironmentStringsA("%PATH%", path
, MAX_PATH
);
6435 r
= MsiGetPropertyA(hpkg
, "SIGPROP4", prop
, &size
);
6436 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6437 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6440 r
= MsiGetPropertyA(hpkg
, "SIGPROP5", prop
, &size
);
6441 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6443 "my%NOVAR%"), "Expected \"my%%NOVAR%%\", got \"%s\"\n", prop
);
6446 r
= MsiGetPropertyA(hpkg
, "SIGPROP6", prop
, &size
);
6447 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6450 ok(!memcmp(prop
, "\0one\0two\0\0", 10),
6451 "Expected \"\\0one\\0two\\0\\0\"\n");
6455 lstrcpyA(path
, "#xCDAB3412EF907856");
6456 r
= MsiGetPropertyA(hpkg
, "SIGPROP7", prop
, &size
);
6457 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6458 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6461 r
= MsiGetPropertyA(hpkg
, "SIGPROP8", prop
, &size
);
6462 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6463 ok(!lstrcmpA(prop
, "##regszdata"),
6464 "Expected \"##regszdata\", got \"%s\"\n", prop
);
6467 sprintf(path
, "%s\\FileName1", CURR_DIR
);
6468 r
= MsiGetPropertyA(hpkg
, "SIGPROP9", prop
, &size
);
6469 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6470 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6473 r
= MsiGetPropertyA(hpkg
, "SIGPROP10", prop
, &size
);
6474 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6475 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6478 sprintf(path
, "%s\\", CURR_DIR
);
6479 r
= MsiGetPropertyA(hpkg
, "SIGPROP11", prop
, &size
);
6480 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6481 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6484 r
= MsiGetPropertyA(hpkg
, "SIGPROP12", prop
, &size
);
6485 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6486 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6489 sprintf(path
, "%s\\", CURR_DIR
);
6490 r
= MsiGetPropertyA(hpkg
, "SIGPROP13", prop
, &size
);
6491 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6492 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6495 r
= MsiGetPropertyA(hpkg
, "SIGPROP14", prop
, &size
);
6496 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6497 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6500 r
= MsiGetPropertyA(hpkg
, "SIGPROP15", prop
, &size
);
6501 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6502 ok(!lstrcmpA(prop
, "regszdata"),
6503 "Expected \"regszdata\", got \"%s\"\n", prop
);
6506 r
= MsiGetPropertyA(hpkg
, "SIGPROP16", prop
, &size
);
6507 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6508 ok(!lstrcmpA(prop
, "regszdata"),
6509 "Expected \"regszdata\", got \"%s\"\n", prop
);
6514 r
= MsiGetPropertyA(hpkg
, "SIGPROP17", prop
, &size
);
6515 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6516 ok(!lstrcmpA(prop
, "regszdata"),
6517 "Expected \"regszdata\", got \"%s\"\n", prop
);
6521 r
= MsiGetPropertyA(hpkg
, "SIGPROP18", prop
, &size
);
6522 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6523 ok(!lstrcmpA(prop
, "defvalue"),
6524 "Expected \"defvalue\", got \"%s\"\n", prop
);
6527 r
= MsiGetPropertyA(hpkg
, "SIGPROP19", prop
, &size
);
6528 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6529 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6532 r
= MsiGetPropertyA(hpkg
, "SIGPROP20", prop
, &size
);
6533 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6534 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6539 sprintf(path
, "%s\\FileName3.dll", CURR_DIR
);
6540 r
= MsiGetPropertyA(hpkg
, "SIGPROP21", prop
, &size
);
6541 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6542 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6545 r
= MsiGetPropertyA(hpkg
, "SIGPROP22", prop
, &size
);
6546 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6547 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6550 sprintf(path
, "%s\\FileName5.dll", CURR_DIR
);
6551 r
= MsiGetPropertyA(hpkg
, "SIGPROP23", prop
, &size
);
6552 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6553 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6557 lstrcpyA(path
, CURR_DIR
);
6558 ptr
= strrchr(path
, '\\') + 1;
6560 r
= MsiGetPropertyA(hpkg
, "SIGPROP24", prop
, &size
);
6561 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6562 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6565 sprintf(path
, "%s\\", CURR_DIR
);
6566 r
= MsiGetPropertyA(hpkg
, "SIGPROP25", prop
, &size
);
6567 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6568 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6571 r
= MsiGetPropertyA(hpkg
, "SIGPROP26", prop
, &size
);
6572 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6573 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6576 r
= MsiGetPropertyA(hpkg
, "SIGPROP27", prop
, &size
);
6577 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6578 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6581 r
= MsiGetPropertyA(hpkg
, "SIGPROP28", prop
, &size
);
6582 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6583 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6586 sprintf(path
, "%s\\FileName1", CURR_DIR
);
6587 r
= MsiGetPropertyA(hpkg
, "SIGPROP29", prop
, &size
);
6588 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6589 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6592 sprintf(path
, "%s\\FileName1", CURR_DIR
);
6593 r
= MsiGetPropertyA(hpkg
, "SIGPROP30", prop
, &size
);
6594 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6596 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6598 todo_wine
ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6600 RegSetValueA(hklm
, NULL
, REG_SZ
, "", 0);
6601 RegDeleteValueA(hklm
, "Value1");
6602 RegDeleteValueA(hklm
, "Value2");
6603 RegDeleteValueA(hklm
, "Value3");
6604 RegDeleteValueA(hklm
, "Value4");
6605 RegDeleteValueA(hklm
, "Value5");
6606 RegDeleteValueA(hklm
, "Value6");
6607 RegDeleteValueA(hklm
, "Value7");
6608 RegDeleteValueA(hklm
, "Value8");
6609 RegDeleteValueA(hklm
, "Value9");
6610 RegDeleteValueA(hklm
, "Value10");
6611 RegDeleteValueA(hklm
, "Value11");
6612 RegDeleteValueA(hklm
, "Value12");
6613 RegDeleteValueA(hklm
, "Value13");
6614 RegDeleteValueA(hklm
, "Value14");
6615 RegDeleteValueA(hklm
, "Value15");
6616 RegDeleteValueA(hklm
, "Value16");
6617 RegDeleteValueA(hklm
, "Value17");
6618 RegDeleteKeyA(hklm
, "");
6621 RegDeleteValueA(classes
, "Value1");
6622 RegDeleteKeyA(classes
, "");
6623 RegCloseKey(classes
);
6625 RegDeleteValueA(hkcu
, "Value1");
6626 RegDeleteKeyA(hkcu
, "");
6629 RegDeleteValueA(users
, "Value1");
6630 RegDeleteKeyA(users
, "");
6633 DeleteFileA("FileName1");
6634 DeleteFileA("FileName3.dll");
6635 DeleteFileA("FileName4.dll");
6636 DeleteFileA("FileName5.dll");
6637 MsiCloseHandle(hpkg
);
6638 DeleteFileA(msifile
);
6641 static void delete_win_ini(LPCSTR file
)
6643 CHAR path
[MAX_PATH
];
6645 GetWindowsDirectoryA(path
, MAX_PATH
);
6646 lstrcatA(path
, "\\");
6647 lstrcatA(path
, file
);
6652 static void test_appsearch_inilocator(void)
6654 MSIHANDLE hpkg
, hdb
;
6655 CHAR path
[MAX_PATH
];
6656 CHAR prop
[MAX_PATH
];
6664 if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
6667 DeleteFileA("test.dll");
6669 WritePrivateProfileStringA("Section", "Key", "keydata,field2", "IniFile.ini");
6671 create_test_file("FileName1");
6672 sprintf(path
, "%s\\FileName1", CURR_DIR
);
6673 WritePrivateProfileStringA("Section", "Key2", path
, "IniFile.ini");
6675 WritePrivateProfileStringA("Section", "Key3", CURR_DIR
, "IniFile.ini");
6677 sprintf(path
, "%s\\IDontExist", CURR_DIR
);
6678 WritePrivateProfileStringA("Section", "Key4", path
, "IniFile.ini");
6680 create_file_with_version("FileName2.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6681 sprintf(path
, "%s\\FileName2.dll", CURR_DIR
);
6682 WritePrivateProfileStringA("Section", "Key5", path
, "IniFile.ini");
6684 create_file_with_version("FileName3.dll", MAKELONG(1, 2), MAKELONG(3, 4));
6685 sprintf(path
, "%s\\FileName3.dll", CURR_DIR
);
6686 WritePrivateProfileStringA("Section", "Key6", path
, "IniFile.ini");
6688 create_file_with_version("FileName4.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6689 sprintf(path
, "%s\\FileName4.dll", CURR_DIR
);
6690 WritePrivateProfileStringA("Section", "Key7", path
, "IniFile.ini");
6692 hdb
= create_package_db();
6693 ok(hdb
, "Expected a valid database handle\n");
6695 r
= create_appsearch_table(hdb
);
6696 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6698 r
= add_appsearch_entry(hdb
, "'SIGPROP1', 'NewSignature1'");
6699 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6701 r
= add_appsearch_entry(hdb
, "'SIGPROP2', 'NewSignature2'");
6702 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6704 r
= add_appsearch_entry(hdb
, "'SIGPROP3', 'NewSignature3'");
6705 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6707 r
= add_appsearch_entry(hdb
, "'SIGPROP4', 'NewSignature4'");
6708 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6710 r
= add_appsearch_entry(hdb
, "'SIGPROP5', 'NewSignature5'");
6711 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6713 r
= add_appsearch_entry(hdb
, "'SIGPROP6', 'NewSignature6'");
6714 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6716 r
= add_appsearch_entry(hdb
, "'SIGPROP7', 'NewSignature7'");
6717 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6719 r
= add_appsearch_entry(hdb
, "'SIGPROP8', 'NewSignature8'");
6720 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6722 r
= add_appsearch_entry(hdb
, "'SIGPROP9', 'NewSignature9'");
6723 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6725 r
= add_appsearch_entry(hdb
, "'SIGPROP10', 'NewSignature10'");
6726 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6728 r
= add_appsearch_entry(hdb
, "'SIGPROP11', 'NewSignature11'");
6729 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6731 r
= add_appsearch_entry(hdb
, "'SIGPROP12', 'NewSignature12'");
6732 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6734 r
= create_inilocator_table(hdb
);
6735 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6737 /* msidbLocatorTypeRawValue, field 1 */
6738 str
= "'NewSignature1', 'IniFile.ini', 'Section', 'Key', 1, 2";
6739 r
= add_inilocator_entry(hdb
, str
);
6740 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6742 /* msidbLocatorTypeRawValue, field 2 */
6743 str
= "'NewSignature2', 'IniFile.ini', 'Section', 'Key', 2, 2";
6744 r
= add_inilocator_entry(hdb
, str
);
6745 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6747 /* msidbLocatorTypeRawValue, entire field */
6748 str
= "'NewSignature3', 'IniFile.ini', 'Section', 'Key', 0, 2";
6749 r
= add_inilocator_entry(hdb
, str
);
6750 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6752 /* msidbLocatorTypeFile */
6753 str
= "'NewSignature4', 'IniFile.ini', 'Section', 'Key2', 1, 1";
6754 r
= add_inilocator_entry(hdb
, str
);
6755 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6757 /* msidbLocatorTypeDirectory, file */
6758 str
= "'NewSignature5', 'IniFile.ini', 'Section', 'Key2', 1, 0";
6759 r
= add_inilocator_entry(hdb
, str
);
6760 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6762 /* msidbLocatorTypeDirectory, directory */
6763 str
= "'NewSignature6', 'IniFile.ini', 'Section', 'Key3', 1, 0";
6764 r
= add_inilocator_entry(hdb
, str
);
6765 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6767 /* msidbLocatorTypeFile, file, no signature */
6768 str
= "'NewSignature7', 'IniFile.ini', 'Section', 'Key2', 1, 1";
6769 r
= add_inilocator_entry(hdb
, str
);
6770 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6772 /* msidbLocatorTypeFile, dir, no signature */
6773 str
= "'NewSignature8', 'IniFile.ini', 'Section', 'Key3', 1, 1";
6774 r
= add_inilocator_entry(hdb
, str
);
6775 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6777 /* msidbLocatorTypeFile, file does not exist */
6778 str
= "'NewSignature9', 'IniFile.ini', 'Section', 'Key4', 1, 1";
6779 r
= add_inilocator_entry(hdb
, str
);
6780 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6782 /* msidbLocatorTypeFile, signature with version */
6783 str
= "'NewSignature10', 'IniFile.ini', 'Section', 'Key5', 1, 1";
6784 r
= add_inilocator_entry(hdb
, str
);
6785 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6787 /* msidbLocatorTypeFile, signature with version, ver > max */
6788 str
= "'NewSignature11', 'IniFile.ini', 'Section', 'Key6', 1, 1";
6789 r
= add_inilocator_entry(hdb
, str
);
6790 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6792 /* msidbLocatorTypeFile, signature with version, sig->name ignored */
6793 str
= "'NewSignature12', 'IniFile.ini', 'Section', 'Key7', 1, 1";
6794 r
= add_inilocator_entry(hdb
, str
);
6795 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6797 r
= create_signature_table(hdb
);
6798 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6800 r
= add_signature_entry(hdb
, "'NewSignature4', 'FileName1', '', '', '', '', '', '', ''");
6801 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6803 r
= add_signature_entry(hdb
, "'NewSignature9', 'IDontExist', '', '', '', '', '', '', ''");
6804 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6806 r
= add_signature_entry(hdb
, "'NewSignature10', 'FileName2.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
6807 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6809 r
= add_signature_entry(hdb
, "'NewSignature11', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
6810 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6812 r
= add_signature_entry(hdb
, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
6813 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6815 hpkg
= package_from_db(hdb
);
6816 ok(hpkg
, "Expected a valid package handle\n");
6818 r
= MsiDoAction(hpkg
, "AppSearch");
6819 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6822 r
= MsiGetPropertyA(hpkg
, "SIGPROP1", prop
, &size
);
6823 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6824 ok(!lstrcmpA(prop
, "keydata"), "Expected \"keydata\", got \"%s\"\n", prop
);
6827 r
= MsiGetPropertyA(hpkg
, "SIGPROP2", prop
, &size
);
6828 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6829 ok(!lstrcmpA(prop
, "field2"), "Expected \"field2\", got \"%s\"\n", prop
);
6832 r
= MsiGetPropertyA(hpkg
, "SIGPROP3", prop
, &size
);
6833 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6834 ok(!lstrcmpA(prop
, "keydata,field2"),
6835 "Expected \"keydata,field2\", got \"%s\"\n", prop
);
6838 sprintf(path
, "%s\\FileName1", CURR_DIR
);
6839 r
= MsiGetPropertyA(hpkg
, "SIGPROP4", prop
, &size
);
6840 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6841 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6844 r
= MsiGetPropertyA(hpkg
, "SIGPROP5", prop
, &size
);
6845 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6846 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6849 sprintf(path
, "%s\\", CURR_DIR
);
6850 r
= MsiGetPropertyA(hpkg
, "SIGPROP6", prop
, &size
);
6851 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6852 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6855 sprintf(path
, "%s\\", CURR_DIR
);
6856 r
= MsiGetPropertyA(hpkg
, "SIGPROP7", prop
, &size
);
6857 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6858 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6861 lstrcpyA(path
, CURR_DIR
);
6862 ptr
= strrchr(path
, '\\');
6864 r
= MsiGetPropertyA(hpkg
, "SIGPROP8", prop
, &size
);
6865 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6866 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6869 r
= MsiGetPropertyA(hpkg
, "SIGPROP9", prop
, &size
);
6870 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6871 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6876 sprintf(path
, "%s\\FileName2.dll", CURR_DIR
);
6877 r
= MsiGetPropertyA(hpkg
, "SIGPROP10", prop
, &size
);
6878 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6879 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6882 r
= MsiGetPropertyA(hpkg
, "SIGPROP11", prop
, &size
);
6883 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6884 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6887 sprintf(path
, "%s\\FileName4.dll", CURR_DIR
);
6888 r
= MsiGetPropertyA(hpkg
, "SIGPROP12", prop
, &size
);
6889 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6890 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6893 delete_win_ini("IniFile.ini");
6894 DeleteFileA("FileName1");
6895 DeleteFileA("FileName2.dll");
6896 DeleteFileA("FileName3.dll");
6897 DeleteFileA("FileName4.dll");
6898 MsiCloseHandle(hpkg
);
6899 DeleteFileA(msifile
);
6902 static void test_appsearch_drlocator(void)
6904 MSIHANDLE hpkg
, hdb
;
6905 CHAR path
[MAX_PATH
];
6906 CHAR prop
[MAX_PATH
];
6913 if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
6916 DeleteFileA("test.dll");
6918 create_test_file("FileName1");
6919 CreateDirectoryA("one", NULL
);
6920 CreateDirectoryA("one\\two", NULL
);
6921 CreateDirectoryA("one\\two\\three", NULL
);
6922 create_test_file("one\\two\\three\\FileName2");
6923 CreateDirectoryA("another", NULL
);
6924 create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6925 create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
6926 create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6928 hdb
= create_package_db();
6929 ok(hdb
, "Expected a valid database handle\n");
6931 r
= create_appsearch_table(hdb
);
6932 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6934 r
= add_appsearch_entry(hdb
, "'SIGPROP1', 'NewSignature1'");
6935 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6937 r
= add_appsearch_entry(hdb
, "'SIGPROP2', 'NewSignature2'");
6938 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6940 r
= add_appsearch_entry(hdb
, "'SIGPROP3', 'NewSignature3'");
6941 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6943 r
= add_appsearch_entry(hdb
, "'SIGPROP4', 'NewSignature4'");
6944 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6946 r
= add_appsearch_entry(hdb
, "'SIGPROP5', 'NewSignature5'");
6947 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6949 r
= add_appsearch_entry(hdb
, "'SIGPROP6', 'NewSignature6'");
6950 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6952 r
= add_appsearch_entry(hdb
, "'SIGPROP7', 'NewSignature7'");
6953 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6955 r
= add_appsearch_entry(hdb
, "'SIGPROP8', 'NewSignature8'");
6956 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6958 r
= add_appsearch_entry(hdb
, "'SIGPROP9', 'NewSignature9'");
6959 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6961 r
= add_appsearch_entry(hdb
, "'SIGPROP10', 'NewSignature10'");
6962 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6964 r
= create_drlocator_table(hdb
);
6965 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6967 /* no parent, full path, depth 0, signature */
6968 sprintf(path
, "'NewSignature1', '', '%s', 0", CURR_DIR
);
6969 r
= add_drlocator_entry(hdb
, path
);
6970 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6972 /* no parent, full path, depth 0, no signature */
6973 sprintf(path
, "'NewSignature2', '', '%s', 0", CURR_DIR
);
6974 r
= add_drlocator_entry(hdb
, path
);
6975 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6977 /* no parent, relative path, depth 0, no signature */
6978 sprintf(path
, "'NewSignature3', '', '%s', 0", CURR_DIR
+ 3);
6979 r
= add_drlocator_entry(hdb
, path
);
6980 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6982 /* no parent, full path, depth 2, signature */
6983 sprintf(path
, "'NewSignature4', '', '%s', 2", CURR_DIR
);
6984 r
= add_drlocator_entry(hdb
, path
);
6985 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6987 /* no parent, full path, depth 3, signature */
6988 sprintf(path
, "'NewSignature5', '', '%s', 3", CURR_DIR
);
6989 r
= add_drlocator_entry(hdb
, path
);
6990 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6992 /* no parent, full path, depth 1, signature is dir */
6993 sprintf(path
, "'NewSignature6', '', '%s', 1", CURR_DIR
);
6994 r
= add_drlocator_entry(hdb
, path
);
6995 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6997 /* parent is in DrLocator, relative path, depth 0, signature */
6998 sprintf(path
, "'NewSignature7', 'NewSignature1', 'one\\two\\three', 1");
6999 r
= add_drlocator_entry(hdb
, path
);
7000 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7002 /* no parent, full path, depth 0, signature w/ version */
7003 sprintf(path
, "'NewSignature8', '', '%s', 0", CURR_DIR
);
7004 r
= add_drlocator_entry(hdb
, path
);
7005 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7007 /* no parent, full path, depth 0, signature w/ version, ver > max */
7008 sprintf(path
, "'NewSignature9', '', '%s', 0", CURR_DIR
);
7009 r
= add_drlocator_entry(hdb
, path
);
7010 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7012 /* no parent, full path, depth 0, signature w/ version, sig->name not ignored */
7013 sprintf(path
, "'NewSignature10', '', '%s', 0", CURR_DIR
);
7014 r
= add_drlocator_entry(hdb
, path
);
7015 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7017 r
= create_signature_table(hdb
);
7018 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7020 str
= "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''";
7021 r
= add_signature_entry(hdb
, str
);
7022 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7024 str
= "'NewSignature4', 'FileName2', '', '', '', '', '', '', ''";
7025 r
= add_signature_entry(hdb
, str
);
7026 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7028 str
= "'NewSignature5', 'FileName2', '', '', '', '', '', '', ''";
7029 r
= add_signature_entry(hdb
, str
);
7030 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7032 str
= "'NewSignature6', 'another', '', '', '', '', '', '', ''";
7033 r
= add_signature_entry(hdb
, str
);
7034 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7036 str
= "'NewSignature7', 'FileName2', '', '', '', '', '', '', ''";
7037 r
= add_signature_entry(hdb
, str
);
7038 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7040 str
= "'NewSignature8', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
7041 r
= add_signature_entry(hdb
, str
);
7042 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7044 str
= "'NewSignature9', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
7045 r
= add_signature_entry(hdb
, str
);
7046 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7048 str
= "'NewSignature10', 'necessary', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
7049 r
= add_signature_entry(hdb
, str
);
7050 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7052 hpkg
= package_from_db(hdb
);
7053 ok(hpkg
, "Expected a valid package handle\n");
7055 r
= MsiDoAction(hpkg
, "AppSearch");
7056 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7059 sprintf(path
, "%s\\FileName1", CURR_DIR
);
7060 r
= MsiGetPropertyA(hpkg
, "SIGPROP1", prop
, &size
);
7061 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7062 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
7065 sprintf(path
, "%s\\", CURR_DIR
);
7066 r
= MsiGetPropertyA(hpkg
, "SIGPROP2", prop
, &size
);
7067 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7068 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
7071 sprintf(path
, "%s\\", CURR_DIR
);
7072 r
= MsiGetPropertyA(hpkg
, "SIGPROP3", prop
, &size
);
7073 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7074 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
7077 r
= MsiGetPropertyA(hpkg
, "SIGPROP4", prop
, &size
);
7078 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7079 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
7082 sprintf(path
, "%s\\one\\two\\three\\FileName2", CURR_DIR
);
7083 r
= MsiGetPropertyA(hpkg
, "SIGPROP5", prop
, &size
);
7084 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7085 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
7088 r
= MsiGetPropertyA(hpkg
, "SIGPROP6", prop
, &size
);
7089 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7090 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
7093 sprintf(path
, "%s\\one\\two\\three\\FileName2", CURR_DIR
);
7094 r
= MsiGetPropertyA(hpkg
, "SIGPROP7", prop
, &size
);
7095 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7096 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
7101 sprintf(path
, "%s\\FileName3.dll", CURR_DIR
);
7102 r
= MsiGetPropertyA(hpkg
, "SIGPROP8", 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
, "SIGPROP9", prop
, &size
);
7108 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7109 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
7112 r
= MsiGetPropertyA(hpkg
, "SIGPROP10", prop
, &size
);
7113 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7114 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
7117 DeleteFileA("FileName1");
7118 DeleteFileA("FileName3.dll");
7119 DeleteFileA("FileName4.dll");
7120 DeleteFileA("FileName5.dll");
7121 DeleteFileA("one\\two\\three\\FileName2");
7122 RemoveDirectoryA("one\\two\\three");
7123 RemoveDirectoryA("one\\two");
7124 RemoveDirectoryA("one");
7125 RemoveDirectoryA("another");
7126 MsiCloseHandle(hpkg
);
7127 DeleteFileA(msifile
);
7130 static void test_featureparents(void)
7135 INSTALLSTATE state
, action
;
7137 hdb
= create_package_db();
7138 ok ( hdb
, "failed to create package database\n" );
7140 r
= add_directory_entry( hdb
, "'TARGETDIR', '', 'SourceDir'");
7141 ok( r
== ERROR_SUCCESS
, "cannot add directory: %d\n", r
);
7143 r
= create_feature_table( hdb
);
7144 ok( r
== ERROR_SUCCESS
, "cannot create Feature table: %d\n", r
);
7146 r
= create_component_table( hdb
);
7147 ok( r
== ERROR_SUCCESS
, "cannot create Component table: %d\n", r
);
7149 r
= create_feature_components_table( hdb
);
7150 ok( r
== ERROR_SUCCESS
, "cannot create FeatureComponents table: %d\n", r
);
7152 r
= create_file_table( hdb
);
7153 ok( r
== ERROR_SUCCESS
, "cannot create File table: %d\n", r
);
7155 /* msidbFeatureAttributesFavorLocal */
7156 r
= add_feature_entry( hdb
, "'zodiac', '', '', '', 2, 1, '', 0" );
7157 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
7159 /* msidbFeatureAttributesFavorSource */
7160 r
= add_feature_entry( hdb
, "'perseus', '', '', '', 2, 1, '', 1" );
7161 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
7163 /* msidbFeatureAttributesFavorLocal */
7164 r
= add_feature_entry( hdb
, "'orion', '', '', '', 2, 1, '', 0" );
7165 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
7167 /* disabled because of install level */
7168 r
= add_feature_entry( hdb
, "'waters', '', '', '', 15, 101, '', 9" );
7169 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
7171 /* child feature of disabled feature */
7172 r
= add_feature_entry( hdb
, "'bayer', 'waters', '', '', 14, 1, '', 9" );
7173 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
7175 /* component of disabled feature (install level) */
7176 r
= add_component_entry( hdb
, "'delphinus', '', 'TARGETDIR', 0, '', 'delphinus_file'" );
7177 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
7179 /* component of disabled child feature (install level) */
7180 r
= add_component_entry( hdb
, "'hydrus', '', 'TARGETDIR', 0, '', 'hydrus_file'" );
7181 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
7183 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
7184 r
= add_component_entry( hdb
, "'leo', '', 'TARGETDIR', 0, '', 'leo_file'" );
7185 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
7187 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
7188 r
= add_component_entry( hdb
, "'virgo', '', 'TARGETDIR', 1, '', 'virgo_file'" );
7189 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
7191 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
7192 r
= add_component_entry( hdb
, "'libra', '', 'TARGETDIR', 2, '', 'libra_file'" );
7193 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
7195 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
7196 r
= add_component_entry( hdb
, "'cassiopeia', '', 'TARGETDIR', 0, '', 'cassiopeia_file'" );
7197 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
7199 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
7200 r
= add_component_entry( hdb
, "'cepheus', '', 'TARGETDIR', 1, '', 'cepheus_file'" );
7201 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
7203 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
7204 r
= add_component_entry( hdb
, "'andromeda', '', 'TARGETDIR', 2, '', 'andromeda_file'" );
7205 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
7207 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
7208 r
= add_component_entry( hdb
, "'canis', '', 'TARGETDIR', 0, '', 'canis_file'" );
7209 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
7211 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
7212 r
= add_component_entry( hdb
, "'monoceros', '', 'TARGETDIR', 1, '', 'monoceros_file'" );
7213 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
7215 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
7216 r
= add_component_entry( hdb
, "'lepus', '', 'TARGETDIR', 2, '', 'lepus_file'" );
7218 r
= add_feature_components_entry( hdb
, "'zodiac', 'leo'" );
7219 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7221 r
= add_feature_components_entry( hdb
, "'zodiac', 'virgo'" );
7222 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7224 r
= add_feature_components_entry( hdb
, "'zodiac', 'libra'" );
7225 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7227 r
= add_feature_components_entry( hdb
, "'perseus', 'cassiopeia'" );
7228 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7230 r
= add_feature_components_entry( hdb
, "'perseus', 'cepheus'" );
7231 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7233 r
= add_feature_components_entry( hdb
, "'perseus', 'andromeda'" );
7234 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7236 r
= add_feature_components_entry( hdb
, "'orion', 'leo'" );
7237 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7239 r
= add_feature_components_entry( hdb
, "'orion', 'virgo'" );
7240 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7242 r
= add_feature_components_entry( hdb
, "'orion', 'libra'" );
7243 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7245 r
= add_feature_components_entry( hdb
, "'orion', 'cassiopeia'" );
7246 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7248 r
= add_feature_components_entry( hdb
, "'orion', 'cepheus'" );
7249 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7251 r
= add_feature_components_entry( hdb
, "'orion', 'andromeda'" );
7252 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7254 r
= add_feature_components_entry( hdb
, "'orion', 'canis'" );
7255 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7257 r
= add_feature_components_entry( hdb
, "'orion', 'monoceros'" );
7258 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7260 r
= add_feature_components_entry( hdb
, "'orion', 'lepus'" );
7261 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7263 r
= add_feature_components_entry( hdb
, "'waters', 'delphinus'" );
7264 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7266 r
= add_feature_components_entry( hdb
, "'bayer', 'hydrus'" );
7267 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7269 r
= add_file_entry( hdb
, "'leo_file', 'leo', 'leo.txt', 100, '', '1033', 8192, 1" );
7270 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7272 r
= add_file_entry( hdb
, "'virgo_file', 'virgo', 'virgo.txt', 0, '', '1033', 8192, 1" );
7273 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7275 r
= add_file_entry( hdb
, "'libra_file', 'libra', 'libra.txt', 0, '', '1033', 8192, 1" );
7276 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7278 r
= add_file_entry( hdb
, "'cassiopeia_file', 'cassiopeia', 'cassiopeia.txt', 0, '', '1033', 8192, 1" );
7279 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7281 r
= add_file_entry( hdb
, "'cepheus_file', 'cepheus', 'cepheus.txt', 0, '', '1033', 8192, 1" );
7282 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7284 r
= add_file_entry( hdb
, "'andromeda_file', 'andromeda', 'andromeda.txt', 0, '', '1033', 8192, 1" );
7285 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7287 r
= add_file_entry( hdb
, "'canis_file', 'canis', 'canis.txt', 0, '', '1033', 8192, 1" );
7288 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7290 r
= add_file_entry( hdb
, "'monoceros_file', 'monoceros', 'monoceros.txt', 0, '', '1033', 8192, 1" );
7291 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7293 r
= add_file_entry( hdb
, "'lepus_file', 'lepus', 'lepus.txt', 0, '', '1033', 8192, 1" );
7294 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7296 r
= add_file_entry( hdb
, "'delphinus_file', 'delphinus', 'delphinus.txt', 0, '', '1033', 8192, 1" );
7297 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7299 r
= add_file_entry( hdb
, "'hydrus_file', 'hydrus', 'hydrus.txt', 0, '', '1033', 8192, 1" );
7300 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7302 hpkg
= package_from_db( hdb
);
7303 ok( hpkg
, "failed to create package\n");
7305 MsiCloseHandle( hdb
);
7307 r
= MsiDoAction( hpkg
, "CostInitialize");
7308 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
7310 r
= MsiDoAction( hpkg
, "FileCost");
7311 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
7313 r
= MsiDoAction( hpkg
, "CostFinalize");
7314 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
7318 r
= MsiGetFeatureState(hpkg
, "zodiac", &state
, &action
);
7319 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7320 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
7321 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
7325 r
= MsiGetFeatureState(hpkg
, "perseus", &state
, &action
);
7326 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7327 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
7328 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
7332 r
= MsiGetFeatureState(hpkg
, "orion", &state
, &action
);
7333 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7334 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
7335 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
7339 r
= MsiGetFeatureState(hpkg
, "waters", &state
, &action
);
7340 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7341 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
7342 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
7346 r
= MsiGetFeatureState(hpkg
, "bayer", &state
, &action
);
7347 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7348 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
7349 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
7353 r
= MsiGetComponentState(hpkg
, "leo", &state
, &action
);
7354 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7355 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
7356 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
7360 r
= MsiGetComponentState(hpkg
, "virgo", &state
, &action
);
7361 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7362 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state
);
7363 ok( action
== INSTALLSTATE_SOURCE
, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action
);
7367 r
= MsiGetComponentState(hpkg
, "libra", &state
, &action
);
7368 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7369 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state
);
7370 ok( action
== INSTALLSTATE_LOCAL
, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action
);
7374 r
= MsiGetComponentState(hpkg
, "cassiopeia", &state
, &action
);
7375 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7376 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state
);
7377 ok( action
== INSTALLSTATE_LOCAL
, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action
);
7381 r
= MsiGetComponentState(hpkg
, "cepheus", &state
, &action
);
7382 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7383 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7384 ok( action
== INSTALLSTATE_SOURCE
, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action
);
7388 r
= MsiGetComponentState(hpkg
, "andromeda", &state
, &action
);
7389 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7390 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state
);
7391 ok( action
== INSTALLSTATE_LOCAL
, "Expected andromeda INSTALLSTATE_LOCAL, got %d\n", action
);
7395 r
= MsiGetComponentState(hpkg
, "canis", &state
, &action
);
7396 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7397 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state
);
7398 ok( action
== INSTALLSTATE_LOCAL
, "Expected canis INSTALLSTATE_LOCAL, got %d\n", action
);
7402 r
= MsiGetComponentState(hpkg
, "monoceros", &state
, &action
);
7403 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7404 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state
);
7405 ok( action
== INSTALLSTATE_SOURCE
, "Expected monoceros INSTALLSTATE_SOURCE, got %d\n", action
);
7409 r
= MsiGetComponentState(hpkg
, "lepus", &state
, &action
);
7410 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7411 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7412 ok( action
== INSTALLSTATE_LOCAL
, "Expected lepus INSTALLSTATE_LOCAL, got %d\n", action
);
7416 r
= MsiGetComponentState(hpkg
, "delphinus", &state
, &action
);
7417 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7418 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7419 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action
);
7423 r
= MsiGetComponentState(hpkg
, "hydrus", &state
, &action
);
7424 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7425 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7426 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action
);
7428 r
= MsiSetFeatureState(hpkg
, "orion", INSTALLSTATE_ABSENT
);
7429 ok( r
== ERROR_SUCCESS
, "failed to set feature state: %d\n", r
);
7433 r
= MsiGetFeatureState(hpkg
, "zodiac", &state
, &action
);
7434 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7435 ok( state
== INSTALLSTATE_ABSENT
, "Expected zodiac INSTALLSTATE_ABSENT, got %d\n", state
);
7436 ok( action
== INSTALLSTATE_LOCAL
, "Expected zodiac INSTALLSTATE_LOCAL, got %d\n", action
);
7440 r
= MsiGetFeatureState(hpkg
, "perseus", &state
, &action
);
7441 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7442 ok( state
== INSTALLSTATE_ABSENT
, "Expected perseus INSTALLSTATE_ABSENT, got %d\n", state
);
7443 ok( action
== INSTALLSTATE_SOURCE
, "Expected perseus INSTALLSTATE_SOURCE, got %d\n", action
);
7447 r
= MsiGetFeatureState(hpkg
, "orion", &state
, &action
);
7448 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7449 ok( state
== INSTALLSTATE_ABSENT
, "Expected orion INSTALLSTATE_ABSENT, got %d\n", state
);
7450 ok( action
== INSTALLSTATE_ABSENT
, "Expected orion INSTALLSTATE_ABSENT, got %d\n", action
);
7454 r
= MsiGetComponentState(hpkg
, "leo", &state
, &action
);
7455 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7456 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected leo INSTALLSTATE_UNKNOWN, got %d\n", state
);
7457 ok( action
== INSTALLSTATE_LOCAL
, "Expected leo INSTALLSTATE_LOCAL, got %d\n", action
);
7461 r
= MsiGetComponentState(hpkg
, "virgo", &state
, &action
);
7462 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7463 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state
);
7464 ok( action
== INSTALLSTATE_SOURCE
, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action
);
7468 r
= MsiGetComponentState(hpkg
, "libra", &state
, &action
);
7469 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7470 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state
);
7471 ok( action
== INSTALLSTATE_LOCAL
, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action
);
7475 r
= MsiGetComponentState(hpkg
, "cassiopeia", &state
, &action
);
7476 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7477 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state
);
7478 ok( action
== INSTALLSTATE_LOCAL
, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action
);
7482 r
= MsiGetComponentState(hpkg
, "cepheus", &state
, &action
);
7483 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7484 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7485 ok( action
== INSTALLSTATE_SOURCE
, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action
);
7489 r
= MsiGetComponentState(hpkg
, "andromeda", &state
, &action
);
7490 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7491 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state
);
7492 ok( action
== INSTALLSTATE_SOURCE
, "Expected andromeda INSTALLSTATE_SOURCE, got %d\n", action
);
7496 r
= MsiGetComponentState(hpkg
, "canis", &state
, &action
);
7497 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7498 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state
);
7499 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", action
);
7503 r
= MsiGetComponentState(hpkg
, "monoceros", &state
, &action
);
7504 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7505 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state
);
7506 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", action
);
7510 r
= MsiGetComponentState(hpkg
, "lepus", &state
, &action
);
7511 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7512 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7513 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", action
);
7517 r
= MsiGetComponentState(hpkg
, "delphinus", &state
, &action
);
7518 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7519 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7520 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action
);
7524 r
= MsiGetComponentState(hpkg
, "hydrus", &state
, &action
);
7525 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7526 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7527 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action
);
7529 MsiCloseHandle(hpkg
);
7530 DeleteFileA(msifile
);
7533 static void test_installprops(void)
7535 MSIHANDLE hpkg
, hdb
;
7536 CHAR path
[MAX_PATH
];
7544 GetCurrentDirectory(MAX_PATH
, path
);
7545 lstrcat(path
, "\\");
7546 lstrcat(path
, msifile
);
7548 hdb
= create_package_db();
7549 ok( hdb
, "failed to create database\n");
7551 hpkg
= package_from_db(hdb
);
7552 ok( hpkg
, "failed to create package\n");
7554 MsiCloseHandle(hdb
);
7557 r
= MsiGetProperty(hpkg
, "DATABASE", buf
, &size
);
7558 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7559 ok( !lstrcmp(buf
, path
), "Expected %s, got %s\n", path
, buf
);
7561 RegOpenKey(HKEY_CURRENT_USER
, "SOFTWARE\\Microsoft\\MS Setup (ACME)\\User Info", &hkey1
);
7563 RegOpenKey(HKEY_LOCAL_MACHINE
, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", &hkey2
);
7568 if (RegQueryValueEx(hkey1
, "DefName", NULL
, &type
, (LPBYTE
)path
, &size
) != ERROR_SUCCESS
)
7572 RegQueryValueEx(hkey2
, "RegisteredOwner", NULL
, &type
, (LPBYTE
)path
, &size
);
7575 /* win9x doesn't set this */
7579 r
= MsiGetProperty(hpkg
, "USERNAME", buf
, &size
);
7580 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7581 ok( !lstrcmp(buf
, path
), "Expected %s, got %s\n", path
, buf
);
7587 if (RegQueryValueEx(hkey1
, "DefCompany", NULL
, &type
, (LPBYTE
)path
, &size
) != ERROR_SUCCESS
)
7591 RegQueryValueEx(hkey2
, "RegisteredOrganization", NULL
, &type
, (LPBYTE
)path
, &size
);
7597 r
= MsiGetProperty(hpkg
, "COMPANYNAME", buf
, &size
);
7598 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7599 ok( !lstrcmp(buf
, path
), "Expected %s, got %s\n", path
, buf
);
7603 r
= MsiGetProperty(hpkg
, "VersionDatabase", buf
, &size
);
7604 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7605 trace("VersionDatabase = %s\n", buf
);
7608 r
= MsiGetProperty(hpkg
, "VersionMsi", buf
, &size
);
7609 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7610 trace("VersionMsi = %s\n", buf
);
7613 r
= MsiGetProperty(hpkg
, "Date", buf
, &size
);
7614 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7615 trace("Date = %s\n", buf
);
7618 r
= MsiGetProperty(hpkg
, "Time", buf
, &size
);
7619 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7620 trace("Time = %s\n", buf
);
7623 r
= MsiGetProperty(hpkg
, "PackageCode", buf
, &size
);
7624 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7625 trace("PackageCode = %s\n", buf
);
7627 langid
= GetUserDefaultLangID();
7628 sprintf(path
, "%d", langid
);
7631 r
= MsiGetProperty(hpkg
, "UserLanguageID", buf
, &size
);
7632 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS< got %d\n", r
);
7633 ok( !lstrcmpA(buf
, path
), "Expected \"%s\", got \"%s\"\n", path
, buf
);
7635 res
= GetSystemMetrics(SM_CXSCREEN
);
7637 r
= MsiGetProperty(hpkg
, "ScreenX", buf
, &size
);
7638 ok(atol(buf
) == res
, "Expected %d, got %ld\n", res
, atol(buf
));
7640 res
= GetSystemMetrics(SM_CYSCREEN
);
7642 r
= MsiGetProperty(hpkg
, "ScreenY", buf
, &size
);
7643 ok(atol(buf
) == res
, "Expected %d, got %ld\n", res
, atol(buf
));
7647 MsiCloseHandle(hpkg
);
7648 DeleteFile(msifile
);
7651 static void test_launchconditions(void)
7657 MsiSetInternalUI(INSTALLUILEVEL_NONE
, NULL
);
7659 hdb
= create_package_db();
7660 ok( hdb
, "failed to create package database\n" );
7662 r
= create_launchcondition_table( hdb
);
7663 ok( r
== ERROR_SUCCESS
, "cannot create LaunchCondition table: %d\n", r
);
7665 r
= add_launchcondition_entry( hdb
, "'X = \"1\"', 'one'" );
7666 ok( r
== ERROR_SUCCESS
, "cannot add launch condition: %d\n", r
);
7668 /* invalid condition */
7669 r
= add_launchcondition_entry( hdb
, "'X != \"1\"', 'one'" );
7670 ok( r
== ERROR_SUCCESS
, "cannot add launch condition: %d\n", r
);
7672 hpkg
= package_from_db( hdb
);
7673 ok( hpkg
, "failed to create package\n");
7675 MsiCloseHandle( hdb
);
7677 r
= MsiSetProperty( hpkg
, "X", "1" );
7678 ok( r
== ERROR_SUCCESS
, "failed to set property\n" );
7680 /* invalid conditions are ignored */
7681 r
= MsiDoAction( hpkg
, "LaunchConditions" );
7682 ok( r
== ERROR_SUCCESS
, "cost init failed\n" );
7684 /* verify LaunchConditions still does some verification */
7685 r
= MsiSetProperty( hpkg
, "X", "2" );
7686 ok( r
== ERROR_SUCCESS
, "failed to set property\n" );
7688 r
= MsiDoAction( hpkg
, "LaunchConditions" );
7689 ok( r
== ERROR_INSTALL_FAILURE
, "Expected ERROR_INSTALL_FAILURE, got %d\n", r
);
7691 MsiCloseHandle( hpkg
);
7692 DeleteFile( msifile
);
7695 static void test_ccpsearch(void)
7697 MSIHANDLE hdb
, hpkg
;
7698 CHAR prop
[MAX_PATH
];
7699 DWORD size
= MAX_PATH
;
7702 MsiSetInternalUI(INSTALLUILEVEL_NONE
, NULL
);
7704 hdb
= create_package_db();
7705 ok(hdb
, "failed to create package database\n");
7707 r
= create_ccpsearch_table(hdb
);
7708 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7710 r
= add_ccpsearch_entry(hdb
, "'CCP_random'");
7711 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7713 r
= add_ccpsearch_entry(hdb
, "'RMCCP_random'");
7714 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7716 r
= create_reglocator_table(hdb
);
7717 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7719 r
= add_reglocator_entry(hdb
, "'CCP_random', 0, 'htmlfile\\shell\\open\\nonexistent', '', 1");
7720 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7722 r
= create_drlocator_table(hdb
);
7723 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7725 r
= add_drlocator_entry(hdb
, "'RMCCP_random', '', 'C:\\', '0'");
7726 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7728 r
= create_signature_table(hdb
);
7729 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7731 hpkg
= package_from_db(hdb
);
7732 ok(hpkg
, "failed to create package\n");
7734 MsiCloseHandle(hdb
);
7736 r
= MsiDoAction(hpkg
, "CCPSearch");
7737 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7739 r
= MsiGetPropertyA(hpkg
, "CCP_Success", prop
, &size
);
7740 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7741 ok(!lstrcmpA(prop
, "1"), "Expected 1, got %s\n", prop
);
7743 MsiCloseHandle(hpkg
);
7744 DeleteFileA(msifile
);
7747 static void test_complocator(void)
7749 MSIHANDLE hdb
, hpkg
;
7751 CHAR prop
[MAX_PATH
];
7752 CHAR expected
[MAX_PATH
];
7753 DWORD size
= MAX_PATH
;
7755 hdb
= create_package_db();
7756 ok(hdb
, "failed to create package database\n");
7758 r
= create_appsearch_table(hdb
);
7759 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7761 r
= add_appsearch_entry(hdb
, "'ABELISAURUS', 'abelisaurus'");
7762 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7764 r
= add_appsearch_entry(hdb
, "'BACTROSAURUS', 'bactrosaurus'");
7765 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7767 r
= add_appsearch_entry(hdb
, "'CAMELOTIA', 'camelotia'");
7768 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7770 r
= add_appsearch_entry(hdb
, "'DICLONIUS', 'diclonius'");
7771 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7773 r
= add_appsearch_entry(hdb
, "'ECHINODON', 'echinodon'");
7774 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7776 r
= add_appsearch_entry(hdb
, "'FALCARIUS', 'falcarius'");
7777 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7779 r
= add_appsearch_entry(hdb
, "'GALLIMIMUS', 'gallimimus'");
7780 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7782 r
= add_appsearch_entry(hdb
, "'HAGRYPHUS', 'hagryphus'");
7783 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7785 r
= add_appsearch_entry(hdb
, "'IGUANODON', 'iguanodon'");
7786 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7788 r
= add_appsearch_entry(hdb
, "'JOBARIA', 'jobaria'");
7789 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7791 r
= add_appsearch_entry(hdb
, "'KAKURU', 'kakuru'");
7792 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7794 r
= add_appsearch_entry(hdb
, "'LABOCANIA', 'labocania'");
7795 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7797 r
= add_appsearch_entry(hdb
, "'MEGARAPTOR', 'megaraptor'");
7798 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7800 r
= add_appsearch_entry(hdb
, "'NEOSODON', 'neosodon'");
7801 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7803 r
= add_appsearch_entry(hdb
, "'OLOROTITAN', 'olorotitan'");
7804 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7806 r
= add_appsearch_entry(hdb
, "'PANTYDRACO', 'pantydraco'");
7807 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7809 r
= create_complocator_table(hdb
);
7810 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7812 r
= add_complocator_entry(hdb
, "'abelisaurus', '{E3619EED-305A-418C-B9C7-F7D7377F0934}', 1");
7813 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7815 r
= add_complocator_entry(hdb
, "'bactrosaurus', '{D56B688D-542F-42Ef-90FD-B6DA76EE8119}', 0");
7816 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7818 r
= add_complocator_entry(hdb
, "'camelotia', '{8211BE36-2466-47E3-AFB7-6AC72E51AED2}', 1");
7819 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7821 r
= add_complocator_entry(hdb
, "'diclonius', '{5C767B20-A33C-45A4-B80B-555E512F01AE}', 0");
7822 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7824 r
= add_complocator_entry(hdb
, "'echinodon', '{A19E16C5-C75D-4699-8111-C4338C40C3CB}', 1");
7825 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7827 r
= add_complocator_entry(hdb
, "'falcarius', '{17762FA1-A7AE-4CC6-8827-62873C35361D}', 0");
7828 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7830 r
= add_complocator_entry(hdb
, "'gallimimus', '{75EBF568-C959-41E0-A99E-9050638CF5FB}', 1");
7831 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7833 r
= add_complocator_entry(hdb
, "'hagrphus', '{D4969B72-17D9-4AB6-BE49-78F2FEE857AC}', 0");
7834 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7836 r
= add_complocator_entry(hdb
, "'iguanodon', '{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}', 1");
7837 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7839 r
= add_complocator_entry(hdb
, "'jobaria', '{243C22B1-8C51-4151-B9D1-1AE5265E079E}', 0");
7840 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7842 r
= add_complocator_entry(hdb
, "'kakuru', '{5D0F03BA-50BC-44F2-ABB1-72C972F4E514}', 1");
7843 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7845 r
= add_complocator_entry(hdb
, "'labocania', '{C7DDB60C-7828-4046-A6F8-699D5E92F1ED}', 0");
7846 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7848 r
= add_complocator_entry(hdb
, "'megaraptor', '{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}', 1");
7849 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7851 r
= add_complocator_entry(hdb
, "'neosodon', '{0B499649-197A-48EF-93D2-AF1C17ED6E90}', 0");
7852 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7854 r
= add_complocator_entry(hdb
, "'olorotitan', '{54E9E91F-AED2-46D5-A25A-7E50AFA24513}', 1");
7855 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7857 r
= add_complocator_entry(hdb
, "'pantydraco', '{2A989951-5565-4FA7-93A7-E800A3E67D71}', 0");
7858 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7860 r
= create_signature_table(hdb
);
7861 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7863 r
= add_signature_entry(hdb
, "'abelisaurus', 'abelisaurus', '', '', '', '', '', '', ''");
7864 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7866 r
= add_signature_entry(hdb
, "'bactrosaurus', 'bactrosaurus', '', '', '', '', '', '', ''");
7867 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7869 r
= add_signature_entry(hdb
, "'camelotia', 'camelotia', '', '', '', '', '', '', ''");
7870 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7872 r
= add_signature_entry(hdb
, "'diclonius', 'diclonius', '', '', '', '', '', '', ''");
7873 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7875 r
= add_signature_entry(hdb
, "'iguanodon', 'iguanodon', '', '', '', '', '', '', ''");
7876 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7878 r
= add_signature_entry(hdb
, "'jobaria', 'jobaria', '', '', '', '', '', '', ''");
7879 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7881 r
= add_signature_entry(hdb
, "'kakuru', 'kakuru', '', '', '', '', '', '', ''");
7882 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7884 r
= add_signature_entry(hdb
, "'labocania', 'labocania', '', '', '', '', '', '', ''");
7885 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7887 hpkg
= package_from_db(hdb
);
7888 ok(hpkg
, "failed to create package\n");
7890 MsiCloseHandle(hdb
);
7892 create_test_file("abelisaurus");
7893 create_test_file("bactrosaurus");
7894 create_test_file("camelotia");
7895 create_test_file("diclonius");
7896 create_test_file("echinodon");
7897 create_test_file("falcarius");
7898 create_test_file("gallimimus");
7899 create_test_file("hagryphus");
7900 CreateDirectoryA("iguanodon", NULL
);
7901 CreateDirectoryA("jobaria", NULL
);
7902 CreateDirectoryA("kakuru", NULL
);
7903 CreateDirectoryA("labocania", NULL
);
7904 CreateDirectoryA("megaraptor", NULL
);
7905 CreateDirectoryA("neosodon", NULL
);
7906 CreateDirectoryA("olorotitan", NULL
);
7907 CreateDirectoryA("pantydraco", NULL
);
7909 set_component_path("abelisaurus", MSIINSTALLCONTEXT_MACHINE
,
7910 "{E3619EED-305A-418C-B9C7-F7D7377F0934}", NULL
, FALSE
);
7911 set_component_path("bactrosaurus", MSIINSTALLCONTEXT_MACHINE
,
7912 "{D56B688D-542F-42Ef-90FD-B6DA76EE8119}", NULL
, FALSE
);
7913 set_component_path("echinodon", MSIINSTALLCONTEXT_MACHINE
,
7914 "{A19E16C5-C75D-4699-8111-C4338C40C3CB}", NULL
, FALSE
);
7915 set_component_path("falcarius", MSIINSTALLCONTEXT_MACHINE
,
7916 "{17762FA1-A7AE-4CC6-8827-62873C35361D}", NULL
, FALSE
);
7917 set_component_path("iguanodon", MSIINSTALLCONTEXT_MACHINE
,
7918 "{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}", NULL
, FALSE
);
7919 set_component_path("jobaria", MSIINSTALLCONTEXT_MACHINE
,
7920 "{243C22B1-8C51-4151-B9D1-1AE5265E079E}", NULL
, FALSE
);
7921 set_component_path("megaraptor", MSIINSTALLCONTEXT_MACHINE
,
7922 "{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}", NULL
, FALSE
);
7923 set_component_path("neosodon", MSIINSTALLCONTEXT_MACHINE
,
7924 "{0B499649-197A-48EF-93D2-AF1C17ED6E90}", NULL
, FALSE
);
7926 r
= MsiDoAction(hpkg
, "AppSearch");
7927 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7930 r
= MsiGetPropertyA(hpkg
, "ABELISAURUS", prop
, &size
);
7931 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7933 lstrcpyA(expected
, CURR_DIR
);
7934 lstrcatA(expected
, "\\abelisaurus");
7935 ok(!lstrcmpA(prop
, expected
) || !lstrcmpA(prop
, ""),
7936 "Expected %s or empty string, got %s\n", expected
, prop
);
7939 r
= MsiGetPropertyA(hpkg
, "BACTROSAURUS", prop
, &size
);
7940 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7941 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
7944 r
= MsiGetPropertyA(hpkg
, "CAMELOTIA", prop
, &size
);
7945 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7946 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
7949 r
= MsiGetPropertyA(hpkg
, "DICLONIUS", prop
, &size
);
7950 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7951 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
7954 r
= MsiGetPropertyA(hpkg
, "ECHINODON", prop
, &size
);
7955 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7957 lstrcpyA(expected
, CURR_DIR
);
7958 lstrcatA(expected
, "\\");
7959 ok(!lstrcmpA(prop
, expected
) || !lstrcmpA(prop
, ""),
7960 "Expected %s or empty string, got %s\n", expected
, prop
);
7963 r
= MsiGetPropertyA(hpkg
, "FALCARIUS", 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
, "GALLIMIMUS", 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
, "HAGRYPHUS", prop
, &size
);
7974 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7975 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
7978 r
= MsiGetPropertyA(hpkg
, "IGUANODON", prop
, &size
);
7979 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7980 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
7983 r
= MsiGetPropertyA(hpkg
, "JOBARIA", prop
, &size
);
7984 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7985 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
7988 r
= MsiGetPropertyA(hpkg
, "KAKURU", prop
, &size
);
7989 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7990 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
7993 r
= MsiGetPropertyA(hpkg
, "LABOCANIA", prop
, &size
);
7994 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7995 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
7998 r
= MsiGetPropertyA(hpkg
, "MEGARAPTOR", prop
, &size
);
7999 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8001 lstrcpyA(expected
, CURR_DIR
);
8002 lstrcatA(expected
, "\\");
8003 ok(!lstrcmpA(prop
, expected
) || !lstrcmpA(prop
, ""),
8004 "Expected %s or empty string, got %s\n", expected
, prop
);
8007 r
= MsiGetPropertyA(hpkg
, "NEOSODON", prop
, &size
);
8008 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8010 lstrcpyA(expected
, CURR_DIR
);
8011 lstrcatA(expected
, "\\neosodon\\");
8012 ok(!lstrcmpA(prop
, expected
) || !lstrcmpA(prop
, ""),
8013 "Expected %s or empty string, got %s\n", expected
, prop
);
8016 r
= MsiGetPropertyA(hpkg
, "OLOROTITAN", prop
, &size
);
8017 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8018 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
8021 r
= MsiGetPropertyA(hpkg
, "PANTYDRACO", prop
, &size
);
8022 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8023 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
8025 MsiCloseHandle(hpkg
);
8026 DeleteFileA("abelisaurus");
8027 DeleteFileA("bactrosaurus");
8028 DeleteFileA("camelotia");
8029 DeleteFileA("diclonius");
8030 DeleteFileA("echinodon");
8031 DeleteFileA("falcarius");
8032 DeleteFileA("gallimimus");
8033 DeleteFileA("hagryphus");
8034 RemoveDirectoryA("iguanodon");
8035 RemoveDirectoryA("jobaria");
8036 RemoveDirectoryA("kakuru");
8037 RemoveDirectoryA("labocania");
8038 RemoveDirectoryA("megaraptor");
8039 RemoveDirectoryA("neosodon");
8040 RemoveDirectoryA("olorotitan");
8041 RemoveDirectoryA("pantydraco");
8042 delete_component_path("{E3619EED-305A-418C-B9C7-F7D7377F0934}",
8043 MSIINSTALLCONTEXT_MACHINE
, NULL
);
8044 delete_component_path("{D56B688D-542F-42Ef-90FD-B6DA76EE8119}",
8045 MSIINSTALLCONTEXT_MACHINE
, NULL
);
8046 delete_component_path("{A19E16C5-C75D-4699-8111-C4338C40C3CB}",
8047 MSIINSTALLCONTEXT_MACHINE
, NULL
);
8048 delete_component_path("{17762FA1-A7AE-4CC6-8827-62873C35361D}",
8049 MSIINSTALLCONTEXT_MACHINE
, NULL
);
8050 delete_component_path("{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}",
8051 MSIINSTALLCONTEXT_MACHINE
, NULL
);
8052 delete_component_path("{243C22B1-8C51-4151-B9D1-1AE5265E079E}",
8053 MSIINSTALLCONTEXT_MACHINE
, NULL
);
8054 delete_component_path("{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}",
8055 MSIINSTALLCONTEXT_MACHINE
, NULL
);
8056 delete_component_path("{0B499649-197A-48EF-93D2-AF1C17ED6E90}",
8057 MSIINSTALLCONTEXT_MACHINE
, NULL
);
8058 DeleteFileA(msifile
);
8061 static void set_suminfo_prop(MSIHANDLE db
, DWORD prop
, DWORD val
)
8066 r
= MsiGetSummaryInformationA(db
, NULL
, 1, &summary
);
8067 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8069 r
= MsiSummaryInfoSetPropertyA(summary
, prop
, VT_I4
, val
, NULL
, NULL
);
8070 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8072 r
= MsiSummaryInfoPersist(summary
);
8073 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
8075 MsiCloseHandle(summary
);
8078 static void test_MsiGetSourcePath(void)
8080 MSIHANDLE hdb
, hpkg
;
8081 CHAR path
[MAX_PATH
];
8083 CHAR subsrc
[MAX_PATH
];
8084 CHAR sub2
[MAX_PATH
];
8088 lstrcpyA(cwd
, CURR_DIR
);
8089 lstrcatA(cwd
, "\\");
8091 lstrcpyA(subsrc
, cwd
);
8092 lstrcatA(subsrc
, "subsource");
8093 lstrcatA(subsrc
, "\\");
8095 lstrcpyA(sub2
, subsrc
);
8096 lstrcatA(sub2
, "sub2");
8097 lstrcatA(sub2
, "\\");
8099 /* uncompressed source */
8101 hdb
= create_package_db();
8102 ok( hdb
, "failed to create database\n");
8104 set_suminfo_prop(hdb
, PID_WORDCOUNT
, 0);
8106 r
= add_directory_entry(hdb
, "'TARGETDIR', '', 'SourceDir'");
8107 ok(r
== S_OK
, "failed\n");
8109 r
= add_directory_entry(hdb
, "'SubDir', 'TARGETDIR', 'subtarget:subsource'");
8110 ok(r
== S_OK
, "failed\n");
8112 r
= add_directory_entry(hdb
, "'SubDir2', 'SubDir', 'sub2'");
8113 ok(r
== S_OK
, "failed\n");
8115 r
= MsiDatabaseCommit(hdb
);
8116 ok(r
== ERROR_SUCCESS
, "Failed to commit database\n");
8118 hpkg
= package_from_db(hdb
);
8119 ok(hpkg
, "failed to create package\n");
8121 MsiCloseHandle(hdb
);
8123 /* invalid database handle */
8125 lstrcpyA(path
, "kiwi");
8126 r
= MsiGetSourcePath(-1, "TARGETDIR", path
, &size
);
8127 ok(r
== ERROR_INVALID_HANDLE
,
8128 "Expected ERROR_INVALID_HANDLE, got %d\n", r
);
8129 ok(!lstrcmpA(path
, "kiwi"),
8130 "Expected path to be unchanged, got \"%s\"\n", path
);
8131 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8135 lstrcpyA(path
, "kiwi");
8136 r
= MsiGetSourcePath(hpkg
, NULL
, path
, &size
);
8137 ok(r
== ERROR_INVALID_PARAMETER
,
8138 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
8139 ok(!lstrcmpA(path
, "kiwi"),
8140 "Expected path to be unchanged, got \"%s\"\n", path
);
8141 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8143 /* empty szFolder */
8145 lstrcpyA(path
, "kiwi");
8146 r
= MsiGetSourcePath(hpkg
, "", path
, &size
);
8147 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, 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
, "TARGETDIR", path
, &size
);
8156 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8157 ok(!lstrcmpA(path
, "kiwi"),
8158 "Expected path to be unchanged, got \"%s\"\n", path
);
8159 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8163 lstrcpyA(path
, "kiwi");
8164 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8165 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8166 ok(!lstrcmpA(path
, "kiwi"),
8167 "Expected path to be unchanged, got \"%s\"\n", path
);
8168 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8172 lstrcpyA(path
, "kiwi");
8173 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
8174 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8175 ok(!lstrcmpA(path
, "kiwi"),
8176 "Expected path to be unchanged, got \"%s\"\n", path
);
8177 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8179 /* source path does not exist, but the property exists */
8181 lstrcpyA(path
, "kiwi");
8182 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8183 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8184 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8185 ok(size
== 0, "Expected 0, got %d\n", size
);
8189 lstrcpyA(path
, "kiwi");
8190 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8191 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8192 ok(!lstrcmpA(path
, "kiwi"),
8193 "Expected path to be unchanged, got \"%s\"\n", path
);
8194 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8198 lstrcpyA(path
, "kiwi");
8199 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
8200 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8201 ok(!lstrcmpA(path
, "kiwi"),
8202 "Expected path to be unchanged, got \"%s\"\n", path
);
8203 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8205 r
= MsiDoAction(hpkg
, "CostInitialize");
8206 ok(r
== ERROR_SUCCESS
, "cost init failed\n");
8208 /* try TARGETDIR after CostInitialize */
8210 lstrcpyA(path
, "kiwi");
8211 r
= MsiGetSourcePath(hpkg
, "TARGETDIR", path
, &size
);
8212 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8213 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8214 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8216 /* try SourceDir after CostInitialize */
8218 lstrcpyA(path
, "kiwi");
8219 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8220 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8221 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8222 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8224 /* try SOURCEDIR after CostInitialize */
8226 lstrcpyA(path
, "kiwi");
8227 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
8228 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8229 ok(!lstrcmpA(path
, "kiwi"),
8230 "Expected path to be unchanged, got \"%s\"\n", path
);
8231 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8233 /* source path does not exist, but the property exists */
8235 lstrcpyA(path
, "kiwi");
8236 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8237 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
);
8244 /* try SubDir after CostInitialize */
8246 lstrcpyA(path
, "kiwi");
8247 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8248 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8249 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8250 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8252 /* try SubDir2 after CostInitialize */
8254 lstrcpyA(path
, "kiwi");
8255 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
8256 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8257 ok(!lstrcmpA(path
, sub2
), "Expected \"%s\", got \"%s\"\n", sub2
, path
);
8258 ok(size
== lstrlenA(sub2
), "Expected %d, got %d\n", lstrlenA(sub2
), size
);
8260 r
= MsiDoAction(hpkg
, "ResolveSource");
8261 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8263 /* try TARGETDIR after ResolveSource */
8265 lstrcpyA(path
, "kiwi");
8266 r
= MsiGetSourcePath(hpkg
, "TARGETDIR", path
, &size
);
8267 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8268 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8269 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8271 /* try SourceDir after ResolveSource */
8273 lstrcpyA(path
, "kiwi");
8274 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8275 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8276 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8277 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8279 /* try SOURCEDIR after ResolveSource */
8281 lstrcpyA(path
, "kiwi");
8282 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
8283 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8284 ok(!lstrcmpA(path
, "kiwi"),
8285 "Expected path to be unchanged, got \"%s\"\n", path
);
8286 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8288 /* source path does not exist, but the property exists */
8290 lstrcpyA(path
, "kiwi");
8291 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8292 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8293 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8294 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8296 /* try SubDir after ResolveSource */
8298 lstrcpyA(path
, "kiwi");
8299 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8300 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8301 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8302 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8304 /* try SubDir2 after ResolveSource */
8306 lstrcpyA(path
, "kiwi");
8307 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
8308 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8309 ok(!lstrcmpA(path
, sub2
), "Expected \"%s\", got \"%s\"\n", sub2
, path
);
8310 ok(size
== lstrlenA(sub2
), "Expected %d, got %d\n", lstrlenA(sub2
), size
);
8312 r
= MsiDoAction(hpkg
, "FileCost");
8313 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8315 /* try TARGETDIR after FileCost */
8317 lstrcpyA(path
, "kiwi");
8318 r
= MsiGetSourcePath(hpkg
, "TARGETDIR", path
, &size
);
8319 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8320 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8321 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8323 /* try SourceDir after FileCost */
8325 lstrcpyA(path
, "kiwi");
8326 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8327 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8328 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8329 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8331 /* try SOURCEDIR after FileCost */
8333 lstrcpyA(path
, "kiwi");
8334 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
8335 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8336 ok(!lstrcmpA(path
, "kiwi"),
8337 "Expected path to be unchanged, got \"%s\"\n", path
);
8338 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8340 /* try SubDir after FileCost */
8342 lstrcpyA(path
, "kiwi");
8343 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8344 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8345 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8346 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8348 /* try SubDir2 after FileCost */
8350 lstrcpyA(path
, "kiwi");
8351 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
8352 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8353 ok(!lstrcmpA(path
, sub2
), "Expected \"%s\", got \"%s\"\n", sub2
, path
);
8354 ok(size
== lstrlenA(sub2
), "Expected %d, got %d\n", lstrlenA(sub2
), size
);
8356 r
= MsiDoAction(hpkg
, "CostFinalize");
8357 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8359 /* try TARGETDIR after CostFinalize */
8361 lstrcpyA(path
, "kiwi");
8362 r
= MsiGetSourcePath(hpkg
, "TARGETDIR", path
, &size
);
8363 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8364 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8365 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8367 /* try SourceDir after CostFinalize */
8369 lstrcpyA(path
, "kiwi");
8370 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8371 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8372 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8373 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8375 /* try SOURCEDIR after CostFinalize */
8377 lstrcpyA(path
, "kiwi");
8378 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
8379 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8380 ok(!lstrcmpA(path
, "kiwi"),
8381 "Expected path to be unchanged, got \"%s\"\n", path
);
8382 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8384 /* try SubDir after CostFinalize */
8386 lstrcpyA(path
, "kiwi");
8387 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8388 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8389 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8390 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8392 /* try SubDir2 after CostFinalize */
8394 lstrcpyA(path
, "kiwi");
8395 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
8396 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8397 ok(!lstrcmpA(path
, sub2
), "Expected \"%s\", got \"%s\"\n", sub2
, path
);
8398 ok(size
== lstrlenA(sub2
), "Expected %d, got %d\n", lstrlenA(sub2
), size
);
8400 /* nonexistent directory */
8402 lstrcpyA(path
, "kiwi");
8403 r
= MsiGetSourcePath(hpkg
, "IDontExist", path
, &size
);
8404 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8405 ok(!lstrcmpA(path
, "kiwi"),
8406 "Expected path to be unchanged, got \"%s\"\n", path
);
8407 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8409 /* NULL szPathBuf */
8411 r
= MsiGetSourcePath(hpkg
, "SourceDir", NULL
, &size
);
8412 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8413 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8415 /* NULL pcchPathBuf */
8416 lstrcpyA(path
, "kiwi");
8417 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, NULL
);
8418 ok(r
== ERROR_INVALID_PARAMETER
,
8419 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
8420 ok(!lstrcmpA(path
, "kiwi"),
8421 "Expected path to be unchanged, got \"%s\"\n", path
);
8423 /* pcchPathBuf is 0 */
8425 lstrcpyA(path
, "kiwi");
8426 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8427 ok(r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
8428 ok(!lstrcmpA(path
, "kiwi"),
8429 "Expected path to be unchanged, got \"%s\"\n", path
);
8430 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8432 /* pcchPathBuf does not have room for NULL terminator */
8433 size
= lstrlenA(cwd
);
8434 lstrcpyA(path
, "kiwi");
8435 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8436 ok(r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
8437 ok(!strncmp(path
, cwd
, lstrlenA(cwd
) - 1),
8438 "Expected path with no backslash, got \"%s\"\n", path
);
8439 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8441 /* pcchPathBuf has room for NULL terminator */
8442 size
= lstrlenA(cwd
) + 1;
8443 lstrcpyA(path
, "kiwi");
8444 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8445 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8446 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8447 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8449 MsiCloseHandle(hpkg
);
8451 /* compressed source */
8453 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_DIRECT
, &hdb
);
8454 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8456 set_suminfo_prop(hdb
, PID_WORDCOUNT
, msidbSumInfoSourceTypeCompressed
);
8458 hpkg
= package_from_db(hdb
);
8459 ok(hpkg
, "failed to create package\n");
8461 r
= MsiDoAction(hpkg
, "CostInitialize");
8462 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8463 r
= MsiDoAction(hpkg
, "FileCost");
8464 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8465 r
= MsiDoAction(hpkg
, "CostFinalize");
8466 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8468 /* try TARGETDIR after CostFinalize */
8470 lstrcpyA(path
, "kiwi");
8471 r
= MsiGetSourcePath(hpkg
, "TARGETDIR", path
, &size
);
8472 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8473 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8474 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8476 /* try SourceDir after CostFinalize */
8478 lstrcpyA(path
, "kiwi");
8479 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8480 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8481 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8482 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8484 /* try SOURCEDIR after CostFinalize */
8486 lstrcpyA(path
, "kiwi");
8487 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
8490 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8491 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8492 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8495 /* try SubDir after CostFinalize */
8497 lstrcpyA(path
, "kiwi");
8498 r
= MsiGetSourcePath(hpkg
, "SubDir", 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 SubDir2 after CostFinalize */
8505 lstrcpyA(path
, "kiwi");
8506 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
8507 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8508 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8509 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8511 MsiCloseHandle(hpkg
);
8512 DeleteFile(msifile
);
8515 static void test_shortlongsource(void)
8517 MSIHANDLE hdb
, hpkg
;
8518 CHAR path
[MAX_PATH
];
8520 CHAR subsrc
[MAX_PATH
];
8524 lstrcpyA(cwd
, CURR_DIR
);
8525 lstrcatA(cwd
, "\\");
8527 lstrcpyA(subsrc
, cwd
);
8528 lstrcatA(subsrc
, "long");
8529 lstrcatA(subsrc
, "\\");
8531 /* long file names */
8533 hdb
= create_package_db();
8534 ok( hdb
, "failed to create database\n");
8536 set_suminfo_prop(hdb
, PID_WORDCOUNT
, 0);
8538 r
= add_directory_entry(hdb
, "'TARGETDIR', '', 'SourceDir'");
8539 ok(r
== S_OK
, "failed\n");
8541 r
= add_directory_entry(hdb
, "'SubDir', 'TARGETDIR', 'short|long'");
8542 ok(r
== S_OK
, "failed\n");
8544 /* CostInitialize:short */
8545 r
= add_directory_entry(hdb
, "'SubDir2', 'TARGETDIR', 'one|two'");
8546 ok(r
== S_OK
, "failed\n");
8548 /* CostInitialize:long */
8549 r
= add_directory_entry(hdb
, "'SubDir3', 'TARGETDIR', 'three|four'");
8550 ok(r
== S_OK
, "failed\n");
8552 /* FileCost:short */
8553 r
= add_directory_entry(hdb
, "'SubDir4', 'TARGETDIR', 'five|six'");
8554 ok(r
== S_OK
, "failed\n");
8557 r
= add_directory_entry(hdb
, "'SubDir5', 'TARGETDIR', 'seven|eight'");
8558 ok(r
== S_OK
, "failed\n");
8560 /* CostFinalize:short */
8561 r
= add_directory_entry(hdb
, "'SubDir6', 'TARGETDIR', 'nine|ten'");
8562 ok(r
== S_OK
, "failed\n");
8564 /* CostFinalize:long */
8565 r
= add_directory_entry(hdb
, "'SubDir7', 'TARGETDIR', 'eleven|twelve'");
8566 ok(r
== S_OK
, "failed\n");
8568 MsiDatabaseCommit(hdb
);
8570 hpkg
= package_from_db(hdb
);
8571 ok(hpkg
, "failed to create package\n");
8573 MsiCloseHandle(hdb
);
8575 CreateDirectoryA("one", NULL
);
8576 CreateDirectoryA("four", NULL
);
8578 r
= MsiDoAction(hpkg
, "CostInitialize");
8579 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8581 CreateDirectory("five", NULL
);
8582 CreateDirectory("eight", NULL
);
8584 r
= MsiDoAction(hpkg
, "FileCost");
8585 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8587 CreateDirectory("nine", NULL
);
8588 CreateDirectory("twelve", NULL
);
8590 r
= MsiDoAction(hpkg
, "CostFinalize");
8591 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8593 /* neither short nor long source directories exist */
8595 lstrcpyA(path
, "kiwi");
8596 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8597 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8598 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8599 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8601 CreateDirectoryA("short", NULL
);
8603 /* short source directory exists */
8605 lstrcpyA(path
, "kiwi");
8606 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8607 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8608 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8609 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8611 CreateDirectoryA("long", NULL
);
8613 /* both short and long source directories exist */
8615 lstrcpyA(path
, "kiwi");
8616 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8617 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8618 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8619 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8621 lstrcpyA(subsrc
, cwd
);
8622 lstrcatA(subsrc
, "two");
8623 lstrcatA(subsrc
, "\\");
8625 /* short dir exists before CostInitialize */
8627 lstrcpyA(path
, "kiwi");
8628 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
8629 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8630 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8631 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8633 lstrcpyA(subsrc
, cwd
);
8634 lstrcatA(subsrc
, "four");
8635 lstrcatA(subsrc
, "\\");
8637 /* long dir exists before CostInitialize */
8639 lstrcpyA(path
, "kiwi");
8640 r
= MsiGetSourcePath(hpkg
, "SubDir3", path
, &size
);
8641 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8642 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8643 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8645 lstrcpyA(subsrc
, cwd
);
8646 lstrcatA(subsrc
, "six");
8647 lstrcatA(subsrc
, "\\");
8649 /* short dir exists before FileCost */
8651 lstrcpyA(path
, "kiwi");
8652 r
= MsiGetSourcePath(hpkg
, "SubDir4", path
, &size
);
8653 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8654 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8655 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8657 lstrcpyA(subsrc
, cwd
);
8658 lstrcatA(subsrc
, "eight");
8659 lstrcatA(subsrc
, "\\");
8661 /* long dir exists before FileCost */
8663 lstrcpyA(path
, "kiwi");
8664 r
= MsiGetSourcePath(hpkg
, "SubDir5", path
, &size
);
8665 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8666 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8667 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8669 lstrcpyA(subsrc
, cwd
);
8670 lstrcatA(subsrc
, "ten");
8671 lstrcatA(subsrc
, "\\");
8673 /* short dir exists before CostFinalize */
8675 lstrcpyA(path
, "kiwi");
8676 r
= MsiGetSourcePath(hpkg
, "SubDir6", path
, &size
);
8677 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8678 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8679 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8681 lstrcpyA(subsrc
, cwd
);
8682 lstrcatA(subsrc
, "twelve");
8683 lstrcatA(subsrc
, "\\");
8685 /* long dir exists before CostFinalize */
8687 lstrcpyA(path
, "kiwi");
8688 r
= MsiGetSourcePath(hpkg
, "SubDir7", path
, &size
);
8689 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8690 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8691 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8693 MsiCloseHandle(hpkg
);
8694 RemoveDirectoryA("short");
8695 RemoveDirectoryA("long");
8696 RemoveDirectoryA("one");
8697 RemoveDirectoryA("four");
8698 RemoveDirectoryA("five");
8699 RemoveDirectoryA("eight");
8700 RemoveDirectoryA("nine");
8701 RemoveDirectoryA("twelve");
8703 /* short file names */
8705 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_DIRECT
, &hdb
);
8706 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8708 set_suminfo_prop(hdb
, PID_WORDCOUNT
, msidbSumInfoSourceTypeSFN
);
8710 hpkg
= package_from_db(hdb
);
8711 ok(hpkg
, "failed to create package\n");
8713 MsiCloseHandle(hdb
);
8715 CreateDirectoryA("one", NULL
);
8716 CreateDirectoryA("four", NULL
);
8718 r
= MsiDoAction(hpkg
, "CostInitialize");
8719 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8721 CreateDirectory("five", NULL
);
8722 CreateDirectory("eight", NULL
);
8724 r
= MsiDoAction(hpkg
, "FileCost");
8725 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8727 CreateDirectory("nine", NULL
);
8728 CreateDirectory("twelve", NULL
);
8730 r
= MsiDoAction(hpkg
, "CostFinalize");
8731 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8733 lstrcpyA(subsrc
, cwd
);
8734 lstrcatA(subsrc
, "short");
8735 lstrcatA(subsrc
, "\\");
8737 /* neither short nor long source directories exist */
8739 lstrcpyA(path
, "kiwi");
8740 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8741 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8742 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8743 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8745 CreateDirectoryA("short", NULL
);
8747 /* short source directory exists */
8749 lstrcpyA(path
, "kiwi");
8750 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8751 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8752 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8753 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8755 CreateDirectoryA("long", NULL
);
8757 /* both short and long source directories exist */
8759 lstrcpyA(path
, "kiwi");
8760 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8761 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8762 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8763 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8765 lstrcpyA(subsrc
, cwd
);
8766 lstrcatA(subsrc
, "one");
8767 lstrcatA(subsrc
, "\\");
8769 /* short dir exists before CostInitialize */
8771 lstrcpyA(path
, "kiwi");
8772 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
8773 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8774 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8775 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8777 lstrcpyA(subsrc
, cwd
);
8778 lstrcatA(subsrc
, "three");
8779 lstrcatA(subsrc
, "\\");
8781 /* long dir exists before CostInitialize */
8783 lstrcpyA(path
, "kiwi");
8784 r
= MsiGetSourcePath(hpkg
, "SubDir3", path
, &size
);
8785 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8786 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8787 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8789 lstrcpyA(subsrc
, cwd
);
8790 lstrcatA(subsrc
, "five");
8791 lstrcatA(subsrc
, "\\");
8793 /* short dir exists before FileCost */
8795 lstrcpyA(path
, "kiwi");
8796 r
= MsiGetSourcePath(hpkg
, "SubDir4", path
, &size
);
8797 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8798 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8799 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8801 lstrcpyA(subsrc
, cwd
);
8802 lstrcatA(subsrc
, "seven");
8803 lstrcatA(subsrc
, "\\");
8805 /* long dir exists before FileCost */
8807 lstrcpyA(path
, "kiwi");
8808 r
= MsiGetSourcePath(hpkg
, "SubDir5", path
, &size
);
8809 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8810 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8811 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8813 lstrcpyA(subsrc
, cwd
);
8814 lstrcatA(subsrc
, "nine");
8815 lstrcatA(subsrc
, "\\");
8817 /* short dir exists before CostFinalize */
8819 lstrcpyA(path
, "kiwi");
8820 r
= MsiGetSourcePath(hpkg
, "SubDir6", path
, &size
);
8821 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8822 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8823 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8825 lstrcpyA(subsrc
, cwd
);
8826 lstrcatA(subsrc
, "eleven");
8827 lstrcatA(subsrc
, "\\");
8829 /* long dir exists before CostFinalize */
8831 lstrcpyA(path
, "kiwi");
8832 r
= MsiGetSourcePath(hpkg
, "SubDir7", path
, &size
);
8833 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8834 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8835 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8837 MsiCloseHandle(hpkg
);
8838 RemoveDirectoryA("short");
8839 RemoveDirectoryA("long");
8840 RemoveDirectoryA("one");
8841 RemoveDirectoryA("four");
8842 RemoveDirectoryA("five");
8843 RemoveDirectoryA("eight");
8844 RemoveDirectoryA("nine");
8845 RemoveDirectoryA("twelve");
8846 DeleteFileA(msifile
);
8849 static void test_sourcedir(void)
8851 MSIHANDLE hdb
, hpkg
;
8853 CHAR path
[MAX_PATH
];
8855 CHAR subsrc
[MAX_PATH
];
8859 lstrcpyA(cwd
, CURR_DIR
);
8860 lstrcatA(cwd
, "\\");
8862 lstrcpyA(subsrc
, cwd
);
8863 lstrcatA(subsrc
, "long");
8864 lstrcatA(subsrc
, "\\");
8866 hdb
= create_package_db();
8867 ok( hdb
, "failed to create database\n");
8869 r
= add_directory_entry(hdb
, "'TARGETDIR', '', 'SourceDir'");
8870 ok(r
== S_OK
, "failed\n");
8872 sprintf(package
, "#%li", hdb
);
8873 r
= MsiOpenPackage(package
, &hpkg
);
8874 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8876 /* properties only */
8878 /* SourceDir prop */
8880 lstrcpyA(path
, "kiwi");
8881 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
8882 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8883 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8884 ok(size
== 0, "Expected 0, got %d\n", size
);
8886 /* SOURCEDIR prop */
8888 lstrcpyA(path
, "kiwi");
8889 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8890 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8891 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8892 ok(size
== 0, "Expected 0, got %d\n", size
);
8894 r
= MsiDoAction(hpkg
, "CostInitialize");
8895 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8897 /* SourceDir after CostInitialize */
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 after CostInitialize */
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
, "FileCost");
8914 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8916 /* SourceDir after FileCost */
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 FileCost */
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
, "CostFinalize");
8933 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8935 /* SourceDir after CostFinalize */
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 CostFinalize */
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
, "ResolveSource");
8952 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8954 /* SourceDir after ResolveSource */
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
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8960 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8962 /* SOURCEDIR after ResolveSource */
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
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8968 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8972 lstrcpyA(path
, "kiwi");
8973 r
= MsiGetProperty(hpkg
, "SoUrCeDiR", path
, &size
);
8974 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8975 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8976 ok(size
== 0, "Expected 0, got %d\n", size
);
8978 MsiCloseHandle(hpkg
);
8980 /* reset the package state */
8981 sprintf(package
, "#%li", hdb
);
8982 r
= MsiOpenPackage(package
, &hpkg
);
8983 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8985 /* test how MsiGetSourcePath affects the properties */
8987 /* SourceDir prop */
8989 lstrcpyA(path
, "kiwi");
8990 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
8991 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
);
8999 lstrcpyA(path
, "kiwi");
9000 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
9001 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
9002 ok(!lstrcmpA(path
, "kiwi"),
9003 "Expected path to be unchanged, got \"%s\"\n", path
);
9004 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
9006 /* SourceDir after MsiGetSourcePath */
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
);
9017 /* SOURCEDIR prop */
9019 lstrcpyA(path
, "kiwi");
9020 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
9021 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9024 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
9025 ok(size
== 0, "Expected 0, got %d\n", size
);
9029 lstrcpyA(path
, "kiwi");
9030 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
9031 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
9032 ok(!lstrcmpA(path
, "kiwi"),
9033 "Expected path to be unchanged, got \"%s\"\n", path
);
9034 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
9036 /* SOURCEDIR prop after MsiGetSourcePath */
9038 lstrcpyA(path
, "kiwi");
9039 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
9040 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9043 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
9044 ok(size
== 0, "Expected 0, got %d\n", size
);
9047 r
= MsiDoAction(hpkg
, "CostInitialize");
9048 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
9050 /* SourceDir after CostInitialize */
9052 lstrcpyA(path
, "kiwi");
9053 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
9054 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9057 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
9058 ok(size
== 0, "Expected 0, got %d\n", size
);
9062 lstrcpyA(path
, "kiwi");
9063 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
9064 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9065 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
9066 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
9068 /* SourceDir after MsiGetSourcePath */
9070 lstrcpyA(path
, "kiwi");
9071 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
9072 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9073 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
9074 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
9076 /* SOURCEDIR after CostInitialize */
9078 lstrcpyA(path
, "kiwi");
9079 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
9080 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9081 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
9082 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
9084 /* SOURCEDIR source path still does not exist */
9086 lstrcpyA(path
, "kiwi");
9087 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
9088 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
9089 ok(!lstrcmpA(path
, "kiwi"),
9090 "Expected path to be unchanged, got \"%s\"\n", path
);
9091 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
9093 r
= MsiDoAction(hpkg
, "FileCost");
9094 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
9096 /* SourceDir after FileCost */
9098 lstrcpyA(path
, "kiwi");
9099 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
9100 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9101 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
9102 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
9104 /* SOURCEDIR after FileCost */
9106 lstrcpyA(path
, "kiwi");
9107 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
9108 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9109 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
9110 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
9112 /* SOURCEDIR source path still does not exist */
9114 lstrcpyA(path
, "kiwi");
9115 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
9116 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
9117 ok(!lstrcmpA(path
, "kiwi"),
9118 "Expected path to be unchanged, got \"%s\"\n", path
);
9119 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
9121 r
= MsiDoAction(hpkg
, "CostFinalize");
9122 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
9124 /* SourceDir after CostFinalize */
9126 lstrcpyA(path
, "kiwi");
9127 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
9128 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9129 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
9130 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
9132 /* SOURCEDIR after CostFinalize */
9134 lstrcpyA(path
, "kiwi");
9135 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
9136 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9137 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
9138 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
9140 /* SOURCEDIR source path still does not exist */
9142 lstrcpyA(path
, "kiwi");
9143 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
9144 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
9145 ok(!lstrcmpA(path
, "kiwi"),
9146 "Expected path to be unchanged, got \"%s\"\n", path
);
9147 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
9149 r
= MsiDoAction(hpkg
, "ResolveSource");
9150 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
9152 /* SourceDir after ResolveSource */
9154 lstrcpyA(path
, "kiwi");
9155 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
9156 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9157 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
9158 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
9160 /* SOURCEDIR after ResolveSource */
9162 lstrcpyA(path
, "kiwi");
9163 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
9164 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9165 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
9166 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
9168 /* SOURCEDIR source path still does not exist */
9170 lstrcpyA(path
, "kiwi");
9171 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
9172 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
9173 ok(!lstrcmpA(path
, "kiwi"),
9174 "Expected path to be unchanged, got \"%s\"\n", path
);
9175 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
9177 MsiCloseHandle(hdb
);
9178 MsiCloseHandle(hpkg
);
9179 DeleteFileA(msifile
);
9189 static const struct access_res create
[16] =
9191 { TRUE
, ERROR_SUCCESS
, TRUE
},
9192 { TRUE
, ERROR_SUCCESS
, TRUE
},
9193 { TRUE
, ERROR_SUCCESS
, FALSE
},
9194 { TRUE
, ERROR_SUCCESS
, FALSE
},
9195 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9196 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9197 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9198 { TRUE
, ERROR_SUCCESS
, FALSE
},
9199 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9200 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9201 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9202 { TRUE
, ERROR_SUCCESS
, TRUE
},
9203 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9204 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9205 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9206 { TRUE
, ERROR_SUCCESS
, TRUE
}
9209 static const struct access_res create_commit
[16] =
9211 { TRUE
, ERROR_SUCCESS
, TRUE
},
9212 { TRUE
, ERROR_SUCCESS
, TRUE
},
9213 { TRUE
, ERROR_SUCCESS
, FALSE
},
9214 { TRUE
, ERROR_SUCCESS
, FALSE
},
9215 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9216 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9217 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9218 { TRUE
, ERROR_SUCCESS
, FALSE
},
9219 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9220 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9221 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9222 { TRUE
, ERROR_SUCCESS
, TRUE
},
9223 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9224 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9225 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9226 { TRUE
, ERROR_SUCCESS
, TRUE
}
9229 static const struct access_res create_close
[16] =
9231 { TRUE
, ERROR_SUCCESS
, FALSE
},
9232 { TRUE
, ERROR_SUCCESS
, FALSE
},
9233 { TRUE
, ERROR_SUCCESS
, FALSE
},
9234 { TRUE
, ERROR_SUCCESS
, FALSE
},
9235 { TRUE
, ERROR_SUCCESS
, FALSE
},
9236 { TRUE
, ERROR_SUCCESS
, FALSE
},
9237 { TRUE
, ERROR_SUCCESS
, FALSE
},
9238 { TRUE
, ERROR_SUCCESS
, FALSE
},
9239 { TRUE
, ERROR_SUCCESS
, FALSE
},
9240 { TRUE
, ERROR_SUCCESS
, FALSE
},
9241 { TRUE
, ERROR_SUCCESS
, FALSE
},
9242 { TRUE
, ERROR_SUCCESS
, FALSE
},
9243 { TRUE
, ERROR_SUCCESS
, FALSE
},
9244 { TRUE
, ERROR_SUCCESS
, FALSE
},
9245 { TRUE
, ERROR_SUCCESS
, FALSE
},
9246 { TRUE
, ERROR_SUCCESS
}
9249 static void _test_file_access(LPCSTR file
, const struct access_res
*ares
, DWORD line
)
9251 DWORD access
= 0, share
= 0;
9256 for (i
= 0; i
< 4; i
++)
9258 if (i
== 0) access
= 0;
9259 if (i
== 1) access
= GENERIC_READ
;
9260 if (i
== 2) access
= GENERIC_WRITE
;
9261 if (i
== 3) access
= GENERIC_READ
| GENERIC_WRITE
;
9263 for (j
= 0; j
< 4; j
++)
9265 if (ares
[idx
].ignore
)
9268 if (j
== 0) share
= 0;
9269 if (j
== 1) share
= FILE_SHARE_READ
;
9270 if (j
== 2) share
= FILE_SHARE_WRITE
;
9271 if (j
== 3) share
= FILE_SHARE_READ
| FILE_SHARE_WRITE
;
9273 SetLastError(0xdeadbeef);
9274 hfile
= CreateFileA(file
, access
, share
, NULL
, OPEN_EXISTING
,
9275 FILE_ATTRIBUTE_NORMAL
, 0);
9276 lasterr
= GetLastError();
9278 ok((hfile
!= INVALID_HANDLE_VALUE
) == ares
[idx
].gothandle
,
9279 "(%d, handle, %d): Expected %d, got %d\n",
9280 line
, idx
, ares
[idx
].gothandle
,
9281 (hfile
!= INVALID_HANDLE_VALUE
));
9283 ok(lasterr
== ares
[idx
].lasterr
||
9284 lasterr
== 0xdeadbeef, /* win9x */
9285 "(%d, lasterr, %d): Expected %d, got %d\n",
9286 line
, idx
, ares
[idx
].lasterr
, lasterr
);
9294 #define test_file_access(file, ares) _test_file_access(file, ares, __LINE__)
9296 static void test_access(void)
9301 r
= MsiOpenDatabaseA(msifile
, MSIDBOPEN_CREATE
, &hdb
);
9302 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9304 test_file_access(msifile
, create
);
9306 r
= MsiDatabaseCommit(hdb
);
9307 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9309 test_file_access(msifile
, create_commit
);
9311 MsiCloseHandle(hdb
);
9313 test_file_access(msifile
, create_close
);
9315 DeleteFileA(msifile
);
9317 r
= MsiOpenDatabaseA(msifile
, MSIDBOPEN_CREATEDIRECT
, &hdb
);
9318 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9320 test_file_access(msifile
, create
);
9322 r
= MsiDatabaseCommit(hdb
);
9323 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9325 test_file_access(msifile
, create_commit
);
9327 MsiCloseHandle(hdb
);
9329 test_file_access(msifile
, create_close
);
9331 DeleteFileA(msifile
);
9334 static void test_emptypackage(void)
9336 MSIHANDLE hpkg
, hdb
, hsuminfo
;
9337 MSIHANDLE hview
, hrec
;
9338 MSICONDITION condition
;
9339 CHAR buffer
[MAX_PATH
];
9343 r
= MsiOpenPackageA("", &hpkg
);
9346 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9349 hdb
= MsiGetActiveDatabase(hpkg
);
9352 ok(hdb
!= 0, "Expected a valid database handle\n");
9355 r
= MsiDatabaseOpenView(hdb
, "SELECT * FROM `_Tables`", &hview
);
9358 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9360 r
= MsiViewExecute(hview
, 0);
9363 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9366 r
= MsiViewFetch(hview
, &hrec
);
9369 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9373 r
= MsiRecordGetString(hrec
, 1, buffer
, &size
);
9376 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9377 ok(!lstrcmpA(buffer
, "_Property"),
9378 "Expected \"_Property\", got \"%s\"\n", buffer
);
9381 MsiCloseHandle(hrec
);
9383 r
= MsiViewFetch(hview
, &hrec
);
9386 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9390 r
= MsiRecordGetString(hrec
, 1, buffer
, &size
);
9393 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9394 ok(!lstrcmpA(buffer
, "#_FolderCache"),
9395 "Expected \"_Property\", got \"%s\"\n", buffer
);
9398 MsiCloseHandle(hrec
);
9399 MsiViewClose(hview
);
9400 MsiCloseHandle(hview
);
9402 condition
= MsiDatabaseIsTablePersistentA(hdb
, "_Property");
9405 ok(condition
== MSICONDITION_FALSE
,
9406 "Expected MSICONDITION_FALSE, got %d\n", condition
);
9409 r
= MsiDatabaseOpenView(hdb
, "SELECT * FROM `_Property`", &hview
);
9412 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9414 r
= MsiViewExecute(hview
, 0);
9417 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9420 /* _Property table is not empty */
9421 r
= MsiViewFetch(hview
, &hrec
);
9424 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9427 MsiCloseHandle(hrec
);
9428 MsiViewClose(hview
);
9429 MsiCloseHandle(hview
);
9431 condition
= MsiDatabaseIsTablePersistentA(hdb
, "#_FolderCache");
9434 ok(condition
== MSICONDITION_FALSE
,
9435 "Expected MSICONDITION_FALSE, got %d\n", condition
);
9438 r
= MsiDatabaseOpenView(hdb
, "SELECT * FROM `#_FolderCache`", &hview
);
9441 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9443 r
= MsiViewExecute(hview
, 0);
9446 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9449 /* #_FolderCache is not empty */
9450 r
= MsiViewFetch(hview
, &hrec
);
9453 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9456 MsiCloseHandle(hrec
);
9457 MsiViewClose(hview
);
9458 MsiCloseHandle(hview
);
9460 r
= MsiDatabaseOpenView(hdb
, "SELECT * FROM `_Streams`", &hview
);
9463 ok(r
== ERROR_BAD_QUERY_SYNTAX
,
9464 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r
);
9467 r
= MsiDatabaseOpenView(hdb
, "SELECT * FROM `_Storages`", &hview
);
9470 ok(r
== ERROR_BAD_QUERY_SYNTAX
,
9471 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r
);
9474 r
= MsiGetSummaryInformationA(hdb
, NULL
, 0, &hsuminfo
);
9477 ok(r
== ERROR_INSTALL_PACKAGE_INVALID
,
9478 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r
);
9481 MsiCloseHandle(hsuminfo
);
9483 r
= MsiDatabaseCommit(hdb
);
9486 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9489 MsiCloseHandle(hdb
);
9490 MsiCloseHandle(hpkg
);
9495 GetCurrentDirectoryA(MAX_PATH
, CURR_DIR
);
9497 test_createpackage();
9499 test_gettargetpath_bad();
9500 test_settargetpath();
9502 test_property_table();
9505 test_formatrecord2();
9510 test_appsearch_complocator();
9511 test_appsearch_reglocator();
9512 test_appsearch_inilocator();
9513 test_appsearch_drlocator();
9514 test_featureparents();
9515 test_installprops();
9516 test_launchconditions();
9519 test_MsiGetSourcePath();
9520 test_shortlongsource();
9523 test_emptypackage();