Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
4e50b617
Commit
4e50b617
authored
Sep 27, 2021
by
Paul Gofman
Committed by
Alexandre Julliard
Sep 27, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Don't use LdrLockLoaderLock() in GetModuleHandleExW().
Signed-off-by:
Paul Gofman
<
pgofman@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
7ddd79b8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
25 deletions
+20
-25
loader.c
dlls/kernelbase/loader.c
+20
-25
No files found.
dlls/kernelbase/loader.c
View file @
4e50b617
...
@@ -373,10 +373,9 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetModuleHandleExA( DWORD flags, LPCSTR name, HMOD
...
@@ -373,10 +373,9 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetModuleHandleExA( DWORD flags, LPCSTR name, HMOD
*/
*/
BOOL
WINAPI
DECLSPEC_HOTPATCH
GetModuleHandleExW
(
DWORD
flags
,
LPCWSTR
name
,
HMODULE
*
module
)
BOOL
WINAPI
DECLSPEC_HOTPATCH
GetModuleHandleExW
(
DWORD
flags
,
LPCWSTR
name
,
HMODULE
*
module
)
{
{
NTSTATUS
status
=
STATUS_SUCCESS
;
HMODULE
ret
=
NULL
;
HMODULE
ret
=
NULL
;
ULONG_PTR
magic
;
NTSTATUS
status
;
BOOL
lock
;
void
*
dummy
;
if
(
!
module
)
if
(
!
module
)
{
{
...
@@ -394,36 +393,32 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetModuleHandleExW( DWORD flags, LPCWSTR name, HMO
...
@@ -394,36 +393,32 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetModuleHandleExW( DWORD flags, LPCWSTR name, HMO
return
FALSE
;
return
FALSE
;
}
}
/* if we are messing with the refcount, grab the loader lock */
if
(
name
&&
!
(
flags
&
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
))
lock
=
(
flags
&
GET_MODULE_HANDLE_EX_FLAG_PIN
)
||
!
(
flags
&
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT
);
if
(
lock
)
LdrLockLoaderLock
(
0
,
NULL
,
&
magic
);
if
(
!
name
)
{
ret
=
NtCurrentTeb
()
->
Peb
->
ImageBaseAddress
;
}
else
if
(
flags
&
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
)
{
void
*
dummy
;
if
(
!
(
ret
=
RtlPcToFileHeader
(
(
void
*
)
name
,
&
dummy
)))
status
=
STATUS_DLL_NOT_FOUND
;
}
else
{
{
UNICODE_STRING
wstr
;
UNICODE_STRING
wstr
;
ULONG
ldr_flags
=
0
;
if
(
flags
&
GET_MODULE_HANDLE_EX_FLAG_PIN
)
ldr_flags
|=
LDR_GET_DLL_HANDLE_EX_FLAG_PIN
;
if
(
flags
&
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT
)
ldr_flags
|=
LDR_GET_DLL_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT
;
RtlInitUnicodeString
(
&
wstr
,
name
);
RtlInitUnicodeString
(
&
wstr
,
name
);
status
=
LdrGetDllHandle
(
NULL
,
0
,
&
wstr
,
&
ret
);
status
=
LdrGetDllHandle
Ex
(
ldr_flags
,
NULL
,
NULL
,
&
wstr
,
&
ret
);
}
}
else
{
ret
=
name
?
RtlPcToFileHeader
(
(
void
*
)
name
,
&
dummy
)
:
NtCurrentTeb
()
->
Peb
->
ImageBaseAddress
;
if
(
status
==
STATUS_SUCCESS
)
if
(
ret
)
{
{
if
(
flags
&
GET_MODULE_HANDLE_EX_FLAG_PIN
)
if
(
!
(
flags
&
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT
))
LdrAddRefDll
(
LDR_ADDREF_DLL_PIN
,
ret
);
status
=
LdrAddRefDll
(
flags
&
GET_MODULE_HANDLE_EX_FLAG_PIN
?
LDR_ADDREF_DLL_PIN
:
0
,
ret
);
else
if
(
!
(
flags
&
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT
))
else
LdrAddRefDll
(
0
,
ret
);
status
=
STATUS_SUCCESS
;
}
else
status
=
STATUS_DLL_NOT_FOUND
;
}
}
if
(
lock
)
LdrUnlockLoaderLock
(
0
,
magic
);
*
module
=
ret
;
*
module
=
ret
;
return
set_ntstatus
(
status
);
return
set_ntstatus
(
status
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment