Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
8220bc9d
Commit
8220bc9d
authored
Oct 11, 1998
by
Marcus Meissner
Committed by
Alexandre Julliard
Oct 11, 1998
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generic dynamic dll loader using dl*() API.
Includes: stdcall->cdecl mapping ability, snooping. (Tested only with glide2x.dll -> libglide2x.so)
parent
8deb379f
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
417 additions
and
83 deletions
+417
-83
configure
configure
+123
-76
configure.in
configure.in
+3
-1
config.h.in
include/config.h.in
+6
-0
module.h
include/module.h
+2
-1
pe_image.h
include/pe_image.h
+23
-0
peexe.h
include/peexe.h
+1
-0
Makefile.in
loader/Makefile.in
+1
-0
elf.c
loader/elf.c
+242
-0
module.c
loader/module.c
+14
-3
pe_image.c
loader/pe_image.c
+2
-2
No files found.
configure
View file @
8220bc9d
...
...
@@ -2117,8 +2117,55 @@ else
echo
"
$ac_t
""no"
1>&6
fi
echo
$ac_n
"checking for dlopen in -ldl""...
$ac_c
"
1>&6
echo
"configure:2122: checking for dlopen in -ldl"
>
&5
ac_lib_var
=
`
echo
dl
'_'
dlopen |
sed
'y%./+-%__p_%'
`
if
eval
"test
\"
`
echo
'$''{'
ac_cv_lib_
$ac_lib_var
'+set}'
`
\"
= set"
;
then
echo
$ac_n
"(cached)
$ac_c
"
1>&6
else
ac_save_LIBS
=
"
$LIBS
"
LIBS
=
"-ldl
$LIBS
"
cat
>
conftest.
$ac_ext
<<
EOF
#line 2130 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char dlopen();
int main() {
dlopen()
; return 0; }
EOF
if
{
(
eval echo
configure:2141:
\"
$ac_link
\"
)
1>&5
;
(
eval
$ac_link
)
2>&5
;
}
&&
test
-s
conftest
;
then
rm
-rf
conftest
*
eval
"ac_cv_lib_
$ac_lib_var
=yes"
else
echo
"configure: failed program was:"
>
&5
cat
conftest.
$ac_ext
>
&5
rm
-rf
conftest
*
eval
"ac_cv_lib_
$ac_lib_var
=no"
fi
rm
-f
conftest
*
LIBS
=
"
$ac_save_LIBS
"
fi
if
eval
"test
\"
`
echo
'$ac_cv_lib_'
$ac_lib_var
`
\"
= yes"
;
then
echo
"
$ac_t
""yes"
1>&6
ac_tr_lib
=
HAVE_LIB
`
echo
dl |
sed
-e
's/[^a-zA-Z0-9_]/_/g'
\
-e
'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'
`
cat
>>
confdefs.h
<<
EOF
#define
$ac_tr_lib
1
EOF
LIBS
=
"-ldl
$LIBS
"
else
echo
"
$ac_t
""no"
1>&6
fi
echo
$ac_n
"checking for XF86DGAQueryExtension in -lXxf86dga""...
$ac_c
"
1>&6
echo
"configure:21
22
: checking for XF86DGAQueryExtension in -lXxf86dga"
>
&5
echo
"configure:21
69
: checking for XF86DGAQueryExtension in -lXxf86dga"
>
&5
ac_lib_var
=
`
echo
Xxf86dga
'_'
XF86DGAQueryExtension |
sed
'y%./+-%__p_%'
`
if
eval
"test
\"
`
echo
'$''{'
ac_cv_lib_
$ac_lib_var
'+set}'
`
\"
= set"
;
then
echo
$ac_n
"(cached)
$ac_c
"
1>&6
...
...
@@ -2126,7 +2173,7 @@ else
ac_save_LIBS
=
"
$LIBS
"
LIBS
=
"-lXxf86dga
$X_LIBS
-lXext -lX11
$LIBS
"
cat
>
conftest.
$ac_ext
<<
EOF
#line 21
30
"configure"
#line 21
77
"configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
...
...
@@ -2137,7 +2184,7 @@ int main() {
XF86DGAQueryExtension()
; return 0; }
EOF
if
{
(
eval echo
configure:21
41
:
\"
$ac_link
\"
)
1>&5
;
(
eval
$ac_link
)
2>&5
;
}
&&
test
-s
conftest
;
then
if
{
(
eval echo
configure:21
88
:
\"
$ac_link
\"
)
1>&5
;
(
eval
$ac_link
)
2>&5
;
}
&&
test
-s
conftest
;
then
rm
-rf
conftest
*
eval
"ac_cv_lib_
$ac_lib_var
=yes"
else
...
...
@@ -2165,17 +2212,17 @@ for ac_hdr in sys/soundcard.h machine/soundcard.h
do
ac_safe
=
`
echo
"
$ac_hdr
"
|
sed
'y%./+-%__p_%'
`
echo
$ac_n
"checking for
$ac_hdr
""...
$ac_c
"
1>&6
echo
"configure:2
169
: checking for
$ac_hdr
"
>
&5
echo
"configure:2
216
: checking for
$ac_hdr
"
>
&5
if
eval
"test
\"
`
echo
'$''{'
ac_cv_header_
$ac_safe
'+set}'
`
\"
= set"
;
then
echo
$ac_n
"(cached)
$ac_c
"
1>&6
else
cat
>
conftest.
$ac_ext
<<
EOF
#line 2
174
"configure"
#line 2
221
"configure"
#include "confdefs.h"
#include <
$ac_hdr
>
EOF
ac_try
=
"
$ac_cpp
conftest.
$ac_ext
>/dev/null 2>conftest.out"
{
(
eval echo
configure:2
179
:
\"
$ac_try
\"
)
1>&5
;
(
eval
$ac_try
)
2>&5
;
}
{
(
eval echo
configure:2
226
:
\"
$ac_try
\"
)
1>&5
;
(
eval
$ac_try
)
2>&5
;
}
ac_err
=
`
grep
-v
'^ *+'
conftest.out
`
if
test
-z
"
$ac_err
"
;
then
rm
-rf
conftest
*
...
...
@@ -2203,12 +2250,12 @@ done
echo
$ac_n
"checking "
for
Open Sound System
"""...
$ac_c
"
1>&6
echo
"configure:22
07
: checking "
for
Open Sound System
""
>
&5
echo
"configure:22
54
: checking "
for
Open Sound System
""
>
&5
if
eval
"test
\"
`
echo
'$''{'
ac_cv_c_opensoundsystem
'+set}'
`
\"
= set"
;
then
echo
$ac_n
"(cached)
$ac_c
"
1>&6
else
cat
>
conftest.
$ac_ext
<<
EOF
#line 22
12
"configure"
#line 22
59
"configure"
#include "confdefs.h"
#ifdef HAVE_SYS_SOUNDCARD_H
...
...
@@ -2228,7 +2275,7 @@ int main() {
; return 0; }
EOF
if
{
(
eval echo
configure:22
32
:
\"
$ac_compile
\"
)
1>&5
;
(
eval
$ac_compile
)
2>&5
;
}
;
then
if
{
(
eval echo
configure:22
79
:
\"
$ac_compile
\"
)
1>&5
;
(
eval
$ac_compile
)
2>&5
;
}
;
then
rm
-rf
conftest
*
ac_cv_c_opensoundsystem
=
"yes"
else
...
...
@@ -2252,12 +2299,12 @@ fi
echo
$ac_n
"checking "
for
union semun
"""...
$ac_c
"
1>&6
echo
"configure:2
256
: checking "
for
union semun
""
>
&5
echo
"configure:2
303
: checking "
for
union semun
""
>
&5
if
eval
"test
\"
`
echo
'$''{'
ac_cv_c_union_semun
'+set}'
`
\"
= set"
;
then
echo
$ac_n
"(cached)
$ac_c
"
1>&6
else
cat
>
conftest.
$ac_ext
<<
EOF
#line 2
261
"configure"
#line 2
308
"configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/sem.h>
...
...
@@ -2265,7 +2312,7 @@ int main() {
union semun foo
; return 0; }
EOF
if
{
(
eval echo
configure:2
269
:
\"
$ac_compile
\"
)
1>&5
;
(
eval
$ac_compile
)
2>&5
;
}
;
then
if
{
(
eval echo
configure:2
316
:
\"
$ac_compile
\"
)
1>&5
;
(
eval
$ac_compile
)
2>&5
;
}
;
then
rm
-rf
conftest
*
ac_cv_c_union_semun
=
"yes"
else
...
...
@@ -2293,7 +2340,7 @@ if test "x${GCC}" = "xyes"
then
CFLAGS
=
"
$CFLAGS
-Wall"
echo
$ac_n
"checking "
for
gcc strength-reduce bug
"""...
$ac_c
"
1>&6
echo
"configure:2
297
: checking "
for
gcc strength-reduce bug
""
>
&5
echo
"configure:2
344
: checking "
for
gcc strength-reduce bug
""
>
&5
if
eval
"test
\"
`
echo
'$''{'
ac_cv_c_gcc_strength_bug
'+set}'
`
\"
= set"
;
then
echo
$ac_n
"(cached)
$ac_c
"
1>&6
else
...
...
@@ -2301,7 +2348,7 @@ else
ac_cv_c_gcc_strength_bug
=
"yes"
else
cat
>
conftest.
$ac_ext
<<
EOF
#line 23
05
"configure"
#line 23
52
"configure"
#include "confdefs.h"
int main(void) {
...
...
@@ -2312,7 +2359,7 @@ int main(void) {
exit( Array[1] != -2 );
}
EOF
if
{
(
eval echo
configure:23
16
:
\"
$ac_link
\"
)
1>&5
;
(
eval
$ac_link
)
2>&5
;
}
&&
test
-s
conftest
&&
(
./conftest
;
exit
)
2>/dev/null
if
{
(
eval echo
configure:23
63
:
\"
$ac_link
\"
)
1>&5
;
(
eval
$ac_link
)
2>&5
;
}
&&
test
-s
conftest
&&
(
./conftest
;
exit
)
2>/dev/null
then
ac_cv_c_gcc_strength_bug
=
"no"
else
...
...
@@ -2335,7 +2382,7 @@ fi
echo
$ac_n
"checking "
whether external symbols need an underscore prefix
"""...
$ac_c
"
1>&6
echo
"configure:23
39
: checking "
whether external symbols need an underscore prefix
""
>
&5
echo
"configure:23
86
: checking "
whether external symbols need an underscore prefix
""
>
&5
if
eval
"test
\"
`
echo
'$''{'
ac_cv_c_extern_prefix
'+set}'
`
\"
= set"
;
then
echo
$ac_n
"(cached)
$ac_c
"
1>&6
else
...
...
@@ -2347,14 +2394,14 @@ _ac_test:
.long 0
EOF
cat
>
conftest.
$ac_ext
<<
EOF
#line 23
51
"configure"
#line 23
98
"configure"
#include "confdefs.h"
extern int ac_test;
int main() {
if (ac_test) return 1
; return 0; }
EOF
if
{
(
eval echo
configure:2
358
:
\"
$ac_link
\"
)
1>&5
;
(
eval
$ac_link
)
2>&5
;
}
&&
test
-s
conftest
;
then
if
{
(
eval echo
configure:2
405
:
\"
$ac_link
\"
)
1>&5
;
(
eval
$ac_link
)
2>&5
;
}
&&
test
-s
conftest
;
then
rm
-rf
conftest
*
ac_cv_c_extern_prefix
=
"yes"
else
...
...
@@ -2378,7 +2425,7 @@ fi
echo
$ac_n
"checking "
whether assembler accepts .string
"""...
$ac_c
"
1>&6
echo
"configure:2
382
: checking "
whether assembler accepts .string
""
>
&5
echo
"configure:2
429
: checking "
whether assembler accepts .string
""
>
&5
if
eval
"test
\"
`
echo
'$''{'
ac_cv_c_asm_string
'+set}'
`
\"
= set"
;
then
echo
$ac_n
"(cached)
$ac_c
"
1>&6
else
...
...
@@ -2388,14 +2435,14 @@ cat > conftest_asm.s <<EOF
.string "test"
EOF
cat
>
conftest.
$ac_ext
<<
EOF
#line 2
392
"configure"
#line 2
439
"configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
if
{
(
eval echo
configure:2
399
:
\"
$ac_link
\"
)
1>&5
;
(
eval
$ac_link
)
2>&5
;
}
&&
test
-s
conftest
;
then
if
{
(
eval echo
configure:2
446
:
\"
$ac_link
\"
)
1>&5
;
(
eval
$ac_link
)
2>&5
;
}
&&
test
-s
conftest
;
then
rm
-rf
conftest
*
ac_cv_c_asm_string
=
"yes"
else
...
...
@@ -2422,21 +2469,21 @@ DLLFLAGS=""
if
test
"
$LIB_TARGET
"
=
"libwine.so.1.0"
then
echo
$ac_n
"checking "
whether we can build a dll
"""...
$ac_c
"
1>&6
echo
"configure:24
26
: checking "
whether we can build a dll
""
>
&5
echo
"configure:24
73
: checking "
whether we can build a dll
""
>
&5
if
eval
"test
\"
`
echo
'$''{'
ac_cv_c_dll
'+set}'
`
\"
= set"
;
then
echo
$ac_n
"(cached)
$ac_c
"
1>&6
else
saved_cflags
=
$CFLAGS
CFLAGS
=
"
$CFLAGS
-fPIC -shared -Wl,-soname,conftest.so.1.0"
cat
>
conftest.
$ac_ext
<<
EOF
#line 24
33
"configure"
#line 24
80
"configure"
#include "confdefs.h"
int main() {
return 1
; return 0; }
EOF
if
{
(
eval echo
configure:24
40
:
\"
$ac_link
\"
)
1>&5
;
(
eval
$ac_link
)
2>&5
;
}
&&
test
-s
conftest
;
then
if
{
(
eval echo
configure:24
87
:
\"
$ac_link
\"
)
1>&5
;
(
eval
$ac_link
)
2>&5
;
}
&&
test
-s
conftest
;
then
rm
-rf
conftest
*
ac_cv_c_dll
=
"yes"
else
...
...
@@ -2462,7 +2509,7 @@ fi
echo
$ac_n
"checking "
for
reentrant libc
"""...
$ac_c
"
1>&6
echo
"configure:2
466
: checking "
for
reentrant libc
""
>
&5
echo
"configure:2
513
: checking "
for
reentrant libc
""
>
&5
if
eval
"test
\"
`
echo
'$''{'
wine_cv_libc_reentrant
'+set}'
`
\"
= set"
;
then
echo
$ac_n
"(cached)
$ac_c
"
1>&6
else
...
...
@@ -2470,14 +2517,14 @@ else
wine_cv_libc_reentrant
=
yes
else
cat
>
conftest.
$ac_ext
<<
EOF
#line 2
474
"configure"
#line 2
521
"configure"
#include "confdefs.h"
int myerrno = 0;
char buf[256];
int *__errno_location(){return &myerrno;}
main(){connect(0,buf,255); exit(!myerrno);}
EOF
if
{
(
eval echo
configure:2
481
:
\"
$ac_link
\"
)
1>&5
;
(
eval
$ac_link
)
2>&5
;
}
&&
test
-s
conftest
&&
(
./conftest
;
exit
)
2>/dev/null
if
{
(
eval echo
configure:2
528
:
\"
$ac_link
\"
)
1>&5
;
(
eval
$ac_link
)
2>&5
;
}
&&
test
-s
conftest
&&
(
./conftest
;
exit
)
2>/dev/null
then
wine_cv_libc_reentrant
=
yes
else
...
...
@@ -2502,7 +2549,7 @@ fi
echo
$ac_n
"checking "
for
reentrant X libraries
"""...
$ac_c
"
1>&6
echo
"configure:25
06
: checking "
for
reentrant X libraries
""
>
&5
echo
"configure:25
53
: checking "
for
reentrant X libraries
""
>
&5
if
eval
"test
\"
`
echo
'$''{'
wine_cv_x_reentrant
'+set}'
`
\"
= set"
;
then
echo
$ac_n
"(cached)
$ac_c
"
1>&6
else
...
...
@@ -2547,12 +2594,12 @@ fi
for
ac_func
in
clone getpagesize memmove sendmsg sigaltstack strerror stricmp tcgetattr timegm usleep wait4 waitpid vfscanf
do
echo
$ac_n
"checking for
$ac_func
""...
$ac_c
"
1>&6
echo
"configure:25
51
: checking for
$ac_func
"
>
&5
echo
"configure:25
98
: checking for
$ac_func
"
>
&5
if
eval
"test
\"
`
echo
'$''{'
ac_cv_func_
$ac_func
'+set}'
`
\"
= set"
;
then
echo
$ac_n
"(cached)
$ac_c
"
1>&6
else
cat
>
conftest.
$ac_ext
<<
EOF
#line 2
556
"configure"
#line 2
603
"configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char
$ac_func
(); below. */
...
...
@@ -2575,7 +2622,7 @@ $ac_func();
; return 0; }
EOF
if
{
(
eval echo
configure:2
579
:
\"
$ac_link
\"
)
1>&5
;
(
eval
$ac_link
)
2>&5
;
}
&&
test
-s
conftest
;
then
if
{
(
eval echo
configure:2
626
:
\"
$ac_link
\"
)
1>&5
;
(
eval
$ac_link
)
2>&5
;
}
&&
test
-s
conftest
;
then
rm
-rf
conftest
*
eval
"ac_cv_func_
$ac_func
=yes"
else
...
...
@@ -2599,21 +2646,21 @@ else
fi
done
for
ac_hdr
in
wctype.h sys/syscall.h syscall.h sys/param.h sys/vfs.h sys/mount.h sys/statfs.h float.h linux/cdrom.h linux/ucdrom.h sys/cdio.h sys/filio.h sys/modem.h strings.h sys/strtio.h
for
ac_hdr
in
wctype.h sys/syscall.h syscall.h sys/param.h sys/vfs.h sys/mount.h sys/statfs.h float.h linux/cdrom.h linux/ucdrom.h sys/cdio.h sys/filio.h sys/modem.h strings.h sys/strtio.h
dlfcn.h
do
ac_safe
=
`
echo
"
$ac_hdr
"
|
sed
'y%./+-%__p_%'
`
echo
$ac_n
"checking for
$ac_hdr
""...
$ac_c
"
1>&6
echo
"configure:26
07
: checking for
$ac_hdr
"
>
&5
echo
"configure:26
54
: checking for
$ac_hdr
"
>
&5
if
eval
"test
\"
`
echo
'$''{'
ac_cv_header_
$ac_safe
'+set}'
`
\"
= set"
;
then
echo
$ac_n
"(cached)
$ac_c
"
1>&6
else
cat
>
conftest.
$ac_ext
<<
EOF
#line 26
12
"configure"
#line 26
59
"configure"
#include "confdefs.h"
#include <
$ac_hdr
>
EOF
ac_try
=
"
$ac_cpp
conftest.
$ac_ext
>/dev/null 2>conftest.out"
{
(
eval echo
configure:26
17
:
\"
$ac_try
\"
)
1>&5
;
(
eval
$ac_try
)
2>&5
;
}
{
(
eval echo
configure:26
64
:
\"
$ac_try
\"
)
1>&5
;
(
eval
$ac_try
)
2>&5
;
}
ac_err
=
`
grep
-v
'^ *+'
conftest.out
`
if
test
-z
"
$ac_err
"
;
then
rm
-rf
conftest
*
...
...
@@ -2640,12 +2687,12 @@ fi
done
echo
$ac_n
"checking whether stat file-mode macros are broken""...
$ac_c
"
1>&6
echo
"configure:26
44
: checking whether stat file-mode macros are broken"
>
&5
echo
"configure:26
91
: checking whether stat file-mode macros are broken"
>
&5
if
eval
"test
\"
`
echo
'$''{'
ac_cv_header_stat_broken
'+set}'
`
\"
= set"
;
then
echo
$ac_n
"(cached)
$ac_c
"
1>&6
else
cat
>
conftest.
$ac_ext
<<
EOF
#line 26
49
"configure"
#line 26
96
"configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
...
...
@@ -2696,12 +2743,12 @@ EOF
fi
echo
$ac_n
"checking for working const""...
$ac_c
"
1>&6
echo
"configure:27
00
: checking for working const"
>
&5
echo
"configure:27
47
: checking for working const"
>
&5
if
eval
"test
\"
`
echo
'$''{'
ac_cv_c_const
'+set}'
`
\"
= set"
;
then
echo
$ac_n
"(cached)
$ac_c
"
1>&6
else
cat
>
conftest.
$ac_ext
<<
EOF
#line 27
05
"configure"
#line 27
52
"configure"
#include "confdefs.h"
int main() {
...
...
@@ -2750,7 +2797,7 @@ ccp = (char const *const *) p;
; return 0; }
EOF
if
{
(
eval echo
configure:2
754
:
\"
$ac_compile
\"
)
1>&5
;
(
eval
$ac_compile
)
2>&5
;
}
;
then
if
{
(
eval echo
configure:2
801
:
\"
$ac_compile
\"
)
1>&5
;
(
eval
$ac_compile
)
2>&5
;
}
;
then
rm
-rf
conftest
*
ac_cv_c_const
=
yes
else
...
...
@@ -2771,12 +2818,12 @@ EOF
fi
echo
$ac_n
"checking for ANSI C header files""...
$ac_c
"
1>&6
echo
"configure:2
775
: checking for ANSI C header files"
>
&5
echo
"configure:2
822
: checking for ANSI C header files"
>
&5
if
eval
"test
\"
`
echo
'$''{'
ac_cv_header_stdc
'+set}'
`
\"
= set"
;
then
echo
$ac_n
"(cached)
$ac_c
"
1>&6
else
cat
>
conftest.
$ac_ext
<<
EOF
#line 2
780
"configure"
#line 2
827
"configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
...
...
@@ -2784,7 +2831,7 @@ else
#include <float.h>
EOF
ac_try
=
"
$ac_cpp
conftest.
$ac_ext
>/dev/null 2>conftest.out"
{
(
eval echo
configure:2
788
:
\"
$ac_try
\"
)
1>&5
;
(
eval
$ac_try
)
2>&5
;
}
{
(
eval echo
configure:2
835
:
\"
$ac_try
\"
)
1>&5
;
(
eval
$ac_try
)
2>&5
;
}
ac_err
=
`
grep
-v
'^ *+'
conftest.out
`
if
test
-z
"
$ac_err
"
;
then
rm
-rf
conftest
*
...
...
@@ -2801,7 +2848,7 @@ rm -f conftest*
if
test
$ac_cv_header_stdc
=
yes
;
then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat
>
conftest.
$ac_ext
<<
EOF
#line 28
05
"configure"
#line 28
52
"configure"
#include "confdefs.h"
#include <string.h>
EOF
...
...
@@ -2819,7 +2866,7 @@ fi
if
test
$ac_cv_header_stdc
=
yes
;
then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat
>
conftest.
$ac_ext
<<
EOF
#line 28
23
"configure"
#line 28
70
"configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
...
...
@@ -2840,7 +2887,7 @@ if test "$cross_compiling" = yes; then
:
else
cat
>
conftest.
$ac_ext
<<
EOF
#line 28
44
"configure"
#line 28
91
"configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
...
...
@@ -2851,7 +2898,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
if
{
(
eval echo
configure:2
855
:
\"
$ac_link
\"
)
1>&5
;
(
eval
$ac_link
)
2>&5
;
}
&&
test
-s
conftest
&&
(
./conftest
;
exit
)
2>/dev/null
if
{
(
eval echo
configure:2
902
:
\"
$ac_link
\"
)
1>&5
;
(
eval
$ac_link
)
2>&5
;
}
&&
test
-s
conftest
&&
(
./conftest
;
exit
)
2>/dev/null
then
:
else
...
...
@@ -2875,12 +2922,12 @@ EOF
fi
echo
$ac_n
"checking for size_t""...
$ac_c
"
1>&6
echo
"configure:2
879
: checking for size_t"
>
&5
echo
"configure:2
926
: checking for size_t"
>
&5
if
eval
"test
\"
`
echo
'$''{'
ac_cv_type_size_t
'+set}'
`
\"
= set"
;
then
echo
$ac_n
"(cached)
$ac_c
"
1>&6
else
cat
>
conftest.
$ac_ext
<<
EOF
#line 2
884
"configure"
#line 2
931
"configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
...
...
@@ -2908,7 +2955,7 @@ EOF
fi
echo
$ac_n
"checking size of long long""...
$ac_c
"
1>&6
echo
"configure:29
12
: checking size of long long"
>
&5
echo
"configure:29
59
: checking size of long long"
>
&5
if
eval
"test
\"
`
echo
'$''{'
ac_cv_sizeof_long_long
'+set}'
`
\"
= set"
;
then
echo
$ac_n
"(cached)
$ac_c
"
1>&6
else
...
...
@@ -2916,7 +2963,7 @@ else
ac_cv_sizeof_long_long
=
0
else
cat
>
conftest.
$ac_ext
<<
EOF
#line 29
20
"configure"
#line 29
67
"configure"
#include "confdefs.h"
#include <stdio.h>
main()
...
...
@@ -2927,7 +2974,7 @@ main()
exit(0);
}
EOF
if
{
(
eval echo
configure:29
31
:
\"
$ac_link
\"
)
1>&5
;
(
eval
$ac_link
)
2>&5
;
}
&&
test
-s
conftest
&&
(
./conftest
;
exit
)
2>/dev/null
if
{
(
eval echo
configure:29
78
:
\"
$ac_link
\"
)
1>&5
;
(
eval
$ac_link
)
2>&5
;
}
&&
test
-s
conftest
&&
(
./conftest
;
exit
)
2>/dev/null
then
ac_cv_sizeof_long_long
=
`
cat
conftestval
`
else
...
...
@@ -2950,7 +2997,7 @@ EOF
if
test
$ac_cv_func_sendmsg
=
no
;
then
echo
$ac_n
"checking for sendmsg in -lsocket""...
$ac_c
"
1>&6
echo
"configure:
2954
: checking for sendmsg in -lsocket"
>
&5
echo
"configure:
3001
: checking for sendmsg in -lsocket"
>
&5
ac_lib_var
=
`
echo
socket
'_'
sendmsg |
sed
'y%./+-%__p_%'
`
if
eval
"test
\"
`
echo
'$''{'
ac_cv_lib_
$ac_lib_var
'+set}'
`
\"
= set"
;
then
echo
$ac_n
"(cached)
$ac_c
"
1>&6
...
...
@@ -2958,7 +3005,7 @@ else
ac_save_LIBS
=
"
$LIBS
"
LIBS
=
"-lsocket
$LIBS
"
cat
>
conftest.
$ac_ext
<<
EOF
#line
2962
"configure"
#line
3009
"configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
...
...
@@ -2969,7 +3016,7 @@ int main() {
sendmsg()
; return 0; }
EOF
if
{
(
eval echo
configure:
2973
:
\"
$ac_link
\"
)
1>&5
;
(
eval
$ac_link
)
2>&5
;
}
&&
test
-s
conftest
;
then
if
{
(
eval echo
configure:
3020
:
\"
$ac_link
\"
)
1>&5
;
(
eval
$ac_link
)
2>&5
;
}
&&
test
-s
conftest
;
then
rm
-rf
conftest
*
eval
"ac_cv_lib_
$ac_lib_var
=yes"
else
...
...
@@ -3002,12 +3049,12 @@ fi
if
test
"
$ac_cv_header_sys_vfs_h
"
=
"yes"
then
echo
$ac_n
"checking "
whether sys/vfs.h defines statfs
"""...
$ac_c
"
1>&6
echo
"configure:30
06
: checking "
whether sys/vfs.h defines statfs
""
>
&5
echo
"configure:30
53
: checking "
whether sys/vfs.h defines statfs
""
>
&5
if
eval
"test
\"
`
echo
'$''{'
wine_cv_sys_vfs_has_statfs
'+set}'
`
\"
= set"
;
then
echo
$ac_n
"(cached)
$ac_c
"
1>&6
else
cat
>
conftest.
$ac_ext
<<
EOF
#line 30
11
"configure"
#line 30
58
"configure"
#include "confdefs.h"
#include <sys/types.h>
...
...
@@ -3024,7 +3071,7 @@ int main() {
; return 0; }
EOF
if
{
(
eval echo
configure:30
28
:
\"
$ac_compile
\"
)
1>&5
;
(
eval
$ac_compile
)
2>&5
;
}
;
then
if
{
(
eval echo
configure:30
75
:
\"
$ac_compile
\"
)
1>&5
;
(
eval
$ac_compile
)
2>&5
;
}
;
then
rm
-rf
conftest
*
wine_cv_sys_vfs_has_statfs
=
yes
else
...
...
@@ -3051,12 +3098,12 @@ fi
if
test
"
$ac_cv_header_sys_statfs_h
"
=
"yes"
then
echo
$ac_n
"checking "
whether sys/statfs.h defines statfs
"""...
$ac_c
"
1>&6
echo
"configure:3
055
: checking "
whether sys/statfs.h defines statfs
""
>
&5
echo
"configure:3
102
: checking "
whether sys/statfs.h defines statfs
""
>
&5
if
eval
"test
\"
`
echo
'$''{'
wine_cv_sys_statfs_has_statfs
'+set}'
`
\"
= set"
;
then
echo
$ac_n
"(cached)
$ac_c
"
1>&6
else
cat
>
conftest.
$ac_ext
<<
EOF
#line 3
060
"configure"
#line 3
107
"configure"
#include "confdefs.h"
#include <sys/types.h>
...
...
@@ -3071,7 +3118,7 @@ int main() {
; return 0; }
EOF
if
{
(
eval echo
configure:3
075
:
\"
$ac_compile
\"
)
1>&5
;
(
eval
$ac_compile
)
2>&5
;
}
;
then
if
{
(
eval echo
configure:3
122
:
\"
$ac_compile
\"
)
1>&5
;
(
eval
$ac_compile
)
2>&5
;
}
;
then
rm
-rf
conftest
*
wine_cv_sys_statfs_has_statfs
=
yes
else
...
...
@@ -3098,12 +3145,12 @@ fi
if
test
"
$ac_cv_header_sys_mount_h
"
=
"yes"
then
echo
$ac_n
"checking "
whether sys/mount.h defines statfs
"""...
$ac_c
"
1>&6
echo
"configure:31
02
: checking "
whether sys/mount.h defines statfs
""
>
&5
echo
"configure:31
49
: checking "
whether sys/mount.h defines statfs
""
>
&5
if
eval
"test
\"
`
echo
'$''{'
wine_cv_sys_mount_has_statfs
'+set}'
`
\"
= set"
;
then
echo
$ac_n
"(cached)
$ac_c
"
1>&6
else
cat
>
conftest.
$ac_ext
<<
EOF
#line 31
07
"configure"
#line 31
54
"configure"
#include "confdefs.h"
#include <sys/types.h>
...
...
@@ -3118,7 +3165,7 @@ int main() {
; return 0; }
EOF
if
{
(
eval echo
configure:31
22
:
\"
$ac_compile
\"
)
1>&5
;
(
eval
$ac_compile
)
2>&5
;
}
;
then
if
{
(
eval echo
configure:31
69
:
\"
$ac_compile
\"
)
1>&5
;
(
eval
$ac_compile
)
2>&5
;
}
;
then
rm
-rf
conftest
*
wine_cv_sys_mount_has_statfs
=
yes
else
...
...
@@ -3144,7 +3191,7 @@ fi
echo
$ac_n
"checking "
for
statfs.f_bfree
"""...
$ac_c
"
1>&6
echo
"configure:31
48
: checking "
for
statfs.f_bfree
""
>
&5
echo
"configure:31
95
: checking "
for
statfs.f_bfree
""
>
&5
if
eval
"test
\"
`
echo
'$''{'
wine_cv_statfs_bfree
'+set}'
`
\"
= set"
;
then
echo
$ac_n
"(cached)
$ac_c
"
1>&6
else
...
...
@@ -3153,7 +3200,7 @@ else
wine_cv_statfs_bfree
=
no
else
cat
>
conftest.
$ac_ext
<<
EOF
#line 3
157
"configure"
#line 3
204
"configure"
#include "confdefs.h"
#include <sys/types.h>
...
...
@@ -3180,7 +3227,7 @@ int main() {
; return 0; }
EOF
if
{
(
eval echo
configure:3
184
:
\"
$ac_compile
\"
)
1>&5
;
(
eval
$ac_compile
)
2>&5
;
}
;
then
if
{
(
eval echo
configure:3
231
:
\"
$ac_compile
\"
)
1>&5
;
(
eval
$ac_compile
)
2>&5
;
}
;
then
rm
-rf
conftest
*
wine_cv_statfs_bfree
=
yes
else
...
...
@@ -3204,7 +3251,7 @@ EOF
fi
echo
$ac_n
"checking "
for
statfs.f_bavail
"""...
$ac_c
"
1>&6
echo
"configure:32
08
: checking "
for
statfs.f_bavail
""
>
&5
echo
"configure:32
55
: checking "
for
statfs.f_bavail
""
>
&5
if
eval
"test
\"
`
echo
'$''{'
wine_cv_statfs_bavail
'+set}'
`
\"
= set"
;
then
echo
$ac_n
"(cached)
$ac_c
"
1>&6
else
...
...
@@ -3213,7 +3260,7 @@ else
wine_cv_statfs_bavail
=
no
else
cat
>
conftest.
$ac_ext
<<
EOF
#line 32
17
"configure"
#line 32
64
"configure"
#include "confdefs.h"
#include <sys/types.h>
...
...
@@ -3240,7 +3287,7 @@ int main() {
; return 0; }
EOF
if
{
(
eval echo
configure:32
44
:
\"
$ac_compile
\"
)
1>&5
;
(
eval
$ac_compile
)
2>&5
;
}
;
then
if
{
(
eval echo
configure:32
91
:
\"
$ac_compile
\"
)
1>&5
;
(
eval
$ac_compile
)
2>&5
;
}
;
then
rm
-rf
conftest
*
wine_cv_statfs_bavail
=
yes
else
...
...
@@ -3265,7 +3312,7 @@ fi
echo
$ac_n
"checking "
for
working sigaltstack
"""...
$ac_c
"
1>&6
echo
"configure:3
269
: checking "
for
working sigaltstack
""
>
&5
echo
"configure:3
316
: checking "
for
working sigaltstack
""
>
&5
if
eval
"test
\"
`
echo
'$''{'
ac_cv_c_working_sigaltstack
'+set}'
`
\"
= set"
;
then
echo
$ac_n
"(cached)
$ac_c
"
1>&6
else
...
...
@@ -3274,7 +3321,7 @@ else
else
cat
>
conftest.
$ac_ext
<<
EOF
#line 3
278
"configure"
#line 3
325
"configure"
#include "confdefs.h"
#include <stdio.h>
...
...
@@ -3312,7 +3359,7 @@ else
}
EOF
if
{
(
eval echo
configure:33
16
:
\"
$ac_link
\"
)
1>&5
;
(
eval
$ac_link
)
2>&5
;
}
&&
test
-s
conftest
&&
(
./conftest
;
exit
)
2>/dev/null
if
{
(
eval echo
configure:33
63
:
\"
$ac_link
\"
)
1>&5
;
(
eval
$ac_link
)
2>&5
;
}
&&
test
-s
conftest
&&
(
./conftest
;
exit
)
2>/dev/null
then
ac_cv_c_working_sigaltstack
=
"yes"
else
...
...
@@ -3339,12 +3386,12 @@ fi
echo
$ac_n
"checking "
for
msg_accrights
in
struct msghdr
"""...
$ac_c
"
1>&6
echo
"configure:33
43
: checking "
for
msg_accrights
in
struct msghdr
""
>
&5
echo
"configure:33
90
: checking "
for
msg_accrights
in
struct msghdr
""
>
&5
if
eval
"test
\"
`
echo
'$''{'
ac_cv_c_msg_accrights
'+set}'
`
\"
= set"
;
then
echo
$ac_n
"(cached)
$ac_c
"
1>&6
else
cat
>
conftest.
$ac_ext
<<
EOF
#line 33
48
"configure"
#line 33
95
"configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/socket.h>
...
...
@@ -3352,7 +3399,7 @@ int main() {
struct msghdr hdr; hdr.msg_accrights=0
; return 0; }
EOF
if
{
(
eval echo
configure:3
356
:
\"
$ac_compile
\"
)
1>&5
;
(
eval
$ac_compile
)
2>&5
;
}
;
then
if
{
(
eval echo
configure:3
403
:
\"
$ac_compile
\"
)
1>&5
;
(
eval
$ac_compile
)
2>&5
;
}
;
then
rm
-rf
conftest
*
ac_cv_c_msg_accrights
=
"yes"
else
...
...
configure.in
View file @
8220bc9d
...
...
@@ -81,6 +81,8 @@ dnl Check for -lw for Solaris
AC_CHECK_LIB(w,iswalnum)
dnl Check for -lxpg4 for FreeBSD
AC_CHECK_LIB(xpg4,setrunelocale)
dnl Check for -ldl
AC_CHECK_LIB(dl,dlopen)
dnl Check for XFree86 DGA extension
AC_CHECK_LIB(Xxf86dga,XF86DGAQueryExtension,AC_DEFINE(HAVE_LIBXXF86DGA) X_PRE_LIBS="$X_PRE_LIBS -lXxf86dga",,$X_LIBS -lXext -lX11)
...
...
@@ -260,7 +262,7 @@ fi
dnl **** Check for functions and header files ****
AC_CHECK_FUNCS(clone getpagesize memmove sendmsg sigaltstack strerror stricmp tcgetattr timegm usleep wait4 waitpid vfscanf)
AC_CHECK_HEADERS(wctype.h sys/syscall.h syscall.h sys/param.h sys/vfs.h sys/mount.h sys/statfs.h float.h linux/cdrom.h linux/ucdrom.h sys/cdio.h sys/filio.h sys/modem.h strings.h sys/strtio.h)
AC_CHECK_HEADERS(wctype.h sys/syscall.h syscall.h sys/param.h sys/vfs.h sys/mount.h sys/statfs.h float.h linux/cdrom.h linux/ucdrom.h sys/cdio.h sys/filio.h sys/modem.h strings.h sys/strtio.h
dlfcn.h
)
AC_HEADER_STAT()
AC_C_CONST()
AC_TYPE_SIZE_T()
...
...
include/config.h.in
View file @
8220bc9d
...
...
@@ -105,6 +105,9 @@
/* Define if you have the waitpid function. */
#undef HAVE_WAITPID
/* Define if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define if you have the <float.h> header file. */
#undef HAVE_FLOAT_H
...
...
@@ -156,6 +159,9 @@
/* Define if you have the <wctype.h> header file. */
#undef HAVE_WCTYPE_H
/* Define if you have the dl library (-ldl). */
#undef HAVE_LIBDL
/* Define if you have the i386 library (-li386). */
#undef HAVE_LIBI386
...
...
include/module.h
View file @
8220bc9d
...
...
@@ -114,7 +114,7 @@ typedef struct _wine_modref
MODULE32_TYPE
type
;
union
{
PE_MODREF
pe
;
/* ELF_MODREF elf; */
ELF_MODREF
elf
;
}
binfmt
;
HMODULE32
module
;
...
...
@@ -145,6 +145,7 @@ extern HMODULE32 MODULE_CreateDummyModule( const OFSTRUCT *ofs );
extern
FARPROC16
MODULE_GetWndProcEntry16
(
const
char
*
name
);
extern
FARPROC16
WINAPI
WIN32_GetProcAddress16
(
HMODULE32
hmodule
,
LPCSTR
name
);
extern
SEGPTR
WINAPI
HasGPHandler
(
SEGPTR
address
);
HMODULE32
MODULE_LoadLibraryEx32A
(
LPCSTR
libname
,
struct
_PDB32
*
process
,
HFILE32
hfile
,
DWORD
flags
);
/* loader/ne/module.c */
extern
NE_MODULE
*
NE_GetPtr
(
HMODULE16
hModule
);
...
...
include/pe_image.h
View file @
8220bc9d
...
...
@@ -52,4 +52,27 @@ extern LPIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(LPIMAGE_RESOURCE_DIRECTORY,LPC
typedef
DWORD
(
CALLBACK
*
DLLENTRYPROC32
)(
HMODULE32
,
DWORD
,
LPVOID
);
typedef
struct
{
WORD
popl
WINE_PACKED
;
/* 0x8f 0x05 */
DWORD
addr_popped
WINE_PACKED
;
/* ... */
BYTE
pushl1
WINE_PACKED
;
/* 0x68 */
DWORD
newret
WINE_PACKED
;
/* ... */
BYTE
pushl2
WINE_PACKED
;
/* 0x68 */
DWORD
origfun
WINE_PACKED
;
/* original function */
BYTE
ret1
WINE_PACKED
;
/* 0xc3 */
WORD
addesp
WINE_PACKED
;
/* 0x83 0xc4 */
BYTE
nrofargs
WINE_PACKED
;
/* nr of arguments to add esp, */
BYTE
pushl3
WINE_PACKED
;
/* 0x68 */
DWORD
oldret
WINE_PACKED
;
/* Filled out from popl above */
BYTE
ret2
WINE_PACKED
;
/* 0xc3 */
}
ELF_STDCALL_STUB
;
typedef
struct
{
void
*
dlhandle
;
ELF_STDCALL_STUB
*
stubs
;
}
ELF_MODREF
;
extern
HMODULE32
ELF_LoadLibraryEx32A
(
LPCSTR
,
struct
_PDB32
*
,
HFILE32
,
DWORD
);
extern
FARPROC32
ELF_FindExportedFunction
(
struct
_PDB32
*
process
,
struct
_wine_modref
*
wm
,
LPCSTR
funcName
);
#endif
/* __WINE_PE_IMAGE_H */
include/peexe.h
View file @
8220bc9d
...
...
@@ -130,6 +130,7 @@ typedef struct _IMAGE_OPTIONAL_HEADER
#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
#define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
#define IMAGE_DIRECTORY_ENTRY_IAT 12
/* Import Address Table */
#define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
/* Subsystem Values */
...
...
loader/Makefile.in
View file @
8220bc9d
...
...
@@ -6,6 +6,7 @@ VPATH = @srcdir@
MODULE
=
loader
C_SRCS
=
\
elf.c
\
libres.c
\
main.c
\
module.c
\
...
...
loader/elf.c
0 → 100644
View file @
8220bc9d
/*
* UNIX dynamic loader
*
* Currently only supports stuff using the dl* API.
*
* Copyright 1998 Marcus Meissner
*
* FIXME: Small reentrancy problem.
* IDEA(s): could be used to split up shell32,comctl32...
*/
#include "config.h"
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include "windows.h"
#include "snoop.h"
#include "process.h"
#include "peexe.h"
#include "heap.h"
#include "pe_image.h"
#include "module.h"
#include "debug.h"
#if defined(HAVE_LIBDL) && defined(HAVE_DLFCN_H)
#define UNIX_DLL_ENDING "so"
#define STUBSIZE 4095
#include <dlfcn.h>
HMODULE32
ELF_LoadLibraryEx32A
(
LPCSTR
libname
,
PDB32
*
process
,
HANDLE32
hf
,
DWORD
flags
)
{
WINE_MODREF
*
wm
;
char
*
modname
,
*
s
,
*
t
,
*
x
;
LPVOID
*
dlhandle
;
LPIMAGE_DOS_HEADER
dh
;
LPIMAGE_NT_HEADERS
nth
;
LPIMAGE_SECTION_HEADER
sh
;
HMODULE32
hmod
;
t
=
HeapAlloc
(
process
->
heap
,
HEAP_ZERO_MEMORY
,
strlen
(
libname
)
+
strlen
(
"lib.so"
)
+
1
);
*
t
=
'\0'
;
/* copy path to tempvar ... */
s
=
strrchr
(
libname
,
'/'
);
if
(
!
s
)
s
=
strrchr
(
libname
,
'\\'
);
if
(
s
)
{
strncpy
(
t
,
libname
,
s
-
libname
+
1
);
t
[
libname
-
s
+
1
]
=
'\0'
;
}
else
s
=
(
LPSTR
)
libname
;
modname
=
s
;
/* append "lib" foo ".so" */
strcat
(
t
,
"lib"
);
x
=
t
+
strlen
(
t
);
strcat
(
t
,
s
);
s
=
strchr
(
x
,
'.'
);
while
(
s
)
{
if
(
!
strcasecmp
(
s
,
".dll"
))
{
strcpy
(
s
+
1
,
UNIX_DLL_ENDING
);
break
;
}
s
=
strchr
(
s
+
1
,
'.'
);
}
/* FIXME: make UNIX filename from DOS fn? */
/* ... and open it */
dlhandle
=
dlopen
(
t
,
RTLD_NOW
);
if
(
!
dlhandle
)
{
HeapFree
(
process
->
heap
,
0
,
t
);
return
0
;
}
wm
=
(
WINE_MODREF
*
)
HeapAlloc
(
process
->
heap
,
HEAP_ZERO_MEMORY
,
sizeof
(
*
wm
));
wm
->
type
=
MODULE32_ELF
;
wm
->
binfmt
.
elf
.
dlhandle
=
dlhandle
;
/* FIXME: hmm, order? */
wm
->
next
=
process
->
modref_list
;
process
->
modref_list
=
wm
;
wm
->
modname
=
HEAP_strdupA
(
process
->
heap
,
0
,
modname
);
wm
->
longname
=
HEAP_strdupA
(
process
->
heap
,
0
,
t
);
hmod
=
(
HMODULE32
)
HeapAlloc
(
process
->
heap
,
HEAP_ZERO_MEMORY
,
sizeof
(
IMAGE_DOS_HEADER
)
+
sizeof
(
IMAGE_NT_HEADERS
)
+
sizeof
(
IMAGE_SECTION_HEADER
)
+
100
);
dh
=
(
LPIMAGE_DOS_HEADER
)
hmod
;
dh
->
e_magic
=
IMAGE_DOS_SIGNATURE
;
dh
->
e_lfanew
=
sizeof
(
IMAGE_DOS_HEADER
);
nth
=
PE_HEADER
(
hmod
);
nth
->
Signature
=
IMAGE_NT_SIGNATURE
;
nth
->
FileHeader
.
Machine
=
IMAGE_FILE_MACHINE_I386
;
nth
->
FileHeader
.
NumberOfSections
=
1
;
nth
->
FileHeader
.
SizeOfOptionalHeader
=
sizeof
(
IMAGE_OPTIONAL_HEADER
);
nth
->
FileHeader
.
Characteristics
=
IMAGE_FILE_RELOCS_STRIPPED
|
IMAGE_FILE_LINE_NUMS_STRIPPED
|
IMAGE_FILE_LOCAL_SYMS_STRIPPED
|
IMAGE_FILE_32BIT_MACHINE
|
IMAGE_FILE_DLL
|
IMAGE_FILE_DEBUG_STRIPPED
;
nth
->
OptionalHeader
.
Magic
=
IMAGE_NT_OPTIONAL_HDR_MAGIC
;
nth
->
OptionalHeader
.
SizeOfCode
=
0
;
nth
->
OptionalHeader
.
SizeOfInitializedData
=
0
;
nth
->
OptionalHeader
.
SizeOfUninitializedData
=
0
;
nth
->
OptionalHeader
.
AddressOfEntryPoint
=
0
;
nth
->
OptionalHeader
.
BaseOfCode
=
0
;
nth
->
OptionalHeader
.
MajorOperatingSystemVersion
=
4
;
nth
->
OptionalHeader
.
MajorImageVersion
=
4
;
nth
->
OptionalHeader
.
SizeOfImage
=
0
;
nth
->
OptionalHeader
.
SizeOfHeaders
=
0
;
nth
->
OptionalHeader
.
Subsystem
=
IMAGE_SUBSYSTEM_NATIVE
;
nth
->
OptionalHeader
.
DllCharacteristics
=
0
;
nth
->
OptionalHeader
.
NumberOfRvaAndSizes
=
0
;
/* allocate one code section that crosses the whole process range
* (we could find out from internal tables ... hmm )
*/
sh
=
(
LPIMAGE_SECTION_HEADER
)(
nth
+
1
);
strcpy
(
sh
->
Name
,
".text"
);
sh
->
Misc
.
VirtualSize
=
0x7fffffff
;
sh
->
VirtualAddress
=
0x42
;
/* so snoop can use it ... */
sh
->
SizeOfRawData
=
0x7fffffff
;
sh
->
PointerToRawData
=
0
;
sh
->
Characteristics
=
IMAGE_SCN_CNT_CODE
|
IMAGE_SCN_CNT_INITIALIZED_DATA
|
IMAGE_SCN_MEM_EXECUTE
|
IMAGE_SCN_MEM_READ
;
wm
->
module
=
hmod
;
SNOOP_RegisterDLL
(
hmod
,
libname
,
STUBSIZE
/
sizeof
(
ELF_STDCALL_STUB
));
return
hmod
;
}
FARPROC32
ELF_FindExportedFunction
(
PDB32
*
process
,
WINE_MODREF
*
wm
,
LPCSTR
funcName
)
{
LPVOID
fun
;
int
i
,
nrofargs
=
0
;
ELF_STDCALL_STUB
*
stub
;
assert
(
wm
->
type
==
MODULE32_ELF
);
if
(
!
HIWORD
(
funcName
))
{
ERR
(
win32
,
"Can't import from UNIX dynamic libs by ordinal, sorry.
\n
"
);
return
(
FARPROC32
)
0
;
}
fun
=
dlsym
(
wm
->
binfmt
.
elf
.
dlhandle
,
funcName
);
/* we sometimes have an excess '_' at the beginning of the name */
if
(
!
fun
&&
(
funcName
[
0
]
==
'_'
))
{
funcName
++
;
fun
=
dlsym
(
wm
->
binfmt
.
elf
.
dlhandle
,
funcName
);
}
if
(
!
fun
)
{
/* Function@nrofargs usually marks a stdcall function
* with nrofargs bytes that are popped at the end
*/
if
(
strchr
(
funcName
,
'@'
))
{
LPSTR
t
,
fn
=
HEAP_strdupA
(
process
->
heap
,
0
,
funcName
);
t
=
strchr
(
fn
,
'@'
);
*
t
=
'\0'
;
nrofargs
=
0
;
sscanf
(
t
+
1
,
"%d"
,
&
nrofargs
);
fun
=
dlsym
(
wm
->
binfmt
.
elf
.
dlhandle
,
fn
);
HeapFree
(
process
->
heap
,
0
,
fn
);
}
}
/* We sometimes have Win32 dlls implemented using stdcall but UNIX
* dlls using cdecl. If we find out the number of args the function
* uses, we remove them from the stack using two small stubs.
*/
if
(
!
wm
->
binfmt
.
elf
.
stubs
)
{
/* one page should suffice */
wm
->
binfmt
.
elf
.
stubs
=
VirtualAlloc
(
NULL
,
STUBSIZE
,
MEM_COMMIT
|
MEM_RESERVE
,
PAGE_EXECUTE_READWRITE
);
memset
(
wm
->
binfmt
.
elf
.
stubs
,
0
,
STUBSIZE
);
}
stub
=
wm
->
binfmt
.
elf
.
stubs
;
for
(
i
=
0
;
i
<
STUBSIZE
/
sizeof
(
ELF_STDCALL_STUB
);
i
++
)
{
if
(
!
stub
->
origfun
)
break
;
if
(
stub
->
origfun
==
(
DWORD
)
fun
)
break
;
stub
++
;
}
if
(
i
==
STUBSIZE
/
sizeof
(
ELF_STDCALL_STUB
))
{
ERR
(
win32
,
"please report, that there are not enough slots for stdcall stubs in the ELF loader.
\n
"
);
assert
(
i
<
STUBSIZE
/
sizeof
(
ELF_STDCALL_STUB
));
}
if
(
!
stub
->
origfun
)
stub
->
origfun
=
(
DWORD
)
fun
;
/* just a marker */
if
(
fun
&&
nrofargs
)
{
/* we don't need it for 0 args */
/* Selfmodifying entry/return stub for stdcall -> cdecl
* conversion.
* - Pop returnaddress directly into our return code
* popl <into code below>
* - Replace it by pointer to start of our returncode
* push $newret
* - And call the original function
* jmp $orgfun
* - Remove the arguments no longer needed
* newret: add esp, <nrofargs>
* - Push the original returnvalue on the stack
* pushl <poppedvalue>
* - And return to it.
* ret
*/
/* FIXME: The function stub is not reentrant. */
((
LPBYTE
)
&
(
stub
->
popl
))[
0
]
=
0x8f
;
((
LPBYTE
)
&
(
stub
->
popl
))[
1
]
=
0x05
;
stub
->
addr_popped
=
(
DWORD
)
&
(
stub
->
oldret
);
stub
->
pushl1
=
0x68
;
stub
->
newret
=
(
DWORD
)
&
(
stub
->
addesp
);
stub
->
pushl2
=
0x68
;
stub
->
origfun
=
(
DWORD
)
fun
;
stub
->
ret1
=
0xc3
;
((
LPBYTE
)
&
(
stub
->
addesp
))[
0
]
=
0x83
;
((
LPBYTE
)
&
(
stub
->
addesp
))[
1
]
=
0xc4
;
stub
->
nrofargs
=
nrofargs
;
stub
->
pushl3
=
0x68
;
/* filled out by entrycode */
stub
->
oldret
=
0xdeadbeef
;
stub
->
ret2
=
0xc3
;
fun
=
(
FARPROC32
)
stub
;
}
if
(
!
fun
)
{
FIXME
(
win32
,
"function %s not found: %s
\n
"
,
funcName
,
dlerror
());
return
fun
;
}
fun
=
SNOOP_GetProcAddress32
(
wm
->
module
,
funcName
,
stub
-
wm
->
binfmt
.
elf
.
stubs
,
fun
);
return
(
FARPROC32
)
fun
;
}
#else
HMODULE32
ELF_LoadLibraryEx32A
(
LPCSTR
libname
,
PDB32
*
process
,
HANDLE32
hf
,
DWORD
flags
)
{
return
0
;
}
FARPROC32
ELF_FindExportedFunction
(
PDB32
*
process
,
WINE_MODREF
*
wm
,
LPCSTR
funcName
)
{
return
(
FARPROC32
)
0
;
}
#endif
loader/module.c
View file @
8220bc9d
...
...
@@ -687,19 +687,28 @@ HMODULE32 WINAPI LoadLibraryEx32W16( LPCSTR libname, HANDLE16 hf,
*/
HMODULE32
WINAPI
LoadLibraryEx32A
(
LPCSTR
libname
,
HFILE32
hfile
,
DWORD
flags
)
{
return
MODULE_LoadLibraryEx32A
(
libname
,
PROCESS_Current
(),
hfile
,
flags
);
}
HMODULE32
MODULE_LoadLibraryEx32A
(
LPCSTR
libname
,
PDB32
*
process
,
HFILE32
hfile
,
DWORD
flags
)
{
HMODULE32
hmod
;
hmod
=
PE_LoadLibraryEx32A
(
libname
,
PROCESS_Current
(),
hfile
,
flags
);
hmod
=
ELF_LoadLibraryEx32A
(
libname
,
process
,
hfile
,
flags
);
if
(
hmod
)
return
hmod
;
/* already initialized for ELF */
hmod
=
PE_LoadLibraryEx32A
(
libname
,
process
,
hfile
,
flags
);
if
(
hmod
<
32
)
{
char
buffer
[
256
];
strcpy
(
buffer
,
libname
);
strcat
(
buffer
,
".dll"
);
hmod
=
PE_LoadLibraryEx32A
(
buffer
,
PROCESS_Current
()
,
hfile
,
flags
);
hmod
=
PE_LoadLibraryEx32A
(
buffer
,
process
,
hfile
,
flags
);
}
/* initialize all DLLs, which haven't been initialized yet. */
if
(
hmod
>=
32
)
PE_InitializeDLLs
(
PROCESS_Current
()
,
DLL_PROCESS_ATTACH
,
NULL
);
PE_InitializeDLLs
(
process
,
DLL_PROCESS_ATTACH
,
NULL
);
return
hmod
;
}
...
...
@@ -1018,6 +1027,8 @@ FARPROC32 MODULE_GetProcAddress32(
{
case
MODULE32_PE
:
return
PE_FindExportedFunction
(
process
,
wm
,
function
);
case
MODULE32_ELF
:
return
ELF_FindExportedFunction
(
process
,
wm
,
function
);
default:
ERR
(
module
,
"wine_modref type %d not handled.
\n
"
,
wm
->
type
);
return
(
FARPROC32
)
0
;
...
...
loader/pe_image.c
View file @
8220bc9d
...
...
@@ -253,7 +253,7 @@ DWORD fixup_imports (PDB32 *process,WINE_MODREF *wm)
char
*
name
=
(
char
*
)
RVA
(
pe_imp
->
Name
);
/* don't use MODULE_Load, Win32 creates new task differently */
hImpModule
=
P
E_LoadLibraryEx32A
(
name
,
process
,
0
,
0
);
hImpModule
=
MODUL
E_LoadLibraryEx32A
(
name
,
process
,
0
,
0
);
if
(
!
hImpModule
)
{
char
*
p
,
buffer
[
2000
];
...
...
@@ -262,7 +262,7 @@ DWORD fixup_imports (PDB32 *process,WINE_MODREF *wm)
if
(
!
(
p
=
strrchr
(
buffer
,
'\\'
)))
p
=
buffer
;
strcpy
(
p
+
1
,
name
);
hImpModule
=
P
E_LoadLibraryEx32A
(
buffer
,
process
,
0
,
0
);
hImpModule
=
MODUL
E_LoadLibraryEx32A
(
buffer
,
process
,
0
,
0
);
}
if
(
!
hImpModule
)
{
ERR
(
module
,
"Module %s not found
\n
"
,
name
);
...
...
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