Commit 798429f9 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

msi: Validate the product code.

parent 861ae27a
...@@ -589,11 +589,12 @@ UINT WINAPI MsiSourceListAddSourceExW( LPCWSTR szProduct, LPCWSTR szUserSid, ...@@ -589,11 +589,12 @@ UINT WINAPI MsiSourceListAddSourceExW( LPCWSTR szProduct, LPCWSTR szUserSid,
HKEY typekey; HKEY typekey;
UINT rc; UINT rc;
media_info source_struct; media_info source_struct;
WCHAR squished_pc[GUID_SIZE];
TRACE("%s %s %x %x %s %i\n", debugstr_w(szProduct), debugstr_w(szUserSid), TRACE("%s %s %x %x %s %i\n", debugstr_w(szProduct), debugstr_w(szUserSid),
dwContext, dwOptions, debugstr_w(szSource), dwIndex); dwContext, dwOptions, debugstr_w(szSource), dwIndex);
if (!szProduct) if (!szProduct || !squash_guid(szProduct, squished_pc))
return ERROR_INVALID_PARAMETER; return ERROR_INVALID_PARAMETER;
if (!szSource) if (!szSource)
......
...@@ -365,27 +365,18 @@ static void test_MsiSourceListAddSourceEx(void) ...@@ -365,27 +365,18 @@ static void test_MsiSourceListAddSourceEx(void)
/* empty szProductCodeOrPatchCode */ /* empty szProductCodeOrPatchCode */
r = pMsiSourceListAddSourceExA("", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, r = pMsiSourceListAddSourceExA("", usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0); 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 */ /* garbage szProductCodeOrPatchCode */
r = pMsiSourceListAddSourceExA("garbage", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, r = pMsiSourceListAddSourceExA("garbage", usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0); 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 */ /* guid without brackets */
r = pMsiSourceListAddSourceExA("51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA", usersid, r = pMsiSourceListAddSourceExA("51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA", usersid,
MSIINSTALLCONTEXT_USERUNMANAGED, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0); 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 */ /* guid with brackets */
r = pMsiSourceListAddSourceExA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}", usersid, r = pMsiSourceListAddSourceExA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}", usersid,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment