Ken Thomases : ntdll: On Mac, store the dyld image info address in the PEB.

Alexandre Julliard julliard at winehq.org
Fri Jan 10 14:44:57 CST 2014


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

Author: Ken Thomases <ken at codeweavers.com>
Date:   Wed Dec  4 16:07:55 2013 -0600

ntdll: On Mac, store the dyld image info address in the PEB.

(cherry picked from commit 22cf68e1bc079c05ad4bf9397c48f6065019d5e3)

---

 dlls/ntdll/thread.c |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 703e83c..ca5c8f9 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -186,6 +186,23 @@ done:
     return status;
 }
 
+#ifdef __APPLE__
+#include <mach/mach.h>
+#include <mach/mach_error.h>
+
+static ULONG get_dyld_image_info_addr(void)
+{
+    ULONG ret = 0;
+#ifdef TASK_DYLD_INFO
+    struct task_dyld_info dyld_info;
+    mach_msg_type_number_t size = TASK_DYLD_INFO_COUNT;
+    if (task_info(mach_task_self(), TASK_DYLD_INFO, (task_info_t)&dyld_info, &size) == KERN_SUCCESS)
+        ret = dyld_info.all_image_info_addr;
+#endif
+    return ret;
+}
+#endif  /* __APPLE__ */
+
 /***********************************************************************
  *           thread_init
  *
@@ -245,6 +262,9 @@ HANDLE thread_init(void)
     InitializeListHead( &ldr.InMemoryOrderModuleList );
     InitializeListHead( &ldr.InInitializationOrderModuleList );
     InitializeListHead( &tls_links );
+#ifdef __APPLE__
+    peb->Reserved[0] = get_dyld_image_info_addr();
+#endif
 
     /* allocate and initialize the initial TEB */
 




More information about the wine-cvs mailing list