Commit e92f6655 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

msi: Validate MsiQueryProductCode parameters.

parent db318ec9
......@@ -764,13 +764,16 @@ INSTALLSTATE WINAPI MsiQueryProductStateW(LPCWSTR szProduct)
UINT rc;
INSTALLSTATE rrc = INSTALLSTATE_UNKNOWN;
HKEY hkey = 0;
static const WCHAR szWindowsInstaller[] = {
'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0 };
DWORD sz;
static const int GUID_LEN = 38;
static const WCHAR szWindowsInstaller[] = {
'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0
};
TRACE("%s\n", debugstr_w(szProduct));
if (!szProduct)
if (!szProduct || !*szProduct || lstrlenW(szProduct) != GUID_LEN)
return INSTALLSTATE_INVALIDARG;
rc = MSIREG_OpenUserProductsKey(szProduct,&hkey,FALSE);
......
......@@ -347,24 +347,15 @@ static void test_MsiQueryProductState(void)
/* empty prodcode */
state = MsiQueryProductStateA("");
todo_wine
{
ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
}
ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
/* garbage prodcode */
state = MsiQueryProductStateA("garbage");
todo_wine
{
ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
}
ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
/* guid without brackets */
state = MsiQueryProductStateA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D");
todo_wine
{
ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
}
ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
/* guid with brackets */
state = MsiQueryProductStateA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}");
......
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