Alexandre Julliard : ntdll: Store the PEB lock pointer in the PEB.

Alexandre Julliard julliard at winehq.org
Thu Aug 31 14:20:46 CDT 2017


Module: wine
Branch: master
Commit: b31583770f074ca343e00f6c2be19b831d6ad90e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b31583770f074ca343e00f6c2be19b831d6ad90e

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Aug 31 10:01:04 2017 +0200

ntdll: Store the PEB lock pointer in the PEB.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/rtl.c    | 13 ++-----------
 dlls/ntdll/thread.c | 10 ++++++++++
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c
index b0ea413..e56eec8 100644
--- a/dlls/ntdll/rtl.c
+++ b/dlls/ntdll/rtl.c
@@ -49,15 +49,6 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
 
-static RTL_CRITICAL_SECTION peb_lock;
-static RTL_CRITICAL_SECTION_DEBUG critsect_debug =
-{
-    0, 0, &peb_lock,
-    { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
-      0, 0, { (DWORD_PTR)(__FILE__ ": peb_lock") }
-};
-static RTL_CRITICAL_SECTION peb_lock = { &critsect_debug, -1, 0, 0, 0, 0 };
-
 #ifdef __i386__
 #define DEFINE_FASTCALL4_ENTRYPOINT( name ) \
     __ASM_STDCALL_FUNC( name, 16, \
@@ -380,7 +371,7 @@ NTSTATUS WINAPI vDbgPrintExWithPrefix( LPCSTR prefix, ULONG id, ULONG level, LPC
  */
 VOID WINAPI RtlAcquirePebLock(void)
 {
-    RtlEnterCriticalSection( &peb_lock );
+    RtlEnterCriticalSection( NtCurrentTeb()->Peb->FastPebLock );
 }
 
 /******************************************************************************
@@ -388,7 +379,7 @@ VOID WINAPI RtlAcquirePebLock(void)
  */
 VOID WINAPI RtlReleasePebLock(void)
 {
-    RtlLeaveCriticalSection( &peb_lock );
+    RtlLeaveCriticalSection( NtCurrentTeb()->Peb->FastPebLock );
 }
 
 /******************************************************************************
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index ba1be0f..6ded7ea 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -69,6 +69,15 @@ static RTL_BITMAP tls_expansion_bitmap;
 static RTL_BITMAP fls_bitmap;
 static int nb_threads = 1;
 
+static RTL_CRITICAL_SECTION peb_lock;
+static RTL_CRITICAL_SECTION_DEBUG critsect_debug =
+{
+    0, 0, &peb_lock,
+    { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
+      0, 0, { (DWORD_PTR)(__FILE__ ": peb_lock") }
+};
+static RTL_CRITICAL_SECTION peb_lock = { &critsect_debug, -1, 0, 0, 0, 0 };
+
 /***********************************************************************
  *           get_unicode_string
  *
@@ -292,6 +301,7 @@ HANDLE thread_init(void)
                              MEM_COMMIT | MEM_TOP_DOWN, PAGE_READWRITE );
     peb = addr;
 
+    peb->FastPebLock        = &peb_lock;
     peb->ProcessParameters  = ¶ms;
     peb->TlsBitmap          = &tls_bitmap;
     peb->TlsExpansionBitmap = &tls_expansion_bitmap;




More information about the wine-cvs mailing list