Commit 0e4be06c authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

shlwapi: Handle NULL pointer in DllGetVersion() (Coverity).

parent 57bfebfc
......@@ -94,6 +94,9 @@ HRESULT WINAPI DllGetVersion (DLLVERSIONINFO *pdvi)
TRACE("(%p)\n",pdvi);
if (!pdvi)
return E_INVALIDARG;
switch (pdvi2->info1.cbSize)
{
case sizeof(DLLVERSIONINFO2):
......@@ -107,7 +110,7 @@ HRESULT WINAPI DllGetVersion (DLLVERSIONINFO *pdvi)
pdvi2->info1.dwPlatformID = DLLVER_PLATFORM_WINDOWS;
return S_OK;
}
if (pdvi)
WARN("pdvi->cbSize = %d, unhandled\n", pdvi2->info1.cbSize);
return E_INVALIDARG;
}
......@@ -70,6 +70,7 @@ static HRESULT (WINAPI *pSKDeleteValueW)(DWORD, LPCWSTR, LPCWSTR);
static HRESULT (WINAPI *pSKAllocValueW)(DWORD, LPCWSTR, LPCWSTR, DWORD*, void**, DWORD*);
static HWND (WINAPI *pSHSetParentHwnd)(HWND, HWND);
static HRESULT (WINAPI *pIUnknown_GetClassID)(IUnknown*, CLSID*);
static HRESULT (WINAPI *pDllGetVersion)(DLLVERSIONINFO2*);
static HMODULE hmlang;
static HRESULT (WINAPI *pLcidToRfc1766A)(LCID, LPSTR, INT);
......@@ -3073,6 +3074,8 @@ static void init_pointers(void)
MAKEFUNC(SKDeleteValueW, 518);
MAKEFUNC(SKAllocValueW, 519);
#undef MAKEFUNC
pDllGetVersion = (void*)GetProcAddress(hShlwapi, "DllGetVersion");
}
static void test_SHSetParentHwnd(void)
......@@ -3246,6 +3249,14 @@ if (0) /* crashes on native systems */
"got wrong clsid %s\n", wine_dbgstr_guid(&clsid));
}
static void test_DllGetVersion(void)
{
HRESULT hr;
hr = pDllGetVersion(NULL);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
}
START_TEST(ordinal)
{
char **argv;
......@@ -3301,6 +3312,7 @@ START_TEST(ordinal)
test_SHGetShellKey();
test_SHSetParentHwnd();
test_IUnknown_GetClassID();
test_DllGetVersion();
FreeLibrary(hshell32);
FreeLibrary(hmlang);
......
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