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
64781643
Commit
64781643
authored
Feb 02, 2002
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not use the PEB lock as loader lock, use a separate critical
section for that (and for the graphics drivers).
parent
2295e87b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
39 deletions
+43
-39
driver.c
dlls/gdi/driver.c
+11
-11
module.c
loader/module.c
+31
-23
process.c
scheduler/process.c
+1
-4
thread.c
scheduler/thread.c
+0
-1
No files found.
dlls/gdi/driver.c
View file @
64781643
...
...
@@ -27,7 +27,7 @@ struct graphics_driver
static
struct
graphics_driver
*
first_driver
;
static
struct
graphics_driver
*
display_driver
;
static
const
DC_FUNCTIONS
*
win16_driver
;
static
CRITICAL_SECTION
driver_section
=
CRITICAL_SECTION_INIT
(
"driver_section"
);
/**********************************************************************
* create_driver
...
...
@@ -207,13 +207,13 @@ const DC_FUNCTIONS *DRIVER_load_driver( LPCSTR name )
HMODULE
module
;
struct
graphics_driver
*
driver
;
Rtl
AcquirePebLock
(
);
Rtl
EnterCriticalSection
(
&
driver_section
);
/* display driver is a special case */
if
(
!
strcasecmp
(
name
,
"display"
))
{
driver
=
load_display_driver
();
Rtl
ReleasePebLock
(
);
Rtl
LeaveCriticalSection
(
&
driver_section
);
return
&
driver
->
funcs
;
}
...
...
@@ -224,7 +224,7 @@ const DC_FUNCTIONS *DRIVER_load_driver( LPCSTR name )
if
(
driver
->
module
==
module
)
{
driver
->
count
++
;
Rtl
ReleasePebLock
(
);
Rtl
LeaveCriticalSection
(
&
driver_section
);
return
&
driver
->
funcs
;
}
}
...
...
@@ -233,19 +233,19 @@ const DC_FUNCTIONS *DRIVER_load_driver( LPCSTR name )
if
(
!
(
module
=
LoadLibraryA
(
name
)))
{
if
(
!
win16_driver
)
win16_driver
=
WIN16DRV_Init
();
Rtl
ReleasePebLock
(
);
Rtl
LeaveCriticalSection
(
&
driver_section
);
return
win16_driver
;
}
if
(
!
(
driver
=
create_driver
(
module
)))
{
FreeLibrary
(
module
);
Rtl
ReleasePebLock
(
);
Rtl
LeaveCriticalSection
(
&
driver_section
);
return
NULL
;
}
TRACE
(
"loaded driver %p for %s
\n
"
,
driver
,
name
);
Rtl
ReleasePebLock
(
);
Rtl
LeaveCriticalSection
(
&
driver_section
);
return
&
driver
->
funcs
;
}
...
...
@@ -259,7 +259,7 @@ const DC_FUNCTIONS *DRIVER_get_driver( const DC_FUNCTIONS *funcs )
{
struct
graphics_driver
*
driver
;
Rtl
AcquirePebLock
(
);
Rtl
EnterCriticalSection
(
&
driver_section
);
if
(
funcs
!=
win16_driver
)
{
for
(
driver
=
first_driver
;
driver
;
driver
=
driver
->
next
)
...
...
@@ -267,7 +267,7 @@ const DC_FUNCTIONS *DRIVER_get_driver( const DC_FUNCTIONS *funcs )
if
(
!
driver
)
ERR
(
"driver not found, trouble ahead
\n
"
);
driver
->
count
++
;
}
Rtl
ReleasePebLock
(
);
Rtl
LeaveCriticalSection
(
&
driver_section
);
return
funcs
;
}
...
...
@@ -281,7 +281,7 @@ void DRIVER_release_driver( const DC_FUNCTIONS *funcs )
{
struct
graphics_driver
*
driver
;
Rtl
AcquirePebLock
(
);
Rtl
EnterCriticalSection
(
&
driver_section
);
if
(
funcs
==
win16_driver
)
goto
done
;
...
...
@@ -300,7 +300,7 @@ void DRIVER_release_driver( const DC_FUNCTIONS *funcs )
FreeLibrary
(
driver
->
module
);
HeapFree
(
GetProcessHeap
(),
0
,
driver
);
done:
Rtl
ReleasePebLock
(
);
Rtl
LeaveCriticalSection
(
&
driver_section
);
}
...
...
loader/module.c
View file @
64781643
...
...
@@ -29,6 +29,8 @@ static WINE_MODREF *exe_modref;
static
int
free_lib_count
;
/* recursion depth of FreeLibrary calls */
static
int
process_detaching
;
/* set on process detach to avoid deadlocks with thread detach */
static
CRITICAL_SECTION
loader_section
=
CRITICAL_SECTION_INIT
(
"loader_section"
);
/***********************************************************************
* wait_input_idle
*
...
...
@@ -176,9 +178,13 @@ BOOL MODULE_DllProcessAttach( WINE_MODREF *wm, LPVOID lpReserved )
BOOL
retv
=
TRUE
;
int
i
;
Rtl
AcquirePebLock
(
);
Rtl
EnterCriticalSection
(
&
loader_section
);
if
(
!
wm
)
wm
=
exe_modref
;
if
(
!
wm
)
{
wm
=
exe_modref
;
PE_InitTls
();
}
assert
(
wm
);
/* prevent infinite recursion in case of cyclical dependencies */
...
...
@@ -221,7 +227,7 @@ BOOL MODULE_DllProcessAttach( WINE_MODREF *wm, LPVOID lpReserved )
TRACE
(
"(%s,%p) - END
\n
"
,
wm
->
modname
,
lpReserved
);
done:
Rtl
ReleasePebLock
(
);
Rtl
LeaveCriticalSection
(
&
loader_section
);
return
retv
;
}
...
...
@@ -236,7 +242,7 @@ void MODULE_DllProcessDetach( BOOL bForceDetach, LPVOID lpReserved )
{
WINE_MODREF
*
wm
;
Rtl
AcquirePebLock
(
);
Rtl
EnterCriticalSection
(
&
loader_section
);
if
(
bForceDetach
)
process_detaching
=
1
;
do
{
...
...
@@ -258,7 +264,7 @@ void MODULE_DllProcessDetach( BOOL bForceDetach, LPVOID lpReserved )
}
}
while
(
wm
);
Rtl
ReleasePebLock
(
);
Rtl
LeaveCriticalSection
(
&
loader_section
);
}
/*************************************************************************
...
...
@@ -276,7 +282,9 @@ void MODULE_DllThreadAttach( LPVOID lpReserved )
if
(
process_detaching
)
return
;
/* FIXME: there is still a race here */
RtlAcquirePebLock
();
RtlEnterCriticalSection
(
&
loader_section
);
PE_InitTls
();
for
(
wm
=
MODULE_modref_list
;
wm
;
wm
=
wm
->
next
)
if
(
!
wm
->
next
)
...
...
@@ -292,7 +300,7 @@ void MODULE_DllThreadAttach( LPVOID lpReserved )
MODULE_InitDLL
(
wm
,
DLL_THREAD_ATTACH
,
lpReserved
);
}
Rtl
ReleasePebLock
(
);
Rtl
LeaveCriticalSection
(
&
loader_section
);
}
/*************************************************************************
...
...
@@ -310,7 +318,7 @@ void MODULE_DllThreadDetach( LPVOID lpReserved )
if
(
process_detaching
)
return
;
/* FIXME: there is still a race here */
Rtl
AcquirePebLock
(
);
Rtl
EnterCriticalSection
(
&
loader_section
);
for
(
wm
=
MODULE_modref_list
;
wm
;
wm
=
wm
->
next
)
{
...
...
@@ -322,7 +330,7 @@ void MODULE_DllThreadDetach( LPVOID lpReserved )
MODULE_InitDLL
(
wm
,
DLL_THREAD_DETACH
,
lpReserved
);
}
Rtl
ReleasePebLock
(
);
Rtl
LeaveCriticalSection
(
&
loader_section
);
}
/****************************************************************************
...
...
@@ -335,7 +343,7 @@ BOOL WINAPI DisableThreadLibraryCalls( HMODULE hModule )
WINE_MODREF
*
wm
;
BOOL
retval
=
TRUE
;
Rtl
AcquirePebLock
(
);
Rtl
EnterCriticalSection
(
&
loader_section
);
wm
=
MODULE32_LookupHMODULE
(
hModule
);
if
(
!
wm
)
...
...
@@ -343,7 +351,7 @@ BOOL WINAPI DisableThreadLibraryCalls( HMODULE hModule )
else
wm
->
flags
|=
WINE_MODREF_NO_DLL_CALLS
;
Rtl
ReleasePebLock
(
);
Rtl
LeaveCriticalSection
(
&
loader_section
);
return
retval
;
}
...
...
@@ -1231,13 +1239,13 @@ DWORD WINAPI GetModuleFileNameA(
{
WINE_MODREF
*
wm
;
Rtl
AcquirePebLock
(
);
Rtl
EnterCriticalSection
(
&
loader_section
);
lpFileName
[
0
]
=
0
;
if
((
wm
=
MODULE32_LookupHMODULE
(
hModule
)))
lstrcpynA
(
lpFileName
,
wm
->
filename
,
size
);
Rtl
ReleasePebLock
(
);
Rtl
LeaveCriticalSection
(
&
loader_section
);
TRACE
(
"%s
\n
"
,
lpFileName
);
return
strlen
(
lpFileName
);
}
...
...
@@ -1304,7 +1312,7 @@ HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags)
/* Fallback to normal behaviour */
}
Rtl
AcquirePebLock
(
);
Rtl
EnterCriticalSection
(
&
loader_section
);
wm
=
MODULE_LoadLibraryExA
(
libname
,
hfile
,
flags
);
if
(
wm
)
...
...
@@ -1318,7 +1326,7 @@ HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags)
}
}
Rtl
ReleasePebLock
(
);
Rtl
LeaveCriticalSection
(
&
loader_section
);
return
wm
?
wm
->
module
:
0
;
}
...
...
@@ -1392,7 +1400,7 @@ WINE_MODREF *MODULE_LoadLibraryExA( LPCSTR libname, HFILE hfile, DWORD flags )
if
(
!
filename
)
return
NULL
;
*
filename
=
0
;
/* Just in case we don't set it before goto error */
Rtl
AcquirePebLock
(
);
Rtl
EnterCriticalSection
(
&
loader_section
);
if
((
flags
&
LOAD_WITH_ALTERED_SEARCH_PATH
)
&&
FILE_contains_path
(
libname
))
{
...
...
@@ -1470,7 +1478,7 @@ WINE_MODREF *MODULE_LoadLibraryExA( LPCSTR libname, HFILE hfile, DWORD flags )
HeapFree
(
GetProcessHeap
(),
0
,
(
LPSTR
)
libdir
);
libdir
=
NULL
;
}
Rtl
ReleasePebLock
(
);
Rtl
LeaveCriticalSection
(
&
loader_section
);
HeapFree
(
GetProcessHeap
(),
0
,
filename
);
return
pwm
;
}
...
...
@@ -1522,7 +1530,7 @@ WINE_MODREF *MODULE_LoadLibraryExA( LPCSTR libname, HFILE hfile, DWORD flags )
HeapFree
(
GetProcessHeap
(),
0
,
(
LPSTR
)
libdir
);
libdir
=
NULL
;
}
Rtl
ReleasePebLock
(
);
Rtl
LeaveCriticalSection
(
&
loader_section
);
SetLastError
(
err
);
/* restore last error */
HeapFree
(
GetProcessHeap
(),
0
,
filename
);
return
pwm
;
...
...
@@ -1538,7 +1546,7 @@ WINE_MODREF *MODULE_LoadLibraryExA( LPCSTR libname, HFILE hfile, DWORD flags )
HeapFree
(
GetProcessHeap
(),
0
,
(
LPSTR
)
libdir
);
libdir
=
NULL
;
}
Rtl
ReleasePebLock
(
);
Rtl
LeaveCriticalSection
(
&
loader_section
);
WARN
(
"Failed to load module '%s'; error=0x%08lx
\n
"
,
filename
,
GetLastError
());
HeapFree
(
GetProcessHeap
(),
0
,
filename
);
return
NULL
;
...
...
@@ -1645,13 +1653,13 @@ BOOL WINAPI FreeLibrary(HINSTANCE hLibModule)
return
TRUE
;
}
Rtl
AcquirePebLock
(
);
Rtl
EnterCriticalSection
(
&
loader_section
);
free_lib_count
++
;
if
((
wm
=
MODULE32_LookupHMODULE
(
hLibModule
)))
retv
=
MODULE_FreeLibrary
(
wm
);
free_lib_count
--
;
Rtl
ReleasePebLock
(
);
Rtl
LeaveCriticalSection
(
&
loader_section
);
return
retv
;
}
...
...
@@ -1829,13 +1837,13 @@ FARPROC MODULE_GetProcAddress(
else
TRACE_
(
win32
)(
"(%08lx,%p)
\n
"
,(
DWORD
)
hModule
,
function
);
Rtl
AcquirePebLock
(
);
Rtl
EnterCriticalSection
(
&
loader_section
);
if
((
wm
=
MODULE32_LookupHMODULE
(
hModule
)))
{
retproc
=
wm
->
find_export
(
wm
,
function
,
snoop
);
if
(
!
retproc
)
SetLastError
(
ERROR_PROC_NOT_FOUND
);
}
Rtl
ReleasePebLock
(
);
Rtl
LeaveCriticalSection
(
&
loader_section
);
return
retproc
;
}
...
...
scheduler/process.c
View file @
64781643
...
...
@@ -111,7 +111,7 @@ extern void PTHREAD_init_done(void);
extern
BOOL
MAIN_MainInit
(
void
);
typedef
WORD
WINAPI
(
*
pUserSignalProc
)(
UINT
,
DWORD
,
DWORD
,
HMODULE16
);
typedef
WORD
(
WINAPI
*
pUserSignalProc
)(
UINT
,
DWORD
,
DWORD
,
HMODULE16
);
/***********************************************************************
* PROCESS_CallUserSignalProc
...
...
@@ -367,10 +367,7 @@ static void start_process(void)
if
(
main_exe_file
)
CloseHandle
(
main_exe_file
);
/* we no longer need it */
RtlAcquirePebLock
();
PE_InitTls
();
MODULE_DllProcessAttach
(
NULL
,
(
LPVOID
)
1
);
RtlReleasePebLock
();
/* Note: The USIG_PROCESS_CREATE signal is supposed to be sent in the
* context of the parent process. Actually, the USER signal proc
...
...
scheduler/thread.c
View file @
64781643
...
...
@@ -247,7 +247,6 @@ static void THREAD_Start(void)
DPRINTF
(
"%08lx:Starting thread (entryproc=%p)
\n
"
,
GetCurrentThreadId
(),
func
);
PROCESS_CallUserSignalProc
(
USIG_THREAD_INIT
,
0
);
PE_InitTls
();
MODULE_DllThreadAttach
(
NULL
);
ExitThread
(
func
(
NtCurrentTeb
()
->
entry_arg
)
);
}
...
...
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