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
2d91f7de
Commit
2d91f7de
authored
Sep 03, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Load libwine dynamically.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
4e80f2ea
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
13 deletions
+50
-13
Makefile.in
dlls/ntdll/Makefile.in
+1
-1
env.c
dlls/ntdll/unix/env.c
+5
-10
loader.c
dlls/ntdll/unix/loader.c
+43
-2
unix_private.h
dlls/ntdll/unix/unix_private.h
+1
-0
No files found.
dlls/ntdll/Makefile.in
View file @
2d91f7de
...
...
@@ -3,7 +3,7 @@ MODULE = ntdll.dll
IMPORTLIB
=
ntdll
IMPORTS
=
winecrt0
EXTRAINCL
=
$(UNWIND_CFLAGS)
EXTRALIBS
=
-lwine
$(IOKIT_LIBS)
$(COREFOUNDATION_LIBS)
$(CORESERVICES_LIBS)
$(RT_LIBS)
$(PTHREAD_LIBS)
$(UNWIND_LIBS)
$(I386_LIBS)
EXTRALIBS
=
$(IOKIT_LIBS)
$(COREFOUNDATION_LIBS)
$(CORESERVICES_LIBS)
$(RT_LIBS)
$(PTHREAD_LIBS)
$(UNWIND_LIBS)
$(I386_LIBS)
EXTRADLLFLAGS
=
-mno-cygwin
-nodefaultlibs
-Wl
,--image-base,0x7bc00000
C_SRCS
=
\
...
...
dlls/ntdll/unix/env.c
View file @
2d91f7de
...
...
@@ -60,18 +60,13 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
environ
);
extern
int
__wine_main_argc
;
extern
char
**
__wine_main_argv
;
extern
char
**
__wine_main_environ
;
extern
WCHAR
**
__wine_main_wargv
;
USHORT
*
uctable
=
NULL
,
*
lctable
=
NULL
;
SIZE_T
startup_info_size
=
0
;
int
main_argc
=
0
;
char
**
main_argv
=
NULL
;
char
**
main_envp
=
NULL
;
static
WCHAR
**
main_wargv
;
WCHAR
**
main_wargv
=
NULL
;
static
LCID
user_lcid
,
system_lcid
;
static
LANGID
user_ui_language
,
system_ui_language
;
...
...
@@ -966,10 +961,10 @@ void init_environment( int argc, char *argv[], char *envp[] )
uctable
=
case_table
+
2
;
lctable
=
case_table
+
case_table
[
1
]
+
2
;
}
__wine_main_argc
=
main_argc
=
argc
;
__wine_main_argv
=
main_argv
=
argv
;
__wine_main_wargv
=
main_wargv
=
build_wargv
(
argv
);
__wine_main_environ
=
main_envp
=
envp
;
main_argc
=
argc
;
main_argv
=
argv
;
main_wargv
=
build_wargv
(
argv
);
main_envp
=
envp
;
}
...
...
dlls/ntdll/unix/loader.c
View file @
2d91f7de
...
...
@@ -87,7 +87,6 @@
#include "winternl.h"
#include "unix_private.h"
#include "wine/list.h"
#include "wine/library.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
module
);
...
...
@@ -815,6 +814,48 @@ static void load_builtin_callback( void *module, const char *filename )
callback_module
=
module
;
}
/***********************************************************************
* load_libwine
*/
static
void
load_libwine
(
void
)
{
#ifdef __APPLE__
#define LIBWINE "libwine.1.dylib"
#elif defined(__ANDROID__)
#define LIBWINE "libwine.so"
#else
#define LIBWINE "libwine.so.1"
#endif
typedef
void
(
*
load_dll_callback_t
)(
void
*
,
const
char
*
);
static
void
(
*
p_wine_dll_set_callback
)(
load_dll_callback_t
load
);
static
int
*
p___wine_main_argc
;
static
char
***
p___wine_main_argv
;
static
char
***
p___wine_main_environ
;
static
WCHAR
***
p___wine_main_wargv
;
char
*
path
;
void
*
handle
;
if
(
build_dir
)
path
=
build_path
(
build_dir
,
"libs/wine/"
LIBWINE
);
else
path
=
build_path
(
dll_dir
,
"../"
LIBWINE
);
if
(
!
(
handle
=
dlopen
(
path
,
RTLD_NOW
))
&&
!
(
handle
=
dlopen
(
LIBWINE
,
RTLD_NOW
)))
return
;
p_wine_dll_set_callback
=
dlsym
(
handle
,
"wine_dll_set_callback"
);
p___wine_main_argc
=
dlsym
(
handle
,
"__wine_main_argc"
);
p___wine_main_argv
=
dlsym
(
handle
,
"__wine_main_argv"
);
p___wine_main_wargv
=
dlsym
(
handle
,
"__wine_main_wargv"
);
p___wine_main_environ
=
dlsym
(
handle
,
"__wine_main_environ"
);
if
(
p_wine_dll_set_callback
)
p_wine_dll_set_callback
(
load_builtin_callback
);
if
(
p___wine_main_argc
)
*
p___wine_main_argc
=
main_argc
;
if
(
p___wine_main_argv
)
*
p___wine_main_argv
=
main_argv
;
if
(
p___wine_main_wargv
)
*
p___wine_main_wargv
=
main_wargv
;
if
(
p___wine_main_environ
)
*
p___wine_main_environ
=
main_envp
;
}
/***********************************************************************
* dlopen_dll
*/
...
...
@@ -1610,7 +1651,7 @@ void __wine_main( int argc, char *argv[], char *envp[] )
load_ntdll
();
init_environment
(
argc
,
argv
,
envp
);
wine_dll_set_callback
(
load_builtin_callback
);
load_libwine
(
);
#ifdef __APPLE__
apple_main_thread
();
...
...
dlls/ntdll/unix/unix_private.h
View file @
2d91f7de
...
...
@@ -129,6 +129,7 @@ extern SIZE_T startup_info_size DECLSPEC_HIDDEN;
extern
int
main_argc
DECLSPEC_HIDDEN
;
extern
char
**
main_argv
DECLSPEC_HIDDEN
;
extern
char
**
main_envp
DECLSPEC_HIDDEN
;
extern
WCHAR
**
main_wargv
DECLSPEC_HIDDEN
;
extern
unsigned
int
server_cpus
DECLSPEC_HIDDEN
;
extern
BOOL
is_wow64
DECLSPEC_HIDDEN
;
extern
HANDLE
keyed_event
DECLSPEC_HIDDEN
;
...
...
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