diff --git a/dlls/shlwapi/shlwapi_main.c b/dlls/shlwapi/shlwapi_main.c index 38439b741e1..f466bb485aa 100644 --- a/dlls/shlwapi/shlwapi_main.c +++ b/dlls/shlwapi/shlwapi_main.c @@ -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); + + WARN("pdvi->cbSize = %d, unhandled\n", pdvi2->info1.cbSize); return E_INVALIDARG; } diff --git a/dlls/shlwapi/tests/ordinal.c b/dlls/shlwapi/tests/ordinal.c index bd3d46abdf2..afccd3a906f 100644 --- a/dlls/shlwapi/tests/ordinal.c +++ b/dlls/shlwapi/tests/ordinal.c @@ -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);