From: Mark Jansen Date: Fri, 10 Jun 2016 20:57:26 +0000 (+0000) Subject: [WIN32SS] Try to load the module before fetching an icon, instead of failing on a... X-Git-Tag: ReactOS-0.4.2~361 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=a44dfe6c76a897d9cebaf5177306ad6983bdce55 [WIN32SS] Try to load the module before fetching an icon, instead of failing on a module that is not available in the current process. CORE-10292 #resolve svn path=/trunk/; revision=71609 --- diff --git a/reactos/win32ss/user/user32/windows/cursoricon.c b/reactos/win32ss/user/user32/windows/cursoricon.c index f5a17acd49f..97ce68bf391 100644 --- a/reactos/win32ss/user/user32/windows/cursoricon.c +++ b/reactos/win32ss/user/user32/windows/cursoricon.c @@ -1867,11 +1867,12 @@ CURSORICON_CopyImage( TRACE("Got module %wZ, resource %p (%S).\n", &ustrModule, ustrRsrc.Buffer, IS_INTRESOURCE(ustrRsrc.Buffer) ? L"" : ustrRsrc.Buffer); - /* Get the module handle */ - if (!GetModuleHandleExW(0, ustrModule.Buffer, &hModule)) + /* Get the module handle or load the module */ + hModule = LoadLibraryExW(ustrModule.Buffer, NULL, LOAD_LIBRARY_AS_IMAGE_RESOURCE | LOAD_LIBRARY_AS_DATAFILE); + if (!hModule) { - /* This should never happen */ - ERR("Invalid handle? Module='%wZ', error %lu.\n", &ustrModule, GetLastError()); + DWORD err = GetLastError(); + ERR("Unable to load/use module '%wZ' in process %lu, error %lu.\n", &ustrModule, GetCurrentProcessId(), err); SetLastError(ERROR_INVALID_PARAMETER); goto leave; }