Commit d4fcc4bd authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

Removed SO loading type.

parent 98f44486
......@@ -18,7 +18,6 @@ C_SRCS = \
$(TOPOBJDIR)/if1632/builtin.c \
$(TOPOBJDIR)/if1632/relay.c \
$(TOPOBJDIR)/if1632/snoop.c \
$(TOPOBJDIR)/loader/elf.c \
$(TOPOBJDIR)/loader/loadorder.c \
$(TOPOBJDIR)/loader/main.c \
$(TOPOBJDIR)/loader/module.c \
......
......@@ -538,7 +538,7 @@ And here is a setup for Drive A, a generic floppy drive:
<varlistentry>
<term>so</term>
<listitem><para>
Native ELF libraries. Will not work yet.
Native ELF libraries. Has been deprecated, ignored.
</para></listitem>
</varlistentry>
<varlistentry>
......@@ -559,7 +559,7 @@ And here is a setup for Drive A, a generic floppy drive:
These settings provide wine's default handling of DLL loading.
</para>
<para>
<programlisting>"DefaultLoadOrder" =" native, so, builtin"</programlisting>
<programlisting>"DefaultLoadOrder" =" native, builtin"</programlisting>
</para>
<para>
This setting is a comma-delimited list of the order in
......@@ -1617,16 +1617,6 @@ OPTIONAL:
that Wine is able to load on demand.
</para> </listitem>
</varlistentry>
<varlistentry>
<term>so</term>
<listitem> <para>
A native Unix <filename>.so</filename> file, with
calling convention conversion thunks generated on the
fly as the library is loaded. This is mostly useful
for libraries such as "glide" that have exactly the
same API on both Windows and Unix.
</para> </listitem>
</varlistentry>
</variablelist>
</sect3>
......
......@@ -192,14 +192,14 @@ Also valid as an AppDefaults setting (recommended/preferred use).
.PP
.B [DllOverrides]
.br
.I format: """modulename""=""native,so,builtin"""
.I format: """modulename""=""native,builtin"""
.br
.I modulename
can be any valid DLL module name. If no extension is specified .dll is
assumed. The specified value is a comma separated list of module-types
to try to load in that specific order. Case is not important and only
the first letter of each type is enough to identify the type n[ative],
s[o], b[uiltin]. Also whitespace is ignored. See also commandline
the first letter of each type is enough to identify the type n[ative]
or b[uiltin]. Also whitespace is ignored. See also commandline
option
.I --dll
for details about the allowable types.
......@@ -208,7 +208,7 @@ The wildcard entry
.I """*"""
specifies the load order to use for modules not explicitly
mentioned. If the wildcard entry is not found, then the order
"native,builtin,so" is used.
"native,builtin" is used.
.br
Examples:
.br
......
......@@ -105,20 +105,18 @@ For more information on debugging messages, see the file
in the source distribution (FIXME: outdated).
.RE
.TP
.I --dll name[,name[,...]]={native|so|builtin}[,{n|s|b}[,...]]
.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
), native ELF libraries (
.I so
)and
),
.B wine
internal dlls (
.I builtin
). The type may be abbreviated with the first letter of the type (
.I n, s, b
.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
......
......@@ -175,7 +175,6 @@ 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
};
......
/*
* UNIX dynamic loader
*
* Currently only supports stuff using the dl* API.
*
* Copyright 1998 Marcus Meissner
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* FIXME: Small reentrancy problem.
* IDEA(s): could be used to split up shell32,comctl32...
*/
#include "config.h"
#include "wine/port.h"
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include "snoop.h"
#include "file.h"
#include "wine/debug.h"
#include "winerror.h"
WINE_DEFAULT_DEBUG_CHANNEL(win32);
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;
#define UNIX_DLL_ENDING "so"
#define STUBSIZE 4095
#define STUBOFFSET (sizeof(IMAGE_DOS_HEADER) + \
sizeof(IMAGE_NT_HEADERS) + \
sizeof(IMAGE_SECTION_HEADER))
static FARPROC ELF_FindExportedFunction( WINE_MODREF *wm, LPCSTR funcName, int hint, BOOL snoop );
static HMODULE ELF_CreateDummyModule( LPCSTR libname, LPCSTR modname )
{
PIMAGE_DOS_HEADER dh;
PIMAGE_NT_HEADERS nth;
PIMAGE_SECTION_HEADER sh;
HMODULE hmod;
hmod = (HMODULE)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(IMAGE_DOS_HEADER) +
sizeof(IMAGE_NT_HEADERS) +
sizeof(IMAGE_SECTION_HEADER) + STUBSIZE );
dh = (PIMAGE_DOS_HEADER)hmod;
dh->e_magic = IMAGE_DOS_SIGNATURE;
dh->e_lfanew = sizeof(IMAGE_DOS_HEADER);
nth = (IMAGE_NT_HEADERS *)(dh + 1);
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=(PIMAGE_SECTION_HEADER)(nth+1);
strcpy(sh->Name,".text");
sh->Misc.VirtualSize = STUBSIZE;
sh->VirtualAddress = STUBOFFSET; /* so snoop can use it ... */
sh->SizeOfRawData = STUBSIZE;
sh->PointerToRawData = 0;
sh->Characteristics = IMAGE_SCN_CNT_CODE|IMAGE_SCN_CNT_INITIALIZED_DATA|IMAGE_SCN_MEM_EXECUTE|IMAGE_SCN_MEM_READ;
return hmod;
}
WINE_MODREF *ELF_LoadLibraryExA( LPCSTR libname, DWORD flags)
{
WINE_MODREF *wm;
HMODULE hmod;
char *modname,*s,*t,*x;
LPVOID *dlhandle;
char error[1024];
t = HeapAlloc( GetProcessHeap(), 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) {
s++; /* skip / or \ */
/* copy everything up to s-1 */
memcpy(t,libname,s-libname);
t[s-libname]= '\0';
} else
s = (LPSTR)libname;
modname = s;
/* append "lib" foo ".so" */
strcat(t,"lib");
x = t+strlen(t);
strcat(t,s);
s = strchr(x,'.');
if (s) {
while (s) {
if (!FILE_strcasecmp(s,".dll")) {
strcpy(s+1,UNIX_DLL_ENDING);
break;
}
s=strchr(s+1,'.');
}
} else {
strcat(x,"."UNIX_DLL_ENDING);
}
/* grab just the last piece of the path/filename
which should be the name of the library we are
looking to load. increment by 1 to skip the DOS slash */
s = strrchr(t,'\\');
s++;
/* ... and open the library pointed by s, while t points
points to the ENTIRE DOS filename of the library
t is returned by HeapAlloc() above and so is also used
with HeapFree() below */
dlhandle = wine_dlopen(s,RTLD_NOW,error,sizeof(error));
if (!dlhandle) {
WARN("failed to load %s: %s\n", s, error);
HeapFree( GetProcessHeap(), 0, t );
SetLastError( ERROR_FILE_NOT_FOUND );
return NULL;
}
hmod = ELF_CreateDummyModule( t, modname );
SNOOP_RegisterDLL(hmod,libname,0,STUBSIZE/sizeof(ELF_STDCALL_STUB));
wm = PE_CreateModule( hmod, libname, 0, 0, FALSE );
wm->find_export = ELF_FindExportedFunction;
wm->dlhandle = dlhandle;
return wm;
}
static FARPROC ELF_FindExportedFunction( WINE_MODREF *wm, LPCSTR funcName, int hint, BOOL snoop )
{
LPVOID fun;
int i,nrofargs = 0;
ELF_STDCALL_STUB *stub, *first_stub;
char error[256];
if (!HIWORD(funcName)) {
ERR("Can't import from UNIX dynamic libs by ordinal, sorry.\n");
return (FARPROC)0;
}
fun = wine_dlsym(wm->dlhandle,funcName,error,sizeof(error));
if (!fun)
{
/* we sometimes have an excess '_' at the beginning of the name */
if (funcName[0]=='_')
{
funcName++ ;
fun = wine_dlsym(wm->dlhandle,funcName,error,sizeof(error));
}
}
if (!fun) {
/* Function@nrofargs usually marks a stdcall function
* with nrofargs bytes that are popped at the end
*/
LPCSTR t;
if ((t = strchr(funcName,'@')))
{
LPSTR fn = HeapAlloc( GetProcessHeap(), 0, t - funcName + 1 );
memcpy( fn, funcName, t - funcName );
fn[t - funcName] = 0;
nrofargs = 0;
sscanf(t+1,"%d",&nrofargs);
fun = wine_dlsym(wm->dlhandle,fn,error,sizeof(error));
HeapFree( GetProcessHeap(), 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.
*/
stub = first_stub = (ELF_STDCALL_STUB *)((char *)wm->module + STUBOFFSET);
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("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=(FARPROC)stub;
}
if (!fun) {
FIXME("function %s not found: %s\n",funcName,error);
return fun;
}
fun = SNOOP_GetProcAddress(wm->module,funcName,stub-first_stub,fun);
return (FARPROC)fun;
}
......@@ -55,39 +55,36 @@ struct loadorder_list
/* the list must remain sorted by dll name */
static module_loadorder_t default_order_list[] =
{
{ "display", { LOADORDER_BI, 0, 0, 0 } },
{ "gdi.exe", { LOADORDER_BI, 0, 0, 0 } },
{ "gdi32", { LOADORDER_BI, 0, 0, 0 } },
{ "glide2x", { LOADORDER_SO, LOADORDER_DLL, 0, 0 } },
{ "glide3x", { LOADORDER_SO, LOADORDER_DLL, 0, 0 } },
{ "icmp", { LOADORDER_BI, 0, 0, 0 } },
{ "kernel", { LOADORDER_BI, 0, 0, 0 } },
{ "kernel32", { LOADORDER_BI, 0, 0, 0 } },
{ "keyboard", { LOADORDER_BI, 0, 0, 0 } },
{ "krnl386.exe", { LOADORDER_BI, 0, 0, 0 } },
{ "mmsystem", { LOADORDER_BI, 0, 0, 0 } },
{ "mouse", { LOADORDER_BI, 0, 0, 0 } },
{ "ntdll", { LOADORDER_BI, 0, 0, 0 } },
{ "odbc32", { LOADORDER_BI, 0, 0, 0 } },
{ "system", { LOADORDER_BI, 0, 0, 0 } },
{ "toolhelp", { LOADORDER_BI, 0, 0, 0 } },
{ "ttydrv", { LOADORDER_BI, 0, 0, 0 } },
{ "user.exe", { LOADORDER_BI, 0, 0, 0 } },
{ "user32", { LOADORDER_BI, 0, 0, 0 } },
{ "w32skrnl", { LOADORDER_BI, 0, 0, 0 } },
{ "winaspi", { LOADORDER_BI, 0, 0, 0 } },
{ "windebug", { LOADORDER_DLL, LOADORDER_BI, 0, 0 } },
{ "winedos", { LOADORDER_BI, 0, 0, 0 } },
{ "wineps", { LOADORDER_BI, 0, 0, 0 } },
{ "wing", { LOADORDER_BI, 0, 0, 0 } },
{ "winmm", { LOADORDER_BI, 0, 0, 0 } },
{ "winsock", { LOADORDER_BI, 0, 0, 0 } },
{ "wnaspi32", { LOADORDER_BI, 0, 0, 0 } },
{ "wow32", { LOADORDER_BI, 0, 0, 0 } },
{ "wprocs", { LOADORDER_BI, 0, 0, 0 } },
{ "ws2_32", { LOADORDER_BI, 0, 0, 0 } },
{ "wsock32", { LOADORDER_BI, 0, 0, 0 } },
{ "x11drv", { LOADORDER_BI, 0, 0, 0 } }
{ "display", { LOADORDER_BI, 0, 0 } },
{ "gdi.exe", { LOADORDER_BI, 0, 0 } },
{ "gdi32", { LOADORDER_BI, 0, 0 } },
{ "icmp", { LOADORDER_BI, 0, 0 } },
{ "kernel", { LOADORDER_BI, 0, 0 } },
{ "kernel32", { LOADORDER_BI, 0, 0 } },
{ "keyboard", { LOADORDER_BI, 0, 0 } },
{ "krnl386.exe", { LOADORDER_BI, 0, 0 } },
{ "mmsystem", { LOADORDER_BI, 0, 0 } },
{ "mouse", { LOADORDER_BI, 0, 0 } },
{ "ntdll", { LOADORDER_BI, 0, 0 } },
{ "odbc32", { LOADORDER_BI, 0, 0 } },
{ "system", { LOADORDER_BI, 0, 0 } },
{ "toolhelp", { LOADORDER_BI, 0, 0 } },
{ "ttydrv", { LOADORDER_BI, 0, 0 } },
{ "user.exe", { LOADORDER_BI, 0, 0 } },
{ "user32", { LOADORDER_BI, 0, 0 } },
{ "w32skrnl", { LOADORDER_BI, 0, 0 } },
{ "winaspi", { LOADORDER_BI, 0, 0 } },
{ "winedos", { LOADORDER_BI, 0, 0 } },
{ "wineps", { LOADORDER_BI, 0, 0 } },
{ "wing", { LOADORDER_BI, 0, 0 } },
{ "winmm", { LOADORDER_BI, 0, 0 } },
{ "winsock", { LOADORDER_BI, 0, 0 } },
{ "wnaspi32", { LOADORDER_BI, 0, 0 } },
{ "wow32", { LOADORDER_BI, 0, 0 } },
{ "wprocs", { LOADORDER_BI, 0, 0 } },
{ "ws2_32", { LOADORDER_BI, 0, 0 } },
{ "wsock32", { LOADORDER_BI, 0, 0 } },
{ "x11drv", { LOADORDER_BI, 0, 0 } }
};
static const struct loadorder_list default_list =
......@@ -100,13 +97,13 @@ static const struct loadorder_list default_list =
/* default if nothing else specified */
static const enum loadorder_type default_loadorder[LOADORDER_NTYPES] =
{
LOADORDER_BI, LOADORDER_DLL, 0, 0
LOADORDER_BI, LOADORDER_DLL, 0
};
/* default for modules with an explicit path */
static const enum loadorder_type default_path_loadorder[LOADORDER_NTYPES] =
{
LOADORDER_DLL, LOADORDER_BI, 0, 0
LOADORDER_DLL, LOADORDER_BI, 0
};
static struct loadorder_list cmdline_list;
......@@ -198,7 +195,6 @@ static const char *debugstr_loadorder( enum loadorder_type lo[] )
switch(lo[i])
{
case LOADORDER_DLL: strcat( buffer, "n," ); break;
case LOADORDER_SO: strcat( buffer, "s," ); break;
case LOADORDER_BI: strcat( buffer, "b," ); break;
default: strcat( buffer, "?," ); break;
}
......@@ -236,12 +232,10 @@ static BOOL ParseLoadOrder(char *order, enum loadorder_type lo[])
case 'N': /* Native */
case 'n': type = LOADORDER_DLL; break;
case 'E': /* Elfdll */
case 'e':
if (!warn++) MESSAGE("Load order 'elfdll' no longer supported, ignored\n");
break;
case 'S': /* So */
case 's': type = LOADORDER_SO; break;
case 's':
if (!warn++) MESSAGE("Load order 'so' no longer supported, ignored\n");
break;
case 'B': /* Builtin */
case 'b': type = LOADORDER_BI; break;
......@@ -458,7 +452,6 @@ static BOOL get_registry_value( HKEY hkey, const char *module, enum loadorder_ty
switch(tolowerW(*str))
{
case 'n': type = LOADORDER_DLL; break;
case 's': type = LOADORDER_SO; break;
case 'b': type = LOADORDER_BI; break;
case 0: break; /* end of string */
default:
......
......@@ -1279,12 +1279,6 @@ WINE_MODREF *MODULE_LoadLibraryExA( LPCSTR libname, HANDLE hfile, DWORD flags )
filetype = "native";
break;
case LOADORDER_SO:
TRACE("Trying so-library '%s'\n", filename);
pwm = ELF_LoadLibraryExA(filename, flags);
filetype = "so";
break;
case LOADORDER_BI:
TRACE("Trying built-in '%s'\n", filename);
pwm = BUILTIN32_LoadLibraryExA(filename, flags);
......
......@@ -957,7 +957,6 @@ static HINSTANCE16 MODULE_LoadModule16( LPCSTR libname, BOOL implicit, BOOL lib_
filetype = "builtin";
break;
case LOADORDER_SO: /* This is not supported for NE modules */
default:
hinst = 2;
break;
......
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