Commit f96c7278 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

kernel32: Clear the module handle on failure in GetModuleHandleEx.

parent e8a95bf6
......@@ -548,7 +548,9 @@ BOOL WINAPI GetModuleHandleExW( DWORD flags, LPCWSTR name, HMODULE *module )
!(flags & GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT))
LdrUnlockLoaderLock( 0, magic );
*module = ret;
if (status == STATUS_SUCCESS) *module = ret;
else *module = NULL;
return (status == STATUS_SUCCESS);
}
......
......@@ -540,7 +540,7 @@ static void testGetModuleHandleEx(void)
error = GetLastError();
ok( !ret, "unexpected success\n" );
ok( error == ERROR_MOD_NOT_FOUND, "got %u\n", error );
todo_wine ok( mod == NULL, "got %p\n", mod );
ok( mod == NULL, "got %p\n", mod );
SetLastError( 0xdeadbeef );
ret = pGetModuleHandleExW( 0, NULL, NULL );
......@@ -567,7 +567,7 @@ static void testGetModuleHandleEx(void)
error = GetLastError();
ok( !ret, "unexpected success\n" );
ok( error == ERROR_MOD_NOT_FOUND, "got %u\n", error );
todo_wine ok( mod == NULL, "got %p\n", mod );
ok( mod == NULL, "got %p\n", mod );
SetLastError( 0xdeadbeef );
ret = pGetModuleHandleExA( GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, NULL, NULL );
......@@ -593,7 +593,7 @@ static void testGetModuleHandleEx(void)
error = GetLastError();
ok( !ret, "unexpected success\n" );
ok( error == ERROR_MOD_NOT_FOUND, "got %u\n", error );
todo_wine ok( mod == NULL, "got %p\n", mod );
ok( mod == NULL, "got %p\n", mod );
SetLastError( 0xdeadbeef );
ret = pGetModuleHandleExW( GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, NULL, NULL );
......@@ -619,7 +619,7 @@ static void testGetModuleHandleEx(void)
error = GetLastError();
ok( !ret, "unexpected success\n" );
ok( error == ERROR_MOD_NOT_FOUND, "got %u\n", error );
todo_wine ok( mod == NULL, "got %p\n", mod );
ok( mod == NULL, "got %p\n", mod );
mod_kernel32 = LoadLibraryA( "kernel32" );
......
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