Commit b9c9cdc5 authored by Alexandre Julliard's avatar Alexandre Julliard

- Added support for app-specific dll overrides using

AppDefaults\<appname>\DllOverrides configuration section. - Better support for multiple --dll options. - Added warning message to discourage putting multiple dlls in a single override entry.
parent 857abbf3
......@@ -68,7 +68,6 @@ WINE REGISTRY Version 2
# <wineconf>
[DllDefaults]
"EXTRA_LD_LIBRARY_PATH" = "${HOME}/wine/cvs/lib"
"DefaultLoadOrder" = "native, builtin, so"
[DllOverrides]
......@@ -82,8 +81,6 @@ WINE REGISTRY Version 2
"lz32" = "builtin, native"
"comctl32" = "builtin, native"
"commctrl" = "builtin, native"
"wsock32" = "builtin"
"winsock" = "builtin"
"advapi32" = "builtin, native"
"crtdll" = "builtin, native"
"mpr" = "builtin, native"
......@@ -91,8 +88,6 @@ WINE REGISTRY Version 2
"ddraw" = "builtin, native"
"dinput" = "builtin, native"
"dsound" = "builtin, native"
"mmsystem" = "builtin"
"winmm" = "builtin"
"msvcrt" = "native, builtin"
"msvideo" = "builtin, native"
"msvfw32" = "builtin, native"
......@@ -105,8 +100,6 @@ WINE REGISTRY Version 2
"msacm" = "builtin, native"
"msacm32" = "builtin, native"
"midimap.drv" = "builtin, native"
"wnaspi32" = "builtin"
"icmp" = "builtin"
[x11drv]
; Number of colors to allocate from the system palette
......
......@@ -103,7 +103,7 @@ Use a desktop window of the given geometry, e.g. "640x480"
.I --display name
Use the specified X display
.TP
.I --dll name[,name[,...]]={native|so|builtin}[,{n|s|b}[,...]][+...]
.I --dll name[,name[,...]]={native|so|builtin}[,{n|s|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
......@@ -119,13 +119,12 @@ internal dlls (
.I n, s, 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. Different load orders can
be specified by separating the entries with a plus sign. 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
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
......@@ -139,7 +138,7 @@ the builtin version if the native load fails.
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:shell,shell32=b+comctl32,commctrl=n
.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
......
......@@ -9,19 +9,18 @@
#include "windef.h"
#define MODULE_LOADORDER_INVALID 0 /* Must be 0 */
#define MODULE_LOADORDER_DLL 1 /* Native DLLs */
#define MODULE_LOADORDER_SO 2 /* Native .so libraries */
#define MODULE_LOADORDER_BI 3 /* Built-in modules */
#define MODULE_LOADORDER_NTYPES 3
enum loadorder_type
{
LOADORDER_INVALID = 0, /* Must be 0 */
LOADORDER_DLL, /* Native DLLs */
LOADORDER_SO, /* Native .so libraries */
LOADORDER_BI, /* Built-in modules */
LOADORDER_NTYPES
};
typedef struct module_loadorder {
char *modulename;
char loadorder[MODULE_LOADORDER_NTYPES];
} module_loadorder_t;
BOOL MODULE_InitLoadOrder(void);
module_loadorder_t *MODULE_GetLoadOrder(const char *path, BOOL win32);
extern void MODULE_InitLoadOrder(void);
extern void MODULE_GetLoadOrder( enum loadorder_type plo[], const char *path, BOOL win32 );
extern void MODULE_AddLoadOrderOption( const char *option );
#endif
......@@ -13,7 +13,6 @@ struct options
{
char * desktopGeometry; /* NULL when no desktop */
char * display; /* display name */
char *dllFlags; /* -dll flags (hack for Winelib support) */
int synchronous; /* X synchronous mode */
int managed; /* Managed windows */
};
......
......@@ -58,12 +58,12 @@ BOOL MAIN_MainInit(void)
/* Registry initialisation */
SHELL_LoadRegistry();
/* Global boot finished, the rest is process-local */
CLIENT_BootDone( TRACE_ON(server) );
/* Initialize module loadorder */
if (!MODULE_InitLoadOrder()) return FALSE;
if (CLIENT_IsBootThread()) MODULE_InitLoadOrder();
/* Global boot finished, the rest is process-local */
CLIENT_BootDone( TRACE_ON(server) );
return TRUE;
}
......
......@@ -1305,7 +1305,7 @@ WINE_MODREF *MODULE_LoadLibraryExA( LPCSTR libname, HFILE hfile, DWORD flags )
DWORD err = GetLastError();
WINE_MODREF *pwm;
int i;
module_loadorder_t *plo;
enum loadorder_type loadorder[LOADORDER_NTYPES];
LPSTR filename, p;
const char *filetype = "";
......@@ -1388,36 +1388,34 @@ WINE_MODREF *MODULE_LoadLibraryExA( LPCSTR libname, HFILE hfile, DWORD flags )
return pwm;
}
plo = MODULE_GetLoadOrder(filename, TRUE);
MODULE_GetLoadOrder( loadorder, filename, TRUE);
for(i = 0; i < MODULE_LOADORDER_NTYPES; i++)
for(i = 0; i < LOADORDER_NTYPES; i++)
{
if (loadorder[i] == LOADORDER_INVALID) break;
SetLastError( ERROR_FILE_NOT_FOUND );
switch(plo->loadorder[i])
switch(loadorder[i])
{
case MODULE_LOADORDER_DLL:
case LOADORDER_DLL:
TRACE("Trying native dll '%s'\n", filename);
pwm = PE_LoadLibraryExA(filename, flags);
filetype = "native";
break;
case MODULE_LOADORDER_SO:
case LOADORDER_SO:
TRACE("Trying so-library '%s'\n", filename);
pwm = ELF_LoadLibraryExA(filename, flags);
filetype = "so";
break;
case MODULE_LOADORDER_BI:
case LOADORDER_BI:
TRACE("Trying built-in '%s'\n", filename);
pwm = BUILTIN32_LoadLibraryExA(filename, flags);
filetype = "builtin";
break;
default:
ERR("Got invalid loadorder type %d (%s index %d)\n", plo->loadorder[i], plo->modulename, i);
/* Fall through */
case MODULE_LOADORDER_INVALID: /* We ignore this as it is an empty entry */
default:
pwm = NULL;
break;
}
......
......@@ -891,35 +891,33 @@ static HINSTANCE16 NE_LoadModule( LPCSTR name, BOOL lib_only )
*/
static HINSTANCE16 MODULE_LoadModule16( LPCSTR libname, BOOL implicit, BOOL lib_only )
{
HINSTANCE16 hinst;
HINSTANCE16 hinst = 2;
enum loadorder_type loadorder[LOADORDER_NTYPES];
int i;
module_loadorder_t *plo;
const char *filetype = "";
plo = MODULE_GetLoadOrder(libname, FALSE);
MODULE_GetLoadOrder(loadorder, libname, FALSE);
for(i = 0; i < MODULE_LOADORDER_NTYPES; i++)
for(i = 0; i < LOADORDER_NTYPES; i++)
{
switch(plo->loadorder[i])
if (loadorder[i] == LOADORDER_INVALID) break;
switch(loadorder[i])
{
case MODULE_LOADORDER_DLL:
case LOADORDER_DLL:
TRACE("Trying native dll '%s'\n", libname);
hinst = NE_LoadModule(libname, lib_only);
filetype = "native";
break;
case MODULE_LOADORDER_BI:
case LOADORDER_BI:
TRACE("Trying built-in '%s'\n", libname);
hinst = BUILTIN_LoadModule(libname);
filetype = "builtin";
break;
default:
ERR("Got invalid loadorder type %d (%s index %d)\n", plo->loadorder[i], plo->modulename, i);
/* Fall through */
case MODULE_LOADORDER_SO: /* This is not supported for NE modules */
case MODULE_LOADORDER_INVALID: /* We ignore this as it is an empty entry */
case LOADORDER_SO: /* This is not supported for NE modules */
default:
hinst = 2;
break;
}
......
......@@ -13,6 +13,7 @@
#include "ntddk.h"
#include "wine/library.h"
#include "options.h"
#include "loadorder.h"
#include "version.h"
#include "debugtools.h"
......@@ -31,7 +32,6 @@ struct options Options =
{
NULL, /* desktopGeometry */
NULL, /* display */
NULL, /* dllFlags */
FALSE, /* synchronous */
FALSE /* Managed windows */
};
......@@ -62,7 +62,6 @@ static char *xstrdup( const char *str )
static void do_debugmsg( const char *arg );
static void do_desktop( const char *arg );
static void do_display( const char *arg );
static void do_dll( const char *arg );
static void do_help( const char *arg );
static void do_language( const char *arg );
static void do_managed( const char *arg );
......@@ -77,7 +76,7 @@ static const struct option_descr option_table[] =
"--desktop geom Use a desktop window of the given geometry" },
{ "display", 0, 1, 0, do_display,
"--display name Use the specified display" },
{ "dll", 0, 1, 1, do_dll,
{ "dll", 0, 1, 1, MODULE_AddLoadOrderOption,
"--dll name Enable or disable built-in DLLs" },
{ "dosver", 0, 1, 1, VERSION_ParseDosVersion,
"--dosver x.xx DOS version to imitate (e.g. 6.22)\n"
......@@ -125,22 +124,6 @@ static void do_display( const char *arg )
Options.display = xstrdup( arg );
}
static void do_dll( const char *arg )
{
if (Options.dllFlags)
{
Options.dllFlags = (char *) realloc ( Options.dllFlags,
strlen ( Options.dllFlags ) + strlen ( arg ) + 2 );
if ( !Options.dllFlags ) out_of_memory();
strcat ( Options.dllFlags, "+" );
strcat ( Options.dllFlags, arg );
}
else
{
Options.dllFlags = xstrdup( arg );
}
}
static void do_language( const char *arg )
{
SetEnvironmentVariableA( "LANGUAGE", arg );
......
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