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
3b5c29f5
Commit
3b5c29f5
authored
Apr 22, 1999
by
Bertho Stultiens
Committed by
Alexandre Julliard
Apr 22, 1999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change wine's dlopen search-patch strategy not using the environment
and added #if:s to seperate the code out if libdl isn't availble.
parent
9bf93c6e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
32 deletions
+30
-32
elfdll.h
include/elfdll.h
+6
-0
elfdll.c
loader/elfdll.c
+17
-18
loadorder.c
loader/loadorder.c
+7
-14
No files found.
include/elfdll.h
View file @
3b5c29f5
...
@@ -4,6 +4,12 @@
...
@@ -4,6 +4,12 @@
WINE_MODREF
*
ELFDLL_LoadLibraryExA
(
LPCSTR
libname
,
DWORD
flags
,
DWORD
*
err
);
WINE_MODREF
*
ELFDLL_LoadLibraryExA
(
LPCSTR
libname
,
DWORD
flags
,
DWORD
*
err
);
HINSTANCE16
ELFDLL_LoadModule16
(
LPCSTR
libname
,
BOOL
implicit
);
HINSTANCE16
ELFDLL_LoadModule16
(
LPCSTR
libname
,
BOOL
implicit
);
void
ELFDLL_UnloadLibrary
(
WINE_MODREF
*
wm
);
void
ELFDLL_UnloadLibrary
(
WINE_MODREF
*
wm
);
#if defined(HAVE_LIBDL) && defined(HAVE_DLFCN_H)
void
*
ELFDLL_dlopen
(
const
char
*
libname
,
int
flags
);
void
*
ELFDLL_dlopen
(
const
char
*
libname
,
int
flags
);
extern
char
*
extra_ld_library_path
;
#endif
#endif
#endif
loader/elfdll.c
View file @
3b5c29f5
...
@@ -21,19 +21,16 @@
...
@@ -21,19 +21,16 @@
#include "winerror.h"
#include "winerror.h"
DECLARE_DEBUG_CHANNEL
(
elfdll
)
DECLARE_DEBUG_CHANNEL
(
elfdll
)
DECLARE_DEBUG_CHANNEL
(
win32
)
#if defined(HAVE_LIBDL) && defined(HAVE_DLFCN_H)
#if defined(HAVE_LIBDL) && defined(HAVE_DLFCN_H)
#include <dlfcn.h>
#include <dlfcn.h>
/*------------------ HACKS -----------------*/
/*------------------ HACKS -----------------*/
#ifndef elfdll
#define elfdll win32
#endif
extern
DWORD
fixup_imports
(
WINE_MODREF
*
wm
);
extern
DWORD
fixup_imports
(
WINE_MODREF
*
wm
);
/*---------------- END HACKS ---------------*/
/*---------------- END HACKS ---------------*/
char
*
extra_ld_library_path
=
NULL
;
/* The extra search-path set in wine.conf */
struct
elfdll_image
struct
elfdll_image
{
{
HMODULE
pe_module_start
;
HMODULE
pe_module_start
;
...
@@ -46,28 +43,30 @@ struct elfdll_image
...
@@ -46,28 +43,30 @@ struct elfdll_image
/****************************************************************************
/****************************************************************************
* ELFDLL_dlopen
* ELFDLL_dlopen
*
*
* Wrapper for dlopen to search the LD_LIBRARY_PATH manually because
* Wrapper for dlopen to search the EXTRA_LD_LIBRARY_PATH from wine.conf
* libdl.so caches the environment and does not accept our changes.
* manually because libdl.so caches the environment and does not accept our
* changes.
*/
*/
void
*
ELFDLL_dlopen
(
const
char
*
libname
,
int
flags
)
void
*
ELFDLL_dlopen
(
const
char
*
libname
,
int
flags
)
{
{
char
*
ldpath
=
getenv
(
"LD_LIBRARY_PATH"
);
char
buffer
[
256
];
char
buffer
[
256
];
int
namelen
;
int
namelen
;
void
*
handle
;
char
*
ldpath
;
if
(
!
ldpath
)
/* First try the default path search of dlopen() */
{
handle
=
dlopen
(
libname
,
flags
);
WARN
(
elfdll
,
"No LD_LIBRARY_PATH set
\n
"
);
if
(
handle
)
return
dlopen
(
libname
,
flags
);
return
handle
;
}
/* Now try to construct searches through our extra search-path */
namelen
=
strlen
(
libname
);
namelen
=
strlen
(
libname
);
while
(
ldpath
)
ldpath
=
extra_ld_library_path
;
while
(
ldpath
&&
*
ldpath
)
{
{
int
len
;
int
len
;
char
*
cptr
;
char
*
cptr
;
char
*
from
;
char
*
from
;
void
*
handle
;
from
=
ldpath
;
from
=
ldpath
;
cptr
=
strchr
(
ldpath
,
':'
);
cptr
=
strchr
(
ldpath
,
':'
);
...
@@ -84,7 +83,7 @@ void *ELFDLL_dlopen(const char *libname, int flags)
...
@@ -84,7 +83,7 @@ void *ELFDLL_dlopen(const char *libname, int flags)
if
(
len
+
namelen
+
1
>=
sizeof
(
buffer
))
if
(
len
+
namelen
+
1
>=
sizeof
(
buffer
))
{
{
ERR
(
elfdll
,
"Buffer overflow! Check LD_LIBRARY_PATH or increase buffer size.
\n
"
);
ERR
(
elfdll
,
"Buffer overflow! Check
EXTRA_
LD_LIBRARY_PATH or increase buffer size.
\n
"
);
return
NULL
;
return
NULL
;
}
}
...
@@ -207,7 +206,7 @@ static WINE_MODREF *ELFDLL_CreateModref(HMODULE hModule, LPCSTR path)
...
@@ -207,7 +206,7 @@ static WINE_MODREF *ELFDLL_CreateModref(HMODULE hModule, LPCSTR path)
if
(
!
(
nt
->
FileHeader
.
Characteristics
&
IMAGE_FILE_DLL
))
if
(
!
(
nt
->
FileHeader
.
Characteristics
&
IMAGE_FILE_DLL
))
{
{
if
(
PROCESS_Current
()
->
exe_modref
)
if
(
PROCESS_Current
()
->
exe_modref
)
FIXME
(
win32
,
"overwriting old exe_modref... arrgh
\n
"
);
FIXME
(
elfdll
,
"overwriting old exe_modref... arrgh
\n
"
);
PROCESS_Current
()
->
exe_modref
=
wm
;
PROCESS_Current
()
->
exe_modref
=
wm
;
}
}
...
@@ -227,7 +226,7 @@ static WINE_MODREF *ELFDLL_CreateModref(HMODULE hModule, LPCSTR path)
...
@@ -227,7 +226,7 @@ static WINE_MODREF *ELFDLL_CreateModref(HMODULE hModule, LPCSTR path)
}
}
}
}
if
(
wm
==
PROCESS_Current
()
->
exe_modref
)
if
(
wm
==
PROCESS_Current
()
->
exe_modref
)
ERR
(
win32
,
"Have to delete current exe_modref. Expect crash now
\n
"
);
ERR
(
elfdll
,
"Have to delete current exe_modref. Expect crash now
\n
"
);
HeapFree
(
procheap
,
0
,
wm
->
shortname
);
HeapFree
(
procheap
,
0
,
wm
->
shortname
);
HeapFree
(
procheap
,
0
,
wm
->
longname
);
HeapFree
(
procheap
,
0
,
wm
->
longname
);
HeapFree
(
procheap
,
0
,
wm
->
modname
);
HeapFree
(
procheap
,
0
,
wm
->
modname
);
...
...
loader/loadorder.c
View file @
3b5c29f5
...
@@ -8,12 +8,15 @@
...
@@ -8,12 +8,15 @@
#include <string.h>
#include <string.h>
#include <assert.h>
#include <assert.h>
#include "config.h"
#include "windef.h"
#include "windef.h"
#include "options.h"
#include "options.h"
#include "debug.h"
#include "debug.h"
#include "loadorder.h"
#include "loadorder.h"
#include "heap.h"
#include "heap.h"
#include "options.h"
#include "options.h"
#include "module.h"
#include "elfdll.h"
DEFAULT_DEBUG_CHANNEL
(
module
)
DEFAULT_DEBUG_CHANNEL
(
module
)
...
@@ -330,26 +333,16 @@ BOOL MODULE_InitLoadOrder(void)
...
@@ -330,26 +333,16 @@ BOOL MODULE_InitLoadOrder(void)
char
buffer
[
BUFFERSIZE
];
char
buffer
[
BUFFERSIZE
];
int
nbuffer
;
int
nbuffer
;
#if defined(HAVE_LIBDL) && defined(HAVE_DLFCN_H)
/* Get/set the new LD_LIBRARY_PATH */
/* Get/set the new LD_LIBRARY_PATH */
nbuffer
=
PROFILE_GetWineIniString
(
"DllDefaults"
,
"EXTRA_LD_LIBRARY_PATH"
,
""
,
buffer
,
sizeof
(
buffer
));
nbuffer
=
PROFILE_GetWineIniString
(
"DllDefaults"
,
"EXTRA_LD_LIBRARY_PATH"
,
""
,
buffer
,
sizeof
(
buffer
));
if
(
nbuffer
)
if
(
nbuffer
)
{
{
char
*
ld_lib_path
=
getenv
(
"LD_LIBRARY_PATH"
);
extra_ld_library_path
=
HEAP_strdupA
(
SystemHeap
,
0
,
buffer
);
if
(
ld_lib_path
)
TRACE
(
module
,
"Setting extra LD_LIBRARY_PATH=%s
\n
"
,
buffer
);
{
/*
* Append new path to current
*/
char
*
tmp
=
HEAP_strdupA
(
SystemHeap
,
0
,
buffer
);
sprintf
(
buffer
,
"LD_LIBRARY_PATH=%s:%s"
,
ld_lib_path
,
tmp
);
HeapFree
(
SystemHeap
,
0
,
tmp
);
}
TRACE
(
module
,
"Setting new LD_LIBRARY_PATH=%s
\n
"
,
buffer
);
putenv
(
buffer
);
}
}
#endif
/* Get the default load order */
/* Get the default load order */
nbuffer
=
PROFILE_GetWineIniString
(
"DllDefaults"
,
"DefaultLoadOrder"
,
"n,e,s,b"
,
buffer
,
sizeof
(
buffer
));
nbuffer
=
PROFILE_GetWineIniString
(
"DllDefaults"
,
"DefaultLoadOrder"
,
"n,e,s,b"
,
buffer
,
sizeof
(
buffer
));
...
...
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