Set last error to ERROR_PROC_NOT_FOUND in case of NULL module in GetProcAddress

Check for error when freeing datafile
Fixes 2 winetests

svn path=/trunk/; revision=51104
This commit is contained in:
Rafal Harabien 2011-03-21 14:16:01 +00:00
parent 073c778dcb
commit 8fb7057c46

View file

@ -310,6 +310,12 @@ GetProcAddress( HMODULE hModule, LPCSTR lpProcName )
FARPROC fnExp = NULL; FARPROC fnExp = NULL;
NTSTATUS Status; NTSTATUS Status;
if (!hModule)
{
SetLastError(ERROR_PROC_NOT_FOUND);
return NULL;
}
if (HIWORD(lpProcName) != 0) if (HIWORD(lpProcName) != 0)
{ {
RtlInitAnsiString (&ProcedureName, RtlInitAnsiString (&ProcedureName,
@ -354,8 +360,7 @@ BOOL WINAPI FreeLibrary(HINSTANCE hLibModule)
{ {
/* this is a LOAD_LIBRARY_AS_DATAFILE module */ /* this is a LOAD_LIBRARY_AS_DATAFILE module */
char *ptr = (char *)hLibModule - 1; char *ptr = (char *)hLibModule - 1;
UnmapViewOfFile(ptr); return UnmapViewOfFile(ptr);
return TRUE;
} }
Status = LdrUnloadDll(hLibModule); Status = LdrUnloadDll(hLibModule);