Alexandre Julliard : ntdll: Store debug options in the PEB memory block.

Alexandre Julliard julliard at winehq.org
Mon May 24 15:59:53 CDT 2021


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon May 24 21:29:14 2021 +0200

ntdll: Store debug options in the PEB memory block.

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

---

 dlls/ntdll/unix/debug.c   | 11 +++++++++++
 dlls/ntdll/unix/virtual.c |  3 ---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/dlls/ntdll/unix/debug.c b/dlls/ntdll/unix/debug.c
index e6c3f67523e..71e4acc483a 100644
--- a/dlls/ntdll/unix/debug.c
+++ b/dlls/ntdll/unix/debug.c
@@ -292,7 +292,18 @@ int __cdecl __wine_dbg_header( enum __wine_debug_class cls, struct __wine_debug_
  */
 void dbg_init(void)
 {
+    struct __wine_debug_channel *options, default_option = { default_flags };
+
     setbuf( stdout, NULL );
     setbuf( stderr, NULL );
+
+    if (nb_debug_options == -1) init_options();
+
+    options = (struct __wine_debug_channel *)((char *)NtCurrentTeb()->Peb + (is_win64 ? 2 : 1) * page_size);
+    memcpy( options, debug_options, nb_debug_options * sizeof(*options) );
+    free( debug_options );
+    debug_options = options;
+    options[nb_debug_options] = default_option;
+    ntdll_get_thread_data()->debug_info = (struct debug_info *)(options + nb_debug_options + 1);
     init_done = TRUE;
 }
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
index bcab898b0fc..4c26e807918 100644
--- a/dlls/ntdll/unix/virtual.c
+++ b/dlls/ntdll/unix/virtual.c
@@ -2894,7 +2894,6 @@ static TEB *init_teb( void *ptr, PEB *peb, BOOL is_wow )
  */
 TEB *virtual_alloc_first_teb(void)
 {
-    struct ntdll_thread_data *thread_data;
     TEB *teb;
     PEB *peb;
     void *ptr;
@@ -2921,8 +2920,6 @@ TEB *virtual_alloc_first_teb(void)
     peb = init_peb( (char *)teb_block + 31 * block_size );
     teb = init_teb( ptr, peb, FALSE );
     *(ULONG_PTR *)&peb->CloudFileFlags = get_image_address();
-    thread_data = (struct ntdll_thread_data *)&teb->GdiTebBatch;
-    thread_data->debug_info = (struct debug_info *)((char *)teb_block + 31 * block_size + 2 * page_size);
     return teb;
 }
 




More information about the wine-cvs mailing list