Commit 9a6567d1 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

kernel32: Added support for GET_MODULE_HANDLE_EX_FLAG_PIN.

parent 4db9cd5f
...@@ -507,6 +507,7 @@ BOOL WINAPI GetModuleHandleExW( DWORD flags, LPCWSTR name, HMODULE *module ) ...@@ -507,6 +507,7 @@ BOOL WINAPI GetModuleHandleExW( DWORD flags, LPCWSTR name, HMODULE *module )
NTSTATUS status = STATUS_SUCCESS; NTSTATUS status = STATUS_SUCCESS;
HMODULE ret; HMODULE ret;
ULONG magic; ULONG magic;
BOOL lock;
if (!module) if (!module)
{ {
...@@ -515,8 +516,8 @@ BOOL WINAPI GetModuleHandleExW( DWORD flags, LPCWSTR name, HMODULE *module ) ...@@ -515,8 +516,8 @@ BOOL WINAPI GetModuleHandleExW( DWORD flags, LPCWSTR name, HMODULE *module )
} }
/* if we are messing with the refcount, grab the loader lock */ /* if we are messing with the refcount, grab the loader lock */
if ((flags & GET_MODULE_HANDLE_EX_FLAG_PIN) || lock = (flags & GET_MODULE_HANDLE_EX_FLAG_PIN) || !(flags & GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT);
!(flags & GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT)) if (lock)
LdrLockLoaderLock( 0, NULL, &magic ); LdrLockLoaderLock( 0, NULL, &magic );
if (!name) if (!name)
...@@ -538,14 +539,13 @@ BOOL WINAPI GetModuleHandleExW( DWORD flags, LPCWSTR name, HMODULE *module ) ...@@ -538,14 +539,13 @@ BOOL WINAPI GetModuleHandleExW( DWORD flags, LPCWSTR name, HMODULE *module )
if (status == STATUS_SUCCESS) if (status == STATUS_SUCCESS)
{ {
if (flags & GET_MODULE_HANDLE_EX_FLAG_PIN) if (flags & GET_MODULE_HANDLE_EX_FLAG_PIN)
FIXME( "should pin refcount for %p\n", ret ); LdrAddRefDll( LDR_ADDREF_DLL_PIN, ret );
else if (!(flags & GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT)) else if (!(flags & GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT))
LdrAddRefDll( 0, ret ); LdrAddRefDll( 0, ret );
} }
else SetLastError( RtlNtStatusToDosError( status ) ); else SetLastError( RtlNtStatusToDosError( status ) );
if ((flags & GET_MODULE_HANDLE_EX_FLAG_PIN) || if (lock)
!(flags & GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT))
LdrUnlockLoaderLock( 0, magic ); LdrUnlockLoaderLock( 0, magic );
if (status == STATUS_SUCCESS) *module = ret; if (status == STATUS_SUCCESS) *module = ret;
......
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