Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
5f6edba5
Commit
5f6edba5
authored
Sep 28, 2021
by
Paul Gofman
Committed by
Alexandre Julliard
Sep 28, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Don't use loader lock for loading libraries as data files.
Signed-off-by:
Paul Gofman
<
pgofman@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
5c0fe4db
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
loader.c
dlls/kernelbase/loader.c
+13
-10
No files found.
dlls/kernelbase/loader.c
View file @
5f6edba5
...
...
@@ -48,6 +48,14 @@ struct exclusive_datafile
};
static
struct
list
exclusive_datafile_list
=
LIST_INIT
(
exclusive_datafile_list
);
static
CRITICAL_SECTION
exclusive_datafile_list_section
;
static
CRITICAL_SECTION_DEBUG
critsect_debug
=
{
0
,
0
,
&
exclusive_datafile_list_section
,
{
&
critsect_debug
.
ProcessLocksList
,
&
critsect_debug
.
ProcessLocksList
},
0
,
0
,
{
(
DWORD_PTR
)(
__FILE__
": exclusive_datafile_list_section"
)
}
};
static
CRITICAL_SECTION
exclusive_datafile_list_section
=
{
&
critsect_debug
,
-
1
,
0
,
0
,
0
,
0
};
/***********************************************************************
* Modules
...
...
@@ -120,7 +128,9 @@ static BOOL load_library_as_datafile( LPCWSTR load_path, DWORD flags, LPCWSTR na
if
(
!
datafile
)
goto
failed
;
datafile
->
module
=
*
mod_ret
;
datafile
->
file
=
file
;
RtlEnterCriticalSection
(
&
exclusive_datafile_list_section
);
list_add_head
(
&
exclusive_datafile_list
,
&
datafile
->
entry
);
RtlLeaveCriticalSection
(
&
exclusive_datafile_list_section
);
TRACE
(
"delaying close %p for module %p
\n
"
,
datafile
->
file
,
datafile
->
module
);
return
TRUE
;
}
...
...
@@ -154,14 +164,8 @@ static HMODULE load_library( const UNICODE_STRING *libname, DWORD flags )
if
(
flags
&
(
LOAD_LIBRARY_AS_DATAFILE
|
LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE
|
LOAD_LIBRARY_AS_IMAGE_RESOURCE
))
{
ULONG_PTR
magic
;
LdrLockLoaderLock
(
0
,
NULL
,
&
magic
);
if
(
!
LdrGetDllHandle
(
load_path
,
flags
,
libname
,
&
module
))
LdrAddRefDll
(
0
,
module
);
else
if
(
LdrGetDllHandleEx
(
0
,
load_path
,
NULL
,
libname
,
&
module
))
load_library_as_datafile
(
load_path
,
flags
,
libname
->
Buffer
,
&
module
);
LdrUnlockLoaderLock
(
0
,
magic
);
}
else
{
...
...
@@ -242,9 +246,8 @@ BOOL WINAPI DECLSPEC_HOTPATCH FreeLibrary( HINSTANCE module )
if
((
ULONG_PTR
)
module
&
1
)
{
struct
exclusive_datafile
*
file
;
ULONG_PTR
magic
;
LdrLockLoaderLock
(
0
,
NULL
,
&
magic
);
RtlEnterCriticalSection
(
&
exclusive_datafile_list_section
);
LIST_FOR_EACH_ENTRY
(
file
,
&
exclusive_datafile_list
,
struct
exclusive_datafile
,
entry
)
{
if
(
file
->
module
!=
module
)
continue
;
...
...
@@ -254,7 +257,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH FreeLibrary( HINSTANCE module )
HeapFree
(
GetProcessHeap
(),
0
,
file
);
break
;
}
LdrUnlockLoaderLock
(
0
,
magic
);
RtlLeaveCriticalSection
(
&
exclusive_datafile_list_section
);
}
return
UnmapViewOfFile
(
ptr
);
}
...
...
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