mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 04:30:57 +00:00
kernel32: Added support for GET_MODULE_HANDLE_EX_FLAG_PIN.
This commit is contained in:
parent
4db9cd5f21
commit
9a6567d1a6
|
@ -507,6 +507,7 @@ BOOL WINAPI GetModuleHandleExW( DWORD flags, LPCWSTR name, HMODULE *module )
|
|||
NTSTATUS status = STATUS_SUCCESS;
|
||||
HMODULE ret;
|
||||
ULONG magic;
|
||||
BOOL lock;
|
||||
|
||||
if (!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 ((flags & GET_MODULE_HANDLE_EX_FLAG_PIN) ||
|
||||
!(flags & GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT))
|
||||
lock = (flags & GET_MODULE_HANDLE_EX_FLAG_PIN) || !(flags & GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT);
|
||||
if (lock)
|
||||
LdrLockLoaderLock( 0, NULL, &magic );
|
||||
|
||||
if (!name)
|
||||
|
@ -538,14 +539,13 @@ BOOL WINAPI GetModuleHandleExW( DWORD flags, LPCWSTR name, HMODULE *module )
|
|||
if (status == STATUS_SUCCESS)
|
||||
{
|
||||
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))
|
||||
LdrAddRefDll( 0, ret );
|
||||
}
|
||||
else SetLastError( RtlNtStatusToDosError( status ) );
|
||||
|
||||
if ((flags & GET_MODULE_HANDLE_EX_FLAG_PIN) ||
|
||||
!(flags & GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT))
|
||||
if (lock)
|
||||
LdrUnlockLoaderLock( 0, magic );
|
||||
|
||||
if (status == STATUS_SUCCESS) *module = ret;
|
||||
|
|
Loading…
Reference in a new issue