msi: Validate the product code.

oldstable
James Hawkins 2007-11-05 04:26:34 -05:00 committed by Alexandre Julliard
parent 861ae27a4f
commit 798429f9ca
2 changed files with 5 additions and 13 deletions

View File

@ -589,11 +589,12 @@ UINT WINAPI MsiSourceListAddSourceExW( LPCWSTR szProduct, LPCWSTR szUserSid,
HKEY typekey;
UINT rc;
media_info source_struct;
WCHAR squished_pc[GUID_SIZE];
TRACE("%s %s %x %x %s %i\n", debugstr_w(szProduct), debugstr_w(szUserSid),
dwContext, dwOptions, debugstr_w(szSource), dwIndex);
if (!szProduct)
if (!szProduct || !squash_guid(szProduct, squished_pc))
return ERROR_INVALID_PARAMETER;
if (!szSource)

View File

@ -365,27 +365,18 @@ static void test_MsiSourceListAddSourceEx(void)
/* empty szProductCodeOrPatchCode */
r = pMsiSourceListAddSourceExA("", usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0);
todo_wine
{
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
}
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
/* garbage szProductCodeOrPatchCode */
r = pMsiSourceListAddSourceExA("garbage", usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0);
todo_wine
{
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
}
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
/* guid without brackets */
r = pMsiSourceListAddSourceExA("51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA", usersid,
MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0);
todo_wine
{
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
}
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
/* guid with brackets */
r = pMsiSourceListAddSourceExA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}", usersid,