msi: Validate the product code.
This commit is contained in:
parent
861ae27a4f
commit
798429f9ca
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
/* guid with brackets */
|
||||
r = pMsiSourceListAddSourceExA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}", usersid,
|
||||
|
|
Loading…
Reference in New Issue