Commit 2052538a authored by Alexandre Julliard's avatar Alexandre Julliard

Moved loadorder support to dlls/ntdll.

Removed the --dll option and replaced it by the WINEDLLOVERRIDES environment variable.
parent 1d2eb37b
......@@ -47,6 +47,7 @@
#include "builtin16.h"
#include "stackframe.h"
#include "excpt.h"
#include "wine/unicode.h"
#include "wine/exception.h"
#include "wine/debug.h"
......@@ -1201,7 +1202,18 @@ static HINSTANCE16 MODULE_LoadModule16( LPCSTR libname, BOOL implicit, BOOL lib_
loadorder[0] = LOADORDER_BI;
loadorder[1] = LOADORDER_INVALID;
}
else MODULE_GetLoadOrder(loadorder, basename, FALSE);
else
{
WCHAR buffer[MAX_PATH], *p;
if (!GetModuleFileNameW( 0, buffer, MAX_PATH )) p = NULL;
else
{
if ((p = strrchrW( buffer, '\\' ))) p++;
else p = buffer;
}
MODULE_GetLoadOrder(loadorder, p, basename, FALSE);
}
for(i = 0; i < LOADORDER_NTYPES; i++)
{
......
......@@ -185,7 +185,7 @@ static HANDLE open_exe_file( const char *name )
name = buffer;
}
MODULE_GetLoadOrder( loadorder, name, TRUE );
MODULE_GetLoadOrder( loadorder, NULL, name, TRUE );
for(i = 0; i < LOADORDER_NTYPES; i++)
{
......@@ -246,7 +246,7 @@ static BOOL find_exe_file( const char *name, char *buffer, int buflen, HANDLE *h
return FALSE;
}
MODULE_GetLoadOrder( loadorder, buffer, TRUE );
MODULE_GetLoadOrder( loadorder, NULL, buffer, TRUE );
for(i = 0; i < LOADORDER_NTYPES; i++)
{
......
......@@ -12,7 +12,6 @@ C_SRCS = \
$(TOPOBJDIR)/files/drive.c \
$(TOPOBJDIR)/files/file.c \
$(TOPOBJDIR)/files/smb.c \
$(TOPOBJDIR)/loader/loadorder.c \
$(TOPOBJDIR)/loader/module.c \
$(TOPOBJDIR)/loader/task.c \
$(TOPOBJDIR)/loader/ne/module.c \
......@@ -42,6 +41,7 @@ C_SRCS = \
heap.c \
large_int.c \
loader.c \
loadorder.c \
misc.c \
nt.c \
om.c \
......
......@@ -1263,6 +1263,7 @@ static NTSTATUS load_dll( LPCSTR libname, DWORD flags, WINE_MODREF** pwm )
LPSTR filename;
const char *filetype = "";
DWORD found;
WINE_MODREF *main_exe;
BOOL allocated_libdir = FALSE;
static LPCSTR libdir = NULL; /* See above */
NTSTATUS nts = STATUS_NO_SUCH_FILE;
......@@ -1343,7 +1344,8 @@ static NTSTATUS load_dll( LPCSTR libname, DWORD flags, WINE_MODREF** pwm )
return STATUS_SUCCESS;
}
MODULE_GetLoadOrder( loadorder, filename, TRUE);
main_exe = get_modref( NtCurrentTeb()->Peb->ImageBaseAddress );
MODULE_GetLoadOrder( loadorder, main_exe->ldr.BaseDllName.Buffer, filename, TRUE);
for (i = 0; i < LOADORDER_NTYPES; i++)
{
......
......@@ -51,6 +51,7 @@ static inline HANDLE ntdll_get_process_heap(void)
{
return NtCurrentTeb()->Peb->ProcessHeap;
}
#define GetProcessHeap() ntdll_get_process_heap()
static inline RTL_USER_PROCESS_PARAMETERS* ntdll_get_process_pmts(void)
{
......
......@@ -104,49 +104,6 @@ For more information on debugging messages, see the file
.I documentation/running.sgml
in the source distribution (FIXME: outdated).
.RE
.TP
.I --dll name[,name[,...]]={native|builtin}[,{n|b}[,...]]
Selects the override type and load order of dll used in the loading
process for any dll. The default is set in the configuration
file. There are currently three types of libraries that can be loaded
into a process' address space: Native windows dlls (
.I native
),
.B wine
internal dlls (
.I builtin
). The type may be abbreviated with the first letter of the type (
.I n, b
). Each sequence of orders must be separated by commas.
.br
Each dll may have its own specific load order. The load order
determines which version of the dll is attempted to be loaded into the
address space. If the first fails, then the next is tried and so
on. Multiple libraries with the same load order can be separated with
commas. It is also possible to use the --dll option several times, to
specify different loadorders for different libraries
.br
Examples:
.br
.I --dll comdlg32,commdlg=n,b
.br
Try to load comdlg32 and commdlg as native windows dll first and try
the builtin version if the native load fails.
.br
.I --dll shell,shell32=n --dll c:\(rs\(rsfoo\(rs\(rsbar\(rs\(rsbaz=b
.br
Try to load the libraries shell and shell32 as native windows dlls. Furthermore, if
an application request to load c:\(rsfoo\(rsbar\(rsbaz.dll load the builtin library baz.
.br
.I --dll comdlg32,commdlg=b,n --dll shell,shell32=b --dll comctl32,commctrl=n
.br
Try to load comdlg32 and commdlg as builtin first and try the native version
if the builtin load fails; load shell32/shell always as builtin and
comctl32/commctrl always as native.
.br
Note: It is wise to keep dll pairs (comdlg32/commdlg, shell/shell32, etc.)
having exactly the same load order. This will prevent mismatches at runtime.
See also configuration file format below.
.PD 1
.SH PROGRAM/ARGUMENTS
The program name may be specified in DOS format (
......@@ -181,7 +138,7 @@ by
For example, if you want to execute
.B wine
with the options
.I --dll riched32=n
.I --debugmsg +module
and if
.B wine
should run the program
......@@ -191,7 +148,7 @@ with the arguments
, then you could use the following command line to invoke
.B wine:
.PP
.I wine --dll riched32=n -- myapp.exe --display 3d somefile
.I wine --debugmsg +module -- myapp.exe --display 3d somefile
.PP
Note that in contrast to previous versions of
.B wine,
......@@ -255,14 +212,61 @@ addition to any directory specified in
Wine will also look in
.B @dlldir@.
.TP
.I WINEDLLOVERRIDES
Defines the override type and load order of dlls used in the loading
process for any dll. The default is set in the configuration
file. There are currently two types of libraries that can be loaded
into a process' address space: Native windows dlls (
.I native
),
.B wine
internal dlls (
.I builtin
). The type may be abbreviated with the first letter of the type (
.I n, b
). Each sequence of orders must be separated by commas.
.br
Each dll may have its own specific load order. The load order
determines which version of the dll is attempted to be loaded into the
address space. If the first fails, then the next is tried and so
on. Multiple libraries with the same load order can be separated with
commas. It is also possible to use specify different loadorders for
different libraries by separating the entries by ";".
.br
Examples:
.RS
.TP
WINEDLLOVERRIDES="comdlg32,commdlg=n,b"
.br
Try to load comdlg32 and commdlg as native windows dll first and try
the builtin version if the native load fails.
.TP
WINEDLLOVERRIDES="shell,shell32=n;c:\(rs\(rsfoo\(rs\(rsbar\(rs\(rsbaz=b"
.br
Try to load the libraries shell and shell32 as native windows dlls. Furthermore, if
an application request to load c:\(rsfoo\(rsbar\(rsbaz.dll load the builtin library baz.
.TP
WINEDLLOVERRIDES="comdlg32,commdlg=b,n;shell,shell32=b;comctl32,commctrl=n"
.br
Try to load comdlg32 and commdlg as builtin first and try the native version
if the builtin load fails; load shell32/shell always as builtin and
comctl32/commctrl always as native.
.br
Note: It is wise to keep dll pairs (comdlg32/commdlg, shell/shell32, etc.)
having exactly the same load order. This will prevent mismatches at runtime.
See also configuration file format below.
.RE
.TP
.I DISPLAY
Specifies the X11 display to use.
.SH CONFIGURATION FILE
.B wine
expects a configuration file (
.I $WINEPREFIX/config
(~/.wine/config)
), which must conform to the format specified in the
or
.I ~/.wine/config
if WINEPREFIX is not set), which must conform to the format specified
in the
.BR wine.conf (5)
man page. A sample configuration file is documentation/samples/config in the
.B wine
......
......@@ -217,8 +217,8 @@ extern HRSRC PE_FindResourceExW(HMODULE,LPCWSTR,LPCWSTR,WORD);
/* loader/loadorder.c */
extern BOOL MODULE_GetBuiltinPath( const char *libname, const char *ext, char *filename, UINT size );
extern void MODULE_GetLoadOrder( enum loadorder_type plo[], const char *path, BOOL win32 );
extern void MODULE_AddLoadOrderOption( const char *option );
extern void MODULE_GetLoadOrder( enum loadorder_type plo[], const WCHAR *app_name,
const char *path, BOOL win32 );
/* relay32/builtin.c */
extern HMODULE BUILTIN32_LoadExeModule( HMODULE main );
......
......@@ -56,6 +56,7 @@ static void out_of_memory(void)
}
static void do_debugmsg( const char *arg );
static void do_dll( const char *arg );
static void do_help( const char *arg );
static void do_version( const char *arg );
......@@ -63,8 +64,8 @@ static const struct option_descr option_table[] =
{
{ "debugmsg", 0, 1, 1, do_debugmsg,
"--debugmsg name Turn debugging-messages on or off" },
{ "dll", 0, 1, 1, MODULE_AddLoadOrderOption,
"--dll name Enable or disable built-in DLLs" },
{ "dll", 0, 1, 1, do_dll,
"--dll name This option is no longer supported" },
{ "help", 'h', 0, 0, do_help,
"--help,-h Show this help message" },
{ "version", 'v', 0, 0, do_version,
......@@ -96,6 +97,14 @@ static void do_debugmsg( const char *arg )
}
}
static void do_dll( const char *arg )
{
MESSAGE("The --dll option has been removed, you should use\n"
"the WINEDLLOVERRIDES environment variable instead.\n"
"To see a help message, run:\n"
" WINEDLLOVERRIDES=help wine <program.exe>\n");
ExitProcess(1);
}
static void remove_options( char *argv[], int pos, int count, int inherit )
{
......
......@@ -109,9 +109,9 @@ fi
# set environment variables needed for Wine
if [ -n "$modules" ]; then
WINEOPTIONS="$WINEOPTIONS --dll $modules=b"
export WINEOPTIONS
if [ -n "$modules" ]; then
WINEDLLOVERRIDES="$WINEDLLOVERRIDES;$modules=b"
export WINEDLLOVERRIDES
fi
WINETEST_PLATFORM=${platform:-wine}
export WINETEST_PLATFORM WINETEST_DEBUG
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment