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
d3bbd03c
Commit
d3bbd03c
authored
Apr 25, 2017
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Also store dynamic loader information in the PEB on Linux.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b6d32239
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
21 deletions
+64
-21
configure
configure
+2
-0
configure.ac
configure.ac
+2
-0
thread.c
dlls/ntdll/thread.c
+54
-21
config.h.in
include/config.h.in
+6
-0
No files found.
configure
View file @
d3bbd03c
...
...
@@ -6888,6 +6888,7 @@ for ac_header in \
stropts.h
\
sys/asoundlib.h
\
sys/attr.h
\
sys/auxv.h
\
sys/cdio.h
\
sys/elf32.h
\
sys/epoll.h
\
...
...
@@ -15302,6 +15303,7 @@ for ac_func in \
futimes
\
futimesat
\
getattrlist
\
getauxval
\
getopt_long_only
\
getpwuid
\
gettimeofday
\
...
...
configure.ac
View file @
d3bbd03c
...
...
@@ -465,6 +465,7 @@ AC_CHECK_HEADERS(\
stropts.h \
sys/asoundlib.h \
sys/attr.h \
sys/auxv.h \
sys/cdio.h \
sys/elf32.h \
sys/epoll.h \
...
...
@@ -2012,6 +2013,7 @@ AC_CHECK_FUNCS(\
futimes \
futimesat \
getattrlist \
getauxval \
getopt_long_only \
getpwuid \
gettimeofday \
...
...
dlls/ntdll/thread.c
View file @
d3bbd03c
...
...
@@ -185,13 +185,56 @@ done:
return
status
;
}
#ifdef __APPLE__
#ifdef __linux__
#ifdef HAVE_ELF_H
# include <elf.h>
#endif
#ifdef HAVE_LINK_H
# include <link.h>
#endif
#ifdef HAVE_SYS_AUXV_H
# include <sys/auxv.h>
#endif
#ifndef HAVE_GETAUXVAL
static
unsigned
long
getauxval
(
unsigned
long
id
)
{
extern
char
**
__wine_main_environ
;
char
**
ptr
=
__wine_main_environ
;
ElfW
(
auxv_t
)
*
auxv
;
while
(
*
ptr
)
ptr
++
;
while
(
!*
ptr
)
ptr
++
;
for
(
auxv
=
(
ElfW
(
auxv_t
)
*
)
ptr
;
auxv
->
a_type
;
auxv
++
)
if
(
auxv
->
a_type
==
id
)
return
auxv
->
a_un
.
a_val
;
return
0
;
}
#endif
static
ULONG_PTR
get_image_addr
(
void
)
{
ULONG_PTR
size
,
num
,
phdr_addr
=
getauxval
(
AT_PHDR
);
ElfW
(
Phdr
)
*
phdr
;
if
(
!
phdr_addr
)
return
0
;
phdr
=
(
ElfW
(
Phdr
)
*
)
phdr_addr
;
size
=
getauxval
(
AT_PHENT
);
num
=
getauxval
(
AT_PHNUM
);
while
(
num
--
)
{
if
(
phdr
->
p_type
==
PT_PHDR
)
return
phdr_addr
-
phdr
->
p_offset
;
phdr
=
(
ElfW
(
Phdr
)
*
)((
char
*
)
phdr
+
size
);
}
return
0
;
}
#elif defined(__APPLE__)
#include <mach/mach.h>
#include <mach/mach_error.h>
static
ULONG
64
get_dyld_image_info
_addr
(
void
)
static
ULONG
_PTR
get_image
_addr
(
void
)
{
ULONG
64
ret
=
0
;
ULONG
_PTR
ret
=
0
;
#ifdef TASK_DYLD_INFO
struct
task_dyld_info
dyld_info
;
mach_msg_type_number_t
size
=
TASK_DYLD_INFO_COUNT
;
...
...
@@ -200,7 +243,13 @@ static ULONG64 get_dyld_image_info_addr(void)
#endif
return
ret
;
}
#endif
/* __APPLE__ */
#else
static
ULONG_PTR
get_image_addr
(
void
)
{
return
0
;
}
#endif
/***********************************************************************
* thread_init
...
...
@@ -219,9 +268,6 @@ HANDLE thread_init(void)
NTSTATUS
status
;
struct
ntdll_thread_data
*
thread_data
;
static
struct
debug_info
debug_info
;
/* debug info for initial thread */
#ifdef __APPLE__
ULONG64
dyld_image_info
;
#endif
virtual_init
();
...
...
@@ -270,20 +316,7 @@ HANDLE thread_init(void)
InitializeListHead
(
&
ldr
.
InLoadOrderModuleList
);
InitializeListHead
(
&
ldr
.
InMemoryOrderModuleList
);
InitializeListHead
(
&
ldr
.
InInitializationOrderModuleList
);
#ifdef __APPLE__
dyld_image_info
=
get_dyld_image_info_addr
();
#ifdef __LP64__
#ifdef WORDS_BIGENDIAN
peb
->
Reserved
[
1
]
=
dyld_image_info
&
0xFFFFFFFF
;
peb
->
Reserved
[
0
]
=
dyld_image_info
>>
32
;
#else
peb
->
Reserved
[
0
]
=
dyld_image_info
&
0xFFFFFFFF
;
peb
->
Reserved
[
1
]
=
dyld_image_info
>>
32
;
#endif
#else
peb
->
Reserved
[
0
]
=
dyld_image_info
&
0xFFFFFFFF
;
#endif
#endif
*
(
ULONG_PTR
*
)
peb
->
Reserved
=
get_image_addr
();
/*
* Starting with Vista, the first user to log on has session id 1.
...
...
include/config.h.in
View file @
d3bbd03c
...
...
@@ -201,6 +201,9 @@
/* Define to 1 if you have the `getattrlist' function. */
#undef HAVE_GETATTRLIST
/* Define to 1 if you have the `getauxval' function. */
#undef HAVE_GETAUXVAL
/* Define to 1 if you have the `getnameinfo' function. */
#undef HAVE_GETNAMEINFO
...
...
@@ -1035,6 +1038,9 @@
/* Define to 1 if you have the <sys/attr.h> header file. */
#undef HAVE_SYS_ATTR_H
/* Define to 1 if you have the <sys/auxv.h> header file. */
#undef HAVE_SYS_AUXV_H
/* Define to 1 if you have the <sys/cdio.h> header file. */
#undef HAVE_SYS_CDIO_H
...
...
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