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
, buf
, size
, &size
);
52 user
= (PTOKEN_USER
)buf
;
53 pConvertSidToStringSidA(user
->User
.Sid
, usersid
);
57 /* RegDeleteTreeW from dlls/advapi32/registry.c */
58 static LSTATUS
package_RegDeleteTreeW(HKEY hKey
, LPCWSTR lpszSubKey
)
61 DWORD dwMaxSubkeyLen
, dwMaxValueLen
;
62 DWORD dwMaxLen
, dwSize
;
63 WCHAR szNameBuf
[MAX_PATH
], *lpszName
= szNameBuf
;
68 ret
= RegOpenKeyExW(hKey
, lpszSubKey
, 0, KEY_READ
, &hSubKey
);
72 ret
= RegQueryInfoKeyW(hSubKey
, NULL
, NULL
, NULL
, NULL
,
73 &dwMaxSubkeyLen
, NULL
, NULL
, &dwMaxValueLen
, NULL
, NULL
, NULL
);
74 if (ret
) goto cleanup
;
78 dwMaxLen
= max(dwMaxSubkeyLen
, dwMaxValueLen
);
79 if (dwMaxLen
> sizeof(szNameBuf
)/sizeof(WCHAR
))
81 /* Name too big: alloc a buffer for it */
82 if (!(lpszName
= HeapAlloc( GetProcessHeap(), 0, dwMaxLen
*sizeof(WCHAR
))))
84 ret
= ERROR_NOT_ENOUGH_MEMORY
;
89 /* Recursively delete all the subkeys */
93 if (RegEnumKeyExW(hSubKey
, 0, lpszName
, &dwSize
, NULL
,
94 NULL
, NULL
, NULL
)) break;
96 ret
= package_RegDeleteTreeW(hSubKey
, lpszName
);
97 if (ret
) goto cleanup
;
101 ret
= RegDeleteKeyW(hKey
, lpszSubKey
);
106 if (RegEnumValueW(hKey
, 0, lpszName
, &dwSize
,
107 NULL
, NULL
, NULL
, NULL
)) break;
109 ret
= RegDeleteValueW(hKey
, lpszName
);
110 if (ret
) goto cleanup
;
114 if (lpszName
!= szNameBuf
)
115 HeapFree(GetProcessHeap(), 0, lpszName
);
117 RegCloseKey(hSubKey
);
121 static BOOL
squash_guid(LPCWSTR in
, LPWSTR out
)
126 if (FAILED(CLSIDFromString((LPOLESTR
)in
, &guid
)))
140 out
[17+i
*2] = in
[n
++];
141 out
[16+i
*2] = in
[n
++];
146 out
[17+i
*2] = in
[n
++];
147 out
[16+i
*2] = in
[n
++];
153 static void create_test_guid(LPSTR prodcode
, LPSTR squashed
)
155 WCHAR guidW
[MAX_PATH
];
156 WCHAR squashedW
[MAX_PATH
];
161 hr
= CoCreateGuid(&guid
);
162 ok(hr
== S_OK
, "Expected S_OK, got %d\n", hr
);
164 size
= StringFromGUID2(&guid
, guidW
, MAX_PATH
);
165 ok(size
== 39, "Expected 39, got %d\n", hr
);
167 WideCharToMultiByte(CP_ACP
, 0, guidW
, size
, prodcode
, MAX_PATH
, NULL
, NULL
);
168 squash_guid(guidW
, squashedW
);
169 WideCharToMultiByte(CP_ACP
, 0, squashedW
, -1, squashed
, MAX_PATH
, NULL
, NULL
);
172 static void set_component_path(LPCSTR filename
, MSIINSTALLCONTEXT context
,
173 LPCSTR guid
, LPSTR usersid
, BOOL dir
)
175 WCHAR guidW
[MAX_PATH
];
176 WCHAR squashedW
[MAX_PATH
];
177 CHAR squashed
[MAX_PATH
];
178 CHAR comppath
[MAX_PATH
];
179 CHAR prodpath
[MAX_PATH
];
184 MultiByteToWideChar(CP_ACP
, 0, guid
, -1, guidW
, MAX_PATH
);
185 squash_guid(guidW
, squashedW
);
186 WideCharToMultiByte(CP_ACP
, 0, squashedW
, -1, squashed
, MAX_PATH
, NULL
, NULL
);
188 if (context
== MSIINSTALLCONTEXT_MACHINE
)
190 prod
= "3D0DAE300FACA1300AD792060BCDAA92";
192 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
193 "Installer\\UserData\\S-1-5-18\\Components\\%s", squashed
);
195 "SOFTWARE\\Classes\\Installer\\"
196 "Products\\3D0DAE300FACA1300AD792060BCDAA92");
198 else if (context
== MSIINSTALLCONTEXT_USERUNMANAGED
)
200 prod
= "7D2F387510109040002000060BECB6AB";
202 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
203 "Installer\\UserData\\%s\\Components\\%s", usersid
, squashed
);
205 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
206 "Installer\\%s\\Installer\\Products\\"
207 "7D2F387510109040002000060BECB6AB", usersid
);
209 else if (context
== MSIINSTALLCONTEXT_USERMANAGED
)
211 prod
= "7D2F387510109040002000060BECB6AB";
213 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
214 "Installer\\UserData\\%s\\Components\\%s", usersid
, squashed
);
216 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
217 "Installer\\Managed\\%s\\Installer\\Products\\"
218 "7D2F387510109040002000060BECB6AB", usersid
);
221 RegCreateKeyA(HKEY_LOCAL_MACHINE
, comppath
, &hkey
);
223 lstrcpyA(path
, CURR_DIR
);
224 lstrcatA(path
, "\\");
225 if (!dir
) lstrcatA(path
, filename
);
227 RegSetValueExA(hkey
, prod
, 0, REG_SZ
, (LPBYTE
)path
, lstrlenA(path
));
230 RegCreateKeyA(HKEY_LOCAL_MACHINE
, prodpath
, &hkey
);
234 static void delete_component_path(LPCSTR guid
, MSIINSTALLCONTEXT context
, LPSTR usersid
)
236 WCHAR guidW
[MAX_PATH
];
237 WCHAR squashedW
[MAX_PATH
];
238 WCHAR substrW
[MAX_PATH
];
239 CHAR squashed
[MAX_PATH
];
240 CHAR comppath
[MAX_PATH
];
241 CHAR prodpath
[MAX_PATH
];
243 MultiByteToWideChar(CP_ACP
, 0, guid
, -1, guidW
, MAX_PATH
);
244 squash_guid(guidW
, squashedW
);
245 WideCharToMultiByte(CP_ACP
, 0, squashedW
, -1, squashed
, MAX_PATH
, NULL
, NULL
);
247 if (context
== MSIINSTALLCONTEXT_MACHINE
)
250 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
251 "Installer\\UserData\\S-1-5-18\\Components\\%s", squashed
);
253 "SOFTWARE\\Classes\\Installer\\"
254 "Products\\3D0DAE300FACA1300AD792060BCDAA92");
256 else if (context
== MSIINSTALLCONTEXT_USERUNMANAGED
)
259 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
260 "Installer\\UserData\\%s\\Components\\%s", usersid
, squashed
);
262 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
263 "Installer\\%s\\Installer\\Products\\"
264 "7D2F387510109040002000060BECB6AB", usersid
);
266 else if (context
== MSIINSTALLCONTEXT_USERMANAGED
)
269 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
270 "Installer\\UserData\\%s\\Components\\%s", usersid
, squashed
);
272 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
273 "Installer\\Managed\\%s\\Installer\\Products\\"
274 "7D2F387510109040002000060BECB6AB", usersid
);
277 MultiByteToWideChar(CP_ACP
, 0, comppath
, -1, substrW
, MAX_PATH
);
278 package_RegDeleteTreeW(HKEY_LOCAL_MACHINE
, substrW
);
280 MultiByteToWideChar(CP_ACP
, 0, prodpath
, -1, substrW
, MAX_PATH
);
281 package_RegDeleteTreeW(HKEY_LOCAL_MACHINE
, substrW
);
284 static UINT
do_query(MSIHANDLE hdb
, const char *query
, MSIHANDLE
*phrec
)
289 /* open a select query */
290 r
= MsiDatabaseOpenView(hdb
, query
, &hview
);
291 if (r
!= ERROR_SUCCESS
)
293 r
= MsiViewExecute(hview
, 0);
294 if (r
!= ERROR_SUCCESS
)
296 ret
= MsiViewFetch(hview
, phrec
);
297 r
= MsiViewClose(hview
);
298 if (r
!= ERROR_SUCCESS
)
300 r
= MsiCloseHandle(hview
);
301 if (r
!= ERROR_SUCCESS
)
306 static UINT
run_query( MSIHANDLE hdb
, const char *query
)
311 r
= MsiDatabaseOpenView(hdb
, query
, &hview
);
312 if( r
!= ERROR_SUCCESS
)
315 r
= MsiViewExecute(hview
, 0);
316 if( r
== ERROR_SUCCESS
)
317 r
= MsiViewClose(hview
);
318 MsiCloseHandle(hview
);
322 static UINT
create_component_table( MSIHANDLE hdb
)
324 return run_query( hdb
,
325 "CREATE TABLE `Component` ( "
326 "`Component` CHAR(72) NOT NULL, "
327 "`ComponentId` CHAR(38), "
328 "`Directory_` CHAR(72) NOT NULL, "
329 "`Attributes` SHORT NOT NULL, "
330 "`Condition` CHAR(255), "
331 "`KeyPath` CHAR(72) "
332 "PRIMARY KEY `Component`)" );
335 static UINT
create_feature_table( MSIHANDLE hdb
)
337 return run_query( hdb
,
338 "CREATE TABLE `Feature` ( "
339 "`Feature` CHAR(38) NOT NULL, "
340 "`Feature_Parent` CHAR(38), "
342 "`Description` CHAR(255), "
343 "`Display` SHORT NOT NULL, "
344 "`Level` SHORT NOT NULL, "
345 "`Directory_` CHAR(72), "
346 "`Attributes` SHORT NOT NULL "
347 "PRIMARY KEY `Feature`)" );
350 static UINT
create_feature_components_table( MSIHANDLE hdb
)
352 return run_query( hdb
,
353 "CREATE TABLE `FeatureComponents` ( "
354 "`Feature_` CHAR(38) NOT NULL, "
355 "`Component_` CHAR(72) NOT NULL "
356 "PRIMARY KEY `Feature_`, `Component_` )" );
359 static UINT
create_file_table( MSIHANDLE hdb
)
361 return run_query( hdb
,
362 "CREATE TABLE `File` ("
363 "`File` CHAR(72) NOT NULL, "
364 "`Component_` CHAR(72) NOT NULL, "
365 "`FileName` CHAR(255) NOT NULL, "
366 "`FileSize` LONG NOT NULL, "
367 "`Version` CHAR(72), "
368 "`Language` CHAR(20), "
369 "`Attributes` SHORT, "
370 "`Sequence` SHORT NOT NULL "
371 "PRIMARY KEY `File`)" );
374 static UINT
create_remove_file_table( MSIHANDLE hdb
)
376 return run_query( hdb
,
377 "CREATE TABLE `RemoveFile` ("
378 "`FileKey` CHAR(72) NOT NULL, "
379 "`Component_` CHAR(72) NOT NULL, "
380 "`FileName` CHAR(255) LOCALIZABLE, "
381 "`DirProperty` CHAR(72) NOT NULL, "
382 "`InstallMode` SHORT NOT NULL "
383 "PRIMARY KEY `FileKey`)" );
386 static UINT
create_appsearch_table( MSIHANDLE hdb
)
388 return run_query( hdb
,
389 "CREATE TABLE `AppSearch` ("
390 "`Property` CHAR(72) NOT NULL, "
391 "`Signature_` CHAR(72) NOT NULL "
392 "PRIMARY KEY `Property`, `Signature_`)" );
395 static UINT
create_reglocator_table( MSIHANDLE hdb
)
397 return run_query( hdb
,
398 "CREATE TABLE `RegLocator` ("
399 "`Signature_` CHAR(72) NOT NULL, "
400 "`Root` SHORT NOT NULL, "
401 "`Key` CHAR(255) NOT NULL, "
404 "PRIMARY KEY `Signature_`)" );
407 static UINT
create_signature_table( MSIHANDLE hdb
)
409 return run_query( hdb
,
410 "CREATE TABLE `Signature` ("
411 "`Signature` CHAR(72) NOT NULL, "
412 "`FileName` CHAR(255) NOT NULL, "
413 "`MinVersion` CHAR(20), "
414 "`MaxVersion` CHAR(20), "
419 "`Languages` CHAR(255) "
420 "PRIMARY KEY `Signature`)" );
423 static UINT
create_launchcondition_table( MSIHANDLE hdb
)
425 return run_query( hdb
,
426 "CREATE TABLE `LaunchCondition` ("
427 "`Condition` CHAR(255) NOT NULL, "
428 "`Description` CHAR(255) NOT NULL "
429 "PRIMARY KEY `Condition`)" );
432 static UINT
create_property_table( MSIHANDLE hdb
)
434 return run_query( hdb
,
435 "CREATE TABLE `Property` ("
436 "`Property` CHAR(72) NOT NULL, "
438 "PRIMARY KEY `Property`)" );
441 static UINT
create_install_execute_sequence_table( MSIHANDLE hdb
)
443 return run_query( hdb
,
444 "CREATE TABLE `InstallExecuteSequence` ("
445 "`Action` CHAR(72) NOT NULL, "
446 "`Condition` CHAR(255), "
448 "PRIMARY KEY `Action`)" );
451 static UINT
create_media_table( MSIHANDLE hdb
)
453 return run_query( hdb
,
454 "CREATE TABLE `Media` ("
455 "`DiskId` SHORT NOT NULL, "
456 "`LastSequence` SHORT NOT NULL, "
457 "`DiskPrompt` CHAR(64), "
458 "`Cabinet` CHAR(255), "
459 "`VolumeLabel` CHAR(32), "
461 "PRIMARY KEY `DiskId`)" );
464 static UINT
create_ccpsearch_table( MSIHANDLE hdb
)
466 return run_query( hdb
,
467 "CREATE TABLE `CCPSearch` ("
468 "`Signature_` CHAR(72) NOT NULL "
469 "PRIMARY KEY `Signature_`)" );
472 static UINT
create_drlocator_table( MSIHANDLE hdb
)
474 return run_query( hdb
,
475 "CREATE TABLE `DrLocator` ("
476 "`Signature_` CHAR(72) NOT NULL, "
477 "`Parent` CHAR(72), "
480 "PRIMARY KEY `Signature_`, `Parent`, `Path`)" );
483 static UINT
create_complocator_table( MSIHANDLE hdb
)
485 return run_query( hdb
,
486 "CREATE TABLE `CompLocator` ("
487 "`Signature_` CHAR(72) NOT NULL, "
488 "`ComponentId` CHAR(38) NOT NULL, "
490 "PRIMARY KEY `Signature_`)" );
493 static UINT
create_inilocator_table( MSIHANDLE hdb
)
495 return run_query( hdb
,
496 "CREATE TABLE `IniLocator` ("
497 "`Signature_` CHAR(72) NOT NULL, "
498 "`FileName` CHAR(255) NOT NULL, "
499 "`Section` CHAR(96)NOT NULL, "
500 "`Key` CHAR(128)NOT NULL, "
503 "PRIMARY KEY `Signature_`)" );
506 #define make_add_entry(type, qtext) \
507 static UINT add##_##type##_##entry( MSIHANDLE hdb, const char *values ) \
509 char insert[] = qtext; \
512 sz = strlen(values) + sizeof insert; \
513 query = HeapAlloc(GetProcessHeap(),0,sz); \
514 sprintf(query,insert,values); \
515 r = run_query( hdb, query ); \
516 HeapFree(GetProcessHeap(), 0, query); \
520 make_add_entry(component
,
521 "INSERT INTO `Component` "
522 "(`Component`, `ComponentId`, `Directory_`, "
523 "`Attributes`, `Condition`, `KeyPath`) VALUES( %s )")
525 make_add_entry(directory
,
526 "INSERT INTO `Directory` "
527 "(`Directory`,`Directory_Parent`,`DefaultDir`) VALUES( %s )")
529 make_add_entry(feature
,
530 "INSERT INTO `Feature` "
531 "(`Feature`, `Feature_Parent`, `Title`, `Description`, "
532 "`Display`, `Level`, `Directory_`, `Attributes`) VALUES( %s )")
534 make_add_entry(feature_components
,
535 "INSERT INTO `FeatureComponents` "
536 "(`Feature_`, `Component_`) VALUES( %s )")
539 "INSERT INTO `File` "
540 "(`File`, `Component_`, `FileName`, `FileSize`, "
541 "`Version`, `Language`, `Attributes`, `Sequence`) VALUES( %s )")
543 make_add_entry(appsearch
,
544 "INSERT INTO `AppSearch` "
545 "(`Property`, `Signature_`) VALUES( %s )")
547 make_add_entry(reglocator
,
548 "INSERT INTO `RegLocator` "
549 "(`Signature_`, `Root`, `Key`, `Name`, `Type`) VALUES( %s )")
551 make_add_entry(signature
,
552 "INSERT INTO `Signature` "
553 "(`Signature`, `FileName`, `MinVersion`, `MaxVersion`,"
554 " `MinSize`, `MaxSize`, `MinDate`, `MaxDate`, `Languages`) "
557 make_add_entry(launchcondition
,
558 "INSERT INTO `LaunchCondition` "
559 "(`Condition`, `Description`) VALUES( %s )")
561 make_add_entry(property
,
562 "INSERT INTO `Property` (`Property`, `Value`) VALUES( %s )")
564 make_add_entry(install_execute_sequence
,
565 "INSERT INTO `InstallExecuteSequence` "
566 "(`Action`, `Condition`, `Sequence`) VALUES( %s )")
568 make_add_entry(media
,
569 "INSERT INTO `Media` "
570 "(`DiskId`, `LastSequence`, `DiskPrompt`, "
571 "`Cabinet`, `VolumeLabel`, `Source`) VALUES( %s )")
573 make_add_entry(ccpsearch
,
574 "INSERT INTO `CCPSearch` (`Signature_`) VALUES( %s )")
576 make_add_entry(drlocator
,
577 "INSERT INTO `DrLocator` "
578 "(`Signature_`, `Parent`, `Path`, `Depth`) VALUES( %s )")
580 make_add_entry(complocator
,
581 "INSERT INTO `CompLocator` "
582 "(`Signature_`, `ComponentId`, `Type`) VALUES( %s )")
584 make_add_entry(inilocator
,
585 "INSERT INTO `IniLocator` "
586 "(`Signature_`, `FileName`, `Section`, `Key`, `Field`, `Type`) "
589 static UINT
set_summary_info(MSIHANDLE hdb
)
594 /* build summary info */
595 res
= MsiGetSummaryInformation(hdb
, NULL
, 7, &suminfo
);
596 ok( res
== ERROR_SUCCESS
, "Failed to open summaryinfo\n" );
598 res
= MsiSummaryInfoSetProperty(suminfo
,2, VT_LPSTR
, 0,NULL
,
599 "Installation Database");
600 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
602 res
= MsiSummaryInfoSetProperty(suminfo
,3, VT_LPSTR
, 0,NULL
,
603 "Installation Database");
604 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
606 res
= MsiSummaryInfoSetProperty(suminfo
,4, VT_LPSTR
, 0,NULL
,
608 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
610 res
= MsiSummaryInfoSetProperty(suminfo
,7, VT_LPSTR
, 0,NULL
,
612 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
614 res
= MsiSummaryInfoSetProperty(suminfo
,9, VT_LPSTR
, 0,NULL
,
615 "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}");
616 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
618 res
= MsiSummaryInfoSetProperty(suminfo
, 14, VT_I4
, 100, NULL
, NULL
);
619 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
621 res
= MsiSummaryInfoSetProperty(suminfo
, 15, VT_I4
, 0, NULL
, NULL
);
622 ok( res
== ERROR_SUCCESS
, "Failed to set summary info\n" );
624 res
= MsiSummaryInfoPersist(suminfo
);
625 ok( res
== ERROR_SUCCESS
, "Failed to make summary info persist\n" );
627 res
= MsiCloseHandle( suminfo
);
628 ok( res
== ERROR_SUCCESS
, "Failed to close suminfo\n" );
634 static MSIHANDLE
create_package_db(void)
641 /* create an empty database */
642 res
= MsiOpenDatabase(msifile
, MSIDBOPEN_CREATE
, &hdb
);
643 ok( res
== ERROR_SUCCESS
, "Failed to create database\n" );
644 if( res
!= ERROR_SUCCESS
)
647 res
= MsiDatabaseCommit( hdb
);
648 ok( res
== ERROR_SUCCESS
, "Failed to commit database\n" );
650 res
= set_summary_info(hdb
);
652 res
= run_query( hdb
,
653 "CREATE TABLE `Directory` ( "
654 "`Directory` CHAR(255) NOT NULL, "
655 "`Directory_Parent` CHAR(255), "
656 "`DefaultDir` CHAR(255) NOT NULL "
657 "PRIMARY KEY `Directory`)" );
658 ok( res
== ERROR_SUCCESS
, "Failed to create directory table\n" );
663 static MSIHANDLE
package_from_db(MSIHANDLE hdb
)
669 sprintf(szPackage
,"#%i",hdb
);
670 res
= MsiOpenPackage(szPackage
,&hPackage
);
671 if (res
!= ERROR_SUCCESS
)
674 res
= MsiCloseHandle(hdb
);
675 if (res
!= ERROR_SUCCESS
)
681 static void create_test_file(const CHAR
*name
)
686 file
= CreateFileA(name
, GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
, 0, NULL
);
687 ok(file
!= INVALID_HANDLE_VALUE
, "Failure to open file %s\n", name
);
688 WriteFile(file
, name
, strlen(name
), &written
, NULL
);
689 WriteFile(file
, "\n", strlen("\n"), &written
, NULL
);
693 typedef struct _tagVS_VERSIONINFO
700 VS_FIXEDFILEINFO Value
;
705 #define roundoffs(a, b, r) (((BYTE *)(b) - (BYTE *)(a) + ((r) - 1)) & ~((r) - 1))
706 #define roundpos(a, b, r) (((BYTE *)(a)) + roundoffs(a, b, r))
708 static BOOL
create_file_with_version(const CHAR
*name
, LONG ms
, LONG ls
)
710 VS_VERSIONINFO
*pVerInfo
;
711 VS_FIXEDFILEINFO
*pFixedInfo
;
718 GetSystemDirectory(path
, MAX_PATH
);
719 lstrcatA(path
, "\\kernel32.dll");
721 CopyFileA(path
, name
, FALSE
);
723 size
= GetFileVersionInfoSize(path
, &handle
);
724 buffer
= HeapAlloc(GetProcessHeap(), 0, size
);
726 GetFileVersionInfoA(path
, 0, size
, buffer
);
728 pVerInfo
= (VS_VERSIONINFO
*)buffer
;
729 ofs
= (BYTE
*)&pVerInfo
->szKey
[lstrlenW(pVerInfo
->szKey
) + 1];
730 pFixedInfo
= (VS_FIXEDFILEINFO
*)roundpos(pVerInfo
, ofs
, 4);
732 pFixedInfo
->dwFileVersionMS
= ms
;
733 pFixedInfo
->dwFileVersionLS
= ls
;
734 pFixedInfo
->dwProductVersionMS
= ms
;
735 pFixedInfo
->dwProductVersionLS
= ls
;
737 resource
= BeginUpdateResource(name
, FALSE
);
741 if (!UpdateResource(resource
, RT_VERSION
, MAKEINTRESOURCE(VS_VERSION_INFO
),
742 MAKELANGID(LANG_NEUTRAL
, SUBLANG_NEUTRAL
), buffer
, size
))
745 if (!EndUpdateResource(resource
, FALSE
))
751 HeapFree(GetProcessHeap(), 0, buffer
);
755 static void test_createpackage(void)
757 MSIHANDLE hPackage
= 0;
760 hPackage
= package_from_db(create_package_db());
761 ok( hPackage
!= 0, " Failed to create package\n");
763 res
= MsiCloseHandle( hPackage
);
764 ok( res
== ERROR_SUCCESS
, "Failed to close package\n" );
768 static void test_doaction( void )
773 r
= MsiDoAction( -1, NULL
);
774 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
776 hpkg
= package_from_db(create_package_db());
777 ok( hpkg
, "failed to create package\n");
779 r
= MsiDoAction(hpkg
, NULL
);
780 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
782 r
= MsiDoAction(0, "boo");
783 ok( r
== ERROR_INVALID_HANDLE
, "wrong return val\n");
785 r
= MsiDoAction(hpkg
, "boo");
786 ok( r
== ERROR_FUNCTION_NOT_CALLED
, "wrong return val\n");
788 MsiCloseHandle( hpkg
);
792 static void test_gettargetpath_bad(void)
799 hpkg
= package_from_db(create_package_db());
800 ok( hpkg
, "failed to create package\n");
802 r
= MsiGetTargetPath( 0, NULL
, NULL
, NULL
);
803 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
805 r
= MsiGetTargetPath( 0, NULL
, NULL
, &sz
);
806 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
808 r
= MsiGetTargetPath( 0, "boo", NULL
, NULL
);
809 ok( r
== ERROR_INVALID_HANDLE
, "wrong return val\n");
811 r
= MsiGetTargetPath( 0, "boo", NULL
, NULL
);
812 ok( r
== ERROR_INVALID_HANDLE
, "wrong return val\n");
814 r
= MsiGetTargetPath( hpkg
, "boo", NULL
, NULL
);
815 ok( r
== ERROR_DIRECTORY
, "wrong return val\n");
817 r
= MsiGetTargetPath( hpkg
, "boo", buffer
, NULL
);
818 ok( r
== ERROR_DIRECTORY
, "wrong return val\n");
820 MsiCloseHandle( hpkg
);
824 static void query_file_path(MSIHANDLE hpkg
, LPCSTR file
, LPSTR buff
)
830 rec
= MsiCreateRecord( 1 );
831 ok(rec
, "MsiCreate record failed\n");
833 r
= MsiRecordSetString( rec
, 0, file
);
834 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
837 r
= MsiFormatRecord( hpkg
, rec
, buff
, &size
);
838 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
840 MsiCloseHandle( rec
);
843 static void test_settargetpath(void)
845 char tempdir
[MAX_PATH
+8], buffer
[MAX_PATH
], file
[MAX_PATH
];
851 hdb
= create_package_db();
852 ok ( hdb
, "failed to create package database\n" );
854 r
= add_directory_entry( hdb
, "'TARGETDIR', '', 'SourceDir'" );
855 ok( r
== S_OK
, "failed to add directory entry: %d\n" , r
);
857 r
= create_component_table( hdb
);
858 ok( r
== S_OK
, "cannot create Component table: %d\n", r
);
860 r
= add_component_entry( hdb
, "'RootComp', '{83e2694d-0864-4124-9323-6d37630912a1}', 'TARGETDIR', 8, '', 'RootFile'" );
861 ok( r
== S_OK
, "cannot add dummy component: %d\n", r
);
863 r
= add_component_entry( hdb
, "'TestComp', '{A3FB59C8-C293-4F7E-B8C5-F0E1D8EEE4E5}', 'TestDir', 0, '', 'TestFile'" );
864 ok( r
== S_OK
, "cannot add test component: %d\n", r
);
866 r
= create_feature_table( hdb
);
867 ok( r
== S_OK
, "cannot create Feature table: %d\n", r
);
869 r
= add_feature_entry( hdb
, "'TestFeature', '', '', '', 0, 1, '', 0" );
870 ok( r
== ERROR_SUCCESS
, "cannot add TestFeature to Feature table: %d\n", r
);
872 r
= create_feature_components_table( hdb
);
873 ok( r
== S_OK
, "cannot create FeatureComponents table: %d\n", r
);
875 r
= add_feature_components_entry( hdb
, "'TestFeature', 'RootComp'" );
876 ok( r
== S_OK
, "cannot insert component into FeatureComponents table: %d\n", r
);
878 r
= add_feature_components_entry( hdb
, "'TestFeature', 'TestComp'" );
879 ok( r
== S_OK
, "cannot insert component into FeatureComponents table: %d\n", r
);
881 add_directory_entry( hdb
, "'TestParent', 'TARGETDIR', 'TestParent'" );
882 add_directory_entry( hdb
, "'TestDir', 'TestParent', 'TestDir'" );
884 r
= create_file_table( hdb
);
885 ok( r
== S_OK
, "cannot create File table: %d\n", r
);
887 r
= add_file_entry( hdb
, "'RootFile', 'RootComp', 'rootfile.txt', 0, '', '1033', 8192, 1" );
888 ok( r
== S_OK
, "cannot add file to the File table: %d\n", r
);
890 r
= add_file_entry( hdb
, "'TestFile', 'TestComp', 'testfile.txt', 0, '', '1033', 8192, 1" );
891 ok( r
== S_OK
, "cannot add file to the File table: %d\n", r
);
893 hpkg
= package_from_db( hdb
);
894 ok( hpkg
, "failed to create package\n");
896 r
= MsiDoAction( hpkg
, "CostInitialize");
897 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
899 r
= MsiDoAction( hpkg
, "FileCost");
900 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
902 r
= MsiDoAction( hpkg
, "CostFinalize");
903 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
905 r
= MsiSetTargetPath( 0, NULL
, NULL
);
906 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
908 r
= MsiSetTargetPath( 0, "boo", "C:\\bogusx" );
909 ok( r
== ERROR_INVALID_HANDLE
, "wrong return val\n");
911 r
= MsiSetTargetPath( hpkg
, "boo", NULL
);
912 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
914 r
= MsiSetTargetPath( hpkg
, "boo", "c:\\bogusx" );
915 ok( r
== ERROR_DIRECTORY
, "wrong return val\n");
917 sz
= sizeof tempdir
- 1;
918 r
= MsiGetTargetPath( hpkg
, "TARGETDIR", tempdir
, &sz
);
919 sprintf( file
, "%srootfile.txt", tempdir
);
920 query_file_path( hpkg
, "[#RootFile]", buffer
);
921 ok( r
== ERROR_SUCCESS
, "failed to get target path: %d\n", r
);
922 ok( !lstrcmp(buffer
, file
), "Expected %s, got %s\n", file
, buffer
);
924 GetTempFileName( tempdir
, "_wt", 0, buffer
);
925 sprintf( tempdir
, "%s\\subdir", buffer
);
927 r
= MsiSetTargetPath( hpkg
, "TARGETDIR", buffer
);
928 ok( r
== ERROR_SUCCESS
|| r
== ERROR_DIRECTORY
,
929 "MsiSetTargetPath on file returned %d\n", r
);
931 r
= MsiSetTargetPath( hpkg
, "TARGETDIR", tempdir
);
932 ok( r
== ERROR_SUCCESS
|| r
== ERROR_DIRECTORY
,
933 "MsiSetTargetPath on 'subdir' of file returned %d\n", r
);
935 DeleteFile( buffer
);
937 r
= MsiSetTargetPath( hpkg
, "TARGETDIR", buffer
);
938 ok( r
== ERROR_SUCCESS
, "MsiSetTargetPath returned %d\n", r
);
940 r
= GetFileAttributes( buffer
);
941 ok ( r
== INVALID_FILE_ATTRIBUTES
, "file/directory exists after MsiSetTargetPath. Attributes: %08X\n", r
);
943 r
= MsiSetTargetPath( hpkg
, "TARGETDIR", tempdir
);
944 ok( r
== ERROR_SUCCESS
, "MsiSetTargetPath on subsubdir returned %d\n", r
);
946 sz
= sizeof buffer
- 1;
947 lstrcat( tempdir
, "\\" );
948 r
= MsiGetTargetPath( hpkg
, "TARGETDIR", buffer
, &sz
);
949 ok( r
== ERROR_SUCCESS
, "failed to get target path: %d\n", r
);
950 ok( !lstrcmp(buffer
, tempdir
), "Expected %s, got %s\n", tempdir
, buffer
);
952 sprintf( file
, "%srootfile.txt", tempdir
);
953 query_file_path( hpkg
, "[#RootFile]", buffer
);
954 ok( !lstrcmp(buffer
, file
), "Expected %s, got %s\n", file
, buffer
);
956 r
= MsiSetTargetPath( hpkg
, "TestParent", "C:\\one\\two" );
957 ok( r
== ERROR_SUCCESS
, "MsiSetTargetPath returned %d\n", r
);
959 query_file_path( hpkg
, "[#TestFile]", buffer
);
960 ok( !lstrcmp(buffer
, "C:\\one\\two\\TestDir\\testfile.txt"),
961 "Expected C:\\one\\two\\TestDir\\testfile.txt, got %s\n", buffer
);
963 sz
= sizeof buffer
- 1;
964 r
= MsiGetTargetPath( hpkg
, "TestParent", buffer
, &sz
);
965 ok( r
== ERROR_SUCCESS
, "failed to get target path: %d\n", r
);
966 ok( !lstrcmp(buffer
, "C:\\one\\two\\"), "Expected C:\\one\\two\\, got %s\n", buffer
);
968 MsiCloseHandle( hpkg
);
971 static void test_condition(void)
976 hpkg
= package_from_db(create_package_db());
977 ok( hpkg
, "failed to create package\n");
979 r
= MsiEvaluateCondition(0, NULL
);
980 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
982 r
= MsiEvaluateCondition(hpkg
, NULL
);
983 ok( r
== MSICONDITION_NONE
, "wrong return val\n");
985 r
= MsiEvaluateCondition(hpkg
, "");
986 ok( r
== MSICONDITION_NONE
, "wrong return val\n");
988 r
= MsiEvaluateCondition(hpkg
, "1");
989 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
991 r
= MsiEvaluateCondition(hpkg
, "0");
992 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
994 r
= MsiEvaluateCondition(hpkg
, "-1");
995 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
997 r
= MsiEvaluateCondition(hpkg
, "0 = 0");
998 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1000 r
= MsiEvaluateCondition(hpkg
, "0 <> 0");
1001 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1003 r
= MsiEvaluateCondition(hpkg
, "0 = 1");
1004 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1006 r
= MsiEvaluateCondition(hpkg
, "0 > 1");
1007 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1009 r
= MsiEvaluateCondition(hpkg
, "0 ~> 1");
1010 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1012 r
= MsiEvaluateCondition(hpkg
, "1 > 1");
1013 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1015 r
= MsiEvaluateCondition(hpkg
, "1 ~> 1");
1016 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1018 r
= MsiEvaluateCondition(hpkg
, "0 >= 1");
1019 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1021 r
= MsiEvaluateCondition(hpkg
, "0 ~>= 1");
1022 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1024 r
= MsiEvaluateCondition(hpkg
, "1 >= 1");
1025 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1027 r
= MsiEvaluateCondition(hpkg
, "1 ~>= 1");
1028 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1030 r
= MsiEvaluateCondition(hpkg
, "0 < 1");
1031 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1033 r
= MsiEvaluateCondition(hpkg
, "0 ~< 1");
1034 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1036 r
= MsiEvaluateCondition(hpkg
, "1 < 1");
1037 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1039 r
= MsiEvaluateCondition(hpkg
, "1 ~< 1");
1040 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1042 r
= MsiEvaluateCondition(hpkg
, "0 <= 1");
1043 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1045 r
= MsiEvaluateCondition(hpkg
, "0 ~<= 1");
1046 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1048 r
= MsiEvaluateCondition(hpkg
, "1 <= 1");
1049 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1051 r
= MsiEvaluateCondition(hpkg
, "1 ~<= 1");
1052 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1054 r
= MsiEvaluateCondition(hpkg
, "0 >=");
1055 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1057 r
= MsiEvaluateCondition(hpkg
, " ");
1058 ok( r
== MSICONDITION_NONE
, "wrong return val\n");
1060 r
= MsiEvaluateCondition(hpkg
, "LicView <> \"1\"");
1061 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1063 r
= MsiEvaluateCondition(hpkg
, "LicView <> \"0\"");
1064 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1066 r
= MsiEvaluateCondition(hpkg
, "LicView <> LicView");
1067 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1069 r
= MsiEvaluateCondition(hpkg
, "not 0");
1070 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1072 r
= MsiEvaluateCondition(hpkg
, "not LicView");
1073 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1075 r
= MsiEvaluateCondition(hpkg
, "not \"A\"");
1076 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1078 r
= MsiEvaluateCondition(hpkg
, "~not \"A\"");
1079 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1081 r
= MsiEvaluateCondition(hpkg
, "\"0\"");
1082 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1084 r
= MsiEvaluateCondition(hpkg
, "1 and 2");
1085 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1087 r
= MsiEvaluateCondition(hpkg
, "not 0 and 3");
1088 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1090 r
= MsiEvaluateCondition(hpkg
, "not 0 and 0");
1091 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1093 r
= MsiEvaluateCondition(hpkg
, "not 0 or 1");
1094 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1096 r
= MsiEvaluateCondition(hpkg
, "(0)");
1097 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1099 r
= MsiEvaluateCondition(hpkg
, "(((((1))))))");
1100 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1102 r
= MsiEvaluateCondition(hpkg
, "(((((1)))))");
1103 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1105 r
= MsiEvaluateCondition(hpkg
, " \"A\" < \"B\" ");
1106 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1108 r
= MsiEvaluateCondition(hpkg
, " \"A\" > \"B\" ");
1109 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1111 r
= MsiEvaluateCondition(hpkg
, " \"1\" > \"12\" ");
1112 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1114 r
= MsiEvaluateCondition(hpkg
, " \"100\" < \"21\" ");
1115 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1117 r
= MsiEvaluateCondition(hpkg
, "0 < > 0");
1118 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1120 r
= MsiEvaluateCondition(hpkg
, "(1<<1) == 2");
1121 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1123 r
= MsiEvaluateCondition(hpkg
, " \"A\" = \"a\" ");
1124 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1126 r
= MsiEvaluateCondition(hpkg
, " \"A\" ~ = \"a\" ");
1127 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1129 r
= MsiEvaluateCondition(hpkg
, " \"A\" ~= \"a\" ");
1130 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1132 r
= MsiEvaluateCondition(hpkg
, " \"A\" ~= 1 ");
1133 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1135 r
= MsiEvaluateCondition(hpkg
, " \"A\" = 1 ");
1136 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1138 r
= MsiEvaluateCondition(hpkg
, " 1 ~= 1 ");
1139 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1141 r
= MsiEvaluateCondition(hpkg
, " 1 ~= \"1\" ");
1142 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1144 r
= MsiEvaluateCondition(hpkg
, " 1 = \"1\" ");
1145 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1147 r
= MsiEvaluateCondition(hpkg
, " 0 = \"1\" ");
1148 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1150 r
= MsiEvaluateCondition(hpkg
, " 0 < \"100\" ");
1151 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1153 r
= MsiEvaluateCondition(hpkg
, " 100 > \"0\" ");
1154 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1156 r
= MsiEvaluateCondition(hpkg
, "1 XOR 1");
1157 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1159 r
= MsiEvaluateCondition(hpkg
, "1 IMP 1");
1160 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1162 r
= MsiEvaluateCondition(hpkg
, "1 IMP 0");
1163 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1165 r
= MsiEvaluateCondition(hpkg
, "0 IMP 0");
1166 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1168 r
= MsiEvaluateCondition(hpkg
, "0 EQV 0");
1169 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1171 r
= MsiEvaluateCondition(hpkg
, "0 EQV 1");
1172 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1174 r
= MsiEvaluateCondition(hpkg
, "1 IMP 1 OR 0");
1175 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1177 r
= MsiEvaluateCondition(hpkg
, "1 IMPL 1");
1178 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1180 r
= MsiEvaluateCondition(hpkg
, "\"ASFD\" >< \"S\" ");
1181 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1183 r
= MsiEvaluateCondition(hpkg
, "\"ASFD\" ~>< \"s\" ");
1184 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1186 r
= MsiEvaluateCondition(hpkg
, "\"ASFD\" ~>< \"\" ");
1187 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1189 r
= MsiEvaluateCondition(hpkg
, "\"ASFD\" ~>< \"sss\" ");
1190 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1192 MsiSetProperty(hpkg
, "mm", "5" );
1194 r
= MsiEvaluateCondition(hpkg
, "mm = 5");
1195 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1197 r
= MsiEvaluateCondition(hpkg
, "mm < 6");
1198 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1200 r
= MsiEvaluateCondition(hpkg
, "mm <= 5");
1201 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1203 r
= MsiEvaluateCondition(hpkg
, "mm > 4");
1204 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1206 r
= MsiEvaluateCondition(hpkg
, "mm < 12");
1207 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1209 r
= MsiEvaluateCondition(hpkg
, "mm = \"5\"");
1210 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1212 r
= MsiEvaluateCondition(hpkg
, "0 = \"\"");
1213 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1215 r
= MsiEvaluateCondition(hpkg
, "0 AND \"\"");
1216 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1218 r
= MsiEvaluateCondition(hpkg
, "1 AND \"\"");
1219 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1221 r
= MsiEvaluateCondition(hpkg
, "1 AND \"1\"");
1222 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1224 r
= MsiEvaluateCondition(hpkg
, "3 >< 1");
1225 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1227 r
= MsiEvaluateCondition(hpkg
, "3 >< 4");
1228 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1230 r
= MsiEvaluateCondition(hpkg
, "NOT 0 AND 0");
1231 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1233 r
= MsiEvaluateCondition(hpkg
, "NOT 0 AND 1");
1234 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1236 r
= MsiEvaluateCondition(hpkg
, "NOT 1 OR 0");
1237 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1239 r
= MsiEvaluateCondition(hpkg
, "0 AND 1 OR 1");
1240 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1242 r
= MsiEvaluateCondition(hpkg
, "0 AND 0 OR 1");
1243 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1245 r
= MsiEvaluateCondition(hpkg
, "NOT 0 AND 1 OR 0");
1246 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1248 r
= MsiEvaluateCondition(hpkg
, "_1 = _1");
1249 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1251 r
= MsiEvaluateCondition(hpkg
, "( 1 AND 1 ) = 2");
1252 ok( r
== MSICONDITION_ERROR
, "wrong return val\n");
1254 r
= MsiEvaluateCondition(hpkg
, "NOT ( 1 AND 1 )");
1255 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1257 r
= MsiEvaluateCondition(hpkg
, "NOT A AND (BBBBBBBBBB=2 OR CCC=1) AND Ddddddddd");
1258 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1260 r
= MsiEvaluateCondition(hpkg
, "Installed<>\"\"");
1261 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1263 r
= MsiEvaluateCondition(hpkg
, "NOT 1 AND 0");
1264 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1266 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1267 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1269 r
= MsiEvaluateCondition(hpkg
, "bandalmael<>0");
1270 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1272 r
= MsiEvaluateCondition(hpkg
, "bandalmael<0");
1273 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1275 r
= MsiEvaluateCondition(hpkg
, "bandalmael>0");
1276 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1278 r
= MsiEvaluateCondition(hpkg
, "bandalmael>=0");
1279 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1281 r
= MsiEvaluateCondition(hpkg
, "bandalmael<=0");
1282 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1284 r
= MsiEvaluateCondition(hpkg
, "bandalmael~<>0");
1285 ok( r
== MSICONDITION_TRUE
, "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", "" );
1292 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1293 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1295 MsiSetProperty(hpkg
, "bandalmael", "asdf" );
1296 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1297 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1299 MsiSetProperty(hpkg
, "bandalmael", "0asdf" );
1300 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1301 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1303 MsiSetProperty(hpkg
, "bandalmael", "0 " );
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_TRUE
, "wrong return val\n");
1311 MsiSetProperty(hpkg
, "bandalmael", "0000000000000" );
1312 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1313 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1315 MsiSetProperty(hpkg
, "bandalmael", "--0" );
1316 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1317 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1319 MsiSetProperty(hpkg
, "bandalmael", "0x00" );
1320 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1321 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1323 MsiSetProperty(hpkg
, "bandalmael", "-" );
1324 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1325 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1327 MsiSetProperty(hpkg
, "bandalmael", "+0" );
1328 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1329 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1331 MsiSetProperty(hpkg
, "bandalmael", "0.0" );
1332 r
= MsiEvaluateCondition(hpkg
, "bandalmael=0");
1333 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1334 r
= MsiEvaluateCondition(hpkg
, "bandalmael<>0");
1335 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1337 MsiSetProperty(hpkg
, "one", "hi");
1338 MsiSetProperty(hpkg
, "two", "hithere");
1339 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1340 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1342 MsiSetProperty(hpkg
, "one", "hithere");
1343 MsiSetProperty(hpkg
, "two", "hi");
1344 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1345 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1347 MsiSetProperty(hpkg
, "one", "hello");
1348 MsiSetProperty(hpkg
, "two", "hi");
1349 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1350 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1352 MsiSetProperty(hpkg
, "one", "hellohithere");
1353 MsiSetProperty(hpkg
, "two", "hi");
1354 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1355 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1357 MsiSetProperty(hpkg
, "one", "");
1358 MsiSetProperty(hpkg
, "two", "hi");
1359 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1360 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1362 MsiSetProperty(hpkg
, "one", "hi");
1363 MsiSetProperty(hpkg
, "two", "");
1364 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1365 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1367 MsiSetProperty(hpkg
, "one", "");
1368 MsiSetProperty(hpkg
, "two", "");
1369 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1370 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1372 MsiSetProperty(hpkg
, "one", "1234");
1373 MsiSetProperty(hpkg
, "two", "1");
1374 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1375 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1377 MsiSetProperty(hpkg
, "one", "one 1234");
1378 MsiSetProperty(hpkg
, "two", "1");
1379 r
= MsiEvaluateCondition(hpkg
, "one >< two");
1380 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1382 MsiSetProperty(hpkg
, "one", "hithere");
1383 MsiSetProperty(hpkg
, "two", "hi");
1384 r
= MsiEvaluateCondition(hpkg
, "one << two");
1385 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1387 MsiSetProperty(hpkg
, "one", "hi");
1388 MsiSetProperty(hpkg
, "two", "hithere");
1389 r
= MsiEvaluateCondition(hpkg
, "one << two");
1390 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1392 MsiSetProperty(hpkg
, "one", "hi");
1393 MsiSetProperty(hpkg
, "two", "hi");
1394 r
= MsiEvaluateCondition(hpkg
, "one << two");
1395 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1397 MsiSetProperty(hpkg
, "one", "abcdhithere");
1398 MsiSetProperty(hpkg
, "two", "hi");
1399 r
= MsiEvaluateCondition(hpkg
, "one << two");
1400 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1402 MsiSetProperty(hpkg
, "one", "");
1403 MsiSetProperty(hpkg
, "two", "hi");
1404 r
= MsiEvaluateCondition(hpkg
, "one << two");
1405 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1407 MsiSetProperty(hpkg
, "one", "hithere");
1408 MsiSetProperty(hpkg
, "two", "");
1409 r
= MsiEvaluateCondition(hpkg
, "one << two");
1410 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1412 MsiSetProperty(hpkg
, "one", "");
1413 MsiSetProperty(hpkg
, "two", "");
1414 r
= MsiEvaluateCondition(hpkg
, "one << two");
1415 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1417 MsiSetProperty(hpkg
, "one", "1234");
1418 MsiSetProperty(hpkg
, "two", "1");
1419 r
= MsiEvaluateCondition(hpkg
, "one << two");
1420 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1422 MsiSetProperty(hpkg
, "one", "1234 one");
1423 MsiSetProperty(hpkg
, "two", "1");
1424 r
= MsiEvaluateCondition(hpkg
, "one << two");
1425 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1427 MsiSetProperty(hpkg
, "one", "hithere");
1428 MsiSetProperty(hpkg
, "two", "there");
1429 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1430 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1432 MsiSetProperty(hpkg
, "one", "hithere");
1433 MsiSetProperty(hpkg
, "two", "hi");
1434 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1435 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1437 MsiSetProperty(hpkg
, "one", "there");
1438 MsiSetProperty(hpkg
, "two", "hithere");
1439 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1440 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1442 MsiSetProperty(hpkg
, "one", "there");
1443 MsiSetProperty(hpkg
, "two", "there");
1444 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1445 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1447 MsiSetProperty(hpkg
, "one", "abcdhithere");
1448 MsiSetProperty(hpkg
, "two", "hi");
1449 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1450 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1452 MsiSetProperty(hpkg
, "one", "");
1453 MsiSetProperty(hpkg
, "two", "there");
1454 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1455 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1457 MsiSetProperty(hpkg
, "one", "there");
1458 MsiSetProperty(hpkg
, "two", "");
1459 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1460 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1462 MsiSetProperty(hpkg
, "one", "");
1463 MsiSetProperty(hpkg
, "two", "");
1464 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1465 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1467 MsiSetProperty(hpkg
, "one", "1234");
1468 MsiSetProperty(hpkg
, "two", "4");
1469 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1470 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1472 MsiSetProperty(hpkg
, "one", "one 1234");
1473 MsiSetProperty(hpkg
, "two", "4");
1474 r
= MsiEvaluateCondition(hpkg
, "one >> two");
1475 ok( r
== MSICONDITION_TRUE
, "wrong return val\n");
1477 MsiSetProperty(hpkg
, "MsiNetAssemblySupport", NULL
); /* make sure it's empty */
1479 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322\"");
1480 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1482 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport > \"1.1.4322\"");
1483 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1485 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport >= \"1.1.4322\"");
1486 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1488 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport <= \"1.1.4322\"");
1489 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1491 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport <> \"1.1.4322\"");
1492 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1494 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport ~< \"1.1.4322\"");
1495 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1497 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"abcd\"");
1498 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1500 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a1.1.4322\"");
1501 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1503 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322a\"");
1504 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1506 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"0000001.1.4322\"");
1507 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1509 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322.1\"");
1510 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1512 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322.1.1\"");
1513 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1515 r
= MsiEvaluateCondition(hpkg
, "\"2\" < \"1.1");
1516 ok( r
== MSICONDITION_ERROR
, "wrong return val (%d)\n", r
);
1518 r
= MsiEvaluateCondition(hpkg
, "\"2\" < \"1.1\"");
1519 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1521 r
= MsiEvaluateCondition(hpkg
, "\"2\" < \"12.1\"");
1522 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1524 r
= MsiEvaluateCondition(hpkg
, "\"02.1\" < \"2.11\"");
1525 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1527 r
= MsiEvaluateCondition(hpkg
, "\"02.1.1\" < \"2.1\"");
1528 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1530 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1\"");
1531 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1533 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1\"");
1534 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1536 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"0\"");
1537 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1539 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"-1\"");
1540 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1542 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a\"");
1543 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1545 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"!\"");
1546 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1548 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"!\"");
1549 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1551 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"/\"");
1552 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1554 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \" \"");
1555 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1557 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"azAZ_\"");
1558 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1560 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a[a]\"");
1561 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1563 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a[a]a\"");
1564 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1566 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"[a]\"");
1567 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1569 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"[a]a\"");
1570 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1572 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"{a}\"");
1573 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1575 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"{a\"");
1576 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1578 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"[a\"");
1579 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1581 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a{\"");
1582 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1584 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"a]\"");
1585 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1587 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"A\"");
1588 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1590 MsiSetProperty(hpkg
, "MsiNetAssemblySupport", "1.1.4322");
1591 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.4322\"");
1592 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1594 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.14322\"");
1595 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1597 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1.5\"");
1598 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1600 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1.1\"");
1601 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1603 r
= MsiEvaluateCondition(hpkg
, "MsiNetAssemblySupport < \"1\"");
1604 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1606 MsiSetProperty(hpkg
, "one", "1");
1607 r
= MsiEvaluateCondition(hpkg
, "one < \"1\"");
1608 ok( r
== MSICONDITION_FALSE
, "wrong return val\n");
1610 MsiSetProperty(hpkg
, "X", "5.0");
1612 r
= MsiEvaluateCondition(hpkg
, "X != \"\"");
1613 ok( r
== MSICONDITION_ERROR
, "wrong return val (%d)\n", r
);
1615 r
= MsiEvaluateCondition(hpkg
, "X =\"5.0\"");
1616 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1618 r
= MsiEvaluateCondition(hpkg
, "X =\"5.1\"");
1619 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1621 r
= MsiEvaluateCondition(hpkg
, "X =\"6.0\"");
1622 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1624 r
= MsiEvaluateCondition(hpkg
, "X =\"5.0\" or X =\"5.1\" or X =\"6.0\"");
1625 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1627 r
= MsiEvaluateCondition(hpkg
, "(X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1628 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1630 r
= MsiEvaluateCondition(hpkg
, "X !=\"\" and (X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
1631 ok( r
== MSICONDITION_ERROR
, "wrong return val (%d)\n", r
);
1633 /* feature doesn't exist */
1634 r
= MsiEvaluateCondition(hpkg
, "&nofeature");
1635 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1637 MsiSetProperty(hpkg
, "A", "2");
1638 MsiSetProperty(hpkg
, "X", "50");
1640 r
= MsiEvaluateCondition(hpkg
, "2 <= 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_TRUE
, "wrong return val (%d)\n", r
);
1657 MsiSetProperty(hpkg
, "A", "7");
1658 MsiSetProperty(hpkg
, "X", "50");
1660 r
= MsiEvaluateCondition(hpkg
, "7 <= X");
1661 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1663 r
= MsiEvaluateCondition(hpkg
, "A <= X");
1664 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1666 r
= MsiEvaluateCondition(hpkg
, "A <= 50");
1667 ok( r
== MSICONDITION_TRUE
, "wrong return val (%d)\n", r
);
1669 MsiSetProperty(hpkg
, "X", "50val");
1671 r
= MsiEvaluateCondition(hpkg
, "2 <= X");
1672 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1674 r
= MsiEvaluateCondition(hpkg
, "A <= X");
1675 ok( r
== MSICONDITION_FALSE
, "wrong return val (%d)\n", r
);
1677 MsiCloseHandle( hpkg
);
1678 DeleteFile(msifile
);
1681 static BOOL
check_prop_empty( MSIHANDLE hpkg
, const char * prop
)
1689 r
= MsiGetProperty( hpkg
, prop
, buffer
, &sz
);
1690 return r
== ERROR_SUCCESS
&& buffer
[0] == 0 && sz
== 0;
1693 static void test_props(void)
1695 MSIHANDLE hpkg
, hdb
;
1700 hdb
= create_package_db();
1702 "CREATE TABLE `Property` ( "
1703 "`Property` CHAR(255) NOT NULL, "
1704 "`Value` CHAR(255) "
1705 "PRIMARY KEY `Property`)" );
1706 ok( r
== ERROR_SUCCESS
, "Failed\n" );
1709 "INSERT INTO `Property` "
1710 "(`Property`, `Value`) "
1711 "VALUES( 'MetadataCompName', 'Photoshop.dll' )");
1712 ok( r
== ERROR_SUCCESS
, "Failed\n" );
1714 hpkg
= package_from_db( hdb
);
1715 ok( hpkg
, "failed to create package\n");
1717 /* test invalid values */
1718 r
= MsiGetProperty( 0, NULL
, NULL
, NULL
);
1719 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
1721 r
= MsiGetProperty( hpkg
, NULL
, NULL
, NULL
);
1722 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
1724 r
= MsiGetProperty( hpkg
, "boo", NULL
, NULL
);
1725 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1727 r
= MsiGetProperty( hpkg
, "boo", buffer
, NULL
);
1728 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
1730 /* test retrieving an empty/nonexistent property */
1732 r
= MsiGetProperty( hpkg
, "boo", NULL
, &sz
);
1733 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1734 ok( sz
== 0, "wrong size returned\n");
1736 check_prop_empty( hpkg
, "boo");
1739 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1740 ok( r
== ERROR_MORE_DATA
, "wrong return val\n");
1741 ok( !strcmp(buffer
,"x"), "buffer was changed\n");
1742 ok( sz
== 0, "wrong size returned\n");
1746 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1747 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1748 ok( buffer
[0] == 0, "buffer was not changed\n");
1749 ok( sz
== 0, "wrong size returned\n");
1751 /* set the property to something */
1752 r
= MsiSetProperty( 0, NULL
, NULL
);
1753 ok( r
== ERROR_INVALID_HANDLE
, "wrong return val\n");
1755 r
= MsiSetProperty( hpkg
, NULL
, NULL
);
1756 ok( r
== ERROR_INVALID_PARAMETER
, "wrong return val\n");
1758 r
= MsiSetProperty( hpkg
, "", NULL
);
1759 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1761 /* try set and get some illegal property identifiers */
1762 r
= MsiSetProperty( hpkg
, "", "asdf" );
1763 ok( r
== ERROR_FUNCTION_FAILED
, "wrong return val\n");
1765 r
= MsiSetProperty( hpkg
, "=", "asdf" );
1766 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1768 r
= MsiSetProperty( hpkg
, " ", "asdf" );
1769 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1771 r
= MsiSetProperty( hpkg
, "'", "asdf" );
1772 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1776 r
= MsiGetProperty( hpkg
, "'", buffer
, &sz
);
1777 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1778 ok( !strcmp(buffer
,"asdf"), "buffer was not changed\n");
1780 /* set empty values */
1781 r
= MsiSetProperty( hpkg
, "boo", NULL
);
1782 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1783 ok( check_prop_empty( hpkg
, "boo"), "prop wasn't empty\n");
1785 r
= MsiSetProperty( hpkg
, "boo", "" );
1786 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1787 ok( check_prop_empty( hpkg
, "boo"), "prop wasn't empty\n");
1789 /* set a non-empty value */
1790 r
= MsiSetProperty( hpkg
, "boo", "xyz" );
1791 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1795 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1796 ok( r
== ERROR_MORE_DATA
, "wrong return val\n");
1797 ok( buffer
[0] == 0, "buffer was not changed\n");
1798 ok( sz
== 3, "wrong size returned\n");
1802 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1803 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1804 ok( !strcmp(buffer
,"xyz"), "buffer was not changed\n");
1805 ok( sz
== 3, "wrong size returned\n");
1809 r
= MsiGetProperty( hpkg
, "boo", buffer
, &sz
);
1810 ok( r
== ERROR_MORE_DATA
, "wrong return val\n");
1811 ok( !strcmp(buffer
,"xy"), "buffer was not changed\n");
1812 ok( sz
== 3, "wrong size returned\n");
1814 r
= MsiSetProperty(hpkg
, "SourceDir", "foo");
1815 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1818 r
= MsiGetProperty(hpkg
, "SOURCEDIR", buffer
, &sz
);
1819 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1820 ok( !strcmp(buffer
,""), "buffer wrong\n");
1821 ok( sz
== 0, "wrong size returned\n");
1824 r
= MsiGetProperty(hpkg
, "SOMERANDOMNAME", buffer
, &sz
);
1825 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1826 ok( !strcmp(buffer
,""), "buffer wrong\n");
1827 ok( sz
== 0, "wrong size returned\n");
1830 r
= MsiGetProperty(hpkg
, "SourceDir", buffer
, &sz
);
1831 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1832 ok( !strcmp(buffer
,"foo"), "buffer wrong\n");
1833 ok( sz
== 3, "wrong size returned\n");
1835 r
= MsiSetProperty(hpkg
, "MetadataCompName", "Photoshop.dll");
1836 ok( r
== ERROR_SUCCESS
, "wrong return val\n");
1839 r
= MsiGetProperty(hpkg
, "MetadataCompName", NULL
, &sz
);
1840 ok( r
== ERROR_SUCCESS
, "return wrong\n");
1841 ok( sz
== 13, "size wrong (%d)\n", sz
);
1844 r
= MsiGetProperty(hpkg
, "MetadataCompName", buffer
, &sz
);
1845 ok( r
== ERROR_MORE_DATA
, "return wrong\n");
1846 ok( !strcmp(buffer
,"Photoshop.dl"), "buffer wrong\n");
1848 r
= MsiSetProperty(hpkg
, "property", "value");
1849 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1852 r
= MsiGetProperty(hpkg
, "property", buffer
, &sz
);
1853 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1854 ok( !strcmp(buffer
, "value"), "Expected value, got %s\n", buffer
);
1856 r
= MsiSetProperty(hpkg
, "property", NULL
);
1857 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1860 r
= MsiGetProperty(hpkg
, "property", buffer
, &sz
);
1861 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1862 ok( !strlen(buffer
), "Expected empty string, got %s\n", buffer
);
1864 MsiCloseHandle( hpkg
);
1865 DeleteFile(msifile
);
1868 static BOOL
find_prop_in_property(MSIHANDLE hdb
, LPCSTR prop
, LPCSTR val
)
1870 MSIHANDLE hview
, hrec
;
1872 CHAR buffer
[MAX_PATH
];
1876 r
= MsiDatabaseOpenView(hdb
, "SELECT * FROM `_Property`", &hview
);
1877 ok(r
== ERROR_SUCCESS
, "MsiDatabaseOpenView failed\n");
1878 r
= MsiViewExecute(hview
, 0);
1879 ok(r
== ERROR_SUCCESS
, "MsiViewExecute failed\n");
1882 while (r
== ERROR_SUCCESS
&& !found
)
1884 r
= MsiViewFetch(hview
, &hrec
);
1885 if (r
!= ERROR_SUCCESS
) break;
1888 r
= MsiRecordGetString(hrec
, 1, buffer
, &sz
);
1889 if (r
== ERROR_SUCCESS
&& !lstrcmpA(buffer
, prop
))
1892 r
= MsiRecordGetString(hrec
, 2, buffer
, &sz
);
1893 if (r
== ERROR_SUCCESS
&& !lstrcmpA(buffer
, val
))
1897 MsiCloseHandle(hrec
);
1900 MsiViewClose(hview
);
1901 MsiCloseHandle(hview
);
1906 static void test_property_table(void)
1910 MSIHANDLE hpkg
, hdb
, hrec
;
1911 char buffer
[MAX_PATH
];
1915 hdb
= create_package_db();
1916 ok( hdb
, "failed to create package\n");
1918 hpkg
= package_from_db(hdb
);
1919 ok( hpkg
, "failed to create package\n");
1921 MsiCloseHandle(hdb
);
1923 hdb
= MsiGetActiveDatabase(hpkg
);
1925 query
= "CREATE TABLE `_Property` ( "
1926 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
1927 r
= run_query(hdb
, query
);
1928 ok(r
== ERROR_BAD_QUERY_SYNTAX
, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r
);
1930 MsiCloseHandle(hdb
);
1931 MsiCloseHandle(hpkg
);
1932 DeleteFile(msifile
);
1934 hdb
= create_package_db();
1935 ok( hdb
, "failed to create package\n");
1937 query
= "CREATE TABLE `_Property` ( "
1938 "`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
1939 r
= run_query(hdb
, query
);
1940 ok(r
== ERROR_SUCCESS
, "failed to create table\n");
1942 query
= "ALTER `_Property` ADD `foo` INTEGER";
1943 r
= run_query(hdb
, query
);
1944 ok(r
== ERROR_BAD_QUERY_SYNTAX
, "failed to add column\n");
1946 query
= "ALTER TABLE `_Property` ADD `foo` INTEGER";
1947 r
= run_query(hdb
, query
);
1948 ok(r
== ERROR_BAD_QUERY_SYNTAX
, "failed to add column\n");
1950 query
= "ALTER TABLE `_Property` ADD `extra` INTEGER";
1951 r
= run_query(hdb
, query
);
1952 ok(r
== ERROR_SUCCESS
, "failed to add column\n");
1954 hpkg
= package_from_db(hdb
);
1957 ok(!hpkg
, "package should not be created\n");
1960 MsiCloseHandle(hdb
);
1961 MsiCloseHandle(hpkg
);
1962 DeleteFile(msifile
);
1964 hdb
= create_package_db();
1965 ok (hdb
, "failed to create package database\n");
1967 r
= create_property_table(hdb
);
1968 ok(r
== ERROR_SUCCESS
, "cannot create Property table: %d\n", r
);
1970 r
= add_property_entry(hdb
, "'prop', 'val'");
1971 ok(r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
1973 hpkg
= package_from_db(hdb
);
1974 ok(hpkg
, "failed to create package\n");
1976 MsiCloseHandle(hdb
);
1979 r
= MsiGetProperty(hpkg
, "prop", buffer
, &sz
);
1980 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1981 ok(!lstrcmp(buffer
, "val"), "Expected val, got %s\n", buffer
);
1983 hdb
= MsiGetActiveDatabase(hpkg
);
1985 found
= find_prop_in_property(hdb
, "prop", "val");
1986 ok(found
, "prop should be in the _Property table\n");
1988 r
= add_property_entry(hdb
, "'dantes', 'mercedes'");
1989 ok(r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
1991 query
= "SELECT * FROM `_Property` WHERE `Property` = 'dantes'";
1992 r
= do_query(hdb
, query
, &hrec
);
1993 ok(r
== ERROR_BAD_QUERY_SYNTAX
, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r
);
1995 found
= find_prop_in_property(hdb
, "dantes", "mercedes");
1996 ok(found
== FALSE
, "dantes should not be in the _Property table\n");
1999 lstrcpy(buffer
, "aaa");
2000 r
= MsiGetProperty(hpkg
, "dantes", buffer
, &sz
);
2001 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2002 ok(lstrlenA(buffer
) == 0, "Expected empty string, got %s\n", buffer
);
2004 r
= MsiSetProperty(hpkg
, "dantes", "mercedes");
2005 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2007 found
= find_prop_in_property(hdb
, "dantes", "mercedes");
2008 ok(found
== TRUE
, "dantes should be in the _Property table\n");
2010 MsiCloseHandle(hdb
);
2011 MsiCloseHandle(hpkg
);
2012 DeleteFile(msifile
);
2015 static UINT
try_query_param( MSIHANDLE hdb
, LPCSTR szQuery
, MSIHANDLE hrec
)
2020 res
= MsiDatabaseOpenView( hdb
, szQuery
, &htab
);
2021 if( res
== ERROR_SUCCESS
)
2025 r
= MsiViewExecute( htab
, hrec
);
2026 if( r
!= ERROR_SUCCESS
)
2029 fprintf(stderr
,"MsiViewExecute failed %08x\n", res
);
2032 r
= MsiViewClose( htab
);
2033 if( r
!= ERROR_SUCCESS
)
2036 r
= MsiCloseHandle( htab
);
2037 if( r
!= ERROR_SUCCESS
)
2043 static UINT
try_query( MSIHANDLE hdb
, LPCSTR szQuery
)
2045 return try_query_param( hdb
, szQuery
, 0 );
2048 static void set_summary_str(MSIHANDLE hdb
, DWORD pid
, LPCSTR value
)
2053 r
= MsiGetSummaryInformationA(hdb
, NULL
, 1, &summary
);
2054 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2056 r
= MsiSummaryInfoSetPropertyA(summary
, pid
, VT_LPSTR
, 0, NULL
, value
);
2057 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
2059 r
= MsiSummaryInfoPersist(summary
);
2060 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
2062 MsiCloseHandle(summary
);
2065 static void set_summary_dword(MSIHANDLE hdb
, DWORD pid
, DWORD value
)
2070 r
= MsiGetSummaryInformationA(hdb
, NULL
, 1, &summary
);
2071 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2073 r
= MsiSummaryInfoSetPropertyA(summary
, pid
, VT_I4
, value
, NULL
, NULL
);
2074 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
2076 r
= MsiSummaryInfoPersist(summary
);
2077 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
2079 MsiCloseHandle(summary
);
2082 static void test_msipackage(void)
2084 MSIHANDLE hdb
= 0, hpack
= 100;
2089 /* NULL szPackagePath */
2090 r
= MsiOpenPackage(NULL
, &hpack
);
2091 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2093 /* empty szPackagePath */
2094 r
= MsiOpenPackage("", &hpack
);
2097 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2100 if (r
== ERROR_SUCCESS
)
2101 MsiCloseHandle(hpack
);
2103 /* nonexistent szPackagePath */
2104 r
= MsiOpenPackage("nonexistent", &hpack
);
2105 ok(r
== ERROR_FILE_NOT_FOUND
, "Expected ERROR_FILE_NOT_FOUND, got %d\n", r
);
2108 r
= MsiOpenPackage(msifile
, NULL
);
2109 ok(r
== ERROR_INVALID_PARAMETER
, "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
2113 r
= MsiOpenPackage(name
, &hpack
);
2114 ok(r
== ERROR_INVALID_HANDLE
, "Expected ERROR_INVALID_HANDLE, got %d\n", r
);
2116 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_CREATE
, &hdb
);
2117 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2119 /* database exists, but is emtpy */
2120 sprintf(name
, "#%d", hdb
);
2121 r
= MsiOpenPackage(name
, &hpack
);
2122 ok(r
== ERROR_INSTALL_PACKAGE_INVALID
,
2123 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r
);
2125 query
= "CREATE TABLE `Property` ( "
2126 "`Property` CHAR(72), `Value` CHAR(0) "
2127 "PRIMARY KEY `Property`)";
2128 r
= try_query(hdb
, query
);
2129 ok(r
== ERROR_SUCCESS
, "failed to create Properties table\n");
2131 query
= "CREATE TABLE `InstallExecuteSequence` ("
2132 "`Action` CHAR(72), `Condition` CHAR(0), `Sequence` INTEGER "
2133 "PRIMARY KEY `Action`)";
2134 r
= try_query(hdb
, query
);
2135 ok(r
== ERROR_SUCCESS
, "failed to create InstallExecuteSequence table\n");
2137 /* a few key tables exist */
2138 sprintf(name
, "#%d", hdb
);
2139 r
= MsiOpenPackage(name
, &hpack
);
2140 ok(r
== ERROR_INSTALL_PACKAGE_INVALID
,
2141 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r
);
2143 MsiCloseHandle(hdb
);
2144 DeleteFile(msifile
);
2146 /* start with a clean database to show what constitutes a valid package */
2147 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_CREATE
, &hdb
);
2148 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2150 sprintf(name
, "#%d", hdb
);
2152 /* The following summary information props must exist:
2157 set_summary_dword(hdb
, PID_PAGECOUNT
, 100);
2158 r
= MsiOpenPackage(name
, &hpack
);
2159 ok(r
== ERROR_INSTALL_PACKAGE_INVALID
,
2160 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r
);
2162 set_summary_str(hdb
, PID_REVNUMBER
, "{004757CD-5092-49c2-AD20-28E1CE0DF5F2}");
2163 r
= MsiOpenPackage(name
, &hpack
);
2164 ok(r
== ERROR_SUCCESS
,
2165 "Expected ERROR_SUCCESS, got %d\n", r
);
2167 MsiCloseHandle(hpack
);
2168 MsiCloseHandle(hdb
);
2169 DeleteFile(msifile
);
2172 static void test_formatrecord2(void)
2174 MSIHANDLE hpkg
, hrec
;
2179 hpkg
= package_from_db(create_package_db());
2180 ok( hpkg
, "failed to create package\n");
2182 r
= MsiSetProperty(hpkg
, "Manufacturer", " " );
2183 ok( r
== ERROR_SUCCESS
, "set property failed\n");
2185 hrec
= MsiCreateRecord(2);
2186 ok(hrec
, "create record failed\n");
2188 r
= MsiRecordSetString( hrec
, 0, "[ProgramFilesFolder][Manufacturer]\\asdf");
2189 ok( r
== ERROR_SUCCESS
, "format record failed\n");
2193 r
= MsiFormatRecord( hpkg
, hrec
, buffer
, &sz
);
2195 r
= MsiRecordSetString(hrec
, 0, "[foo][1]");
2196 r
= MsiRecordSetString(hrec
, 1, "hoo");
2198 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2199 ok( sz
== 3, "size wrong\n");
2200 ok( 0 == strcmp(buffer
,"hoo"), "wrong output %s\n",buffer
);
2201 ok( r
== ERROR_SUCCESS
, "format failed\n");
2203 r
= MsiRecordSetString(hrec
, 0, "x[~]x");
2205 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2206 ok( sz
== 3, "size wrong\n");
2207 ok( 0 == strcmp(buffer
,"x"), "wrong output %s\n",buffer
);
2208 ok( r
== ERROR_SUCCESS
, "format failed\n");
2210 r
= MsiRecordSetString(hrec
, 0, "[foo.$%}][1]");
2211 r
= MsiRecordSetString(hrec
, 1, "hoo");
2213 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2214 ok( sz
== 3, "size wrong\n");
2215 ok( 0 == strcmp(buffer
,"hoo"), "wrong output %s\n",buffer
);
2216 ok( r
== ERROR_SUCCESS
, "format failed\n");
2218 r
= MsiRecordSetString(hrec
, 0, "[\\[]");
2220 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2221 ok( sz
== 1, "size wrong\n");
2222 ok( 0 == strcmp(buffer
,"["), "wrong output %s\n",buffer
);
2223 ok( r
== ERROR_SUCCESS
, "format failed\n");
2225 SetEnvironmentVariable("FOO", "BAR");
2226 r
= MsiRecordSetString(hrec
, 0, "[%FOO]");
2228 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2229 ok( sz
== 3, "size wrong\n");
2230 ok( 0 == strcmp(buffer
,"BAR"), "wrong output %s\n",buffer
);
2231 ok( r
== ERROR_SUCCESS
, "format failed\n");
2233 r
= MsiRecordSetString(hrec
, 0, "[[1]]");
2234 r
= MsiRecordSetString(hrec
, 1, "%FOO");
2236 r
= MsiFormatRecord(hpkg
, hrec
, buffer
, &sz
);
2237 ok( sz
== 3, "size wrong\n");
2238 ok( 0 == strcmp(buffer
,"BAR"), "wrong output %s\n",buffer
);
2239 ok( r
== ERROR_SUCCESS
, "format failed\n");
2241 MsiCloseHandle( hrec
);
2242 MsiCloseHandle( hpkg
);
2243 DeleteFile(msifile
);
2246 static void test_states(void)
2251 INSTALLSTATE state
, action
;
2253 static const CHAR msifile2
[] = "winetest2.msi";
2254 static const CHAR msifile3
[] = "winetest3.msi";
2256 hdb
= create_package_db();
2257 ok ( hdb
, "failed to create package database\n" );
2259 r
= add_directory_entry( hdb
, "'TARGETDIR', '', 'SourceDir'");
2260 ok( r
== ERROR_SUCCESS
, "cannot add directory: %d\n", r
);
2262 r
= create_property_table( hdb
);
2263 ok( r
== ERROR_SUCCESS
, "cannot create Property table: %d\n", r
);
2265 r
= add_property_entry( hdb
, "'ProductCode', '{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}'" );
2266 ok( r
== ERROR_SUCCESS
, "cannot add property entry: %d\n", r
);
2268 r
= add_property_entry( hdb
, "'ProductLanguage', '1033'" );
2269 ok( r
== ERROR_SUCCESS
, "cannot add property entry: %d\n", r
);
2271 r
= add_property_entry( hdb
, "'ProductName', 'MSITEST'" );
2272 ok( r
== ERROR_SUCCESS
, "cannot add property entry: %d\n", r
);
2274 r
= add_property_entry( hdb
, "'ProductVersion', '1.1.1'" );
2275 ok( r
== ERROR_SUCCESS
, "cannot add property entry: %d\n", r
);
2277 r
= create_install_execute_sequence_table( hdb
);
2278 ok( r
== ERROR_SUCCESS
, "cannot create InstallExecuteSequence table: %d\n", r
);
2280 r
= add_install_execute_sequence_entry( hdb
, "'CostInitialize', '', '800'" );
2281 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2283 r
= add_install_execute_sequence_entry( hdb
, "'FileCost', '', '900'" );
2284 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2286 r
= add_install_execute_sequence_entry( hdb
, "'CostFinalize', '', '1000'" );
2287 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2289 r
= add_install_execute_sequence_entry( hdb
, "'InstallValidate', '', '1400'" );
2290 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2292 r
= add_install_execute_sequence_entry( hdb
, "'InstallInitialize', '', '1500'" );
2293 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2295 r
= add_install_execute_sequence_entry( hdb
, "'ProcessComponents', '', '1600'" );
2296 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2298 r
= add_install_execute_sequence_entry( hdb
, "'UnpublishFeatures', '', '1800'" );
2299 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2301 r
= add_install_execute_sequence_entry( hdb
, "'RegisterProduct', '', '6100'" );
2302 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2304 r
= add_install_execute_sequence_entry( hdb
, "'PublishFeatures', '', '6300'" );
2305 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2307 r
= add_install_execute_sequence_entry( hdb
, "'PublishProduct', '', '6400'" );
2308 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2310 r
= add_install_execute_sequence_entry( hdb
, "'InstallFinalize', '', '6600'" );
2311 ok( r
== ERROR_SUCCESS
, "cannot add install execute sequence entry: %d\n", r
);
2313 r
= create_media_table( hdb
);
2314 ok( r
== ERROR_SUCCESS
, "cannot create media table: %d\n", r
);
2316 r
= add_media_entry( hdb
, "'1', '3', '', '', 'DISK1', ''");
2317 ok( r
== ERROR_SUCCESS
, "cannot add media entry: %d\n", r
);
2319 r
= create_feature_table( hdb
);
2320 ok( r
== ERROR_SUCCESS
, "cannot create Feature table: %d\n", r
);
2322 r
= create_component_table( hdb
);
2323 ok( r
== ERROR_SUCCESS
, "cannot create Component table: %d\n", r
);
2325 /* msidbFeatureAttributesFavorLocal */
2326 r
= add_feature_entry( hdb
, "'one', '', '', '', 2, 1, '', 0" );
2327 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2329 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
2330 r
= add_component_entry( hdb
, "'alpha', '{467EC132-739D-4784-A37B-677AA43DBC94}', 'TARGETDIR', 0, '', 'alpha_file'" );
2331 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2333 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
2334 r
= add_component_entry( hdb
, "'beta', '{2C1F189C-24A6-4C34-B26B-994A6C026506}', 'TARGETDIR', 1, '', 'beta_file'" );
2335 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2337 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
2338 r
= add_component_entry( hdb
, "'gamma', '{C271E2A4-DE2E-4F70-86D1-6984AF7DE2CA}', 'TARGETDIR', 2, '', 'gamma_file'" );
2339 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2341 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSharedDllRefCount */
2342 r
= add_component_entry( hdb
, "'theta', '{4EB3129D-81A8-48D5-9801-75600FED3DD9}', 'TARGETDIR', 8, '', 'theta_file'" );
2343 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2345 /* msidbFeatureAttributesFavorSource */
2346 r
= add_feature_entry( hdb
, "'two', '', '', '', 2, 1, '', 1" );
2347 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2349 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
2350 r
= add_component_entry( hdb
, "'delta', '{938FD4F2-C648-4259-A03C-7AA3B45643F3}', 'TARGETDIR', 0, '', 'delta_file'" );
2351 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2353 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2354 r
= add_component_entry( hdb
, "'epsilon', '{D59713B6-C11D-47F2-A395-1E5321781190}', 'TARGETDIR', 1, '', 'epsilon_file'" );
2355 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2357 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
2358 r
= add_component_entry( hdb
, "'zeta', '{377D33AB-2FAA-42B9-A629-0C0DAE9B9C7A}', 'TARGETDIR', 2, '', 'zeta_file'" );
2359 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2361 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSharedDllRefCount */
2362 r
= add_component_entry( hdb
, "'iota', '{5D36F871-B5ED-4801-9E0F-C46B9E5C9669}', 'TARGETDIR', 8, '', 'iota_file'" );
2363 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2365 /* msidbFeatureAttributesFavorSource */
2366 r
= add_feature_entry( hdb
, "'three', '', '', '', 2, 1, '', 1" );
2367 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2369 /* msidbFeatureAttributesFavorLocal */
2370 r
= add_feature_entry( hdb
, "'four', '', '', '', 2, 1, '', 0" );
2371 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2374 r
= add_feature_entry( hdb
, "'five', '', '', '', 2, 0, '', 1" );
2375 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2377 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
2378 r
= add_component_entry( hdb
, "'eta', '{DD89003F-0DD4-41B8-81C0-3411A7DA2695}', 'TARGETDIR', 1, '', 'eta_file'" );
2379 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2381 /* no feature parent:msidbComponentAttributesLocalOnly */
2382 r
= add_component_entry( hdb
, "'kappa', '{D6B93DC3-8DA5-4769-9888-42BFE156BB8B}', 'TARGETDIR', 1, '', 'kappa_file'" );
2383 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2385 /* msidbFeatureAttributesFavorLocal:removed */
2386 r
= add_feature_entry( hdb
, "'six', '', '', '', 2, 1, '', 0" );
2387 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2389 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesLocalOnly */
2390 r
= add_component_entry( hdb
, "'lambda', '{6528C5E4-02A4-4636-A214-7A66A6C35B64}', 'TARGETDIR', 0, '', 'lambda_file'" );
2391 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2393 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSourceOnly */
2394 r
= add_component_entry( hdb
, "'mu', '{97014BAB-6C56-4013-9A63-2BF913B42519}', 'TARGETDIR', 1, '', 'mu_file'" );
2395 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2397 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesOptional */
2398 r
= add_component_entry( hdb
, "'nu', '{943DD0D8-5808-4954-8526-3B8493FEDDCD}', 'TARGETDIR', 2, '', 'nu_file'" );
2399 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2401 /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSharedDllRefCount */
2402 r
= add_component_entry( hdb
, "'xi', '{D6CF9EF7-6FCF-4930-B34B-F938AEFF9BDB}', 'TARGETDIR', 8, '', 'xi_file'" );
2403 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2405 /* msidbFeatureAttributesFavorSource:removed */
2406 r
= add_feature_entry( hdb
, "'seven', '', '', '', 2, 1, '', 1" );
2407 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
2409 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesLocalOnly */
2410 r
= add_component_entry( hdb
, "'omicron', '{7B57521D-15DB-4141-9AA6-01D934A4433F}', 'TARGETDIR', 0, '', 'omicron_file'" );
2411 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2413 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSourceOnly */
2414 r
= add_component_entry( hdb
, "'pi', '{FB85346B-378E-4492-8769-792305471C81}', 'TARGETDIR', 1, '', 'pi_file'" );
2415 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2417 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesOptional */
2418 r
= add_component_entry( hdb
, "'rho', '{798F2047-7B0C-4783-8BB0-D703E554114B}', 'TARGETDIR', 2, '', 'rho_file'" );
2419 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2421 /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSharedDllRefCount */
2422 r
= add_component_entry( hdb
, "'sigma', '{5CE9DDA8-B67B-4736-9D93-99D61C5B93E7}', 'TARGETDIR', 8, '', 'sigma_file'" );
2423 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
2425 r
= create_feature_components_table( hdb
);
2426 ok( r
== ERROR_SUCCESS
, "cannot create FeatureComponents table: %d\n", r
);
2428 r
= add_feature_components_entry( hdb
, "'one', 'alpha'" );
2429 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2431 r
= add_feature_components_entry( hdb
, "'one', 'beta'" );
2432 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2434 r
= add_feature_components_entry( hdb
, "'one', 'gamma'" );
2435 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2437 r
= add_feature_components_entry( hdb
, "'one', 'theta'" );
2438 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2440 r
= add_feature_components_entry( hdb
, "'two', 'delta'" );
2441 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2443 r
= add_feature_components_entry( hdb
, "'two', 'epsilon'" );
2444 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2446 r
= add_feature_components_entry( hdb
, "'two', 'zeta'" );
2447 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2449 r
= add_feature_components_entry( hdb
, "'two', 'iota'" );
2450 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2452 r
= add_feature_components_entry( hdb
, "'three', 'eta'" );
2453 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2455 r
= add_feature_components_entry( hdb
, "'four', 'eta'" );
2456 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2458 r
= add_feature_components_entry( hdb
, "'five', 'eta'" );
2459 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2461 r
= add_feature_components_entry( hdb
, "'six', 'lambda'" );
2462 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2464 r
= add_feature_components_entry( hdb
, "'six', 'mu'" );
2465 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2467 r
= add_feature_components_entry( hdb
, "'six', 'nu'" );
2468 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2470 r
= add_feature_components_entry( hdb
, "'six', 'xi'" );
2471 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2473 r
= add_feature_components_entry( hdb
, "'seven', 'omicron'" );
2474 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2476 r
= add_feature_components_entry( hdb
, "'seven', 'pi'" );
2477 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2479 r
= add_feature_components_entry( hdb
, "'seven', 'rho'" );
2480 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2482 r
= add_feature_components_entry( hdb
, "'seven', 'sigma'" );
2483 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
2485 r
= create_file_table( hdb
);
2486 ok( r
== ERROR_SUCCESS
, "cannot create File table: %d\n", r
);
2488 r
= add_file_entry( hdb
, "'alpha_file', 'alpha', 'alpha.txt', 100, '', '1033', 8192, 1" );
2489 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2491 r
= add_file_entry( hdb
, "'beta_file', 'beta', 'beta.txt', 0, '', '1033', 8192, 1" );
2492 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2494 r
= add_file_entry( hdb
, "'gamma_file', 'gamma', 'gamma.txt', 0, '', '1033', 8192, 1" );
2495 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2497 r
= add_file_entry( hdb
, "'theta_file', 'theta', 'theta.txt', 0, '', '1033', 8192, 1" );
2498 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2500 r
= add_file_entry( hdb
, "'delta_file', 'delta', 'delta.txt', 0, '', '1033', 8192, 1" );
2501 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2503 r
= add_file_entry( hdb
, "'epsilon_file', 'epsilon', 'epsilon.txt', 0, '', '1033', 8192, 1" );
2504 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2506 r
= add_file_entry( hdb
, "'zeta_file', 'zeta', 'zeta.txt', 0, '', '1033', 8192, 1" );
2507 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2509 r
= add_file_entry( hdb
, "'iota_file', 'iota', 'iota.txt', 0, '', '1033', 8192, 1" );
2510 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2512 /* compressed file */
2513 r
= add_file_entry( hdb
, "'eta_file', 'eta', 'eta.txt', 0, '', '1033', 16384, 1" );
2514 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2516 r
= add_file_entry( hdb
, "'kappa_file', 'kappa', 'kappa.txt', 0, '', '1033', 8192, 1" );
2517 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2519 r
= add_file_entry( hdb
, "'lambda_file', 'lambda', 'lambda.txt', 100, '', '1033', 8192, 1" );
2520 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2522 r
= add_file_entry( hdb
, "'mu_file', 'mu', 'mu.txt', 100, '', '1033', 8192, 1" );
2523 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2525 r
= add_file_entry( hdb
, "'nu_file', 'nu', 'nu.txt', 100, '', '1033', 8192, 1" );
2526 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2528 r
= add_file_entry( hdb
, "'xi_file', 'xi', 'xi.txt', 100, '', '1033', 8192, 1" );
2529 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2531 r
= add_file_entry( hdb
, "'omicron_file', 'omicron', 'omicron.txt', 100, '', '1033', 8192, 1" );
2532 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2534 r
= add_file_entry( hdb
, "'pi_file', 'pi', 'pi.txt', 100, '', '1033', 8192, 1" );
2535 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2537 r
= add_file_entry( hdb
, "'rho_file', 'rho', 'rho.txt', 100, '', '1033', 8192, 1" );
2538 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2540 r
= add_file_entry( hdb
, "'sigma_file', 'sigma', 'sigma.txt', 100, '', '1033', 8192, 1" );
2541 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
2543 MsiDatabaseCommit(hdb
);
2545 /* these properties must not be in the saved msi file */
2546 r
= add_property_entry( hdb
, "'ADDLOCAL', 'one,four'");
2547 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
2549 r
= add_property_entry( hdb
, "'ADDSOURCE', 'two,three'");
2550 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
2552 r
= add_property_entry( hdb
, "'REMOVE', 'six,seven'");
2553 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
2555 hpkg
= package_from_db( hdb
);
2556 ok( hpkg
, "failed to create package\n");
2558 MsiCloseHandle(hdb
);
2560 CopyFileA(msifile
, msifile2
, FALSE
);
2561 CopyFileA(msifile
, msifile3
, FALSE
);
2565 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
2566 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2567 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2568 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2572 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
2573 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2574 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2575 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2579 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
2580 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2581 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2582 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2586 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
2587 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2588 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2589 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2593 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
2594 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2595 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2596 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2600 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
2601 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2602 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2603 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2607 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
2608 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
2609 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2610 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2614 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
2615 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2616 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2617 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2621 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
2622 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2623 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2624 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2628 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
2629 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2630 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2631 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2635 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
2636 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2637 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2638 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2642 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
2643 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2644 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2645 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2649 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
2650 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2651 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2652 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2656 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
2657 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2658 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2659 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2663 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
2664 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2665 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2666 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2670 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
2671 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2672 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2673 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2677 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
2678 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2679 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2680 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2684 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
2685 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2686 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2687 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2691 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
2692 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2693 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2694 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2698 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
2699 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2700 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2701 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2705 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
2706 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2707 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2708 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2712 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
2713 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2714 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2715 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2719 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
2720 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2721 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2722 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2726 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
2727 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2728 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2729 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2733 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
2734 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
2735 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
2736 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
2738 r
= MsiDoAction( hpkg
, "CostInitialize");
2739 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
2743 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
2744 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2745 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2746 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2750 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
2751 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2752 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2753 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2757 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
2758 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2759 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2760 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2764 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
2765 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2766 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2767 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2771 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
2772 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2773 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2774 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2778 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
2779 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2780 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2781 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2785 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
2786 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2787 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2788 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2792 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
2793 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2794 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2795 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2799 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
2800 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2801 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2802 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2806 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
2807 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2808 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2809 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2813 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
2814 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2815 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2816 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2820 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
2821 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2822 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2823 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2827 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
2828 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2829 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2830 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2834 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
2835 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2836 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2837 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2841 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
2842 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2843 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2844 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2848 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
2849 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2850 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2851 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2855 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
2856 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2857 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2858 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2862 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
2863 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2864 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2865 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2869 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
2870 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2871 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2872 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2876 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
2877 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2878 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2879 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2883 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
2884 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2885 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2886 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2890 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
2891 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2892 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2893 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2897 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
2898 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2899 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2900 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2904 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
2905 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2906 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2907 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2911 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
2912 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2913 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2914 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2916 r
= MsiDoAction( hpkg
, "FileCost");
2917 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
2921 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
2922 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2923 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2924 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2928 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
2929 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2930 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2931 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2935 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
2936 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2937 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2938 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2942 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
2943 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2944 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2945 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2949 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
2950 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2951 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2952 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2956 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
2957 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2958 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2959 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2963 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
2964 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2965 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2966 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2970 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
2971 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2972 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2973 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2977 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
2978 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2979 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2980 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2984 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
2985 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2986 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2987 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2991 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
2992 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2993 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2994 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
2998 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
2999 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3000 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3001 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3005 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
3006 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3007 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3008 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3012 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
3013 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3014 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3015 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3019 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
3020 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3021 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3022 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3026 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
3027 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3028 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3029 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3033 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
3034 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3035 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3036 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3040 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
3041 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3042 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3043 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3047 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3048 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3049 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3050 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3054 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
3055 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3056 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3057 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3061 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
3062 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3063 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3064 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3068 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
3069 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3070 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3071 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3075 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
3076 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3077 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3078 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3082 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
3083 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3084 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3085 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3089 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
3090 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3091 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3092 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3094 r
= MsiDoAction( hpkg
, "CostFinalize");
3095 ok( r
== ERROR_SUCCESS
, "cost finalize failed: %d\n", r
);
3099 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3100 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3101 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3102 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3106 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
3107 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3108 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3109 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3113 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3114 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3115 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3116 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3120 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3121 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3122 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3123 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3127 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3128 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3129 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3130 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3134 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
3135 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3136 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3137 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3141 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
3142 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3143 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3144 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3148 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3149 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3150 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3151 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3155 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
3156 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3157 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3158 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3162 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
3163 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3164 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3165 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3169 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
3170 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3171 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3172 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3176 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
3177 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3178 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3179 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3183 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
3184 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3185 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3186 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3190 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
3191 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3192 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3193 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3197 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
3198 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3199 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3200 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3204 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
3205 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3206 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3207 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3211 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
3212 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3213 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3214 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3218 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
3219 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3220 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3221 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3225 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3226 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3227 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3228 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3232 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
3233 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3234 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3235 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3239 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
3240 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3241 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3242 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3246 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
3247 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3248 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3249 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3253 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
3254 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3255 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3256 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3260 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
3261 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3262 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3263 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3267 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
3268 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3269 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3270 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3272 MsiCloseHandle( hpkg
);
3274 /* publish the features and components */
3275 r
= MsiInstallProduct(msifile
, "ADDLOCAL=one,four ADDSOURCE=two,three REMOVE=six,seven");
3276 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3278 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_DIRECT
, &hdb
);
3279 ok(r
== ERROR_SUCCESS
, "failed to open database: %d\n", r
);
3281 /* these properties must not be in the saved msi file */
3282 r
= add_property_entry( hdb
, "'ADDLOCAL', 'one,four'");
3283 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
3285 r
= add_property_entry( hdb
, "'ADDSOURCE', 'two,three'");
3286 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
3288 r
= add_property_entry( hdb
, "'REMOVE', 'six,seven'");
3289 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
3291 hpkg
= package_from_db( hdb
);
3292 ok( hpkg
, "failed to create package\n");
3294 MsiCloseHandle(hdb
);
3298 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3299 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3300 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3301 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3305 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
3306 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3307 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3308 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3312 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3313 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3314 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3315 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3319 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3320 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3321 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3322 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3326 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3327 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3328 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3329 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3333 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
3334 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3335 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3336 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3340 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
3341 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
3342 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3343 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3347 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3348 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3349 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3350 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3354 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
3355 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3356 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3357 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3361 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
3362 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3363 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3364 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3368 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
3369 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3370 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3371 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3375 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
3376 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3377 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3378 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3382 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
3383 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3384 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3385 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3389 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
3390 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3391 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3392 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3396 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
3397 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3398 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3399 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3403 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
3404 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3405 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3406 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3410 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
3411 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3412 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3413 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3417 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
3418 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3419 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3420 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3424 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3425 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3426 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3427 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3431 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
3432 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3433 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3434 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3438 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
3439 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3440 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3441 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3445 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
3446 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3447 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3448 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3452 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
3453 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3454 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3455 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3459 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
3460 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3461 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3462 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3466 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
3467 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
3468 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
3469 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
3471 r
= MsiDoAction( hpkg
, "CostInitialize");
3472 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
3476 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3477 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3478 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3479 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3483 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
3484 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3485 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3486 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3490 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3491 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3492 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3493 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3497 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3498 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3499 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3500 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3504 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3505 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3506 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3507 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3511 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
3512 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3513 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3514 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3518 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
3519 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3520 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3521 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3525 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3526 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3527 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3528 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3532 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
3533 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3534 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3535 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3539 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
3540 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3541 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3542 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3546 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
3547 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3548 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3549 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3553 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
3554 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3555 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3556 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3560 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
3561 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3562 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3563 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3567 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
3568 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3569 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3570 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3574 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
3575 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3576 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3577 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3581 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
3582 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3583 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3584 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3588 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
3589 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3590 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3591 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3595 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
3596 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3597 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3598 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3602 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3603 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3604 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3605 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3609 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
3610 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3611 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3612 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3616 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
3617 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3618 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3619 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3623 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
3624 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3625 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3626 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3630 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
3631 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3632 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3633 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3637 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
3638 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3639 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3640 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3644 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
3645 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3646 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3647 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3649 r
= MsiDoAction( hpkg
, "FileCost");
3650 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
3654 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3655 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3656 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3657 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3661 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
3662 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3663 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3664 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3668 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3669 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3670 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3671 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3675 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3676 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3677 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3678 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3682 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3683 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3684 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3685 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3689 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
3690 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3691 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3692 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3696 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
3697 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3698 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3699 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3703 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3704 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3705 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3706 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3710 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
3711 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3712 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3713 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3717 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
3718 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3719 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3720 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3724 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
3725 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3726 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3727 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3731 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
3732 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3733 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3734 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3738 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
3739 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3740 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3741 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3745 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
3746 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3747 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3748 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3752 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
3753 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3754 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3755 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3759 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
3760 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3761 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3762 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3766 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
3767 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3768 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3769 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3773 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
3774 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3775 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3776 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3780 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3781 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3782 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3783 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3787 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
3788 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3789 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3790 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3794 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
3795 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3796 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3797 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3801 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
3802 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3803 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3804 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3808 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
3809 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3810 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3811 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3815 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
3816 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3817 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3818 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3822 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
3823 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3824 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
3825 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3827 r
= MsiDoAction( hpkg
, "CostFinalize");
3828 ok( r
== ERROR_SUCCESS
, "cost finalize failed: %d\n", r
);
3832 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
3833 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3834 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3835 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3839 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
3840 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3841 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3842 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3846 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
3847 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3848 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3849 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3853 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
3854 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3855 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3856 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3860 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
3861 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3862 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3863 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3867 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
3868 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3869 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3870 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3874 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
3875 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3876 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3877 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3881 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
3882 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3883 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3884 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3888 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
3889 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3890 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3891 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
3895 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
3896 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3897 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3898 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3902 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
3903 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3904 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3905 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3909 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
3910 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3911 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3912 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3916 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
3917 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3918 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3919 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3923 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
3924 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3925 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
3926 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3930 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
3931 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3932 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3933 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3937 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
3938 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3939 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
3940 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
3944 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
3945 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3946 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3947 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3951 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
3952 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3953 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3954 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3958 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
3959 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3960 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3961 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3965 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
3966 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3967 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3968 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3972 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
3973 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3974 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3975 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3979 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
3980 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3981 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3982 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3986 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
3987 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3988 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3989 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
3993 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
3994 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
3995 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
3996 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4000 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
4001 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4002 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4003 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4005 MsiCloseHandle(hpkg
);
4007 /* uninstall the product */
4008 r
= MsiInstallProduct(msifile
, "REMOVE=ALL");
4009 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4011 /* all features installed locally */
4012 r
= MsiInstallProduct(msifile2
, "ADDLOCAL=ALL");
4013 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4015 r
= MsiOpenDatabase(msifile2
, MSIDBOPEN_DIRECT
, &hdb
);
4016 ok(r
== ERROR_SUCCESS
, "failed to open database: %d\n", r
);
4018 /* these properties must not be in the saved msi file */
4019 r
= add_property_entry( hdb
, "'ADDLOCAL', 'one,two,three,four,five,six,seven'");
4020 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
4022 hpkg
= package_from_db( hdb
);
4023 ok( hpkg
, "failed to create package\n");
4027 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
4028 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4029 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4030 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4034 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
4035 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4036 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4037 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4041 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
4042 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4043 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4044 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4048 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
4049 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4050 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4051 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4055 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
4056 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4057 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4058 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4062 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
4063 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4064 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4065 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4069 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
4070 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4071 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4072 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4076 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
4077 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4078 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4079 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4083 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
4084 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4085 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4086 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4090 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
4091 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4092 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4093 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4097 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
4098 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4099 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4100 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4104 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
4105 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4106 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4107 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4111 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
4112 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4113 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4114 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4118 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
4119 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4120 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4121 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4125 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
4126 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4127 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4128 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4132 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
4133 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4134 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4135 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4139 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
4140 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4141 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4142 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4146 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
4147 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4148 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4149 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4153 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
4154 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4155 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4156 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4160 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
4161 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4162 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4163 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4167 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
4168 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4169 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4170 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4174 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
4175 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4176 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4177 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4181 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
4182 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4183 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4184 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4188 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
4189 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4190 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4191 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4195 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
4196 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4197 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4198 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4200 r
= MsiDoAction( hpkg
, "CostInitialize");
4201 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
4205 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
4206 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4207 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4208 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4212 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
4213 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4214 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4215 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4219 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
4220 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4221 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4222 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4226 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
4227 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4228 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4229 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4233 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
4234 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4235 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4236 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4240 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
4241 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4242 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4243 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4247 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
4248 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4249 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4250 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4254 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
4255 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4256 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4257 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4261 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
4262 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4263 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4264 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4268 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
4269 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4270 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4271 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4275 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
4276 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4277 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4278 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4282 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
4283 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4284 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4285 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4289 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
4290 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4291 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4292 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4296 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
4297 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4298 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4299 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4303 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
4304 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4305 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4306 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4310 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
4311 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4312 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4313 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4317 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
4318 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4319 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4320 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4324 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
4325 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4326 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4327 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4331 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
4332 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4333 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4334 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4338 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
4339 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4340 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4341 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4345 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
4346 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4347 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4348 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4352 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
4353 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4354 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4355 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4359 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
4360 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4361 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4362 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4366 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
4367 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4368 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4369 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4373 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
4374 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4375 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4376 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4378 r
= MsiDoAction( hpkg
, "FileCost");
4379 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
4383 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
4384 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4385 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4386 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4390 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
4391 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4392 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4393 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4397 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
4398 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4399 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4400 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4404 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
4405 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4406 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4407 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4411 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
4412 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4413 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4414 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4418 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
4419 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4420 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4421 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4425 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
4426 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4427 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4428 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4432 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
4433 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4434 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4435 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4439 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
4440 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4441 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4442 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4446 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
4447 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4448 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4449 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4453 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
4454 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4455 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4456 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4460 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
4461 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4462 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4463 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4467 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
4468 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4469 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4470 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4474 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
4475 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4476 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4477 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4481 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
4482 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4483 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4484 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4488 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
4489 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4490 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4491 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4495 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
4496 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4497 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4498 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4502 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
4503 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4504 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4505 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4509 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
4510 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4511 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4512 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4516 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
4517 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4518 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4519 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4523 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
4524 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4525 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4526 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4530 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
4531 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4532 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4533 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4537 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
4538 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4539 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4540 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4544 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
4545 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4546 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4547 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4551 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
4552 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4553 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4554 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4556 r
= MsiDoAction( hpkg
, "CostFinalize");
4557 ok( r
== ERROR_SUCCESS
, "cost finalize failed: %d\n", r
);
4561 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
4562 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4563 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4564 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4568 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
4569 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4570 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4571 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4575 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
4576 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4577 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4578 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4582 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
4583 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4584 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4585 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4589 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
4590 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4591 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4592 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4596 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
4597 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4598 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4599 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4603 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
4604 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4605 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4606 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4610 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
4611 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4612 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4613 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4617 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
4618 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4619 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4620 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4624 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
4625 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4626 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4627 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4631 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
4632 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4633 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4634 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4638 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
4639 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4640 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4641 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4645 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
4646 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4647 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4648 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
4652 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
4653 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4654 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4655 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4659 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
4660 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4661 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4662 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4666 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
4667 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4668 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4669 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
4673 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
4674 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4675 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
4676 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4680 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
4681 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4682 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4683 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4687 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
4688 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4689 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4690 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4694 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
4695 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4696 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4697 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4701 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
4702 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4703 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4704 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4708 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
4709 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4710 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4711 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4715 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
4716 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4717 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
4718 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
4722 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
4723 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4724 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4725 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4729 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
4730 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4731 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4732 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
4734 MsiCloseHandle(hpkg
);
4736 /* uninstall the product */
4737 r
= MsiInstallProduct(msifile2
, "REMOVE=ALL");
4738 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4740 /* all features installed from source */
4741 r
= MsiInstallProduct(msifile3
, "ADDSOURCE=ALL");
4742 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4744 r
= MsiOpenDatabase(msifile3
, MSIDBOPEN_DIRECT
, &hdb
);
4745 ok(r
== ERROR_SUCCESS
, "failed to open database: %d\n", r
);
4747 /* this property must not be in the saved msi file */
4748 r
= add_property_entry( hdb
, "'ADDSOURCE', 'one,two,three,four,five,six,seven'");
4749 ok( r
== ERROR_SUCCESS
, "cannot add property: %d\n", r
);
4751 hpkg
= package_from_db( hdb
);
4752 ok( hpkg
, "failed to create package\n");
4756 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
4757 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4758 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4759 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4763 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
4764 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4765 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4766 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4770 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
4771 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4772 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4773 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4777 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
4778 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4779 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4780 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4784 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
4785 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4786 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4787 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4791 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
4792 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4793 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4794 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4798 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
4799 ok( r
== ERROR_UNKNOWN_FEATURE
, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r
);
4800 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4801 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4805 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
4806 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4807 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4808 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4812 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
4813 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4814 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4815 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4819 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
4820 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4821 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4822 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4826 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
4827 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4828 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4829 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4833 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
4834 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4835 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4836 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4840 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
4841 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4842 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4843 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4847 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
4848 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4849 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4850 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4854 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
4855 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4856 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4857 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4861 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
4862 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4863 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4864 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4868 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
4869 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4870 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4871 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4875 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
4876 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4877 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4878 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4882 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
4883 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4884 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4885 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4889 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
4890 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4891 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4892 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4896 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
4897 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4898 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4899 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4903 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
4904 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4905 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4906 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4910 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
4911 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4912 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4913 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4917 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
4918 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4919 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4920 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4924 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
4925 ok( r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
4926 ok( state
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", state
);
4927 ok( action
== 0xdeadbee, "Expected 0xdeadbee, got %d\n", action
);
4929 r
= MsiDoAction( hpkg
, "CostInitialize");
4930 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
4934 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
4935 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4936 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4937 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4941 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
4942 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4943 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4944 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4948 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
4949 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4950 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4951 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4955 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
4956 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4957 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4958 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4962 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
4963 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4964 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4965 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4969 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
4970 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4971 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4972 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4976 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
4977 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4978 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4979 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4983 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
4984 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4985 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4986 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4990 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
4991 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4992 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
4993 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
4997 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
4998 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
4999 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5000 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5004 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
5005 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5006 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5007 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5011 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
5012 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5013 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5014 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5018 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
5019 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5020 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5021 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5025 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
5026 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5027 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5028 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5032 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
5033 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5034 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5035 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5039 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
5040 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5041 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5042 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5046 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
5047 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5048 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5049 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5053 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
5054 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5055 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5056 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5060 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
5061 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5062 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5063 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5067 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
5068 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5069 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5070 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5074 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
5075 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5076 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5077 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5081 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
5082 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5083 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5084 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5088 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
5089 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5090 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5091 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5095 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
5096 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5097 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5098 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5102 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
5103 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5104 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5105 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5107 r
= MsiDoAction( hpkg
, "FileCost");
5108 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
5112 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
5113 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5114 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5115 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5119 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
5120 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5121 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5122 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5126 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
5127 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5128 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5129 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5133 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
5134 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5135 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5136 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5140 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
5141 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5142 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5143 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5147 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
5148 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5149 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5150 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5154 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
5155 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5156 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5157 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5161 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
5162 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5163 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5164 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5168 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
5169 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5170 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5171 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5175 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
5176 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5177 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5178 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5182 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
5183 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5184 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5185 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5189 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
5190 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5191 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5192 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5196 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
5197 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5198 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5199 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5203 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
5204 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5205 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5206 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5210 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
5211 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5212 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5213 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5217 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
5218 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5219 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5220 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5224 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
5225 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5226 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5227 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5231 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
5232 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5233 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5234 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5238 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
5239 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5240 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5241 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5245 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
5246 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5247 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5248 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5252 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
5253 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5254 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5255 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5259 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
5260 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5261 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5262 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5266 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
5267 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5268 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5269 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5273 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
5274 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5275 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5276 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5280 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
5281 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5282 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
5283 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5285 r
= MsiDoAction( hpkg
, "CostFinalize");
5286 ok( r
== ERROR_SUCCESS
, "cost finalize failed: %d\n", r
);
5290 r
= MsiGetFeatureState(hpkg
, "one", &state
, &action
);
5291 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5292 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5293 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5297 r
= MsiGetFeatureState(hpkg
, "two", &state
, &action
);
5298 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5299 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5300 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5304 r
= MsiGetFeatureState(hpkg
, "three", &state
, &action
);
5305 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5306 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5307 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
5311 r
= MsiGetFeatureState(hpkg
, "four", &state
, &action
);
5312 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5313 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5314 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5318 r
= MsiGetFeatureState(hpkg
, "five", &state
, &action
);
5319 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5320 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
5321 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5325 r
= MsiGetFeatureState(hpkg
, "six", &state
, &action
);
5326 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5327 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5328 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5332 r
= MsiGetFeatureState(hpkg
, "seven", &state
, &action
);
5333 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5334 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5335 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5339 r
= MsiGetComponentState(hpkg
, "alpha", &state
, &action
);
5340 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5341 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5342 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5346 r
= MsiGetComponentState(hpkg
, "beta", &state
, &action
);
5347 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5348 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5349 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5353 r
= MsiGetComponentState(hpkg
, "gamma", &state
, &action
);
5354 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5355 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5356 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5360 r
= MsiGetComponentState(hpkg
, "theta", &state
, &action
);
5361 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5362 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5363 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5367 r
= MsiGetComponentState(hpkg
, "delta", &state
, &action
);
5368 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5369 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5370 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
5374 r
= MsiGetComponentState(hpkg
, "epsilon", &state
, &action
);
5375 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5376 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5377 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5381 r
= MsiGetComponentState(hpkg
, "zeta", &state
, &action
);
5382 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5383 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5384 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5388 r
= MsiGetComponentState(hpkg
, "iota", &state
, &action
);
5389 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5390 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5391 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
5395 r
= MsiGetComponentState(hpkg
, "eta", &state
, &action
);
5396 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5397 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5398 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
5402 r
= MsiGetComponentState(hpkg
, "kappa", &state
, &action
);
5403 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5404 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
5405 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5409 r
= MsiGetComponentState(hpkg
, "lambda", &state
, &action
);
5410 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5411 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5412 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5416 r
= MsiGetComponentState(hpkg
, "mu", &state
, &action
);
5417 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5418 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5419 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5423 r
= MsiGetComponentState(hpkg
, "nu", &state
, &action
);
5424 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5425 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5426 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5430 r
= MsiGetComponentState(hpkg
, "xi", &state
, &action
);
5431 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5432 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5433 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5437 r
= MsiGetComponentState(hpkg
, "omicron", &state
, &action
);
5438 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5439 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5440 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5444 r
= MsiGetComponentState(hpkg
, "pi", &state
, &action
);
5445 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5446 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5447 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5451 r
= MsiGetComponentState(hpkg
, "rho", &state
, &action
);
5452 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5453 ok( state
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", state
);
5454 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
5458 r
= MsiGetComponentState(hpkg
, "sigma", &state
, &action
);
5459 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5460 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5461 ok( state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
5463 MsiCloseHandle(hpkg
);
5465 /* uninstall the product */
5466 r
= MsiInstallProduct(msifile3
, "REMOVE=ALL");
5467 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5469 DeleteFileA(msifile
);
5470 DeleteFileA(msifile2
);
5471 DeleteFileA(msifile3
);
5474 static void test_getproperty(void)
5476 MSIHANDLE hPackage
= 0;
5478 static CHAR empty
[] = "";
5482 hPackage
= package_from_db(create_package_db());
5483 ok( hPackage
!= 0, " Failed to create package\n");
5485 /* set the property */
5486 r
= MsiSetProperty(hPackage
, "Name", "Value");
5487 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5489 /* retrieve the size, NULL pointer */
5491 r
= MsiGetProperty(hPackage
, "Name", NULL
, &size
);
5492 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5493 ok( size
== 5, "Expected 5, got %d\n", size
);
5495 /* retrieve the size, empty string */
5497 r
= MsiGetProperty(hPackage
, "Name", empty
, &size
);
5498 ok( r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
5499 ok( size
== 5, "Expected 5, got %d\n", size
);
5501 /* don't change size */
5502 r
= MsiGetProperty(hPackage
, "Name", prop
, &size
);
5503 ok( r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
5504 ok( size
== 5, "Expected 5, got %d\n", size
);
5505 ok( !lstrcmp(prop
, "Valu"), "Expected Valu, got %s\n", prop
);
5507 /* increase the size by 1 */
5509 r
= MsiGetProperty(hPackage
, "Name", prop
, &size
);
5510 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5511 ok( size
== 5, "Expected 5, got %d\n", size
);
5512 ok( !lstrcmp(prop
, "Value"), "Expected Value, got %s\n", prop
);
5514 r
= MsiCloseHandle( hPackage
);
5515 ok( r
== ERROR_SUCCESS
, "Failed to close package\n" );
5516 DeleteFile(msifile
);
5519 static void test_removefiles(void)
5525 hdb
= create_package_db();
5526 ok ( hdb
, "failed to create package database\n" );
5528 r
= add_directory_entry( hdb
, "'TARGETDIR', '', 'SourceDir'");
5529 ok( r
== ERROR_SUCCESS
, "cannot add directory: %d\n", r
);
5531 r
= create_feature_table( hdb
);
5532 ok( r
== ERROR_SUCCESS
, "cannot create Feature table: %d\n", r
);
5534 r
= create_component_table( hdb
);
5535 ok( r
== ERROR_SUCCESS
, "cannot create Component table: %d\n", r
);
5537 r
= add_feature_entry( hdb
, "'one', '', '', '', 2, 1, '', 0" );
5538 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
5540 r
= add_component_entry( hdb
, "'hydrogen', '', 'TARGETDIR', 0, '', 'hydrogen_file'" );
5541 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
5543 r
= add_component_entry( hdb
, "'helium', '', 'TARGETDIR', 0, '', 'helium_file'" );
5544 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
5546 r
= add_component_entry( hdb
, "'lithium', '', 'TARGETDIR', 0, '', 'lithium_file'" );
5547 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
5549 r
= add_component_entry( hdb
, "'beryllium', '', 'TARGETDIR', 0, '', 'beryllium_file'" );
5550 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
5552 r
= add_component_entry( hdb
, "'boron', '', 'TARGETDIR', 0, '', 'boron_file'" );
5553 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
5555 r
= add_component_entry( hdb
, "'carbon', '', 'TARGETDIR', 0, '', 'carbon_file'" );
5556 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
5558 r
= create_feature_components_table( hdb
);
5559 ok( r
== ERROR_SUCCESS
, "cannot create FeatureComponents table: %d\n", r
);
5561 r
= add_feature_components_entry( hdb
, "'one', 'hydrogen'" );
5562 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
5564 r
= add_feature_components_entry( hdb
, "'one', 'helium'" );
5565 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
5567 r
= add_feature_components_entry( hdb
, "'one', 'lithium'" );
5568 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
5570 r
= add_feature_components_entry( hdb
, "'one', 'beryllium'" );
5571 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
5573 r
= add_feature_components_entry( hdb
, "'one', 'boron'" );
5574 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
5576 r
= add_feature_components_entry( hdb
, "'one', 'carbon'" );
5577 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
5579 r
= create_file_table( hdb
);
5580 ok( r
== ERROR_SUCCESS
, "cannot create File table: %d\n", r
);
5582 r
= add_file_entry( hdb
, "'hydrogen_file', 'hydrogen', 'hydrogen.txt', 0, '', '1033', 8192, 1" );
5583 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
5585 r
= add_file_entry( hdb
, "'helium_file', 'helium', 'helium.txt', 0, '', '1033', 8192, 1" );
5586 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
5588 r
= add_file_entry( hdb
, "'lithium_file', 'lithium', 'lithium.txt', 0, '', '1033', 8192, 1" );
5589 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
5591 r
= add_file_entry( hdb
, "'beryllium_file', 'beryllium', 'beryllium.txt', 0, '', '1033', 16384, 1" );
5592 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
5594 r
= add_file_entry( hdb
, "'boron_file', 'boron', 'boron.txt', 0, '', '1033', 16384, 1" );
5595 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
5597 r
= add_file_entry( hdb
, "'carbon_file', 'carbon', 'carbon.txt', 0, '', '1033', 16384, 1" );
5598 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
5600 r
= create_remove_file_table( hdb
);
5601 ok( r
== ERROR_SUCCESS
, "cannot create Remove File table: %d\n", r
);
5603 hpkg
= package_from_db( hdb
);
5604 ok( hpkg
, "failed to create package\n");
5606 MsiCloseHandle( hdb
);
5608 create_test_file( "hydrogen.txt" );
5609 create_test_file( "helium.txt" );
5610 create_test_file( "lithium.txt" );
5611 create_test_file( "beryllium.txt" );
5612 create_test_file( "boron.txt" );
5613 create_test_file( "carbon.txt" );
5615 r
= MsiSetProperty( hpkg
, "TARGETDIR", CURR_DIR
);
5616 ok( r
== ERROR_SUCCESS
, "set property failed\n");
5618 r
= MsiDoAction( hpkg
, "CostInitialize");
5619 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
5621 r
= MsiDoAction( hpkg
, "FileCost");
5622 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
5624 r
= MsiDoAction( hpkg
, "CostFinalize");
5625 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
5627 r
= MsiDoAction( hpkg
, "InstallValidate");
5628 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
5630 r
= MsiSetComponentState( hpkg
, "hydrogen", INSTALLSTATE_ABSENT
);
5631 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
5633 r
= MsiSetComponentState( hpkg
, "helium", INSTALLSTATE_LOCAL
);
5634 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
5636 r
= MsiSetComponentState( hpkg
, "lithium", INSTALLSTATE_SOURCE
);
5637 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
5639 r
= MsiSetComponentState( hpkg
, "beryllium", INSTALLSTATE_ABSENT
);
5640 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
5642 r
= MsiSetComponentState( hpkg
, "boron", INSTALLSTATE_LOCAL
);
5643 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
5645 r
= MsiSetComponentState( hpkg
, "carbon", INSTALLSTATE_SOURCE
);
5646 ok( r
== ERROR_SUCCESS
, "failed to set component state: %d\n", r
);
5648 r
= MsiDoAction( hpkg
, "RemoveFiles");
5649 ok( r
== ERROR_SUCCESS
, "remove files failed\n");
5651 ok(DeleteFileA("hydrogen.txt"), "Expected hydrogen.txt to exist\n");
5652 ok(DeleteFileA("lithium.txt"), "Expected lithium.txt to exist\n");
5653 ok(DeleteFileA("beryllium.txt"), "Expected beryllium.txt to exist\n");
5654 ok(DeleteFileA("carbon.txt"), "Expected carbon.txt to exist\n");
5655 ok(DeleteFileA("helium.txt"), "Expected helium.txt to exist\n");
5656 ok(DeleteFileA("boron.txt"), "Expected boron.txt to exist\n");
5658 MsiCloseHandle( hpkg
);
5659 DeleteFileA(msifile
);
5662 static void test_appsearch(void)
5667 CHAR prop
[MAX_PATH
];
5668 DWORD size
= MAX_PATH
;
5670 hdb
= create_package_db();
5671 ok ( hdb
, "failed to create package database\n" );
5673 r
= create_appsearch_table( hdb
);
5674 ok( r
== ERROR_SUCCESS
, "cannot create AppSearch table: %d\n", r
);
5676 r
= add_appsearch_entry( hdb
, "'WEBBROWSERPROG', 'NewSignature1'" );
5677 ok( r
== ERROR_SUCCESS
, "cannot add entry: %d\n", r
);
5679 r
= create_reglocator_table( hdb
);
5680 ok( r
== ERROR_SUCCESS
, "cannot create RegLocator table: %d\n", r
);
5682 r
= add_reglocator_entry( hdb
, "'NewSignature1', 0, 'htmlfile\\shell\\open\\command', '', 1" );
5683 ok( r
== ERROR_SUCCESS
, "cannot create RegLocator table: %d\n", r
);
5685 r
= create_signature_table( hdb
);
5686 ok( r
== ERROR_SUCCESS
, "cannot create Signature table: %d\n", r
);
5688 r
= add_signature_entry( hdb
, "'NewSignature1', 'FileName', '', '', '', '', '', '', ''" );
5689 ok( r
== ERROR_SUCCESS
, "cannot create Signature table: %d\n", r
);
5691 hpkg
= package_from_db( hdb
);
5692 ok( hpkg
, "failed to create package\n");
5694 MsiCloseHandle( hdb
);
5696 r
= MsiDoAction( hpkg
, "AppSearch" );
5697 ok( r
== ERROR_SUCCESS
, "AppSearch failed: %d\n", r
);
5699 r
= MsiGetPropertyA( hpkg
, "WEBBROWSERPROG", prop
, &size
);
5700 ok( r
== ERROR_SUCCESS
, "get property failed: %d\n", r
);
5703 ok( lstrlenA(prop
) != 0, "Expected non-zero length\n");
5706 MsiCloseHandle( hpkg
);
5707 DeleteFileA(msifile
);
5710 static void test_appsearch_complocator(void)
5712 MSIHANDLE hpkg
, hdb
;
5713 CHAR path
[MAX_PATH
];
5714 CHAR prop
[MAX_PATH
];
5719 get_user_sid(&usersid
);
5722 skip("ConvertSidToStringSidA is not available\n");
5726 create_test_file("FileName1");
5727 create_test_file("FileName4");
5728 set_component_path("FileName1", MSIINSTALLCONTEXT_MACHINE
,
5729 "{A8AE6692-96BA-4198-8399-145D7D1D0D0E}", NULL
, FALSE
);
5731 create_test_file("FileName2");
5732 set_component_path("FileName2", MSIINSTALLCONTEXT_USERUNMANAGED
,
5733 "{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}", usersid
, FALSE
);
5735 create_test_file("FileName3");
5736 set_component_path("FileName3", MSIINSTALLCONTEXT_USERMANAGED
,
5737 "{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}", usersid
, FALSE
);
5739 create_test_file("FileName5");
5740 set_component_path("FileName5", MSIINSTALLCONTEXT_MACHINE
,
5741 "{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}", NULL
, TRUE
);
5743 create_test_file("FileName6");
5744 set_component_path("FileName6", MSIINSTALLCONTEXT_MACHINE
,
5745 "{C0ECD96F-7898-4410-9667-194BD8C1B648}", NULL
, TRUE
);
5747 create_test_file("FileName7");
5748 set_component_path("FileName7", MSIINSTALLCONTEXT_MACHINE
,
5749 "{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}", NULL
, FALSE
);
5751 /* dir is FALSE, but we're pretending it's a directory */
5752 set_component_path("IDontExist\\", MSIINSTALLCONTEXT_MACHINE
,
5753 "{91B7359B-07F2-4221-AA8D-DE102BB87A5F}", NULL
, FALSE
);
5755 create_file_with_version("FileName8.dll", MAKELONG(2, 1), MAKELONG(4, 3));
5756 set_component_path("FileName8.dll", MSIINSTALLCONTEXT_MACHINE
,
5757 "{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}", NULL
, FALSE
);
5759 create_file_with_version("FileName9.dll", MAKELONG(1, 2), MAKELONG(3, 4));
5760 set_component_path("FileName9.dll", MSIINSTALLCONTEXT_MACHINE
,
5761 "{A204DF48-7346-4635-BA2E-66247DBAC9DF}", NULL
, FALSE
);
5763 create_file_with_version("FileName10.dll", MAKELONG(2, 1), MAKELONG(4, 3));
5764 set_component_path("FileName10.dll", MSIINSTALLCONTEXT_MACHINE
,
5765 "{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}", NULL
, FALSE
);
5767 hdb
= create_package_db();
5768 ok(hdb
, "Expected a valid database handle\n");
5770 r
= create_appsearch_table(hdb
);
5771 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5773 r
= add_appsearch_entry(hdb
, "'SIGPROP1', 'NewSignature1'");
5774 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5776 r
= add_appsearch_entry(hdb
, "'SIGPROP2', 'NewSignature2'");
5777 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5779 r
= add_appsearch_entry(hdb
, "'SIGPROP3', 'NewSignature3'");
5780 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5782 r
= add_appsearch_entry(hdb
, "'SIGPROP4', 'NewSignature4'");
5783 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5785 r
= add_appsearch_entry(hdb
, "'SIGPROP5', 'NewSignature5'");
5786 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5788 r
= add_appsearch_entry(hdb
, "'SIGPROP6', 'NewSignature6'");
5789 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5791 r
= add_appsearch_entry(hdb
, "'SIGPROP7', 'NewSignature7'");
5792 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5794 r
= add_appsearch_entry(hdb
, "'SIGPROP8', 'NewSignature8'");
5795 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5797 r
= add_appsearch_entry(hdb
, "'SIGPROP9', 'NewSignature9'");
5798 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5800 r
= add_appsearch_entry(hdb
, "'SIGPROP10', 'NewSignature10'");
5801 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5803 r
= add_appsearch_entry(hdb
, "'SIGPROP11', 'NewSignature11'");
5804 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5806 r
= add_appsearch_entry(hdb
, "'SIGPROP12', 'NewSignature12'");
5807 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5809 r
= create_complocator_table(hdb
);
5810 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5812 /* published component, machine, file, signature, misdbLocatorTypeFile */
5813 r
= add_complocator_entry(hdb
, "'NewSignature1', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 1");
5814 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5816 /* published component, user-unmanaged, file, signature, misdbLocatorTypeFile */
5817 r
= add_complocator_entry(hdb
, "'NewSignature2', '{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}', 1");
5818 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5820 /* published component, user-managed, file, signature, misdbLocatorTypeFile */
5821 r
= add_complocator_entry(hdb
, "'NewSignature3', '{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}', 1");
5822 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5824 /* published component, machine, file, signature, misdbLocatorTypeDirectory */
5825 r
= add_complocator_entry(hdb
, "'NewSignature4', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 0");
5826 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5828 /* published component, machine, dir, signature, misdbLocatorTypeDirectory */
5829 r
= add_complocator_entry(hdb
, "'NewSignature5', '{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}', 0");
5830 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5832 /* published component, machine, dir, no signature, misdbLocatorTypeDirectory */
5833 r
= add_complocator_entry(hdb
, "'NewSignature6', '{C0ECD96F-7898-4410-9667-194BD8C1B648}', 0");
5834 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5836 /* published component, machine, file, no signature, misdbLocatorTypeFile */
5837 r
= add_complocator_entry(hdb
, "'NewSignature7', '{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}', 1");
5838 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5840 /* unpublished component, no signature, misdbLocatorTypeDir */
5841 r
= add_complocator_entry(hdb
, "'NewSignature8', '{FB671D5B-5083-4048-90E0-481C48D8F3A5}', 0");
5842 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5844 /* published component, no signature, dir does not exist misdbLocatorTypeDir */
5845 r
= add_complocator_entry(hdb
, "'NewSignature9', '{91B7359B-07F2-4221-AA8D-DE102BB87A5F}', 0");
5846 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5848 /* published component, signature w/ ver, misdbLocatorTypeFile */
5849 r
= add_complocator_entry(hdb
, "'NewSignature10', '{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}', 1");
5850 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5852 /* published component, signature w/ ver, ver > max, misdbLocatorTypeFile */
5853 r
= add_complocator_entry(hdb
, "'NewSignature11', '{A204DF48-7346-4635-BA2E-66247DBAC9DF}', 1");
5854 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5856 /* published component, signature w/ ver, sig->name ignored, misdbLocatorTypeFile */
5857 r
= add_complocator_entry(hdb
, "'NewSignature12', '{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}', 1");
5858 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5860 r
= create_signature_table(hdb
);
5861 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5863 r
= add_signature_entry(hdb
, "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''");
5864 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5866 r
= add_signature_entry(hdb
, "'NewSignature2', 'FileName2', '', '', '', '', '', '', ''");
5867 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5869 r
= add_signature_entry(hdb
, "'NewSignature3', 'FileName3', '', '', '', '', '', '', ''");
5870 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5872 r
= add_signature_entry(hdb
, "'NewSignature4', 'FileName4', '', '', '', '', '', '', ''");
5873 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5875 r
= add_signature_entry(hdb
, "'NewSignature5', 'FileName5', '', '', '', '', '', '', ''");
5876 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5878 r
= add_signature_entry(hdb
, "'NewSignature10', 'FileName8.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
5879 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5881 r
= add_signature_entry(hdb
, "'NewSignature11', 'FileName9.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
5882 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5884 r
= add_signature_entry(hdb
, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
5885 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5887 hpkg
= package_from_db(hdb
);
5888 ok(hpkg
, "Expected a valid package handle\n");
5890 r
= MsiSetPropertyA(hpkg
, "SIGPROP8", "october");
5891 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5893 r
= MsiDoAction(hpkg
, "AppSearch");
5894 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5897 sprintf(path
, "%s\\FileName1", CURR_DIR
);
5898 r
= MsiGetPropertyA(hpkg
, "SIGPROP1", prop
, &size
);
5899 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5900 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
5903 sprintf(path
, "%s\\FileName2", CURR_DIR
);
5904 r
= MsiGetPropertyA(hpkg
, "SIGPROP2", prop
, &size
);
5905 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5906 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
5909 sprintf(path
, "%s\\FileName3", CURR_DIR
);
5910 r
= MsiGetPropertyA(hpkg
, "SIGPROP3", prop
, &size
);
5911 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5912 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
5915 sprintf(path
, "%s\\FileName4", CURR_DIR
);
5916 r
= MsiGetPropertyA(hpkg
, "SIGPROP4", prop
, &size
);
5917 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5918 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
5921 sprintf(path
, "%s\\FileName5", CURR_DIR
);
5922 r
= MsiGetPropertyA(hpkg
, "SIGPROP5", prop
, &size
);
5923 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5924 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
5927 sprintf(path
, "%s\\", CURR_DIR
);
5928 r
= MsiGetPropertyA(hpkg
, "SIGPROP6", prop
, &size
);
5929 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5930 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
5933 sprintf(path
, "%s\\", CURR_DIR
);
5934 r
= MsiGetPropertyA(hpkg
, "SIGPROP7", prop
, &size
);
5935 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5936 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
5939 r
= MsiGetPropertyA(hpkg
, "SIGPROP8", prop
, &size
);
5940 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5941 ok(!lstrcmpA(prop
, "october"), "Expected \"october\", got \"%s\"\n", prop
);
5944 r
= MsiGetPropertyA(hpkg
, "SIGPROP9", prop
, &size
);
5945 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5946 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
5949 sprintf(path
, "%s\\FileName8.dll", CURR_DIR
);
5950 r
= MsiGetPropertyA(hpkg
, "SIGPROP10", prop
, &size
);
5951 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5952 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
5955 r
= MsiGetPropertyA(hpkg
, "SIGPROP11", prop
, &size
);
5956 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5957 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
5960 sprintf(path
, "%s\\FileName10.dll", CURR_DIR
);
5961 r
= MsiGetPropertyA(hpkg
, "SIGPROP12", prop
, &size
);
5962 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
5963 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
5965 delete_component_path("{A8AE6692-96BA-4198-8399-145D7D1D0D0E}",
5966 MSIINSTALLCONTEXT_MACHINE
, NULL
);
5967 delete_component_path("{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}",
5968 MSIINSTALLCONTEXT_USERUNMANAGED
, usersid
);
5969 delete_component_path("{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}",
5970 MSIINSTALLCONTEXT_USERMANAGED
, usersid
);
5971 delete_component_path("{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}",
5972 MSIINSTALLCONTEXT_MACHINE
, NULL
);
5973 delete_component_path("{C0ECD96F-7898-4410-9667-194BD8C1B648}",
5974 MSIINSTALLCONTEXT_MACHINE
, NULL
);
5975 delete_component_path("{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}",
5976 MSIINSTALLCONTEXT_MACHINE
, NULL
);
5977 delete_component_path("{91B7359B-07F2-4221-AA8D-DE102BB87A5F}",
5978 MSIINSTALLCONTEXT_MACHINE
, NULL
);
5979 delete_component_path("{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}",
5980 MSIINSTALLCONTEXT_MACHINE
, NULL
);
5981 delete_component_path("{A204DF48-7346-4635-BA2E-66247DBAC9DF}",
5982 MSIINSTALLCONTEXT_MACHINE
, NULL
);
5983 delete_component_path("{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}",
5984 MSIINSTALLCONTEXT_MACHINE
, NULL
);
5986 DeleteFileA("FileName1");
5987 DeleteFileA("FileName2");
5988 DeleteFileA("FileName3");
5989 DeleteFileA("FileName4");
5990 DeleteFileA("FileName5");
5991 DeleteFileA("FileName6");
5992 DeleteFileA("FileName7");
5993 DeleteFileA("FileName8.dll");
5994 DeleteFileA("FileName9.dll");
5995 DeleteFileA("FileName10.dll");
5996 MsiCloseHandle(hpkg
);
5997 DeleteFileA(msifile
);
6000 static void test_appsearch_reglocator(void)
6002 MSIHANDLE hpkg
, hdb
;
6003 CHAR path
[MAX_PATH
];
6004 CHAR prop
[MAX_PATH
];
6007 BOOL space
, version
;
6016 if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
6019 DeleteFileA("test.dll");
6021 res
= RegCreateKeyA(HKEY_CLASSES_ROOT
, "Software\\Wine", &classes
);
6022 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6024 res
= RegSetValueExA(classes
, "Value1", 0, REG_SZ
,
6025 (const BYTE
*)"regszdata", 10);
6026 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6028 res
= RegCreateKeyA(HKEY_CURRENT_USER
, "Software\\Wine", &hkcu
);
6029 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6031 res
= RegSetValueExA(hkcu
, "Value1", 0, REG_SZ
,
6032 (const BYTE
*)"regszdata", 10);
6033 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6036 res
= RegCreateKeyA(HKEY_USERS
, "S-1-5-18\\Software\\Wine", &users
);
6037 ok(res
== ERROR_SUCCESS
||
6038 broken(res
== ERROR_INVALID_PARAMETER
),
6039 "Expected ERROR_SUCCESS, got %d\n", res
);
6041 if (res
== ERROR_SUCCESS
)
6043 res
= RegSetValueExA(users
, "Value1", 0, REG_SZ
,
6044 (const BYTE
*)"regszdata", 10);
6045 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6048 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, "Software\\Wine", &hklm
);
6049 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6051 res
= RegSetValueA(hklm
, NULL
, REG_SZ
, "defvalue", 8);
6052 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6054 res
= RegSetValueExA(hklm
, "Value1", 0, REG_SZ
,
6055 (const BYTE
*)"regszdata", 10);
6056 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6059 res
= RegSetValueExA(hklm
, "Value2", 0, REG_DWORD
,
6060 (const BYTE
*)&val
, sizeof(DWORD
));
6061 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6064 res
= RegSetValueExA(hklm
, "Value3", 0, REG_DWORD
,
6065 (const BYTE
*)&val
, sizeof(DWORD
));
6066 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6068 res
= RegSetValueExA(hklm
, "Value4", 0, REG_EXPAND_SZ
,
6069 (const BYTE
*)"%PATH%", 7);
6070 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6072 res
= RegSetValueExA(hklm
, "Value5", 0, REG_EXPAND_SZ
,
6073 (const BYTE
*)"my%NOVAR%", 10);
6074 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6076 res
= RegSetValueExA(hklm
, "Value6", 0, REG_MULTI_SZ
,
6077 (const BYTE
*)"one\0two\0", 9);
6078 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6080 binary
[0] = 0x1234abcd;
6081 binary
[1] = 0x567890ef;
6082 res
= RegSetValueExA(hklm
, "Value7", 0, REG_BINARY
,
6083 (const BYTE
*)binary
, sizeof(binary
));
6084 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6086 res
= RegSetValueExA(hklm
, "Value8", 0, REG_SZ
,
6087 (const BYTE
*)"#regszdata", 11);
6088 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6090 create_test_file("FileName1");
6091 sprintf(path
, "%s\\FileName1", CURR_DIR
);
6092 res
= RegSetValueExA(hklm
, "Value9", 0, REG_SZ
,
6093 (const BYTE
*)path
, lstrlenA(path
) + 1);
6094 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6096 sprintf(path
, "%s\\FileName2", CURR_DIR
);
6097 res
= RegSetValueExA(hklm
, "Value10", 0, REG_SZ
,
6098 (const BYTE
*)path
, lstrlenA(path
) + 1);
6099 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6101 lstrcpyA(path
, CURR_DIR
);
6102 res
= RegSetValueExA(hklm
, "Value11", 0, REG_SZ
,
6103 (const BYTE
*)path
, lstrlenA(path
) + 1);
6104 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6106 res
= RegSetValueExA(hklm
, "Value12", 0, REG_SZ
,
6107 (const BYTE
*)"", 1);
6108 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6110 create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6111 sprintf(path
, "%s\\FileName3.dll", CURR_DIR
);
6112 res
= RegSetValueExA(hklm
, "Value13", 0, REG_SZ
,
6113 (const BYTE
*)path
, lstrlenA(path
) + 1);
6114 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6116 create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
6117 sprintf(path
, "%s\\FileName4.dll", CURR_DIR
);
6118 res
= RegSetValueExA(hklm
, "Value14", 0, REG_SZ
,
6119 (const BYTE
*)path
, lstrlenA(path
) + 1);
6120 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6122 create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6123 sprintf(path
, "%s\\FileName5.dll", CURR_DIR
);
6124 res
= RegSetValueExA(hklm
, "Value15", 0, REG_SZ
,
6125 (const BYTE
*)path
, lstrlenA(path
) + 1);
6126 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
6128 sprintf(path
, "\"%s\\FileName1\" -option", CURR_DIR
);
6129 res
= RegSetValueExA(hklm
, "value16", 0, REG_SZ
,
6130 (const BYTE
*)path
, lstrlenA(path
) + 1);
6132 space
= (strchr(CURR_DIR
, ' ')) ? TRUE
: FALSE
;
6133 sprintf(path
, "%s\\FileName1 -option", CURR_DIR
);
6134 res
= RegSetValueExA(hklm
, "value17", 0, REG_SZ
,
6135 (const BYTE
*)path
, lstrlenA(path
) + 1);
6137 hdb
= create_package_db();
6138 ok(hdb
, "Expected a valid database handle\n");
6140 r
= create_appsearch_table(hdb
);
6141 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6143 r
= add_appsearch_entry(hdb
, "'SIGPROP1', 'NewSignature1'");
6144 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6146 r
= add_appsearch_entry(hdb
, "'SIGPROP2', 'NewSignature2'");
6147 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6149 r
= add_appsearch_entry(hdb
, "'SIGPROP3', 'NewSignature3'");
6150 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6152 r
= add_appsearch_entry(hdb
, "'SIGPROP4', 'NewSignature4'");
6153 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6155 r
= add_appsearch_entry(hdb
, "'SIGPROP5', 'NewSignature5'");
6156 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6158 r
= add_appsearch_entry(hdb
, "'SIGPROP6', 'NewSignature6'");
6159 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6161 r
= add_appsearch_entry(hdb
, "'SIGPROP7', 'NewSignature7'");
6162 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6164 r
= add_appsearch_entry(hdb
, "'SIGPROP8', 'NewSignature8'");
6165 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6167 r
= add_appsearch_entry(hdb
, "'SIGPROP9', 'NewSignature9'");
6168 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6170 r
= add_appsearch_entry(hdb
, "'SIGPROP10', 'NewSignature10'");
6171 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6173 r
= add_appsearch_entry(hdb
, "'SIGPROP11', 'NewSignature11'");
6174 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6176 r
= add_appsearch_entry(hdb
, "'SIGPROP12', 'NewSignature12'");
6177 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6179 r
= add_appsearch_entry(hdb
, "'SIGPROP13', 'NewSignature13'");
6180 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6182 r
= add_appsearch_entry(hdb
, "'SIGPROP14', 'NewSignature14'");
6183 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6185 r
= add_appsearch_entry(hdb
, "'SIGPROP15', 'NewSignature15'");
6186 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6188 r
= add_appsearch_entry(hdb
, "'SIGPROP16', 'NewSignature16'");
6189 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6191 r
= add_appsearch_entry(hdb
, "'SIGPROP17', 'NewSignature17'");
6192 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6194 r
= add_appsearch_entry(hdb
, "'SIGPROP18', 'NewSignature18'");
6195 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6197 r
= add_appsearch_entry(hdb
, "'SIGPROP19', 'NewSignature19'");
6198 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6200 r
= add_appsearch_entry(hdb
, "'SIGPROP20', 'NewSignature20'");
6201 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6203 r
= add_appsearch_entry(hdb
, "'SIGPROP21', 'NewSignature21'");
6204 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6206 r
= add_appsearch_entry(hdb
, "'SIGPROP22', 'NewSignature22'");
6207 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6209 r
= add_appsearch_entry(hdb
, "'SIGPROP23', 'NewSignature23'");
6210 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6212 r
= add_appsearch_entry(hdb
, "'SIGPROP24', 'NewSignature24'");
6213 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6215 r
= add_appsearch_entry(hdb
, "'SIGPROP25', 'NewSignature25'");
6216 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6218 r
= add_appsearch_entry(hdb
, "'SIGPROP26', 'NewSignature26'");
6219 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6221 r
= add_appsearch_entry(hdb
, "'SIGPROP27', 'NewSignature27'");
6222 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6224 r
= add_appsearch_entry(hdb
, "'SIGPROP28', 'NewSignature28'");
6225 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6227 r
= add_appsearch_entry(hdb
, "'SIGPROP29', 'NewSignature29'");
6228 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6230 r
= add_appsearch_entry(hdb
, "'SIGPROP30', 'NewSignature30'");
6231 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6233 r
= create_reglocator_table(hdb
);
6234 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6236 /* HKLM, msidbLocatorTypeRawValue, REG_SZ */
6237 str
= "'NewSignature1', 2, 'Software\\Wine', 'Value1', 2";
6238 r
= add_reglocator_entry(hdb
, str
);
6239 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6241 /* HKLM, msidbLocatorTypeRawValue, positive DWORD */
6242 str
= "'NewSignature2', 2, 'Software\\Wine', 'Value2', 2";
6243 r
= add_reglocator_entry(hdb
, str
);
6244 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6246 /* HKLM, msidbLocatorTypeRawValue, negative DWORD */
6247 str
= "'NewSignature3', 2, 'Software\\Wine', 'Value3', 2";
6248 r
= add_reglocator_entry(hdb
, str
);
6249 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6251 /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
6252 str
= "'NewSignature4', 2, 'Software\\Wine', 'Value4', 2";
6253 r
= add_reglocator_entry(hdb
, str
);
6254 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6256 /* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
6257 str
= "'NewSignature5', 2, 'Software\\Wine', 'Value5', 2";
6258 r
= add_reglocator_entry(hdb
, str
);
6259 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6261 /* HKLM, msidbLocatorTypeRawValue, REG_MULTI_SZ */
6262 str
= "'NewSignature6', 2, 'Software\\Wine', 'Value6', 2";
6263 r
= add_reglocator_entry(hdb
, str
);
6264 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6266 /* HKLM, msidbLocatorTypeRawValue, REG_BINARY */
6267 str
= "'NewSignature7', 2, 'Software\\Wine', 'Value7', 2";
6268 r
= add_reglocator_entry(hdb
, str
);
6269 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6271 /* HKLM, msidbLocatorTypeRawValue, REG_SZ first char is # */
6272 str
= "'NewSignature8', 2, 'Software\\Wine', 'Value8', 2";
6273 r
= add_reglocator_entry(hdb
, str
);
6274 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6276 /* HKLM, msidbLocatorTypeFileName, signature, file exists */
6277 str
= "'NewSignature9', 2, 'Software\\Wine', 'Value9', 1";
6278 r
= add_reglocator_entry(hdb
, str
);
6279 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6281 /* HKLM, msidbLocatorTypeFileName, signature, file does not exist */
6282 str
= "'NewSignature10', 2, 'Software\\Wine', 'Value10', 1";
6283 r
= add_reglocator_entry(hdb
, str
);
6284 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6286 /* HKLM, msidbLocatorTypeFileName, no signature */
6287 str
= "'NewSignature11', 2, 'Software\\Wine', 'Value9', 1";
6288 r
= add_reglocator_entry(hdb
, str
);
6289 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6291 /* HKLM, msidbLocatorTypeDirectory, no signature, file exists */
6292 str
= "'NewSignature12', 2, 'Software\\Wine', 'Value9', 0";
6293 r
= add_reglocator_entry(hdb
, str
);
6294 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6296 /* HKLM, msidbLocatorTypeDirectory, no signature, directory exists */
6297 str
= "'NewSignature13', 2, 'Software\\Wine', 'Value11', 0";
6298 r
= add_reglocator_entry(hdb
, str
);
6299 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6301 /* HKLM, msidbLocatorTypeDirectory, signature, file exists */
6302 str
= "'NewSignature14', 2, 'Software\\Wine', 'Value9', 0";
6303 r
= add_reglocator_entry(hdb
, str
);
6304 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6306 /* HKCR, msidbLocatorTypeRawValue, REG_SZ */
6307 str
= "'NewSignature15', 0, 'Software\\Wine', 'Value1', 2";
6308 r
= add_reglocator_entry(hdb
, str
);
6309 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6311 /* HKCU, msidbLocatorTypeRawValue, REG_SZ */
6312 str
= "'NewSignature16', 1, 'Software\\Wine', 'Value1', 2";
6313 r
= add_reglocator_entry(hdb
, str
);
6314 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6316 /* HKU, msidbLocatorTypeRawValue, REG_SZ */
6317 str
= "'NewSignature17', 3, 'S-1-5-18\\Software\\Wine', 'Value1', 2";
6318 r
= add_reglocator_entry(hdb
, str
);
6319 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6321 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, NULL Name */
6322 str
= "'NewSignature18', 2, 'Software\\Wine', '', 2";
6323 r
= add_reglocator_entry(hdb
, str
);
6324 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6326 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, key does not exist */
6327 str
= "'NewSignature19', 2, 'Software\\IDontExist', '', 2";
6328 r
= add_reglocator_entry(hdb
, str
);
6329 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6331 /* HKLM, msidbLocatorTypeRawValue, REG_SZ, value is empty */
6332 str
= "'NewSignature20', 2, 'Software\\Wine', 'Value12', 2";
6333 r
= add_reglocator_entry(hdb
, str
);
6334 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6336 /* HKLM, msidbLocatorTypeFileName, signature, file exists w/ version */
6337 str
= "'NewSignature21', 2, 'Software\\Wine', 'Value13', 1";
6338 r
= add_reglocator_entry(hdb
, str
);
6339 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6341 /* HKLM, msidbLocatorTypeFileName, file exists w/ version, version > max */
6342 str
= "'NewSignature22', 2, 'Software\\Wine', 'Value14', 1";
6343 r
= add_reglocator_entry(hdb
, str
);
6344 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6346 /* HKLM, msidbLocatorTypeFileName, file exists w/ version, sig->name ignored */
6347 str
= "'NewSignature23', 2, 'Software\\Wine', 'Value15', 1";
6348 r
= add_reglocator_entry(hdb
, str
);
6349 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6351 /* HKLM, msidbLocatorTypeFileName, no signature, directory exists */
6352 str
= "'NewSignature24', 2, 'Software\\Wine', 'Value11', 1";
6353 r
= add_reglocator_entry(hdb
, str
);
6354 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6356 /* HKLM, msidbLocatorTypeFileName, no signature, file does not exist */
6357 str
= "'NewSignature25', 2, 'Software\\Wine', 'Value10', 1";
6358 r
= add_reglocator_entry(hdb
, str
);
6359 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6361 /* HKLM, msidbLocatorTypeDirectory, signature, directory exists */
6362 str
= "'NewSignature26', 2, 'Software\\Wine', 'Value11', 0";
6363 r
= add_reglocator_entry(hdb
, str
);
6364 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6366 /* HKLM, msidbLocatorTypeDirectory, signature, file does not exist */
6367 str
= "'NewSignature27', 2, 'Software\\Wine', 'Value10', 0";
6368 r
= add_reglocator_entry(hdb
, str
);
6369 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6371 /* HKLM, msidbLocatorTypeDirectory, no signature, file does not exist */
6372 str
= "'NewSignature28', 2, 'Software\\Wine', 'Value10', 0";
6373 r
= add_reglocator_entry(hdb
, str
);
6374 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6376 /* HKLM, msidbLocatorTypeFile, file exists, in quotes */
6377 str
= "'NewSignature29', 2, 'Software\\Wine', 'Value16', 1";
6378 r
= add_reglocator_entry(hdb
, str
);
6379 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6381 /* HKLM, msidbLocatorTypeFile, file exists, no quotes */
6382 str
= "'NewSignature30', 2, 'Software\\Wine', 'Value17', 1";
6383 r
= add_reglocator_entry(hdb
, str
);
6384 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6386 r
= create_signature_table(hdb
);
6387 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6389 str
= "'NewSignature9', 'FileName1', '', '', '', '', '', '', ''";
6390 r
= add_signature_entry(hdb
, str
);
6391 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6393 str
= "'NewSignature10', 'FileName2', '', '', '', '', '', '', ''";
6394 r
= add_signature_entry(hdb
, str
);
6395 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6397 str
= "'NewSignature14', 'FileName1', '', '', '', '', '', '', ''";
6398 r
= add_signature_entry(hdb
, str
);
6399 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6401 str
= "'NewSignature21', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
6402 r
= add_signature_entry(hdb
, str
);
6403 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6405 str
= "'NewSignature22', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
6406 r
= add_signature_entry(hdb
, str
);
6407 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6409 str
= "'NewSignature23', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
6410 r
= add_signature_entry(hdb
, str
);
6411 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6413 ptr
= strrchr(CURR_DIR
, '\\') + 1;
6414 sprintf(path
, "'NewSignature26', '%s', '', '', '', '', '', '', ''", ptr
);
6415 r
= add_signature_entry(hdb
, path
);
6416 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6418 str
= "'NewSignature27', 'FileName2', '', '', '', '', '', '', ''";
6419 r
= add_signature_entry(hdb
, str
);
6420 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6422 str
= "'NewSignature29', 'FileName1', '', '', '', '', '', '', ''";
6423 r
= add_signature_entry(hdb
, str
);
6424 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6426 str
= "'NewSignature30', 'FileName1', '', '', '', '', '', '', ''";
6427 r
= add_signature_entry(hdb
, str
);
6428 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6430 hpkg
= package_from_db(hdb
);
6431 ok(hpkg
, "Expected a valid package handle\n");
6433 r
= MsiDoAction(hpkg
, "AppSearch");
6434 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6437 r
= MsiGetPropertyA(hpkg
, "SIGPROP1", prop
, &size
);
6438 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6439 ok(!lstrcmpA(prop
, "regszdata"),
6440 "Expected \"regszdata\", got \"%s\"\n", prop
);
6443 r
= MsiGetPropertyA(hpkg
, "SIGPROP2", prop
, &size
);
6444 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6445 ok(!lstrcmpA(prop
, "#42"), "Expected \"#42\", got \"%s\"\n", prop
);
6448 r
= MsiGetPropertyA(hpkg
, "SIGPROP3", prop
, &size
);
6449 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6450 ok(!lstrcmpA(prop
, "#-42"), "Expected \"#-42\", got \"%s\"\n", prop
);
6452 ExpandEnvironmentStringsA("%PATH%", path
, MAX_PATH
);
6455 r
= MsiGetPropertyA(hpkg
, "SIGPROP4", prop
, &size
);
6456 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6457 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6460 r
= MsiGetPropertyA(hpkg
, "SIGPROP5", prop
, &size
);
6461 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6463 "my%NOVAR%"), "Expected \"my%%NOVAR%%\", got \"%s\"\n", prop
);
6466 r
= MsiGetPropertyA(hpkg
, "SIGPROP6", prop
, &size
);
6467 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6470 ok(!memcmp(prop
, "\0one\0two\0\0", 10),
6471 "Expected \"\\0one\\0two\\0\\0\"\n");
6475 lstrcpyA(path
, "#xCDAB3412EF907856");
6476 r
= MsiGetPropertyA(hpkg
, "SIGPROP7", prop
, &size
);
6477 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6478 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6481 r
= MsiGetPropertyA(hpkg
, "SIGPROP8", prop
, &size
);
6482 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6483 ok(!lstrcmpA(prop
, "##regszdata"),
6484 "Expected \"##regszdata\", got \"%s\"\n", prop
);
6487 sprintf(path
, "%s\\FileName1", CURR_DIR
);
6488 r
= MsiGetPropertyA(hpkg
, "SIGPROP9", prop
, &size
);
6489 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6490 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6493 r
= MsiGetPropertyA(hpkg
, "SIGPROP10", prop
, &size
);
6494 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6495 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6498 sprintf(path
, "%s\\", CURR_DIR
);
6499 r
= MsiGetPropertyA(hpkg
, "SIGPROP11", prop
, &size
);
6500 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6501 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6504 r
= MsiGetPropertyA(hpkg
, "SIGPROP12", prop
, &size
);
6505 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6506 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6509 sprintf(path
, "%s\\", CURR_DIR
);
6510 r
= MsiGetPropertyA(hpkg
, "SIGPROP13", prop
, &size
);
6511 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6512 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6515 r
= MsiGetPropertyA(hpkg
, "SIGPROP14", prop
, &size
);
6516 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6517 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6520 r
= MsiGetPropertyA(hpkg
, "SIGPROP15", prop
, &size
);
6521 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6522 ok(!lstrcmpA(prop
, "regszdata"),
6523 "Expected \"regszdata\", got \"%s\"\n", prop
);
6526 r
= MsiGetPropertyA(hpkg
, "SIGPROP16", prop
, &size
);
6527 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6528 ok(!lstrcmpA(prop
, "regszdata"),
6529 "Expected \"regszdata\", got \"%s\"\n", prop
);
6534 r
= MsiGetPropertyA(hpkg
, "SIGPROP17", prop
, &size
);
6535 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6536 ok(!lstrcmpA(prop
, "regszdata"),
6537 "Expected \"regszdata\", got \"%s\"\n", prop
);
6541 r
= MsiGetPropertyA(hpkg
, "SIGPROP18", prop
, &size
);
6542 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6543 ok(!lstrcmpA(prop
, "defvalue"),
6544 "Expected \"defvalue\", got \"%s\"\n", prop
);
6547 r
= MsiGetPropertyA(hpkg
, "SIGPROP19", prop
, &size
);
6548 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6549 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6552 r
= MsiGetPropertyA(hpkg
, "SIGPROP20", prop
, &size
);
6553 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6554 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6559 sprintf(path
, "%s\\FileName3.dll", CURR_DIR
);
6560 r
= MsiGetPropertyA(hpkg
, "SIGPROP21", 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 r
= MsiGetPropertyA(hpkg
, "SIGPROP22", prop
, &size
);
6566 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6567 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6570 sprintf(path
, "%s\\FileName5.dll", CURR_DIR
);
6571 r
= MsiGetPropertyA(hpkg
, "SIGPROP23", prop
, &size
);
6572 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6573 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6577 lstrcpyA(path
, CURR_DIR
);
6578 ptr
= strrchr(path
, '\\') + 1;
6580 r
= MsiGetPropertyA(hpkg
, "SIGPROP24", prop
, &size
);
6581 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6582 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6585 sprintf(path
, "%s\\", CURR_DIR
);
6586 r
= MsiGetPropertyA(hpkg
, "SIGPROP25", prop
, &size
);
6587 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6588 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6591 r
= MsiGetPropertyA(hpkg
, "SIGPROP26", prop
, &size
);
6592 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6593 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6596 r
= MsiGetPropertyA(hpkg
, "SIGPROP27", prop
, &size
);
6597 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6598 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6601 r
= MsiGetPropertyA(hpkg
, "SIGPROP28", prop
, &size
);
6602 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6603 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6606 sprintf(path
, "%s\\FileName1", CURR_DIR
);
6607 r
= MsiGetPropertyA(hpkg
, "SIGPROP29", prop
, &size
);
6608 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6609 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6612 sprintf(path
, "%s\\FileName1", CURR_DIR
);
6613 r
= MsiGetPropertyA(hpkg
, "SIGPROP30", prop
, &size
);
6614 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6616 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6618 todo_wine
ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6620 RegSetValueA(hklm
, NULL
, REG_SZ
, "", 0);
6621 RegDeleteValueA(hklm
, "Value1");
6622 RegDeleteValueA(hklm
, "Value2");
6623 RegDeleteValueA(hklm
, "Value3");
6624 RegDeleteValueA(hklm
, "Value4");
6625 RegDeleteValueA(hklm
, "Value5");
6626 RegDeleteValueA(hklm
, "Value6");
6627 RegDeleteValueA(hklm
, "Value7");
6628 RegDeleteValueA(hklm
, "Value8");
6629 RegDeleteValueA(hklm
, "Value9");
6630 RegDeleteValueA(hklm
, "Value10");
6631 RegDeleteValueA(hklm
, "Value11");
6632 RegDeleteValueA(hklm
, "Value12");
6633 RegDeleteValueA(hklm
, "Value13");
6634 RegDeleteValueA(hklm
, "Value14");
6635 RegDeleteValueA(hklm
, "Value15");
6636 RegDeleteValueA(hklm
, "Value16");
6637 RegDeleteValueA(hklm
, "Value17");
6638 RegDeleteKeyA(hklm
, "");
6641 RegDeleteValueA(classes
, "Value1");
6642 RegDeleteKeyA(classes
, "");
6643 RegCloseKey(classes
);
6645 RegDeleteValueA(hkcu
, "Value1");
6646 RegDeleteKeyA(hkcu
, "");
6649 RegDeleteValueA(users
, "Value1");
6650 RegDeleteKeyA(users
, "");
6653 DeleteFileA("FileName1");
6654 DeleteFileA("FileName3.dll");
6655 DeleteFileA("FileName4.dll");
6656 DeleteFileA("FileName5.dll");
6657 MsiCloseHandle(hpkg
);
6658 DeleteFileA(msifile
);
6661 static void delete_win_ini(LPCSTR file
)
6663 CHAR path
[MAX_PATH
];
6665 GetWindowsDirectoryA(path
, MAX_PATH
);
6666 lstrcatA(path
, "\\");
6667 lstrcatA(path
, file
);
6672 static void test_appsearch_inilocator(void)
6674 MSIHANDLE hpkg
, hdb
;
6675 CHAR path
[MAX_PATH
];
6676 CHAR prop
[MAX_PATH
];
6684 if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
6687 DeleteFileA("test.dll");
6689 WritePrivateProfileStringA("Section", "Key", "keydata,field2", "IniFile.ini");
6691 create_test_file("FileName1");
6692 sprintf(path
, "%s\\FileName1", CURR_DIR
);
6693 WritePrivateProfileStringA("Section", "Key2", path
, "IniFile.ini");
6695 WritePrivateProfileStringA("Section", "Key3", CURR_DIR
, "IniFile.ini");
6697 sprintf(path
, "%s\\IDontExist", CURR_DIR
);
6698 WritePrivateProfileStringA("Section", "Key4", path
, "IniFile.ini");
6700 create_file_with_version("FileName2.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6701 sprintf(path
, "%s\\FileName2.dll", CURR_DIR
);
6702 WritePrivateProfileStringA("Section", "Key5", path
, "IniFile.ini");
6704 create_file_with_version("FileName3.dll", MAKELONG(1, 2), MAKELONG(3, 4));
6705 sprintf(path
, "%s\\FileName3.dll", CURR_DIR
);
6706 WritePrivateProfileStringA("Section", "Key6", path
, "IniFile.ini");
6708 create_file_with_version("FileName4.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6709 sprintf(path
, "%s\\FileName4.dll", CURR_DIR
);
6710 WritePrivateProfileStringA("Section", "Key7", path
, "IniFile.ini");
6712 hdb
= create_package_db();
6713 ok(hdb
, "Expected a valid database handle\n");
6715 r
= create_appsearch_table(hdb
);
6716 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6718 r
= add_appsearch_entry(hdb
, "'SIGPROP1', 'NewSignature1'");
6719 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6721 r
= add_appsearch_entry(hdb
, "'SIGPROP2', 'NewSignature2'");
6722 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6724 r
= add_appsearch_entry(hdb
, "'SIGPROP3', 'NewSignature3'");
6725 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6727 r
= add_appsearch_entry(hdb
, "'SIGPROP4', 'NewSignature4'");
6728 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6730 r
= add_appsearch_entry(hdb
, "'SIGPROP5', 'NewSignature5'");
6731 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6733 r
= add_appsearch_entry(hdb
, "'SIGPROP6', 'NewSignature6'");
6734 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6736 r
= add_appsearch_entry(hdb
, "'SIGPROP7', 'NewSignature7'");
6737 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6739 r
= add_appsearch_entry(hdb
, "'SIGPROP8', 'NewSignature8'");
6740 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6742 r
= add_appsearch_entry(hdb
, "'SIGPROP9', 'NewSignature9'");
6743 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6745 r
= add_appsearch_entry(hdb
, "'SIGPROP10', 'NewSignature10'");
6746 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6748 r
= add_appsearch_entry(hdb
, "'SIGPROP11', 'NewSignature11'");
6749 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6751 r
= add_appsearch_entry(hdb
, "'SIGPROP12', 'NewSignature12'");
6752 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6754 r
= create_inilocator_table(hdb
);
6755 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6757 /* msidbLocatorTypeRawValue, field 1 */
6758 str
= "'NewSignature1', 'IniFile.ini', 'Section', 'Key', 1, 2";
6759 r
= add_inilocator_entry(hdb
, str
);
6760 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6762 /* msidbLocatorTypeRawValue, field 2 */
6763 str
= "'NewSignature2', 'IniFile.ini', 'Section', 'Key', 2, 2";
6764 r
= add_inilocator_entry(hdb
, str
);
6765 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6767 /* msidbLocatorTypeRawValue, entire field */
6768 str
= "'NewSignature3', 'IniFile.ini', 'Section', 'Key', 0, 2";
6769 r
= add_inilocator_entry(hdb
, str
);
6770 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6772 /* msidbLocatorTypeFile */
6773 str
= "'NewSignature4', 'IniFile.ini', 'Section', 'Key2', 1, 1";
6774 r
= add_inilocator_entry(hdb
, str
);
6775 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6777 /* msidbLocatorTypeDirectory, file */
6778 str
= "'NewSignature5', 'IniFile.ini', 'Section', 'Key2', 1, 0";
6779 r
= add_inilocator_entry(hdb
, str
);
6780 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6782 /* msidbLocatorTypeDirectory, directory */
6783 str
= "'NewSignature6', 'IniFile.ini', 'Section', 'Key3', 1, 0";
6784 r
= add_inilocator_entry(hdb
, str
);
6785 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6787 /* msidbLocatorTypeFile, file, no signature */
6788 str
= "'NewSignature7', 'IniFile.ini', 'Section', 'Key2', 1, 1";
6789 r
= add_inilocator_entry(hdb
, str
);
6790 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6792 /* msidbLocatorTypeFile, dir, no signature */
6793 str
= "'NewSignature8', 'IniFile.ini', 'Section', 'Key3', 1, 1";
6794 r
= add_inilocator_entry(hdb
, str
);
6795 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6797 /* msidbLocatorTypeFile, file does not exist */
6798 str
= "'NewSignature9', 'IniFile.ini', 'Section', 'Key4', 1, 1";
6799 r
= add_inilocator_entry(hdb
, str
);
6800 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6802 /* msidbLocatorTypeFile, signature with version */
6803 str
= "'NewSignature10', 'IniFile.ini', 'Section', 'Key5', 1, 1";
6804 r
= add_inilocator_entry(hdb
, str
);
6805 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6807 /* msidbLocatorTypeFile, signature with version, ver > max */
6808 str
= "'NewSignature11', 'IniFile.ini', 'Section', 'Key6', 1, 1";
6809 r
= add_inilocator_entry(hdb
, str
);
6810 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6812 /* msidbLocatorTypeFile, signature with version, sig->name ignored */
6813 str
= "'NewSignature12', 'IniFile.ini', 'Section', 'Key7', 1, 1";
6814 r
= add_inilocator_entry(hdb
, str
);
6815 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6817 r
= create_signature_table(hdb
);
6818 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6820 r
= add_signature_entry(hdb
, "'NewSignature4', 'FileName1', '', '', '', '', '', '', ''");
6821 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6823 r
= add_signature_entry(hdb
, "'NewSignature9', 'IDontExist', '', '', '', '', '', '', ''");
6824 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6826 r
= add_signature_entry(hdb
, "'NewSignature10', 'FileName2.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
6827 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6829 r
= add_signature_entry(hdb
, "'NewSignature11', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
6830 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6832 r
= add_signature_entry(hdb
, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
6833 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6835 hpkg
= package_from_db(hdb
);
6836 ok(hpkg
, "Expected a valid package handle\n");
6838 r
= MsiDoAction(hpkg
, "AppSearch");
6839 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6842 r
= MsiGetPropertyA(hpkg
, "SIGPROP1", prop
, &size
);
6843 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6844 ok(!lstrcmpA(prop
, "keydata"), "Expected \"keydata\", got \"%s\"\n", prop
);
6847 r
= MsiGetPropertyA(hpkg
, "SIGPROP2", prop
, &size
);
6848 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6849 ok(!lstrcmpA(prop
, "field2"), "Expected \"field2\", got \"%s\"\n", prop
);
6852 r
= MsiGetPropertyA(hpkg
, "SIGPROP3", prop
, &size
);
6853 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6854 ok(!lstrcmpA(prop
, "keydata,field2"),
6855 "Expected \"keydata,field2\", got \"%s\"\n", prop
);
6858 sprintf(path
, "%s\\FileName1", CURR_DIR
);
6859 r
= MsiGetPropertyA(hpkg
, "SIGPROP4", prop
, &size
);
6860 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6861 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6864 r
= MsiGetPropertyA(hpkg
, "SIGPROP5", prop
, &size
);
6865 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6866 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6869 sprintf(path
, "%s\\", CURR_DIR
);
6870 r
= MsiGetPropertyA(hpkg
, "SIGPROP6", prop
, &size
);
6871 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6872 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6875 sprintf(path
, "%s\\", CURR_DIR
);
6876 r
= MsiGetPropertyA(hpkg
, "SIGPROP7", prop
, &size
);
6877 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6878 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6881 lstrcpyA(path
, CURR_DIR
);
6882 ptr
= strrchr(path
, '\\');
6884 r
= MsiGetPropertyA(hpkg
, "SIGPROP8", prop
, &size
);
6885 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6886 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6889 r
= MsiGetPropertyA(hpkg
, "SIGPROP9", prop
, &size
);
6890 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6891 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6896 sprintf(path
, "%s\\FileName2.dll", CURR_DIR
);
6897 r
= MsiGetPropertyA(hpkg
, "SIGPROP10", prop
, &size
);
6898 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6899 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6902 r
= MsiGetPropertyA(hpkg
, "SIGPROP11", prop
, &size
);
6903 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6904 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
6907 sprintf(path
, "%s\\FileName4.dll", CURR_DIR
);
6908 r
= MsiGetPropertyA(hpkg
, "SIGPROP12", prop
, &size
);
6909 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6910 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
6913 delete_win_ini("IniFile.ini");
6914 DeleteFileA("FileName1");
6915 DeleteFileA("FileName2.dll");
6916 DeleteFileA("FileName3.dll");
6917 DeleteFileA("FileName4.dll");
6918 MsiCloseHandle(hpkg
);
6919 DeleteFileA(msifile
);
6922 static void test_appsearch_drlocator(void)
6924 MSIHANDLE hpkg
, hdb
;
6925 CHAR path
[MAX_PATH
];
6926 CHAR prop
[MAX_PATH
];
6933 if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
6936 DeleteFileA("test.dll");
6938 create_test_file("FileName1");
6939 CreateDirectoryA("one", NULL
);
6940 CreateDirectoryA("one\\two", NULL
);
6941 CreateDirectoryA("one\\two\\three", NULL
);
6942 create_test_file("one\\two\\three\\FileName2");
6943 CreateDirectoryA("another", NULL
);
6944 create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6945 create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
6946 create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
6948 hdb
= create_package_db();
6949 ok(hdb
, "Expected a valid database handle\n");
6951 r
= create_appsearch_table(hdb
);
6952 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6954 r
= add_appsearch_entry(hdb
, "'SIGPROP1', 'NewSignature1'");
6955 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6957 r
= add_appsearch_entry(hdb
, "'SIGPROP2', 'NewSignature2'");
6958 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6960 r
= add_appsearch_entry(hdb
, "'SIGPROP3', 'NewSignature3'");
6961 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6963 r
= add_appsearch_entry(hdb
, "'SIGPROP4', 'NewSignature4'");
6964 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6966 r
= add_appsearch_entry(hdb
, "'SIGPROP5', 'NewSignature5'");
6967 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6969 r
= add_appsearch_entry(hdb
, "'SIGPROP6', 'NewSignature6'");
6970 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6972 r
= add_appsearch_entry(hdb
, "'SIGPROP7', 'NewSignature7'");
6973 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6975 r
= add_appsearch_entry(hdb
, "'SIGPROP8', 'NewSignature8'");
6976 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6978 r
= add_appsearch_entry(hdb
, "'SIGPROP9', 'NewSignature9'");
6979 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6981 r
= add_appsearch_entry(hdb
, "'SIGPROP10', 'NewSignature10'");
6982 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6984 r
= create_drlocator_table(hdb
);
6985 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6987 /* no parent, full path, depth 0, signature */
6988 sprintf(path
, "'NewSignature1', '', '%s', 0", 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 0, no signature */
6993 sprintf(path
, "'NewSignature2', '', '%s', 0", CURR_DIR
);
6994 r
= add_drlocator_entry(hdb
, path
);
6995 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
6997 /* no parent, relative path, depth 0, no signature */
6998 sprintf(path
, "'NewSignature3', '', '%s', 0", CURR_DIR
+ 3);
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 2, signature */
7003 sprintf(path
, "'NewSignature4', '', '%s', 2", 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 3, signature */
7008 sprintf(path
, "'NewSignature5', '', '%s', 3", 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 1, signature is dir */
7013 sprintf(path
, "'NewSignature6', '', '%s', 1", CURR_DIR
);
7014 r
= add_drlocator_entry(hdb
, path
);
7015 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7017 /* parent is in DrLocator, relative path, depth 0, signature */
7018 sprintf(path
, "'NewSignature7', 'NewSignature1', 'one\\two\\three', 1");
7019 r
= add_drlocator_entry(hdb
, path
);
7020 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7022 /* no parent, full path, depth 0, signature w/ version */
7023 sprintf(path
, "'NewSignature8', '', '%s', 0", CURR_DIR
);
7024 r
= add_drlocator_entry(hdb
, path
);
7025 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7027 /* no parent, full path, depth 0, signature w/ version, ver > max */
7028 sprintf(path
, "'NewSignature9', '', '%s', 0", CURR_DIR
);
7029 r
= add_drlocator_entry(hdb
, path
);
7030 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7032 /* no parent, full path, depth 0, signature w/ version, sig->name not ignored */
7033 sprintf(path
, "'NewSignature10', '', '%s', 0", CURR_DIR
);
7034 r
= add_drlocator_entry(hdb
, path
);
7035 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7037 r
= create_signature_table(hdb
);
7038 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7040 str
= "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''";
7041 r
= add_signature_entry(hdb
, str
);
7042 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7044 str
= "'NewSignature4', 'FileName2', '', '', '', '', '', '', ''";
7045 r
= add_signature_entry(hdb
, str
);
7046 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7048 str
= "'NewSignature5', 'FileName2', '', '', '', '', '', '', ''";
7049 r
= add_signature_entry(hdb
, str
);
7050 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7052 str
= "'NewSignature6', 'another', '', '', '', '', '', '', ''";
7053 r
= add_signature_entry(hdb
, str
);
7054 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7056 str
= "'NewSignature7', 'FileName2', '', '', '', '', '', '', ''";
7057 r
= add_signature_entry(hdb
, str
);
7058 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7060 str
= "'NewSignature8', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
7061 r
= add_signature_entry(hdb
, str
);
7062 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7064 str
= "'NewSignature9', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
7065 r
= add_signature_entry(hdb
, str
);
7066 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7068 str
= "'NewSignature10', 'necessary', '1.1.1.1', '2.1.1.1', '', '', '', '', ''";
7069 r
= add_signature_entry(hdb
, str
);
7070 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7072 hpkg
= package_from_db(hdb
);
7073 ok(hpkg
, "Expected a valid package handle\n");
7075 r
= MsiDoAction(hpkg
, "AppSearch");
7076 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7079 sprintf(path
, "%s\\FileName1", CURR_DIR
);
7080 r
= MsiGetPropertyA(hpkg
, "SIGPROP1", prop
, &size
);
7081 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7082 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
7085 sprintf(path
, "%s\\", CURR_DIR
);
7086 r
= MsiGetPropertyA(hpkg
, "SIGPROP2", prop
, &size
);
7087 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7088 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
7091 sprintf(path
, "%s\\", CURR_DIR
);
7092 r
= MsiGetPropertyA(hpkg
, "SIGPROP3", prop
, &size
);
7093 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7094 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
7097 r
= MsiGetPropertyA(hpkg
, "SIGPROP4", prop
, &size
);
7098 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7099 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
7102 sprintf(path
, "%s\\one\\two\\three\\FileName2", CURR_DIR
);
7103 r
= MsiGetPropertyA(hpkg
, "SIGPROP5", prop
, &size
);
7104 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7105 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
7108 r
= MsiGetPropertyA(hpkg
, "SIGPROP6", prop
, &size
);
7109 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7110 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
7113 sprintf(path
, "%s\\one\\two\\three\\FileName2", CURR_DIR
);
7114 r
= MsiGetPropertyA(hpkg
, "SIGPROP7", prop
, &size
);
7115 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7116 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
7121 sprintf(path
, "%s\\FileName3.dll", CURR_DIR
);
7122 r
= MsiGetPropertyA(hpkg
, "SIGPROP8", prop
, &size
);
7123 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7124 ok(!lstrcmpA(prop
, path
), "Expected \"%s\", got \"%s\"\n", path
, prop
);
7127 r
= MsiGetPropertyA(hpkg
, "SIGPROP9", prop
, &size
);
7128 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7129 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
7132 r
= MsiGetPropertyA(hpkg
, "SIGPROP10", prop
, &size
);
7133 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7134 ok(!lstrcmpA(prop
, ""), "Expected \"\", got \"%s\"\n", prop
);
7137 DeleteFileA("FileName1");
7138 DeleteFileA("FileName3.dll");
7139 DeleteFileA("FileName4.dll");
7140 DeleteFileA("FileName5.dll");
7141 DeleteFileA("one\\two\\three\\FileName2");
7142 RemoveDirectoryA("one\\two\\three");
7143 RemoveDirectoryA("one\\two");
7144 RemoveDirectoryA("one");
7145 RemoveDirectoryA("another");
7146 MsiCloseHandle(hpkg
);
7147 DeleteFileA(msifile
);
7150 static void test_featureparents(void)
7155 INSTALLSTATE state
, action
;
7157 hdb
= create_package_db();
7158 ok ( hdb
, "failed to create package database\n" );
7160 r
= add_directory_entry( hdb
, "'TARGETDIR', '', 'SourceDir'");
7161 ok( r
== ERROR_SUCCESS
, "cannot add directory: %d\n", r
);
7163 r
= create_feature_table( hdb
);
7164 ok( r
== ERROR_SUCCESS
, "cannot create Feature table: %d\n", r
);
7166 r
= create_component_table( hdb
);
7167 ok( r
== ERROR_SUCCESS
, "cannot create Component table: %d\n", r
);
7169 r
= create_feature_components_table( hdb
);
7170 ok( r
== ERROR_SUCCESS
, "cannot create FeatureComponents table: %d\n", r
);
7172 r
= create_file_table( hdb
);
7173 ok( r
== ERROR_SUCCESS
, "cannot create File table: %d\n", r
);
7175 /* msidbFeatureAttributesFavorLocal */
7176 r
= add_feature_entry( hdb
, "'zodiac', '', '', '', 2, 1, '', 0" );
7177 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
7179 /* msidbFeatureAttributesFavorSource */
7180 r
= add_feature_entry( hdb
, "'perseus', '', '', '', 2, 1, '', 1" );
7181 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
7183 /* msidbFeatureAttributesFavorLocal */
7184 r
= add_feature_entry( hdb
, "'orion', '', '', '', 2, 1, '', 0" );
7185 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
7187 /* disabled because of install level */
7188 r
= add_feature_entry( hdb
, "'waters', '', '', '', 15, 101, '', 9" );
7189 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
7191 /* child feature of disabled feature */
7192 r
= add_feature_entry( hdb
, "'bayer', 'waters', '', '', 14, 1, '', 9" );
7193 ok( r
== ERROR_SUCCESS
, "cannot add feature: %d\n", r
);
7195 /* component of disabled feature (install level) */
7196 r
= add_component_entry( hdb
, "'delphinus', '', 'TARGETDIR', 0, '', 'delphinus_file'" );
7197 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
7199 /* component of disabled child feature (install level) */
7200 r
= add_component_entry( hdb
, "'hydrus', '', 'TARGETDIR', 0, '', 'hydrus_file'" );
7201 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
7203 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
7204 r
= add_component_entry( hdb
, "'leo', '', 'TARGETDIR', 0, '', 'leo_file'" );
7205 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
7207 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
7208 r
= add_component_entry( hdb
, "'virgo', '', 'TARGETDIR', 1, '', 'virgo_file'" );
7209 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
7211 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
7212 r
= add_component_entry( hdb
, "'libra', '', 'TARGETDIR', 2, '', 'libra_file'" );
7213 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
7215 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
7216 r
= add_component_entry( hdb
, "'cassiopeia', '', 'TARGETDIR', 0, '', 'cassiopeia_file'" );
7217 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
7219 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
7220 r
= add_component_entry( hdb
, "'cepheus', '', 'TARGETDIR', 1, '', 'cepheus_file'" );
7221 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
7223 /* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
7224 r
= add_component_entry( hdb
, "'andromeda', '', 'TARGETDIR', 2, '', 'andromeda_file'" );
7225 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
7227 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
7228 r
= add_component_entry( hdb
, "'canis', '', 'TARGETDIR', 0, '', 'canis_file'" );
7229 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
7231 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
7232 r
= add_component_entry( hdb
, "'monoceros', '', 'TARGETDIR', 1, '', 'monoceros_file'" );
7233 ok( r
== ERROR_SUCCESS
, "cannot add component: %d\n", r
);
7235 /* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
7236 r
= add_component_entry( hdb
, "'lepus', '', 'TARGETDIR', 2, '', 'lepus_file'" );
7238 r
= add_feature_components_entry( hdb
, "'zodiac', 'leo'" );
7239 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7241 r
= add_feature_components_entry( hdb
, "'zodiac', 'virgo'" );
7242 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7244 r
= add_feature_components_entry( hdb
, "'zodiac', 'libra'" );
7245 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7247 r
= add_feature_components_entry( hdb
, "'perseus', 'cassiopeia'" );
7248 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7250 r
= add_feature_components_entry( hdb
, "'perseus', 'cepheus'" );
7251 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7253 r
= add_feature_components_entry( hdb
, "'perseus', 'andromeda'" );
7254 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7256 r
= add_feature_components_entry( hdb
, "'orion', 'leo'" );
7257 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7259 r
= add_feature_components_entry( hdb
, "'orion', 'virgo'" );
7260 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7262 r
= add_feature_components_entry( hdb
, "'orion', 'libra'" );
7263 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7265 r
= add_feature_components_entry( hdb
, "'orion', 'cassiopeia'" );
7266 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7268 r
= add_feature_components_entry( hdb
, "'orion', 'cepheus'" );
7269 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7271 r
= add_feature_components_entry( hdb
, "'orion', 'andromeda'" );
7272 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7274 r
= add_feature_components_entry( hdb
, "'orion', 'canis'" );
7275 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7277 r
= add_feature_components_entry( hdb
, "'orion', 'monoceros'" );
7278 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7280 r
= add_feature_components_entry( hdb
, "'orion', 'lepus'" );
7281 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7283 r
= add_feature_components_entry( hdb
, "'waters', 'delphinus'" );
7284 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7286 r
= add_feature_components_entry( hdb
, "'bayer', 'hydrus'" );
7287 ok( r
== ERROR_SUCCESS
, "cannot add feature components: %d\n", r
);
7289 r
= add_file_entry( hdb
, "'leo_file', 'leo', 'leo.txt', 100, '', '1033', 8192, 1" );
7290 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7292 r
= add_file_entry( hdb
, "'virgo_file', 'virgo', 'virgo.txt', 0, '', '1033', 8192, 1" );
7293 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7295 r
= add_file_entry( hdb
, "'libra_file', 'libra', 'libra.txt', 0, '', '1033', 8192, 1" );
7296 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7298 r
= add_file_entry( hdb
, "'cassiopeia_file', 'cassiopeia', 'cassiopeia.txt', 0, '', '1033', 8192, 1" );
7299 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7301 r
= add_file_entry( hdb
, "'cepheus_file', 'cepheus', 'cepheus.txt', 0, '', '1033', 8192, 1" );
7302 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7304 r
= add_file_entry( hdb
, "'andromeda_file', 'andromeda', 'andromeda.txt', 0, '', '1033', 8192, 1" );
7305 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7307 r
= add_file_entry( hdb
, "'canis_file', 'canis', 'canis.txt', 0, '', '1033', 8192, 1" );
7308 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7310 r
= add_file_entry( hdb
, "'monoceros_file', 'monoceros', 'monoceros.txt', 0, '', '1033', 8192, 1" );
7311 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7313 r
= add_file_entry( hdb
, "'lepus_file', 'lepus', 'lepus.txt', 0, '', '1033', 8192, 1" );
7314 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7316 r
= add_file_entry( hdb
, "'delphinus_file', 'delphinus', 'delphinus.txt', 0, '', '1033', 8192, 1" );
7317 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7319 r
= add_file_entry( hdb
, "'hydrus_file', 'hydrus', 'hydrus.txt', 0, '', '1033', 8192, 1" );
7320 ok( r
== ERROR_SUCCESS
, "cannot add file: %d\n", r
);
7322 hpkg
= package_from_db( hdb
);
7323 ok( hpkg
, "failed to create package\n");
7325 MsiCloseHandle( hdb
);
7327 r
= MsiDoAction( hpkg
, "CostInitialize");
7328 ok( r
== ERROR_SUCCESS
, "cost init failed\n");
7330 r
= MsiDoAction( hpkg
, "FileCost");
7331 ok( r
== ERROR_SUCCESS
, "file cost failed\n");
7333 r
= MsiDoAction( hpkg
, "CostFinalize");
7334 ok( r
== ERROR_SUCCESS
, "cost finalize failed\n");
7338 r
= MsiGetFeatureState(hpkg
, "zodiac", &state
, &action
);
7339 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7340 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
7341 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
7345 r
= MsiGetFeatureState(hpkg
, "perseus", &state
, &action
);
7346 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7347 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
7348 ok( action
== INSTALLSTATE_SOURCE
, "Expected INSTALLSTATE_SOURCE, got %d\n", action
);
7352 r
= MsiGetFeatureState(hpkg
, "orion", &state
, &action
);
7353 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7354 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
7355 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
7359 r
= MsiGetFeatureState(hpkg
, "waters", &state
, &action
);
7360 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7361 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
7362 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
7366 r
= MsiGetFeatureState(hpkg
, "bayer", &state
, &action
);
7367 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7368 ok( state
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", state
);
7369 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
7373 r
= MsiGetComponentState(hpkg
, "leo", &state
, &action
);
7374 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7375 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
7376 ok( action
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", action
);
7380 r
= MsiGetComponentState(hpkg
, "virgo", &state
, &action
);
7381 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7382 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state
);
7383 ok( action
== INSTALLSTATE_SOURCE
, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action
);
7387 r
= MsiGetComponentState(hpkg
, "libra", &state
, &action
);
7388 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7389 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state
);
7390 ok( action
== INSTALLSTATE_LOCAL
, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action
);
7394 r
= MsiGetComponentState(hpkg
, "cassiopeia", &state
, &action
);
7395 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7396 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state
);
7397 ok( action
== INSTALLSTATE_LOCAL
, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action
);
7401 r
= MsiGetComponentState(hpkg
, "cepheus", &state
, &action
);
7402 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7403 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7404 ok( action
== INSTALLSTATE_SOURCE
, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action
);
7408 r
= MsiGetComponentState(hpkg
, "andromeda", &state
, &action
);
7409 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7410 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state
);
7411 ok( action
== INSTALLSTATE_LOCAL
, "Expected andromeda INSTALLSTATE_LOCAL, got %d\n", action
);
7415 r
= MsiGetComponentState(hpkg
, "canis", &state
, &action
);
7416 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7417 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state
);
7418 ok( action
== INSTALLSTATE_LOCAL
, "Expected canis INSTALLSTATE_LOCAL, got %d\n", action
);
7422 r
= MsiGetComponentState(hpkg
, "monoceros", &state
, &action
);
7423 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7424 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state
);
7425 ok( action
== INSTALLSTATE_SOURCE
, "Expected monoceros INSTALLSTATE_SOURCE, got %d\n", action
);
7429 r
= MsiGetComponentState(hpkg
, "lepus", &state
, &action
);
7430 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7431 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7432 ok( action
== INSTALLSTATE_LOCAL
, "Expected lepus INSTALLSTATE_LOCAL, got %d\n", action
);
7436 r
= MsiGetComponentState(hpkg
, "delphinus", &state
, &action
);
7437 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7438 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7439 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action
);
7443 r
= MsiGetComponentState(hpkg
, "hydrus", &state
, &action
);
7444 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7445 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7446 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action
);
7448 r
= MsiSetFeatureState(hpkg
, "orion", INSTALLSTATE_ABSENT
);
7449 ok( r
== ERROR_SUCCESS
, "failed to set feature state: %d\n", r
);
7453 r
= MsiGetFeatureState(hpkg
, "zodiac", &state
, &action
);
7454 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7455 ok( state
== INSTALLSTATE_ABSENT
, "Expected zodiac INSTALLSTATE_ABSENT, got %d\n", state
);
7456 ok( action
== INSTALLSTATE_LOCAL
, "Expected zodiac INSTALLSTATE_LOCAL, got %d\n", action
);
7460 r
= MsiGetFeatureState(hpkg
, "perseus", &state
, &action
);
7461 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7462 ok( state
== INSTALLSTATE_ABSENT
, "Expected perseus INSTALLSTATE_ABSENT, got %d\n", state
);
7463 ok( action
== INSTALLSTATE_SOURCE
, "Expected perseus INSTALLSTATE_SOURCE, got %d\n", action
);
7467 r
= MsiGetFeatureState(hpkg
, "orion", &state
, &action
);
7468 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7469 ok( state
== INSTALLSTATE_ABSENT
, "Expected orion INSTALLSTATE_ABSENT, got %d\n", state
);
7470 ok( action
== INSTALLSTATE_ABSENT
, "Expected orion INSTALLSTATE_ABSENT, got %d\n", action
);
7474 r
= MsiGetComponentState(hpkg
, "leo", &state
, &action
);
7475 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7476 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected leo INSTALLSTATE_UNKNOWN, got %d\n", state
);
7477 ok( action
== INSTALLSTATE_LOCAL
, "Expected leo INSTALLSTATE_LOCAL, got %d\n", action
);
7481 r
= MsiGetComponentState(hpkg
, "virgo", &state
, &action
);
7482 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7483 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state
);
7484 ok( action
== INSTALLSTATE_SOURCE
, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action
);
7488 r
= MsiGetComponentState(hpkg
, "libra", &state
, &action
);
7489 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7490 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected libra INSTALLSTATE_UNKNOWN, got %d\n", state
);
7491 ok( action
== INSTALLSTATE_LOCAL
, "Expected libra INSTALLSTATE_LOCAL, got %d\n", action
);
7495 r
= MsiGetComponentState(hpkg
, "cassiopeia", &state
, &action
);
7496 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7497 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected cassiopeia INSTALLSTATE_UNKNOWN, got %d\n", state
);
7498 ok( action
== INSTALLSTATE_LOCAL
, "Expected cassiopeia INSTALLSTATE_LOCAL, got %d\n", action
);
7502 r
= MsiGetComponentState(hpkg
, "cepheus", &state
, &action
);
7503 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7504 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7505 ok( action
== INSTALLSTATE_SOURCE
, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action
);
7509 r
= MsiGetComponentState(hpkg
, "andromeda", &state
, &action
);
7510 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7511 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state
);
7512 ok( action
== INSTALLSTATE_SOURCE
, "Expected andromeda INSTALLSTATE_SOURCE, got %d\n", action
);
7516 r
= MsiGetComponentState(hpkg
, "canis", &state
, &action
);
7517 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7518 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", state
);
7519 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected canis INSTALLSTATE_UNKNOWN, got %d\n", action
);
7523 r
= MsiGetComponentState(hpkg
, "monoceros", &state
, &action
);
7524 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7525 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state
);
7526 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", action
);
7530 r
= MsiGetComponentState(hpkg
, "lepus", &state
, &action
);
7531 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7532 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7533 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected lepus INSTALLSTATE_UNKNOWN, got %d\n", action
);
7537 r
= MsiGetComponentState(hpkg
, "delphinus", &state
, &action
);
7538 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7539 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7540 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected delphinus INSTALLSTATE_UNKNOWN, got %d\n", action
);
7544 r
= MsiGetComponentState(hpkg
, "hydrus", &state
, &action
);
7545 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7546 ok( state
== INSTALLSTATE_UNKNOWN
, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", state
);
7547 ok( action
== INSTALLSTATE_UNKNOWN
, "Expected hydrus INSTALLSTATE_UNKNOWN, got %d\n", action
);
7549 MsiCloseHandle(hpkg
);
7550 DeleteFileA(msifile
);
7553 static void test_installprops(void)
7555 MSIHANDLE hpkg
, hdb
;
7556 CHAR path
[MAX_PATH
];
7564 GetCurrentDirectory(MAX_PATH
, path
);
7565 lstrcat(path
, "\\");
7566 lstrcat(path
, msifile
);
7568 hdb
= create_package_db();
7569 ok( hdb
, "failed to create database\n");
7571 hpkg
= package_from_db(hdb
);
7572 ok( hpkg
, "failed to create package\n");
7574 MsiCloseHandle(hdb
);
7577 r
= MsiGetProperty(hpkg
, "DATABASE", buf
, &size
);
7578 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7579 ok( !lstrcmp(buf
, path
), "Expected %s, got %s\n", path
, buf
);
7581 RegOpenKey(HKEY_CURRENT_USER
, "SOFTWARE\\Microsoft\\MS Setup (ACME)\\User Info", &hkey1
);
7583 RegOpenKey(HKEY_LOCAL_MACHINE
, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", &hkey2
);
7588 if (RegQueryValueEx(hkey1
, "DefName", NULL
, &type
, (LPBYTE
)path
, &size
) != ERROR_SUCCESS
)
7592 RegQueryValueEx(hkey2
, "RegisteredOwner", NULL
, &type
, (LPBYTE
)path
, &size
);
7595 /* win9x doesn't set this */
7599 r
= MsiGetProperty(hpkg
, "USERNAME", buf
, &size
);
7600 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7601 ok( !lstrcmp(buf
, path
), "Expected %s, got %s\n", path
, buf
);
7607 if (RegQueryValueEx(hkey1
, "DefCompany", NULL
, &type
, (LPBYTE
)path
, &size
) != ERROR_SUCCESS
)
7611 RegQueryValueEx(hkey2
, "RegisteredOrganization", NULL
, &type
, (LPBYTE
)path
, &size
);
7617 r
= MsiGetProperty(hpkg
, "COMPANYNAME", buf
, &size
);
7618 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7619 ok( !lstrcmp(buf
, path
), "Expected %s, got %s\n", path
, buf
);
7623 r
= MsiGetProperty(hpkg
, "VersionDatabase", buf
, &size
);
7624 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7625 trace("VersionDatabase = %s\n", buf
);
7628 r
= MsiGetProperty(hpkg
, "VersionMsi", buf
, &size
);
7629 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7630 trace("VersionMsi = %s\n", buf
);
7633 r
= MsiGetProperty(hpkg
, "Date", buf
, &size
);
7634 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7635 trace("Date = %s\n", buf
);
7638 r
= MsiGetProperty(hpkg
, "Time", buf
, &size
);
7639 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7640 trace("Time = %s\n", buf
);
7643 r
= MsiGetProperty(hpkg
, "PackageCode", buf
, &size
);
7644 ok( r
== ERROR_SUCCESS
, "failed to get property: %d\n", r
);
7645 trace("PackageCode = %s\n", buf
);
7647 langid
= GetUserDefaultLangID();
7648 sprintf(path
, "%d", langid
);
7651 r
= MsiGetProperty(hpkg
, "UserLanguageID", buf
, &size
);
7652 ok( r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS< got %d\n", r
);
7653 ok( !lstrcmpA(buf
, path
), "Expected \"%s\", got \"%s\"\n", path
, buf
);
7655 res
= GetSystemMetrics(SM_CXSCREEN
);
7657 r
= MsiGetProperty(hpkg
, "ScreenX", buf
, &size
);
7658 ok(atol(buf
) == res
, "Expected %d, got %ld\n", res
, atol(buf
));
7660 res
= GetSystemMetrics(SM_CYSCREEN
);
7662 r
= MsiGetProperty(hpkg
, "ScreenY", buf
, &size
);
7663 ok(atol(buf
) == res
, "Expected %d, got %ld\n", res
, atol(buf
));
7667 MsiCloseHandle(hpkg
);
7668 DeleteFile(msifile
);
7671 static void test_launchconditions(void)
7677 MsiSetInternalUI(INSTALLUILEVEL_NONE
, NULL
);
7679 hdb
= create_package_db();
7680 ok( hdb
, "failed to create package database\n" );
7682 r
= create_launchcondition_table( hdb
);
7683 ok( r
== ERROR_SUCCESS
, "cannot create LaunchCondition table: %d\n", r
);
7685 r
= add_launchcondition_entry( hdb
, "'X = \"1\"', 'one'" );
7686 ok( r
== ERROR_SUCCESS
, "cannot add launch condition: %d\n", r
);
7688 /* invalid condition */
7689 r
= add_launchcondition_entry( hdb
, "'X != \"1\"', 'one'" );
7690 ok( r
== ERROR_SUCCESS
, "cannot add launch condition: %d\n", r
);
7692 hpkg
= package_from_db( hdb
);
7693 ok( hpkg
, "failed to create package\n");
7695 MsiCloseHandle( hdb
);
7697 r
= MsiSetProperty( hpkg
, "X", "1" );
7698 ok( r
== ERROR_SUCCESS
, "failed to set property\n" );
7700 /* invalid conditions are ignored */
7701 r
= MsiDoAction( hpkg
, "LaunchConditions" );
7702 ok( r
== ERROR_SUCCESS
, "cost init failed\n" );
7704 /* verify LaunchConditions still does some verification */
7705 r
= MsiSetProperty( hpkg
, "X", "2" );
7706 ok( r
== ERROR_SUCCESS
, "failed to set property\n" );
7708 r
= MsiDoAction( hpkg
, "LaunchConditions" );
7709 ok( r
== ERROR_INSTALL_FAILURE
, "Expected ERROR_INSTALL_FAILURE, got %d\n", r
);
7711 MsiCloseHandle( hpkg
);
7712 DeleteFile( msifile
);
7715 static void test_ccpsearch(void)
7717 MSIHANDLE hdb
, hpkg
;
7718 CHAR prop
[MAX_PATH
];
7719 DWORD size
= MAX_PATH
;
7722 MsiSetInternalUI(INSTALLUILEVEL_NONE
, NULL
);
7724 hdb
= create_package_db();
7725 ok(hdb
, "failed to create package database\n");
7727 r
= create_ccpsearch_table(hdb
);
7728 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7730 r
= add_ccpsearch_entry(hdb
, "'CCP_random'");
7731 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7733 r
= add_ccpsearch_entry(hdb
, "'RMCCP_random'");
7734 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7736 r
= create_reglocator_table(hdb
);
7737 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7739 r
= add_reglocator_entry(hdb
, "'CCP_random', 0, 'htmlfile\\shell\\open\\nonexistent', '', 1");
7740 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7742 r
= create_drlocator_table(hdb
);
7743 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7745 r
= add_drlocator_entry(hdb
, "'RMCCP_random', '', 'C:\\', '0'");
7746 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7748 r
= create_signature_table(hdb
);
7749 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7751 hpkg
= package_from_db(hdb
);
7752 ok(hpkg
, "failed to create package\n");
7754 MsiCloseHandle(hdb
);
7756 r
= MsiDoAction(hpkg
, "CCPSearch");
7757 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7759 r
= MsiGetPropertyA(hpkg
, "CCP_Success", prop
, &size
);
7760 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7761 ok(!lstrcmpA(prop
, "1"), "Expected 1, got %s\n", prop
);
7763 MsiCloseHandle(hpkg
);
7764 DeleteFileA(msifile
);
7767 static void test_complocator(void)
7769 MSIHANDLE hdb
, hpkg
;
7771 CHAR prop
[MAX_PATH
];
7772 CHAR expected
[MAX_PATH
];
7773 DWORD size
= MAX_PATH
;
7775 hdb
= create_package_db();
7776 ok(hdb
, "failed to create package database\n");
7778 r
= create_appsearch_table(hdb
);
7779 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7781 r
= add_appsearch_entry(hdb
, "'ABELISAURUS', 'abelisaurus'");
7782 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7784 r
= add_appsearch_entry(hdb
, "'BACTROSAURUS', 'bactrosaurus'");
7785 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7787 r
= add_appsearch_entry(hdb
, "'CAMELOTIA', 'camelotia'");
7788 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7790 r
= add_appsearch_entry(hdb
, "'DICLONIUS', 'diclonius'");
7791 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7793 r
= add_appsearch_entry(hdb
, "'ECHINODON', 'echinodon'");
7794 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7796 r
= add_appsearch_entry(hdb
, "'FALCARIUS', 'falcarius'");
7797 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7799 r
= add_appsearch_entry(hdb
, "'GALLIMIMUS', 'gallimimus'");
7800 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7802 r
= add_appsearch_entry(hdb
, "'HAGRYPHUS', 'hagryphus'");
7803 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7805 r
= add_appsearch_entry(hdb
, "'IGUANODON', 'iguanodon'");
7806 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7808 r
= add_appsearch_entry(hdb
, "'JOBARIA', 'jobaria'");
7809 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7811 r
= add_appsearch_entry(hdb
, "'KAKURU', 'kakuru'");
7812 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7814 r
= add_appsearch_entry(hdb
, "'LABOCANIA', 'labocania'");
7815 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7817 r
= add_appsearch_entry(hdb
, "'MEGARAPTOR', 'megaraptor'");
7818 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7820 r
= add_appsearch_entry(hdb
, "'NEOSODON', 'neosodon'");
7821 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7823 r
= add_appsearch_entry(hdb
, "'OLOROTITAN', 'olorotitan'");
7824 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7826 r
= add_appsearch_entry(hdb
, "'PANTYDRACO', 'pantydraco'");
7827 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7829 r
= create_complocator_table(hdb
);
7830 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7832 r
= add_complocator_entry(hdb
, "'abelisaurus', '{E3619EED-305A-418C-B9C7-F7D7377F0934}', 1");
7833 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7835 r
= add_complocator_entry(hdb
, "'bactrosaurus', '{D56B688D-542F-42Ef-90FD-B6DA76EE8119}', 0");
7836 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7838 r
= add_complocator_entry(hdb
, "'camelotia', '{8211BE36-2466-47E3-AFB7-6AC72E51AED2}', 1");
7839 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7841 r
= add_complocator_entry(hdb
, "'diclonius', '{5C767B20-A33C-45A4-B80B-555E512F01AE}', 0");
7842 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7844 r
= add_complocator_entry(hdb
, "'echinodon', '{A19E16C5-C75D-4699-8111-C4338C40C3CB}', 1");
7845 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7847 r
= add_complocator_entry(hdb
, "'falcarius', '{17762FA1-A7AE-4CC6-8827-62873C35361D}', 0");
7848 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7850 r
= add_complocator_entry(hdb
, "'gallimimus', '{75EBF568-C959-41E0-A99E-9050638CF5FB}', 1");
7851 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7853 r
= add_complocator_entry(hdb
, "'hagrphus', '{D4969B72-17D9-4AB6-BE49-78F2FEE857AC}', 0");
7854 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7856 r
= add_complocator_entry(hdb
, "'iguanodon', '{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}', 1");
7857 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7859 r
= add_complocator_entry(hdb
, "'jobaria', '{243C22B1-8C51-4151-B9D1-1AE5265E079E}', 0");
7860 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7862 r
= add_complocator_entry(hdb
, "'kakuru', '{5D0F03BA-50BC-44F2-ABB1-72C972F4E514}', 1");
7863 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7865 r
= add_complocator_entry(hdb
, "'labocania', '{C7DDB60C-7828-4046-A6F8-699D5E92F1ED}', 0");
7866 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7868 r
= add_complocator_entry(hdb
, "'megaraptor', '{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}', 1");
7869 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7871 r
= add_complocator_entry(hdb
, "'neosodon', '{0B499649-197A-48EF-93D2-AF1C17ED6E90}', 0");
7872 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7874 r
= add_complocator_entry(hdb
, "'olorotitan', '{54E9E91F-AED2-46D5-A25A-7E50AFA24513}', 1");
7875 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7877 r
= add_complocator_entry(hdb
, "'pantydraco', '{2A989951-5565-4FA7-93A7-E800A3E67D71}', 0");
7878 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7880 r
= create_signature_table(hdb
);
7881 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7883 r
= add_signature_entry(hdb
, "'abelisaurus', 'abelisaurus', '', '', '', '', '', '', ''");
7884 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7886 r
= add_signature_entry(hdb
, "'bactrosaurus', 'bactrosaurus', '', '', '', '', '', '', ''");
7887 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7889 r
= add_signature_entry(hdb
, "'camelotia', 'camelotia', '', '', '', '', '', '', ''");
7890 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7892 r
= add_signature_entry(hdb
, "'diclonius', 'diclonius', '', '', '', '', '', '', ''");
7893 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7895 r
= add_signature_entry(hdb
, "'iguanodon', 'iguanodon', '', '', '', '', '', '', ''");
7896 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7898 r
= add_signature_entry(hdb
, "'jobaria', 'jobaria', '', '', '', '', '', '', ''");
7899 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7901 r
= add_signature_entry(hdb
, "'kakuru', 'kakuru', '', '', '', '', '', '', ''");
7902 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7904 r
= add_signature_entry(hdb
, "'labocania', 'labocania', '', '', '', '', '', '', ''");
7905 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7907 hpkg
= package_from_db(hdb
);
7908 ok(hpkg
, "failed to create package\n");
7910 MsiCloseHandle(hdb
);
7912 create_test_file("abelisaurus");
7913 create_test_file("bactrosaurus");
7914 create_test_file("camelotia");
7915 create_test_file("diclonius");
7916 create_test_file("echinodon");
7917 create_test_file("falcarius");
7918 create_test_file("gallimimus");
7919 create_test_file("hagryphus");
7920 CreateDirectoryA("iguanodon", NULL
);
7921 CreateDirectoryA("jobaria", NULL
);
7922 CreateDirectoryA("kakuru", NULL
);
7923 CreateDirectoryA("labocania", NULL
);
7924 CreateDirectoryA("megaraptor", NULL
);
7925 CreateDirectoryA("neosodon", NULL
);
7926 CreateDirectoryA("olorotitan", NULL
);
7927 CreateDirectoryA("pantydraco", NULL
);
7929 set_component_path("abelisaurus", MSIINSTALLCONTEXT_MACHINE
,
7930 "{E3619EED-305A-418C-B9C7-F7D7377F0934}", NULL
, FALSE
);
7931 set_component_path("bactrosaurus", MSIINSTALLCONTEXT_MACHINE
,
7932 "{D56B688D-542F-42Ef-90FD-B6DA76EE8119}", NULL
, FALSE
);
7933 set_component_path("echinodon", MSIINSTALLCONTEXT_MACHINE
,
7934 "{A19E16C5-C75D-4699-8111-C4338C40C3CB}", NULL
, FALSE
);
7935 set_component_path("falcarius", MSIINSTALLCONTEXT_MACHINE
,
7936 "{17762FA1-A7AE-4CC6-8827-62873C35361D}", NULL
, FALSE
);
7937 set_component_path("iguanodon", MSIINSTALLCONTEXT_MACHINE
,
7938 "{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}", NULL
, FALSE
);
7939 set_component_path("jobaria", MSIINSTALLCONTEXT_MACHINE
,
7940 "{243C22B1-8C51-4151-B9D1-1AE5265E079E}", NULL
, FALSE
);
7941 set_component_path("megaraptor", MSIINSTALLCONTEXT_MACHINE
,
7942 "{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}", NULL
, FALSE
);
7943 set_component_path("neosodon", MSIINSTALLCONTEXT_MACHINE
,
7944 "{0B499649-197A-48EF-93D2-AF1C17ED6E90}", NULL
, FALSE
);
7946 r
= MsiDoAction(hpkg
, "AppSearch");
7947 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7950 r
= MsiGetPropertyA(hpkg
, "ABELISAURUS", prop
, &size
);
7951 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7953 lstrcpyA(expected
, CURR_DIR
);
7954 lstrcatA(expected
, "\\abelisaurus");
7955 ok(!lstrcmpA(prop
, expected
) || !lstrcmpA(prop
, ""),
7956 "Expected %s or empty string, got %s\n", expected
, prop
);
7959 r
= MsiGetPropertyA(hpkg
, "BACTROSAURUS", prop
, &size
);
7960 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7961 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
7964 r
= MsiGetPropertyA(hpkg
, "CAMELOTIA", prop
, &size
);
7965 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7966 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
7969 r
= MsiGetPropertyA(hpkg
, "DICLONIUS", prop
, &size
);
7970 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7971 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
7974 r
= MsiGetPropertyA(hpkg
, "ECHINODON", prop
, &size
);
7975 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
7977 lstrcpyA(expected
, CURR_DIR
);
7978 lstrcatA(expected
, "\\");
7979 ok(!lstrcmpA(prop
, expected
) || !lstrcmpA(prop
, ""),
7980 "Expected %s or empty string, got %s\n", expected
, prop
);
7983 r
= MsiGetPropertyA(hpkg
, "FALCARIUS", 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
, "GALLIMIMUS", 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
, "HAGRYPHUS", 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
, "IGUANODON", prop
, &size
);
7999 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8000 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
8003 r
= MsiGetPropertyA(hpkg
, "JOBARIA", prop
, &size
);
8004 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8005 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
8008 r
= MsiGetPropertyA(hpkg
, "KAKURU", prop
, &size
);
8009 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8010 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
8013 r
= MsiGetPropertyA(hpkg
, "LABOCANIA", prop
, &size
);
8014 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8015 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
8018 r
= MsiGetPropertyA(hpkg
, "MEGARAPTOR", prop
, &size
);
8019 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8021 lstrcpyA(expected
, CURR_DIR
);
8022 lstrcatA(expected
, "\\");
8023 ok(!lstrcmpA(prop
, expected
) || !lstrcmpA(prop
, ""),
8024 "Expected %s or empty string, got %s\n", expected
, prop
);
8027 r
= MsiGetPropertyA(hpkg
, "NEOSODON", prop
, &size
);
8028 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8030 lstrcpyA(expected
, CURR_DIR
);
8031 lstrcatA(expected
, "\\neosodon\\");
8032 ok(!lstrcmpA(prop
, expected
) || !lstrcmpA(prop
, ""),
8033 "Expected %s or empty string, got %s\n", expected
, prop
);
8036 r
= MsiGetPropertyA(hpkg
, "OLOROTITAN", prop
, &size
);
8037 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8038 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
8041 r
= MsiGetPropertyA(hpkg
, "PANTYDRACO", prop
, &size
);
8042 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8043 ok(!lstrcmpA(prop
, ""), "Expected , got %s\n", prop
);
8045 MsiCloseHandle(hpkg
);
8046 DeleteFileA("abelisaurus");
8047 DeleteFileA("bactrosaurus");
8048 DeleteFileA("camelotia");
8049 DeleteFileA("diclonius");
8050 DeleteFileA("echinodon");
8051 DeleteFileA("falcarius");
8052 DeleteFileA("gallimimus");
8053 DeleteFileA("hagryphus");
8054 RemoveDirectoryA("iguanodon");
8055 RemoveDirectoryA("jobaria");
8056 RemoveDirectoryA("kakuru");
8057 RemoveDirectoryA("labocania");
8058 RemoveDirectoryA("megaraptor");
8059 RemoveDirectoryA("neosodon");
8060 RemoveDirectoryA("olorotitan");
8061 RemoveDirectoryA("pantydraco");
8062 delete_component_path("{E3619EED-305A-418C-B9C7-F7D7377F0934}",
8063 MSIINSTALLCONTEXT_MACHINE
, NULL
);
8064 delete_component_path("{D56B688D-542F-42Ef-90FD-B6DA76EE8119}",
8065 MSIINSTALLCONTEXT_MACHINE
, NULL
);
8066 delete_component_path("{A19E16C5-C75D-4699-8111-C4338C40C3CB}",
8067 MSIINSTALLCONTEXT_MACHINE
, NULL
);
8068 delete_component_path("{17762FA1-A7AE-4CC6-8827-62873C35361D}",
8069 MSIINSTALLCONTEXT_MACHINE
, NULL
);
8070 delete_component_path("{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}",
8071 MSIINSTALLCONTEXT_MACHINE
, NULL
);
8072 delete_component_path("{243C22B1-8C51-4151-B9D1-1AE5265E079E}",
8073 MSIINSTALLCONTEXT_MACHINE
, NULL
);
8074 delete_component_path("{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}",
8075 MSIINSTALLCONTEXT_MACHINE
, NULL
);
8076 delete_component_path("{0B499649-197A-48EF-93D2-AF1C17ED6E90}",
8077 MSIINSTALLCONTEXT_MACHINE
, NULL
);
8078 DeleteFileA(msifile
);
8081 static void set_suminfo_prop(MSIHANDLE db
, DWORD prop
, DWORD val
)
8086 r
= MsiGetSummaryInformationA(db
, NULL
, 1, &summary
);
8087 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8089 r
= MsiSummaryInfoSetPropertyA(summary
, prop
, VT_I4
, val
, NULL
, NULL
);
8090 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8092 r
= MsiSummaryInfoPersist(summary
);
8093 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
8095 MsiCloseHandle(summary
);
8098 static void test_MsiGetSourcePath(void)
8100 MSIHANDLE hdb
, hpkg
;
8101 CHAR path
[MAX_PATH
];
8103 CHAR subsrc
[MAX_PATH
];
8104 CHAR sub2
[MAX_PATH
];
8108 lstrcpyA(cwd
, CURR_DIR
);
8109 lstrcatA(cwd
, "\\");
8111 lstrcpyA(subsrc
, cwd
);
8112 lstrcatA(subsrc
, "subsource");
8113 lstrcatA(subsrc
, "\\");
8115 lstrcpyA(sub2
, subsrc
);
8116 lstrcatA(sub2
, "sub2");
8117 lstrcatA(sub2
, "\\");
8119 /* uncompressed source */
8121 hdb
= create_package_db();
8122 ok( hdb
, "failed to create database\n");
8124 set_suminfo_prop(hdb
, PID_WORDCOUNT
, 0);
8126 r
= add_directory_entry(hdb
, "'TARGETDIR', '', 'SourceDir'");
8127 ok(r
== S_OK
, "failed\n");
8129 r
= add_directory_entry(hdb
, "'SubDir', 'TARGETDIR', 'subtarget:subsource'");
8130 ok(r
== S_OK
, "failed\n");
8132 r
= add_directory_entry(hdb
, "'SubDir2', 'SubDir', 'sub2'");
8133 ok(r
== S_OK
, "failed\n");
8135 r
= MsiDatabaseCommit(hdb
);
8136 ok(r
== ERROR_SUCCESS
, "Failed to commit database\n");
8138 hpkg
= package_from_db(hdb
);
8139 ok(hpkg
, "failed to create package\n");
8141 MsiCloseHandle(hdb
);
8143 /* invalid database handle */
8145 lstrcpyA(path
, "kiwi");
8146 r
= MsiGetSourcePath(-1, "TARGETDIR", path
, &size
);
8147 ok(r
== ERROR_INVALID_HANDLE
,
8148 "Expected ERROR_INVALID_HANDLE, got %d\n", r
);
8149 ok(!lstrcmpA(path
, "kiwi"),
8150 "Expected path to be unchanged, got \"%s\"\n", path
);
8151 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8155 lstrcpyA(path
, "kiwi");
8156 r
= MsiGetSourcePath(hpkg
, NULL
, path
, &size
);
8157 ok(r
== ERROR_INVALID_PARAMETER
,
8158 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
8159 ok(!lstrcmpA(path
, "kiwi"),
8160 "Expected path to be unchanged, got \"%s\"\n", path
);
8161 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8163 /* empty szFolder */
8165 lstrcpyA(path
, "kiwi");
8166 r
= MsiGetSourcePath(hpkg
, "", path
, &size
);
8167 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8168 ok(!lstrcmpA(path
, "kiwi"),
8169 "Expected path to be unchanged, got \"%s\"\n", path
);
8170 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8174 lstrcpyA(path
, "kiwi");
8175 r
= MsiGetSourcePath(hpkg
, "TARGETDIR", path
, &size
);
8176 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8177 ok(!lstrcmpA(path
, "kiwi"),
8178 "Expected path to be unchanged, got \"%s\"\n", path
);
8179 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8183 lstrcpyA(path
, "kiwi");
8184 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8185 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8186 ok(!lstrcmpA(path
, "kiwi"),
8187 "Expected path to be unchanged, got \"%s\"\n", path
);
8188 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8192 lstrcpyA(path
, "kiwi");
8193 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
8194 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8195 ok(!lstrcmpA(path
, "kiwi"),
8196 "Expected path to be unchanged, got \"%s\"\n", path
);
8197 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8199 /* source path does not exist, but the property exists */
8201 lstrcpyA(path
, "kiwi");
8202 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8203 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8204 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8205 ok(size
== 0, "Expected 0, got %d\n", size
);
8209 lstrcpyA(path
, "kiwi");
8210 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8211 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8212 ok(!lstrcmpA(path
, "kiwi"),
8213 "Expected path to be unchanged, got \"%s\"\n", path
);
8214 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8218 lstrcpyA(path
, "kiwi");
8219 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
8220 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8221 ok(!lstrcmpA(path
, "kiwi"),
8222 "Expected path to be unchanged, got \"%s\"\n", path
);
8223 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8225 r
= MsiDoAction(hpkg
, "CostInitialize");
8226 ok(r
== ERROR_SUCCESS
, "cost init failed\n");
8228 /* try TARGETDIR after CostInitialize */
8230 lstrcpyA(path
, "kiwi");
8231 r
= MsiGetSourcePath(hpkg
, "TARGETDIR", path
, &size
);
8232 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8233 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8234 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8236 /* try SourceDir after CostInitialize */
8238 lstrcpyA(path
, "kiwi");
8239 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8240 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8241 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8242 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8244 /* try SOURCEDIR after CostInitialize */
8246 lstrcpyA(path
, "kiwi");
8247 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
8248 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8249 ok(!lstrcmpA(path
, "kiwi"),
8250 "Expected path to be unchanged, got \"%s\"\n", path
);
8251 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8253 /* source path does not exist, but the property exists */
8255 lstrcpyA(path
, "kiwi");
8256 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8257 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8260 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8261 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8264 /* try SubDir after CostInitialize */
8266 lstrcpyA(path
, "kiwi");
8267 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8268 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8269 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8270 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8272 /* try SubDir2 after CostInitialize */
8274 lstrcpyA(path
, "kiwi");
8275 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
8276 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8277 ok(!lstrcmpA(path
, sub2
), "Expected \"%s\", got \"%s\"\n", sub2
, path
);
8278 ok(size
== lstrlenA(sub2
), "Expected %d, got %d\n", lstrlenA(sub2
), size
);
8280 r
= MsiDoAction(hpkg
, "ResolveSource");
8281 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8283 /* try TARGETDIR after ResolveSource */
8285 lstrcpyA(path
, "kiwi");
8286 r
= MsiGetSourcePath(hpkg
, "TARGETDIR", path
, &size
);
8287 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8288 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8289 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8291 /* try SourceDir after ResolveSource */
8293 lstrcpyA(path
, "kiwi");
8294 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8295 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8296 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8297 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8299 /* try SOURCEDIR after ResolveSource */
8301 lstrcpyA(path
, "kiwi");
8302 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
8303 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8304 ok(!lstrcmpA(path
, "kiwi"),
8305 "Expected path to be unchanged, got \"%s\"\n", path
);
8306 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8308 /* source path does not exist, but the property exists */
8310 lstrcpyA(path
, "kiwi");
8311 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8312 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8313 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8314 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8316 /* try SubDir after ResolveSource */
8318 lstrcpyA(path
, "kiwi");
8319 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8320 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8321 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8322 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8324 /* try SubDir2 after ResolveSource */
8326 lstrcpyA(path
, "kiwi");
8327 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
8328 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8329 ok(!lstrcmpA(path
, sub2
), "Expected \"%s\", got \"%s\"\n", sub2
, path
);
8330 ok(size
== lstrlenA(sub2
), "Expected %d, got %d\n", lstrlenA(sub2
), size
);
8332 r
= MsiDoAction(hpkg
, "FileCost");
8333 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8335 /* try TARGETDIR after FileCost */
8337 lstrcpyA(path
, "kiwi");
8338 r
= MsiGetSourcePath(hpkg
, "TARGETDIR", path
, &size
);
8339 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8340 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8341 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8343 /* try SourceDir after FileCost */
8345 lstrcpyA(path
, "kiwi");
8346 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8347 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8348 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8349 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8351 /* try SOURCEDIR after FileCost */
8353 lstrcpyA(path
, "kiwi");
8354 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
8355 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8356 ok(!lstrcmpA(path
, "kiwi"),
8357 "Expected path to be unchanged, got \"%s\"\n", path
);
8358 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8360 /* try SubDir after FileCost */
8362 lstrcpyA(path
, "kiwi");
8363 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8364 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8365 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8366 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8368 /* try SubDir2 after FileCost */
8370 lstrcpyA(path
, "kiwi");
8371 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
8372 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8373 ok(!lstrcmpA(path
, sub2
), "Expected \"%s\", got \"%s\"\n", sub2
, path
);
8374 ok(size
== lstrlenA(sub2
), "Expected %d, got %d\n", lstrlenA(sub2
), size
);
8376 r
= MsiDoAction(hpkg
, "CostFinalize");
8377 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8379 /* try TARGETDIR after CostFinalize */
8381 lstrcpyA(path
, "kiwi");
8382 r
= MsiGetSourcePath(hpkg
, "TARGETDIR", path
, &size
);
8383 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8384 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8385 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8387 /* try SourceDir after CostFinalize */
8389 lstrcpyA(path
, "kiwi");
8390 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8391 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8392 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8393 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8395 /* try SOURCEDIR after CostFinalize */
8397 lstrcpyA(path
, "kiwi");
8398 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
8399 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8400 ok(!lstrcmpA(path
, "kiwi"),
8401 "Expected path to be unchanged, got \"%s\"\n", path
);
8402 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8404 /* try SubDir after CostFinalize */
8406 lstrcpyA(path
, "kiwi");
8407 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8408 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8409 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8410 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8412 /* try SubDir2 after CostFinalize */
8414 lstrcpyA(path
, "kiwi");
8415 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
8416 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8417 ok(!lstrcmpA(path
, sub2
), "Expected \"%s\", got \"%s\"\n", sub2
, path
);
8418 ok(size
== lstrlenA(sub2
), "Expected %d, got %d\n", lstrlenA(sub2
), size
);
8420 /* nonexistent directory */
8422 lstrcpyA(path
, "kiwi");
8423 r
= MsiGetSourcePath(hpkg
, "IDontExist", path
, &size
);
8424 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
8425 ok(!lstrcmpA(path
, "kiwi"),
8426 "Expected path to be unchanged, got \"%s\"\n", path
);
8427 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
8429 /* NULL szPathBuf */
8431 r
= MsiGetSourcePath(hpkg
, "SourceDir", NULL
, &size
);
8432 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8433 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8435 /* NULL pcchPathBuf */
8436 lstrcpyA(path
, "kiwi");
8437 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, NULL
);
8438 ok(r
== ERROR_INVALID_PARAMETER
,
8439 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
8440 ok(!lstrcmpA(path
, "kiwi"),
8441 "Expected path to be unchanged, got \"%s\"\n", path
);
8443 /* pcchPathBuf is 0 */
8445 lstrcpyA(path
, "kiwi");
8446 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8447 ok(r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
8448 ok(!lstrcmpA(path
, "kiwi"),
8449 "Expected path to be unchanged, got \"%s\"\n", path
);
8450 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8452 /* pcchPathBuf does not have room for NULL terminator */
8453 size
= lstrlenA(cwd
);
8454 lstrcpyA(path
, "kiwi");
8455 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8456 ok(r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
8457 ok(!strncmp(path
, cwd
, lstrlenA(cwd
) - 1),
8458 "Expected path with no backslash, got \"%s\"\n", path
);
8459 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8461 /* pcchPathBuf has room for NULL terminator */
8462 size
= lstrlenA(cwd
) + 1;
8463 lstrcpyA(path
, "kiwi");
8464 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8465 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8466 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8467 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8469 MsiCloseHandle(hpkg
);
8471 /* compressed source */
8473 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_DIRECT
, &hdb
);
8474 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8476 set_suminfo_prop(hdb
, PID_WORDCOUNT
, msidbSumInfoSourceTypeCompressed
);
8478 hpkg
= package_from_db(hdb
);
8479 ok(hpkg
, "failed to create package\n");
8481 r
= MsiDoAction(hpkg
, "CostInitialize");
8482 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8483 r
= MsiDoAction(hpkg
, "FileCost");
8484 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8485 r
= MsiDoAction(hpkg
, "CostFinalize");
8486 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8488 /* try TARGETDIR after CostFinalize */
8490 lstrcpyA(path
, "kiwi");
8491 r
= MsiGetSourcePath(hpkg
, "TARGETDIR", path
, &size
);
8492 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8493 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8494 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8496 /* try SourceDir after CostFinalize */
8498 lstrcpyA(path
, "kiwi");
8499 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
8500 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8501 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8502 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8504 /* try SOURCEDIR after CostFinalize */
8506 lstrcpyA(path
, "kiwi");
8507 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
8510 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8511 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8512 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8515 /* try SubDir after CostFinalize */
8517 lstrcpyA(path
, "kiwi");
8518 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8519 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8520 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8521 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8523 /* try SubDir2 after CostFinalize */
8525 lstrcpyA(path
, "kiwi");
8526 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
8527 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8528 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8529 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8531 MsiCloseHandle(hpkg
);
8532 DeleteFile(msifile
);
8535 static void test_shortlongsource(void)
8537 MSIHANDLE hdb
, hpkg
;
8538 CHAR path
[MAX_PATH
];
8540 CHAR subsrc
[MAX_PATH
];
8544 lstrcpyA(cwd
, CURR_DIR
);
8545 lstrcatA(cwd
, "\\");
8547 lstrcpyA(subsrc
, cwd
);
8548 lstrcatA(subsrc
, "long");
8549 lstrcatA(subsrc
, "\\");
8551 /* long file names */
8553 hdb
= create_package_db();
8554 ok( hdb
, "failed to create database\n");
8556 set_suminfo_prop(hdb
, PID_WORDCOUNT
, 0);
8558 r
= add_directory_entry(hdb
, "'TARGETDIR', '', 'SourceDir'");
8559 ok(r
== S_OK
, "failed\n");
8561 r
= add_directory_entry(hdb
, "'SubDir', 'TARGETDIR', 'short|long'");
8562 ok(r
== S_OK
, "failed\n");
8564 /* CostInitialize:short */
8565 r
= add_directory_entry(hdb
, "'SubDir2', 'TARGETDIR', 'one|two'");
8566 ok(r
== S_OK
, "failed\n");
8568 /* CostInitialize:long */
8569 r
= add_directory_entry(hdb
, "'SubDir3', 'TARGETDIR', 'three|four'");
8570 ok(r
== S_OK
, "failed\n");
8572 /* FileCost:short */
8573 r
= add_directory_entry(hdb
, "'SubDir4', 'TARGETDIR', 'five|six'");
8574 ok(r
== S_OK
, "failed\n");
8577 r
= add_directory_entry(hdb
, "'SubDir5', 'TARGETDIR', 'seven|eight'");
8578 ok(r
== S_OK
, "failed\n");
8580 /* CostFinalize:short */
8581 r
= add_directory_entry(hdb
, "'SubDir6', 'TARGETDIR', 'nine|ten'");
8582 ok(r
== S_OK
, "failed\n");
8584 /* CostFinalize:long */
8585 r
= add_directory_entry(hdb
, "'SubDir7', 'TARGETDIR', 'eleven|twelve'");
8586 ok(r
== S_OK
, "failed\n");
8588 MsiDatabaseCommit(hdb
);
8590 hpkg
= package_from_db(hdb
);
8591 ok(hpkg
, "failed to create package\n");
8593 MsiCloseHandle(hdb
);
8595 CreateDirectoryA("one", NULL
);
8596 CreateDirectoryA("four", NULL
);
8598 r
= MsiDoAction(hpkg
, "CostInitialize");
8599 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8601 CreateDirectory("five", NULL
);
8602 CreateDirectory("eight", NULL
);
8604 r
= MsiDoAction(hpkg
, "FileCost");
8605 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8607 CreateDirectory("nine", NULL
);
8608 CreateDirectory("twelve", NULL
);
8610 r
= MsiDoAction(hpkg
, "CostFinalize");
8611 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8613 /* neither short nor 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 CreateDirectoryA("short", NULL
);
8623 /* short source directory exists */
8625 lstrcpyA(path
, "kiwi");
8626 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8627 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8628 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8629 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8631 CreateDirectoryA("long", NULL
);
8633 /* both short and long source directories exist */
8635 lstrcpyA(path
, "kiwi");
8636 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8637 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8638 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8639 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8641 lstrcpyA(subsrc
, cwd
);
8642 lstrcatA(subsrc
, "two");
8643 lstrcatA(subsrc
, "\\");
8645 /* short dir exists before CostInitialize */
8647 lstrcpyA(path
, "kiwi");
8648 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
8649 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8650 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8651 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8653 lstrcpyA(subsrc
, cwd
);
8654 lstrcatA(subsrc
, "four");
8655 lstrcatA(subsrc
, "\\");
8657 /* long dir exists before CostInitialize */
8659 lstrcpyA(path
, "kiwi");
8660 r
= MsiGetSourcePath(hpkg
, "SubDir3", path
, &size
);
8661 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8662 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8663 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8665 lstrcpyA(subsrc
, cwd
);
8666 lstrcatA(subsrc
, "six");
8667 lstrcatA(subsrc
, "\\");
8669 /* short dir exists before FileCost */
8671 lstrcpyA(path
, "kiwi");
8672 r
= MsiGetSourcePath(hpkg
, "SubDir4", path
, &size
);
8673 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8674 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8675 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8677 lstrcpyA(subsrc
, cwd
);
8678 lstrcatA(subsrc
, "eight");
8679 lstrcatA(subsrc
, "\\");
8681 /* long dir exists before FileCost */
8683 lstrcpyA(path
, "kiwi");
8684 r
= MsiGetSourcePath(hpkg
, "SubDir5", path
, &size
);
8685 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8686 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8687 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8689 lstrcpyA(subsrc
, cwd
);
8690 lstrcatA(subsrc
, "ten");
8691 lstrcatA(subsrc
, "\\");
8693 /* short dir exists before CostFinalize */
8695 lstrcpyA(path
, "kiwi");
8696 r
= MsiGetSourcePath(hpkg
, "SubDir6", path
, &size
);
8697 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8698 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8699 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8701 lstrcpyA(subsrc
, cwd
);
8702 lstrcatA(subsrc
, "twelve");
8703 lstrcatA(subsrc
, "\\");
8705 /* long dir exists before CostFinalize */
8707 lstrcpyA(path
, "kiwi");
8708 r
= MsiGetSourcePath(hpkg
, "SubDir7", path
, &size
);
8709 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8710 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8711 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8713 MsiCloseHandle(hpkg
);
8714 RemoveDirectoryA("short");
8715 RemoveDirectoryA("long");
8716 RemoveDirectoryA("one");
8717 RemoveDirectoryA("four");
8718 RemoveDirectoryA("five");
8719 RemoveDirectoryA("eight");
8720 RemoveDirectoryA("nine");
8721 RemoveDirectoryA("twelve");
8723 /* short file names */
8725 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_DIRECT
, &hdb
);
8726 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8728 set_suminfo_prop(hdb
, PID_WORDCOUNT
, msidbSumInfoSourceTypeSFN
);
8730 hpkg
= package_from_db(hdb
);
8731 ok(hpkg
, "failed to create package\n");
8733 MsiCloseHandle(hdb
);
8735 CreateDirectoryA("one", NULL
);
8736 CreateDirectoryA("four", NULL
);
8738 r
= MsiDoAction(hpkg
, "CostInitialize");
8739 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8741 CreateDirectory("five", NULL
);
8742 CreateDirectory("eight", NULL
);
8744 r
= MsiDoAction(hpkg
, "FileCost");
8745 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8747 CreateDirectory("nine", NULL
);
8748 CreateDirectory("twelve", NULL
);
8750 r
= MsiDoAction(hpkg
, "CostFinalize");
8751 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8753 lstrcpyA(subsrc
, cwd
);
8754 lstrcatA(subsrc
, "short");
8755 lstrcatA(subsrc
, "\\");
8757 /* neither short nor 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 CreateDirectoryA("short", NULL
);
8767 /* short source directory exists */
8769 lstrcpyA(path
, "kiwi");
8770 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8771 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8772 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8773 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8775 CreateDirectoryA("long", NULL
);
8777 /* both short and long source directories exist */
8779 lstrcpyA(path
, "kiwi");
8780 r
= MsiGetSourcePath(hpkg
, "SubDir", path
, &size
);
8781 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8782 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8783 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8785 lstrcpyA(subsrc
, cwd
);
8786 lstrcatA(subsrc
, "one");
8787 lstrcatA(subsrc
, "\\");
8789 /* short dir exists before CostInitialize */
8791 lstrcpyA(path
, "kiwi");
8792 r
= MsiGetSourcePath(hpkg
, "SubDir2", path
, &size
);
8793 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8794 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8795 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8797 lstrcpyA(subsrc
, cwd
);
8798 lstrcatA(subsrc
, "three");
8799 lstrcatA(subsrc
, "\\");
8801 /* long dir exists before CostInitialize */
8803 lstrcpyA(path
, "kiwi");
8804 r
= MsiGetSourcePath(hpkg
, "SubDir3", path
, &size
);
8805 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8806 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8807 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8809 lstrcpyA(subsrc
, cwd
);
8810 lstrcatA(subsrc
, "five");
8811 lstrcatA(subsrc
, "\\");
8813 /* short dir exists before FileCost */
8815 lstrcpyA(path
, "kiwi");
8816 r
= MsiGetSourcePath(hpkg
, "SubDir4", path
, &size
);
8817 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8818 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8819 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8821 lstrcpyA(subsrc
, cwd
);
8822 lstrcatA(subsrc
, "seven");
8823 lstrcatA(subsrc
, "\\");
8825 /* long dir exists before FileCost */
8827 lstrcpyA(path
, "kiwi");
8828 r
= MsiGetSourcePath(hpkg
, "SubDir5", path
, &size
);
8829 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8830 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8831 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8833 lstrcpyA(subsrc
, cwd
);
8834 lstrcatA(subsrc
, "nine");
8835 lstrcatA(subsrc
, "\\");
8837 /* short dir exists before CostFinalize */
8839 lstrcpyA(path
, "kiwi");
8840 r
= MsiGetSourcePath(hpkg
, "SubDir6", path
, &size
);
8841 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8842 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8843 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8845 lstrcpyA(subsrc
, cwd
);
8846 lstrcatA(subsrc
, "eleven");
8847 lstrcatA(subsrc
, "\\");
8849 /* long dir exists before CostFinalize */
8851 lstrcpyA(path
, "kiwi");
8852 r
= MsiGetSourcePath(hpkg
, "SubDir7", path
, &size
);
8853 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8854 ok(!lstrcmpA(path
, subsrc
), "Expected \"%s\", got \"%s\"\n", subsrc
, path
);
8855 ok(size
== lstrlenA(subsrc
), "Expected %d, got %d\n", lstrlenA(subsrc
), size
);
8857 MsiCloseHandle(hpkg
);
8858 RemoveDirectoryA("short");
8859 RemoveDirectoryA("long");
8860 RemoveDirectoryA("one");
8861 RemoveDirectoryA("four");
8862 RemoveDirectoryA("five");
8863 RemoveDirectoryA("eight");
8864 RemoveDirectoryA("nine");
8865 RemoveDirectoryA("twelve");
8866 DeleteFileA(msifile
);
8869 static void test_sourcedir(void)
8871 MSIHANDLE hdb
, hpkg
;
8873 CHAR path
[MAX_PATH
];
8875 CHAR subsrc
[MAX_PATH
];
8879 lstrcpyA(cwd
, CURR_DIR
);
8880 lstrcatA(cwd
, "\\");
8882 lstrcpyA(subsrc
, cwd
);
8883 lstrcatA(subsrc
, "long");
8884 lstrcatA(subsrc
, "\\");
8886 hdb
= create_package_db();
8887 ok( hdb
, "failed to create database\n");
8889 r
= add_directory_entry(hdb
, "'TARGETDIR', '', 'SourceDir'");
8890 ok(r
== S_OK
, "failed\n");
8892 sprintf(package
, "#%i", hdb
);
8893 r
= MsiOpenPackage(package
, &hpkg
);
8894 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8896 /* properties only */
8898 /* SourceDir prop */
8900 lstrcpyA(path
, "kiwi");
8901 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
8902 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8903 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8904 ok(size
== 0, "Expected 0, got %d\n", size
);
8906 /* SOURCEDIR prop */
8908 lstrcpyA(path
, "kiwi");
8909 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8910 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8911 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8912 ok(size
== 0, "Expected 0, got %d\n", size
);
8914 r
= MsiDoAction(hpkg
, "CostInitialize");
8915 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8917 /* SourceDir after CostInitialize */
8919 lstrcpyA(path
, "kiwi");
8920 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
8921 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8922 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8923 ok(size
== 0, "Expected 0, got %d\n", size
);
8925 /* SOURCEDIR after CostInitialize */
8927 lstrcpyA(path
, "kiwi");
8928 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8929 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8930 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8931 ok(size
== 0, "Expected 0, got %d\n", size
);
8933 r
= MsiDoAction(hpkg
, "FileCost");
8934 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8936 /* SourceDir after FileCost */
8938 lstrcpyA(path
, "kiwi");
8939 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
8940 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8941 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8942 ok(size
== 0, "Expected 0, got %d\n", size
);
8944 /* SOURCEDIR after FileCost */
8946 lstrcpyA(path
, "kiwi");
8947 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8948 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8949 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8950 ok(size
== 0, "Expected 0, got %d\n", size
);
8952 r
= MsiDoAction(hpkg
, "CostFinalize");
8953 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8955 /* SourceDir after CostFinalize */
8957 lstrcpyA(path
, "kiwi");
8958 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
8959 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8960 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8961 ok(size
== 0, "Expected 0, got %d\n", size
);
8963 /* SOURCEDIR after CostFinalize */
8965 lstrcpyA(path
, "kiwi");
8966 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8967 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8968 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8969 ok(size
== 0, "Expected 0, got %d\n", size
);
8971 r
= MsiDoAction(hpkg
, "ResolveSource");
8972 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
8974 /* SourceDir after ResolveSource */
8976 lstrcpyA(path
, "kiwi");
8977 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
8978 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8979 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8980 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8982 /* SOURCEDIR after ResolveSource */
8984 lstrcpyA(path
, "kiwi");
8985 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
8986 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8987 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
8988 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
8992 lstrcpyA(path
, "kiwi");
8993 r
= MsiGetProperty(hpkg
, "SoUrCeDiR", path
, &size
);
8994 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
8995 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
8996 ok(size
== 0, "Expected 0, got %d\n", size
);
8998 MsiCloseHandle(hpkg
);
9000 /* reset the package state */
9001 sprintf(package
, "#%i", hdb
);
9002 r
= MsiOpenPackage(package
, &hpkg
);
9003 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9005 /* test how MsiGetSourcePath affects the properties */
9007 /* SourceDir prop */
9009 lstrcpyA(path
, "kiwi");
9010 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
9011 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9014 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
9015 ok(size
== 0, "Expected 0, got %d\n", size
);
9019 lstrcpyA(path
, "kiwi");
9020 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
9021 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
9022 ok(!lstrcmpA(path
, "kiwi"),
9023 "Expected path to be unchanged, got \"%s\"\n", path
);
9024 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
9026 /* SourceDir after MsiGetSourcePath */
9028 lstrcpyA(path
, "kiwi");
9029 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
9030 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9033 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
9034 ok(size
== 0, "Expected 0, got %d\n", size
);
9037 /* SOURCEDIR prop */
9039 lstrcpyA(path
, "kiwi");
9040 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
9041 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9044 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
9045 ok(size
== 0, "Expected 0, got %d\n", size
);
9049 lstrcpyA(path
, "kiwi");
9050 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
9051 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
9052 ok(!lstrcmpA(path
, "kiwi"),
9053 "Expected path to be unchanged, got \"%s\"\n", path
);
9054 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
9056 /* SOURCEDIR prop after MsiGetSourcePath */
9058 lstrcpyA(path
, "kiwi");
9059 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
9060 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9063 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
9064 ok(size
== 0, "Expected 0, got %d\n", size
);
9067 r
= MsiDoAction(hpkg
, "CostInitialize");
9068 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
9070 /* SourceDir after CostInitialize */
9072 lstrcpyA(path
, "kiwi");
9073 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
9074 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9077 ok(!lstrcmpA(path
, ""), "Expected \"\", got \"%s\"\n", path
);
9078 ok(size
== 0, "Expected 0, got %d\n", size
);
9082 lstrcpyA(path
, "kiwi");
9083 r
= MsiGetSourcePath(hpkg
, "SourceDir", path
, &size
);
9084 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9085 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
9086 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
9088 /* SourceDir after MsiGetSourcePath */
9090 lstrcpyA(path
, "kiwi");
9091 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
9092 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9093 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
9094 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
9096 /* SOURCEDIR after CostInitialize */
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 source path still does not exist */
9106 lstrcpyA(path
, "kiwi");
9107 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
9108 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
9109 ok(!lstrcmpA(path
, "kiwi"),
9110 "Expected path to be unchanged, got \"%s\"\n", path
);
9111 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
9113 r
= MsiDoAction(hpkg
, "FileCost");
9114 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
9116 /* SourceDir after FileCost */
9118 lstrcpyA(path
, "kiwi");
9119 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
9120 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9121 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
9122 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
9124 /* SOURCEDIR after FileCost */
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 source path still does not exist */
9134 lstrcpyA(path
, "kiwi");
9135 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
9136 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
9137 ok(!lstrcmpA(path
, "kiwi"),
9138 "Expected path to be unchanged, got \"%s\"\n", path
);
9139 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
9141 r
= MsiDoAction(hpkg
, "CostFinalize");
9142 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
9144 /* SourceDir after CostFinalize */
9146 lstrcpyA(path
, "kiwi");
9147 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
9148 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9149 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
9150 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
9152 /* SOURCEDIR after CostFinalize */
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 source path still does not exist */
9162 lstrcpyA(path
, "kiwi");
9163 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
9164 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
9165 ok(!lstrcmpA(path
, "kiwi"),
9166 "Expected path to be unchanged, got \"%s\"\n", path
);
9167 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
9169 r
= MsiDoAction(hpkg
, "ResolveSource");
9170 ok(r
== ERROR_SUCCESS
, "file cost failed\n");
9172 /* SourceDir after ResolveSource */
9174 lstrcpyA(path
, "kiwi");
9175 r
= MsiGetProperty(hpkg
, "SourceDir", path
, &size
);
9176 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9177 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
9178 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
9180 /* SOURCEDIR after ResolveSource */
9182 lstrcpyA(path
, "kiwi");
9183 r
= MsiGetProperty(hpkg
, "SOURCEDIR", path
, &size
);
9184 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9185 ok(!lstrcmpA(path
, cwd
), "Expected \"%s\", got \"%s\"\n", cwd
, path
);
9186 ok(size
== lstrlenA(cwd
), "Expected %d, got %d\n", lstrlenA(cwd
), size
);
9188 /* SOURCEDIR source path still does not exist */
9190 lstrcpyA(path
, "kiwi");
9191 r
= MsiGetSourcePath(hpkg
, "SOURCEDIR", path
, &size
);
9192 ok(r
== ERROR_DIRECTORY
, "Expected ERROR_DIRECTORY, got %d\n", r
);
9193 ok(!lstrcmpA(path
, "kiwi"),
9194 "Expected path to be unchanged, got \"%s\"\n", path
);
9195 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
9197 MsiCloseHandle(hdb
);
9198 MsiCloseHandle(hpkg
);
9199 DeleteFileA(msifile
);
9209 static const struct access_res create
[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_commit
[16] =
9231 { TRUE
, ERROR_SUCCESS
, TRUE
},
9232 { TRUE
, ERROR_SUCCESS
, TRUE
},
9233 { TRUE
, ERROR_SUCCESS
, FALSE
},
9234 { TRUE
, ERROR_SUCCESS
, FALSE
},
9235 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9236 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9237 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9238 { TRUE
, ERROR_SUCCESS
, FALSE
},
9239 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9240 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9241 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9242 { TRUE
, ERROR_SUCCESS
, TRUE
},
9243 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9244 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9245 { FALSE
, ERROR_SHARING_VIOLATION
, FALSE
},
9246 { TRUE
, ERROR_SUCCESS
, TRUE
}
9249 static const struct access_res create_close
[16] =
9251 { TRUE
, ERROR_SUCCESS
, FALSE
},
9252 { TRUE
, ERROR_SUCCESS
, FALSE
},
9253 { TRUE
, ERROR_SUCCESS
, FALSE
},
9254 { TRUE
, ERROR_SUCCESS
, FALSE
},
9255 { TRUE
, ERROR_SUCCESS
, FALSE
},
9256 { TRUE
, ERROR_SUCCESS
, FALSE
},
9257 { TRUE
, ERROR_SUCCESS
, FALSE
},
9258 { TRUE
, ERROR_SUCCESS
, FALSE
},
9259 { TRUE
, ERROR_SUCCESS
, FALSE
},
9260 { TRUE
, ERROR_SUCCESS
, FALSE
},
9261 { TRUE
, ERROR_SUCCESS
, FALSE
},
9262 { TRUE
, ERROR_SUCCESS
, FALSE
},
9263 { TRUE
, ERROR_SUCCESS
, FALSE
},
9264 { TRUE
, ERROR_SUCCESS
, FALSE
},
9265 { TRUE
, ERROR_SUCCESS
, FALSE
},
9266 { TRUE
, ERROR_SUCCESS
}
9269 static void _test_file_access(LPCSTR file
, const struct access_res
*ares
, DWORD line
)
9271 DWORD access
= 0, share
= 0;
9276 for (i
= 0; i
< 4; i
++)
9278 if (i
== 0) access
= 0;
9279 if (i
== 1) access
= GENERIC_READ
;
9280 if (i
== 2) access
= GENERIC_WRITE
;
9281 if (i
== 3) access
= GENERIC_READ
| GENERIC_WRITE
;
9283 for (j
= 0; j
< 4; j
++)
9285 if (ares
[idx
].ignore
)
9288 if (j
== 0) share
= 0;
9289 if (j
== 1) share
= FILE_SHARE_READ
;
9290 if (j
== 2) share
= FILE_SHARE_WRITE
;
9291 if (j
== 3) share
= FILE_SHARE_READ
| FILE_SHARE_WRITE
;
9293 SetLastError(0xdeadbeef);
9294 hfile
= CreateFileA(file
, access
, share
, NULL
, OPEN_EXISTING
,
9295 FILE_ATTRIBUTE_NORMAL
, 0);
9296 lasterr
= GetLastError();
9298 ok((hfile
!= INVALID_HANDLE_VALUE
) == ares
[idx
].gothandle
,
9299 "(%d, handle, %d): Expected %d, got %d\n",
9300 line
, idx
, ares
[idx
].gothandle
,
9301 (hfile
!= INVALID_HANDLE_VALUE
));
9303 ok(lasterr
== ares
[idx
].lasterr
||
9304 lasterr
== 0xdeadbeef, /* win9x */
9305 "(%d, lasterr, %d): Expected %d, got %d\n",
9306 line
, idx
, ares
[idx
].lasterr
, lasterr
);
9314 #define test_file_access(file, ares) _test_file_access(file, ares, __LINE__)
9316 static void test_access(void)
9321 r
= MsiOpenDatabaseA(msifile
, MSIDBOPEN_CREATE
, &hdb
);
9322 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9324 test_file_access(msifile
, create
);
9326 r
= MsiDatabaseCommit(hdb
);
9327 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9329 test_file_access(msifile
, create_commit
);
9331 MsiCloseHandle(hdb
);
9333 test_file_access(msifile
, create_close
);
9335 DeleteFileA(msifile
);
9337 r
= MsiOpenDatabaseA(msifile
, MSIDBOPEN_CREATEDIRECT
, &hdb
);
9338 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9340 test_file_access(msifile
, create
);
9342 r
= MsiDatabaseCommit(hdb
);
9343 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9345 test_file_access(msifile
, create_commit
);
9347 MsiCloseHandle(hdb
);
9349 test_file_access(msifile
, create_close
);
9351 DeleteFileA(msifile
);
9354 static void test_emptypackage(void)
9356 MSIHANDLE hpkg
, hdb
, hsuminfo
;
9357 MSIHANDLE hview
, hrec
;
9358 MSICONDITION condition
;
9359 CHAR buffer
[MAX_PATH
];
9363 r
= MsiOpenPackageA("", &hpkg
);
9366 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9369 hdb
= MsiGetActiveDatabase(hpkg
);
9372 ok(hdb
!= 0, "Expected a valid database handle\n");
9375 r
= MsiDatabaseOpenView(hdb
, "SELECT * FROM `_Tables`", &hview
);
9378 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9380 r
= MsiViewExecute(hview
, 0);
9383 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9386 r
= MsiViewFetch(hview
, &hrec
);
9389 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9393 r
= MsiRecordGetString(hrec
, 1, buffer
, &size
);
9396 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9397 ok(!lstrcmpA(buffer
, "_Property"),
9398 "Expected \"_Property\", got \"%s\"\n", buffer
);
9401 MsiCloseHandle(hrec
);
9403 r
= MsiViewFetch(hview
, &hrec
);
9406 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9410 r
= MsiRecordGetString(hrec
, 1, buffer
, &size
);
9413 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9414 ok(!lstrcmpA(buffer
, "#_FolderCache"),
9415 "Expected \"_Property\", got \"%s\"\n", buffer
);
9418 MsiCloseHandle(hrec
);
9419 MsiViewClose(hview
);
9420 MsiCloseHandle(hview
);
9422 condition
= MsiDatabaseIsTablePersistentA(hdb
, "_Property");
9425 ok(condition
== MSICONDITION_FALSE
,
9426 "Expected MSICONDITION_FALSE, got %d\n", condition
);
9429 r
= MsiDatabaseOpenView(hdb
, "SELECT * FROM `_Property`", &hview
);
9432 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9434 r
= MsiViewExecute(hview
, 0);
9437 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9440 /* _Property table is not empty */
9441 r
= MsiViewFetch(hview
, &hrec
);
9444 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9447 MsiCloseHandle(hrec
);
9448 MsiViewClose(hview
);
9449 MsiCloseHandle(hview
);
9451 condition
= MsiDatabaseIsTablePersistentA(hdb
, "#_FolderCache");
9454 ok(condition
== MSICONDITION_FALSE
,
9455 "Expected MSICONDITION_FALSE, got %d\n", condition
);
9458 r
= MsiDatabaseOpenView(hdb
, "SELECT * FROM `#_FolderCache`", &hview
);
9461 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9463 r
= MsiViewExecute(hview
, 0);
9466 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9469 /* #_FolderCache is not empty */
9470 r
= MsiViewFetch(hview
, &hrec
);
9473 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9476 MsiCloseHandle(hrec
);
9477 MsiViewClose(hview
);
9478 MsiCloseHandle(hview
);
9480 r
= MsiDatabaseOpenView(hdb
, "SELECT * FROM `_Streams`", &hview
);
9483 ok(r
== ERROR_BAD_QUERY_SYNTAX
,
9484 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r
);
9487 r
= MsiDatabaseOpenView(hdb
, "SELECT * FROM `_Storages`", &hview
);
9490 ok(r
== ERROR_BAD_QUERY_SYNTAX
,
9491 "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r
);
9494 r
= MsiGetSummaryInformationA(hdb
, NULL
, 0, &hsuminfo
);
9497 ok(r
== ERROR_INSTALL_PACKAGE_INVALID
,
9498 "Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r
);
9501 MsiCloseHandle(hsuminfo
);
9503 r
= MsiDatabaseCommit(hdb
);
9506 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9509 MsiCloseHandle(hdb
);
9510 MsiCloseHandle(hpkg
);
9513 static void test_MsiGetProductProperty(void)
9515 MSIHANDLE hprod
, hdb
;
9517 CHAR path
[MAX_PATH
];
9518 CHAR query
[MAX_PATH
];
9519 CHAR keypath
[MAX_PATH
*2];
9520 CHAR prodcode
[MAX_PATH
];
9521 CHAR prod_squashed
[MAX_PATH
];
9522 HKEY prodkey
, userkey
, props
;
9529 scm
= OpenSCManager(NULL
, NULL
, SC_MANAGER_CONNECT
);
9530 if (!scm
&& (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED
))
9532 win_skip("Different registry keys on Win9x and WinMe\n");
9535 CloseServiceHandle(scm
);
9537 GetCurrentDirectoryA(MAX_PATH
, path
);
9538 lstrcatA(path
, "\\");
9540 create_test_guid(prodcode
, prod_squashed
);
9541 get_user_sid(&usersid
);
9543 r
= MsiOpenDatabase(msifile
, MSIDBOPEN_CREATE
, &hdb
);
9544 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9546 r
= MsiDatabaseCommit(hdb
);
9547 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9549 r
= set_summary_info(hdb
);
9550 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9553 "CREATE TABLE `Directory` ( "
9554 "`Directory` CHAR(255) NOT NULL, "
9555 "`Directory_Parent` CHAR(255), "
9556 "`DefaultDir` CHAR(255) NOT NULL "
9557 "PRIMARY KEY `Directory`)");
9558 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9561 "CREATE TABLE `Property` ( "
9562 "`Property` CHAR(72) NOT NULL, "
9563 "`Value` CHAR(255) "
9564 "PRIMARY KEY `Property`)");
9565 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9567 sprintf(query
, "INSERT INTO `Property` "
9568 "(`Property`, `Value`) "
9569 "VALUES( 'ProductCode', '%s' )", prodcode
);
9570 r
= run_query(hdb
, query
);
9571 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9573 r
= MsiDatabaseCommit(hdb
);
9574 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9576 MsiCloseHandle(hdb
);
9578 lstrcpyA(keypath
, "Software\\Classes\\Installer\\Products\\");
9579 lstrcatA(keypath
, prod_squashed
);
9581 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &prodkey
);
9582 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
9584 lstrcpyA(keypath
, "Software\\Microsoft\\Windows\\CurrentVersion\\");
9585 lstrcatA(keypath
, "Installer\\UserData\\S-1-5-18\\Products\\");
9586 lstrcatA(keypath
, prod_squashed
);
9588 res
= RegCreateKeyA(HKEY_LOCAL_MACHINE
, keypath
, &userkey
);
9589 if (res
== ERROR_ACCESS_DENIED
)
9591 skip("Not enough rights to perform tests\n");
9592 RegDeleteKeyA(prodkey
, "");
9593 RegCloseKey(prodkey
);
9596 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
9598 res
= RegCreateKeyA(userkey
, "InstallProperties", &props
);
9599 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
9601 lstrcpyA(val
, path
);
9602 lstrcatA(val
, "\\winetest.msi");
9603 res
= RegSetValueExA(props
, "LocalPackage", 0, REG_SZ
,
9604 (const BYTE
*)val
, lstrlenA(val
) + 1);
9605 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
9608 r
= MsiOpenProductA(prodcode
, &hprod
);
9609 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9610 ok(hprod
!= 0 && hprod
!= 0xdeadbeef, "Expected a valid product handle\n");
9612 /* hProduct is invalid */
9614 lstrcpyA(val
, "apple");
9615 r
= MsiGetProductPropertyA(0xdeadbeef, "ProductCode", val
, &size
);
9616 ok(r
== ERROR_INVALID_HANDLE
,
9617 "Expected ERROR_INVALID_HANDLE, got %d\n", r
);
9618 ok(!lstrcmpA(val
, "apple"),
9619 "Expected val to be unchanged, got \"%s\"\n", val
);
9620 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
9622 /* szProperty is NULL */
9624 lstrcpyA(val
, "apple");
9625 r
= MsiGetProductPropertyA(hprod
, NULL
, val
, &size
);
9626 ok(r
== ERROR_INVALID_PARAMETER
,
9627 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
9628 ok(!lstrcmpA(val
, "apple"),
9629 "Expected val to be unchanged, got \"%s\"\n", val
);
9630 ok(size
== MAX_PATH
, "Expected size to be unchanged, got %d\n", size
);
9632 /* szProperty is empty */
9634 lstrcpyA(val
, "apple");
9635 r
= MsiGetProductPropertyA(hprod
, "", val
, &size
);
9636 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9637 ok(!lstrcmpA(val
, ""), "Expected \"\", got \"%s\"\n", val
);
9638 ok(size
== 0, "Expected 0, got %d\n", size
);
9640 /* get the property */
9642 lstrcpyA(val
, "apple");
9643 r
= MsiGetProductPropertyA(hprod
, "ProductCode", val
, &size
);
9644 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9645 ok(!lstrcmpA(val
, prodcode
),
9646 "Expected \"%s\", got \"%s\"\n", prodcode
, val
);
9647 ok(size
== lstrlenA(prodcode
),
9648 "Expected %d, got %d\n", lstrlenA(prodcode
), size
);
9650 /* lpValueBuf is NULL */
9652 r
= MsiGetProductPropertyA(hprod
, "ProductCode", NULL
, &size
);
9653 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9654 ok(size
== lstrlenA(prodcode
),
9655 "Expected %d, got %d\n", lstrlenA(prodcode
), size
);
9657 /* pcchValueBuf is NULL */
9658 lstrcpyA(val
, "apple");
9659 r
= MsiGetProductPropertyA(hprod
, "ProductCode", val
, NULL
);
9660 ok(r
== ERROR_INVALID_PARAMETER
,
9661 "Expected ERROR_INVALID_PARAMETER, got %d\n", r
);
9662 ok(!lstrcmpA(val
, "apple"),
9663 "Expected val to be unchanged, got \"%s\"\n", val
);
9664 ok(size
== lstrlenA(prodcode
),
9665 "Expected %d, got %d\n", lstrlenA(prodcode
), size
);
9667 /* pcchValueBuf is too small */
9669 lstrcpyA(val
, "apple");
9670 r
= MsiGetProductPropertyA(hprod
, "ProductCode", val
, &size
);
9671 ok(r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
9672 ok(!strncmp(val
, prodcode
, 3),
9673 "Expected first 3 chars of \"%s\", got \"%s\"\n", prodcode
, val
);
9674 ok(size
== lstrlenA(prodcode
),
9675 "Expected %d, got %d\n", lstrlenA(prodcode
), size
);
9677 /* pcchValueBuf does not leave room for NULL terminator */
9678 size
= lstrlenA(prodcode
);
9679 lstrcpyA(val
, "apple");
9680 r
= MsiGetProductPropertyA(hprod
, "ProductCode", val
, &size
);
9681 ok(r
== ERROR_MORE_DATA
, "Expected ERROR_MORE_DATA, got %d\n", r
);
9682 ok(!strncmp(val
, prodcode
, lstrlenA(prodcode
) - 1),
9683 "Expected first 37 chars of \"%s\", got \"%s\"\n", prodcode
, val
);
9684 ok(size
== lstrlenA(prodcode
),
9685 "Expected %d, got %d\n", lstrlenA(prodcode
), size
);
9687 /* pcchValueBuf has enough room for NULL terminator */
9688 size
= lstrlenA(prodcode
) + 1;
9689 lstrcpyA(val
, "apple");
9690 r
= MsiGetProductPropertyA(hprod
, "ProductCode", val
, &size
);
9691 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9692 ok(!lstrcmpA(val
, prodcode
),
9693 "Expected \"%s\", got \"%s\"\n", prodcode
, val
);
9694 ok(size
== lstrlenA(prodcode
),
9695 "Expected %d, got %d\n", lstrlenA(prodcode
), size
);
9697 /* nonexistent property */
9699 lstrcpyA(val
, "apple");
9700 r
= MsiGetProductPropertyA(hprod
, "IDontExist", val
, &size
);
9701 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9702 ok(!lstrcmpA(val
, ""), "Expected \"\", got \"%s\"\n", val
);
9703 ok(size
== 0, "Expected 0, got %d\n", size
);
9705 r
= MsiSetPropertyA(hprod
, "NewProperty", "value");
9706 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9708 /* non-product property set */
9710 lstrcpyA(val
, "apple");
9711 r
= MsiGetProductPropertyA(hprod
, "NewProperty", val
, &size
);
9712 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9713 ok(!lstrcmpA(val
, ""), "Expected \"\", got \"%s\"\n", val
);
9714 ok(size
== 0, "Expected 0, got %d\n", size
);
9716 r
= MsiSetPropertyA(hprod
, "ProductCode", "value");
9717 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9719 /* non-product property that is also a product property set */
9721 lstrcpyA(val
, "apple");
9722 r
= MsiGetProductPropertyA(hprod
, "ProductCode", val
, &size
);
9723 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
9724 ok(!lstrcmpA(val
, prodcode
),
9725 "Expected \"%s\", got \"%s\"\n", prodcode
, val
);
9726 ok(size
== lstrlenA(prodcode
),
9727 "Expected %d, got %d\n", lstrlenA(prodcode
), size
);
9729 MsiCloseHandle(hprod
);
9731 RegDeleteValueA(props
, "LocalPackage");
9732 RegDeleteKeyA(props
, "");
9734 RegDeleteKeyA(userkey
, "");
9735 RegCloseKey(userkey
);
9736 RegDeleteKeyA(prodkey
, "");
9737 RegCloseKey(prodkey
);
9738 DeleteFileA(msifile
);
9743 GetCurrentDirectoryA(MAX_PATH
, CURR_DIR
);
9745 test_createpackage();
9747 test_gettargetpath_bad();
9748 test_settargetpath();
9750 test_property_table();
9753 test_formatrecord2();
9758 test_appsearch_complocator();
9759 test_appsearch_reglocator();
9760 test_appsearch_inilocator();
9761 test_appsearch_drlocator();
9762 test_featureparents();
9763 test_installprops();
9764 test_launchconditions();
9767 test_MsiGetSourcePath();
9768 test_shortlongsource();
9771 test_emptypackage();
9772 test_MsiGetProductProperty();