Hans Leidekker : kernel32: Clear the module handle on failure in GetModuleHandleEx.
Alexandre Julliard
julliard at winehq.org
Thu Apr 5 12:31:45 CDT 2012
Module: wine
Branch: master
Commit: f96c7278e72a28f96ddb535de8746f4a9780fc9f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f96c7278e72a28f96ddb535de8746f4a9780fc9f
Author: Hans Leidekker <hans at codeweavers.com>
Date: Thu Apr 5 11:16:08 2012 +0200
kernel32: Clear the module handle on failure in GetModuleHandleEx.
---
dlls/kernel32/module.c | 4 +++-
dlls/kernel32/tests/module.c | 8 ++++----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/dlls/kernel32/module.c b/dlls/kernel32/module.c
index 739392f..d4978cf 100644
--- a/dlls/kernel32/module.c
+++ b/dlls/kernel32/module.c
@@ -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);
}
diff --git a/dlls/kernel32/tests/module.c b/dlls/kernel32/tests/module.c
index 30da85f..f88c8cb 100644
--- a/dlls/kernel32/tests/module.c
+++ b/dlls/kernel32/tests/module.c
@@ -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" );
More information about the wine-cvs
mailing list