msi: Handle signature filenames in short|long notation.

This commit is contained in:
Hans Leidekker 2010-08-18 11:22:12 +02:00 committed by Alexandre Julliard
parent 0c044c10d0
commit 5d85497a15
2 changed files with 29 additions and 4 deletions

View File

@ -89,7 +89,7 @@ static UINT ACTION_AppSearchGetSignature(MSIPACKAGE *package, MSISIGNATURE *sig,
'S','i','g','n','a','t','u','r','e',' ', 'S','i','g','n','a','t','u','r','e',' ',
'w','h','e','r','e',' ','S','i','g','n','a','t','u','r','e',' ','=',' ', 'w','h','e','r','e',' ','S','i','g','n','a','t','u','r','e',' ','=',' ',
'\'','%','s','\'',0}; '\'','%','s','\'',0};
LPWSTR minVersion, maxVersion; LPWSTR minVersion, maxVersion, p;
MSIRECORD *row; MSIRECORD *row;
DWORD time; DWORD time;
@ -106,6 +106,12 @@ static UINT ACTION_AppSearchGetSignature(MSIPACKAGE *package, MSISIGNATURE *sig,
/* get properties */ /* get properties */
sig->File = msi_dup_record_field(row,2); sig->File = msi_dup_record_field(row,2);
if ((p = strchrW(sig->File, '|')))
{
p++;
memmove(sig->File, p, (strlenW(p) + 1) * sizeof(WCHAR));
}
minVersion = msi_dup_record_field(row,3); minVersion = msi_dup_record_field(row,3);
if (minVersion) if (minVersion)
{ {

View File

@ -7507,7 +7507,7 @@ static void test_appsearch(void)
UINT r; UINT r;
MSIHANDLE hdb; MSIHANDLE hdb;
CHAR prop[MAX_PATH]; CHAR prop[MAX_PATH];
DWORD size = MAX_PATH; DWORD size;
hdb = create_package_db(); hdb = create_package_db();
ok ( hdb, "failed to create package database\n" ); ok ( hdb, "failed to create package database\n" );
@ -7518,17 +7518,29 @@ static void test_appsearch(void)
r = add_appsearch_entry( hdb, "'WEBBROWSERPROG', 'NewSignature1'" ); r = add_appsearch_entry( hdb, "'WEBBROWSERPROG', 'NewSignature1'" );
ok( r == ERROR_SUCCESS, "cannot add entry: %d\n", r ); ok( r == ERROR_SUCCESS, "cannot add entry: %d\n", r );
r = add_appsearch_entry( hdb, "'NOTEPAD', 'NewSignature2'" );
ok( r == ERROR_SUCCESS, "cannot add entry: %d\n", r );
r = create_reglocator_table( hdb ); r = create_reglocator_table( hdb );
ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r ); ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
r = add_reglocator_entry( hdb, "'NewSignature1', 0, 'htmlfile\\shell\\open\\command', '', 1" ); r = add_reglocator_entry( hdb, "'NewSignature1', 0, 'htmlfile\\shell\\open\\command', '', 1" );
ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r ); ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
r = create_drlocator_table( hdb );
ok( r == ERROR_SUCCESS, "cannot create DrLocator table: %d\n", r );
r = add_drlocator_entry( hdb, "'NewSignature2', 0, 'c:\\windows\\system32', 0" );
ok( r == ERROR_SUCCESS, "cannot create RegLocator table: %d\n", r );
r = create_signature_table( hdb ); r = create_signature_table( hdb );
ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r ); ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r );
r = add_signature_entry( hdb, "'NewSignature1', 'FileName', '', '', '', '', '', '', ''" ); r = add_signature_entry( hdb, "'NewSignature1', 'FileName', '', '', '', '', '', '', ''" );
ok( r == ERROR_SUCCESS, "cannot create Signature table: %d\n", r ); ok( r == ERROR_SUCCESS, "cannot add signature: %d\n", r );
r = add_signature_entry( hdb, "'NewSignature2', 'NOTEPAD.EXE|notepad.exe', '', '', '', '', '', '', ''" );
ok( r == ERROR_SUCCESS, "cannot add signature: %d\n", r );
r = package_from_db( hdb, &hpkg ); r = package_from_db( hdb, &hpkg );
if (r == ERROR_INSTALL_PACKAGE_REJECTED) if (r == ERROR_INSTALL_PACKAGE_REJECTED)
@ -7538,12 +7550,14 @@ static void test_appsearch(void)
return; return;
} }
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r ); ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
MsiCloseHandle( hdb ); MsiCloseHandle( hdb );
if (r != ERROR_SUCCESS)
goto done;
r = MsiDoAction( hpkg, "AppSearch" ); r = MsiDoAction( hpkg, "AppSearch" );
ok( r == ERROR_SUCCESS, "AppSearch failed: %d\n", r); ok( r == ERROR_SUCCESS, "AppSearch failed: %d\n", r);
size = sizeof(prop);
r = MsiGetPropertyA( hpkg, "WEBBROWSERPROG", prop, &size ); r = MsiGetPropertyA( hpkg, "WEBBROWSERPROG", prop, &size );
ok( r == ERROR_SUCCESS, "get property failed: %d\n", r); ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
todo_wine todo_wine
@ -7551,6 +7565,11 @@ static void test_appsearch(void)
ok( lstrlenA(prop) != 0, "Expected non-zero length\n"); ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
} }
size = sizeof(prop);
r = MsiGetPropertyA( hpkg, "NOTEPAD", prop, &size );
ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
done:
MsiCloseHandle( hpkg ); MsiCloseHandle( hpkg );
DeleteFileA(msifile); DeleteFileA(msifile);
} }