mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-01-28 22:04:43 -08:00
ntdll-DllRedirects: Rebase.
This commit is contained in:
parent
a20cac28b5
commit
1977c70f7d
@ -1,17 +1,17 @@
|
||||
From 4db7fb3b3ddb536939776a5a285c808229f98e06 Mon Sep 17 00:00:00 2001
|
||||
From 5fb64d317c91b9fbbfc083b1b935df2300d791c4 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Sat, 13 Dec 2014 05:34:48 +0100
|
||||
Subject: [PATCH] ntdll: Implement loader redirection scheme.
|
||||
Subject: [PATCH 5/5] ntdll: Implement loader redirection scheme.
|
||||
|
||||
---
|
||||
dlls/ntdll/loader.c | 65 ++++++++++++++++++++++++++++++++++++-----------------
|
||||
1 file changed, 44 insertions(+), 21 deletions(-)
|
||||
dlls/ntdll/loader.c | 67 +++++++++++++++++++++++++++++++++++------------------
|
||||
1 file changed, 45 insertions(+), 22 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
|
||||
index 86a9a82..e2213be 100644
|
||||
index f2b4c3f..8ce4260 100644
|
||||
--- a/dlls/ntdll/loader.c
|
||||
+++ b/dlls/ntdll/loader.c
|
||||
@@ -100,6 +100,7 @@ struct builtin_load_info
|
||||
@@ -97,6 +97,7 @@ struct builtin_load_info
|
||||
{
|
||||
const WCHAR *load_path;
|
||||
const WCHAR *filename;
|
||||
@ -19,7 +19,7 @@ index 86a9a82..e2213be 100644
|
||||
NTSTATUS status;
|
||||
WINE_MODREF *wm;
|
||||
};
|
||||
@@ -125,7 +126,8 @@ static WINE_MODREF *cached_modref;
|
||||
@@ -122,7 +123,8 @@ static WINE_MODREF *cached_modref;
|
||||
static WINE_MODREF *current_modref;
|
||||
static WINE_MODREF *last_failed_modref;
|
||||
|
||||
@ -29,7 +29,7 @@ index 86a9a82..e2213be 100644
|
||||
static NTSTATUS process_attach( WINE_MODREF *wm, LPVOID lpReserved );
|
||||
static FARPROC find_ordinal_export( HMODULE module, const IMAGE_EXPORT_DIRECTORY *exports,
|
||||
DWORD exp_size, DWORD ordinal, LPCWSTR load_path );
|
||||
@@ -449,7 +451,7 @@ static FARPROC find_forwarded_export( HMODULE module, const char *forward, LPCWS
|
||||
@@ -446,7 +448,7 @@ static FARPROC find_forwarded_export( HMODULE module, const char *forward, LPCWS
|
||||
if (!(wm = find_basename_module( mod_name )))
|
||||
{
|
||||
TRACE( "delay loading %s for '%s'\n", debugstr_w(mod_name), forward );
|
||||
@ -38,7 +38,7 @@ index 86a9a82..e2213be 100644
|
||||
!(wm->ldr.Flags & LDR_DONT_RESOLVE_REFS))
|
||||
{
|
||||
if (!imports_fixup_done && current_modref)
|
||||
@@ -619,7 +621,7 @@ static BOOL import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *descr, LP
|
||||
@@ -616,7 +618,7 @@ static BOOL import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *descr, LP
|
||||
{
|
||||
ascii_to_unicode( buffer, name, len );
|
||||
buffer[len] = 0;
|
||||
@ -47,7 +47,7 @@ index 86a9a82..e2213be 100644
|
||||
}
|
||||
else /* need to allocate a larger buffer */
|
||||
{
|
||||
@@ -627,7 +629,7 @@ static BOOL import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *descr, LP
|
||||
@@ -624,7 +626,7 @@ static BOOL import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *descr, LP
|
||||
if (!ptr) return FALSE;
|
||||
ascii_to_unicode( ptr, name, len );
|
||||
ptr[len] = 0;
|
||||
@ -56,7 +56,16 @@ index 86a9a82..e2213be 100644
|
||||
RtlFreeHeap( GetProcessHeap(), 0, ptr );
|
||||
}
|
||||
|
||||
@@ -952,7 +954,7 @@ static NTSTATUS fixup_imports( WINE_MODREF *wm, LPCWSTR load_path )
|
||||
@@ -909,7 +911,7 @@ static NTSTATUS fixup_imports_ilonly( WINE_MODREF *wm, LPCWSTR load_path, void *
|
||||
|
||||
prev = current_modref;
|
||||
current_modref = wm;
|
||||
- if (!(status = load_dll( load_path, mscoreeW, 0, &imp ))) wm->deps[0] = imp;
|
||||
+ if (!(status = load_dll( load_path, mscoreeW, NULL, 0, &imp ))) wm->deps[0] = imp;
|
||||
current_modref = prev;
|
||||
if (status) return status;
|
||||
|
||||
@@ -987,7 +989,7 @@ static NTSTATUS fixup_imports( WINE_MODREF *wm, LPCWSTR load_path )
|
||||
* Allocate a WINE_MODREF structure and add it to the process list
|
||||
* The loader_section must be locked while calling this function.
|
||||
*/
|
||||
@ -65,7 +74,7 @@ index 86a9a82..e2213be 100644
|
||||
{
|
||||
WINE_MODREF *wm;
|
||||
const WCHAR *p;
|
||||
@@ -974,7 +976,7 @@ static WINE_MODREF *alloc_module( HMODULE hModule, LPCWSTR filename )
|
||||
@@ -1009,7 +1011,7 @@ static WINE_MODREF *alloc_module( HMODULE hModule, LPCWSTR filename )
|
||||
wm->ldr.TimeDateStamp = 0;
|
||||
wm->ldr.ActivationContext = 0;
|
||||
|
||||
@ -74,7 +83,7 @@ index 86a9a82..e2213be 100644
|
||||
if ((p = strrchrW( wm->ldr.FullDllName.Buffer, '\\' ))) p++;
|
||||
else p = wm->ldr.FullDllName.Buffer;
|
||||
RtlInitUnicodeString( &wm->ldr.BaseDllName, p );
|
||||
@@ -1679,7 +1681,7 @@ static void load_builtin_callback( void *module, const char *filename )
|
||||
@@ -1624,7 +1626,7 @@ static void load_builtin_callback( void *module, const char *filename )
|
||||
return;
|
||||
}
|
||||
|
||||
@ -83,7 +92,7 @@ index 86a9a82..e2213be 100644
|
||||
RtlFreeHeap( GetProcessHeap(), 0, fullname );
|
||||
if (!wm)
|
||||
{
|
||||
@@ -1880,8 +1882,8 @@ static BOOL is_valid_binary( const pe_image_info_t *info )
|
||||
@@ -1825,8 +1827,8 @@ static BOOL is_valid_binary( const pe_image_info_t *info )
|
||||
/******************************************************************************
|
||||
* load_native_dll (internal)
|
||||
*/
|
||||
@ -94,7 +103,7 @@ index 86a9a82..e2213be 100644
|
||||
{
|
||||
void *module;
|
||||
HANDLE mapping;
|
||||
@@ -1924,7 +1926,7 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file,
|
||||
@@ -1869,7 +1871,7 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file,
|
||||
|
||||
/* create the MODREF */
|
||||
|
||||
@ -103,7 +112,7 @@ index 86a9a82..e2213be 100644
|
||||
{
|
||||
if (module) NtUnmapViewOfSection( NtCurrentProcess(), module );
|
||||
return STATUS_NO_MEMORY;
|
||||
@@ -1983,8 +1985,8 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file,
|
||||
@@ -1931,8 +1933,8 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file,
|
||||
/***********************************************************************
|
||||
* load_builtin_dll
|
||||
*/
|
||||
@ -114,7 +123,7 @@ index 86a9a82..e2213be 100644
|
||||
{
|
||||
char error[256], dllname[MAX_PATH];
|
||||
const WCHAR *name, *p;
|
||||
@@ -2004,6 +2006,7 @@ static NTSTATUS load_builtin_dll( LPCWSTR load_path, LPCWSTR path, HANDLE file,
|
||||
@@ -1952,6 +1954,7 @@ static NTSTATUS load_builtin_dll( LPCWSTR load_path, LPCWSTR path, HANDLE file,
|
||||
*/
|
||||
info.load_path = load_path;
|
||||
info.filename = NULL;
|
||||
@ -122,7 +131,7 @@ index 86a9a82..e2213be 100644
|
||||
info.status = STATUS_SUCCESS;
|
||||
info.wm = NULL;
|
||||
|
||||
@@ -2451,7 +2454,8 @@ overflow:
|
||||
@@ -2399,7 +2402,8 @@ overflow:
|
||||
* Load a PE style module according to the load order.
|
||||
* The loader_section must be locked while calling this function.
|
||||
*/
|
||||
@ -132,7 +141,7 @@ index 86a9a82..e2213be 100644
|
||||
{
|
||||
BOOL data = flags & (LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE);
|
||||
enum loadorder loadorder;
|
||||
@@ -2489,6 +2493,25 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_
|
||||
@@ -2437,6 +2441,25 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_
|
||||
}
|
||||
|
||||
main_exe = get_modref( NtCurrentTeb()->Peb->ImageBaseAddress );
|
||||
@ -158,7 +167,7 @@ index 86a9a82..e2213be 100644
|
||||
loadorder = get_load_order( main_exe ? main_exe->ldr.BaseDllName.Buffer : NULL, filename );
|
||||
|
||||
if (handle && is_fake_dll( handle ))
|
||||
@@ -2511,22 +2534,22 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_
|
||||
@@ -2459,22 +2482,22 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_
|
||||
if (!handle) nts = STATUS_DLL_NOT_FOUND;
|
||||
else
|
||||
{
|
||||
@ -186,7 +195,7 @@ index 86a9a82..e2213be 100644
|
||||
if (nts == STATUS_SUCCESS && loadorder == LO_DEFAULT &&
|
||||
(MODULE_InitDLL( *pwm, DLL_WINE_PREATTACH, NULL ) != STATUS_SUCCESS))
|
||||
{
|
||||
@@ -2536,7 +2559,7 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_
|
||||
@@ -2484,7 +2507,7 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_
|
||||
nts = STATUS_DLL_NOT_FOUND;
|
||||
}
|
||||
if (nts == STATUS_DLL_NOT_FOUND && loadorder != LO_BUILTIN)
|
||||
@ -195,7 +204,7 @@ index 86a9a82..e2213be 100644
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2569,7 +2592,7 @@ NTSTATUS WINAPI DECLSPEC_HOTPATCH LdrLoadDll(LPCWSTR path_name, DWORD flags,
|
||||
@@ -2517,7 +2540,7 @@ NTSTATUS WINAPI DECLSPEC_HOTPATCH LdrLoadDll(LPCWSTR path_name, DWORD flags,
|
||||
RtlEnterCriticalSection( &loader_section );
|
||||
|
||||
if (!path_name) path_name = NtCurrentTeb()->Peb->ProcessParameters->DllPath.Buffer;
|
||||
@ -204,7 +213,7 @@ index 86a9a82..e2213be 100644
|
||||
|
||||
if (nts == STATUS_SUCCESS && !(wm->ldr.Flags & LDR_DONT_RESOLVE_REFS))
|
||||
{
|
||||
@@ -3598,7 +3621,7 @@ void __wine_process_init(void)
|
||||
@@ -3478,7 +3501,7 @@ void __wine_process_init(void)
|
||||
/* setup the load callback and create ntdll modref */
|
||||
wine_dll_set_callback( load_builtin_callback );
|
||||
|
||||
@ -214,5 +223,5 @@ index 86a9a82..e2213be 100644
|
||||
MESSAGE( "wine: could not load kernel32.dll, status %x\n", status );
|
||||
exit(1);
|
||||
--
|
||||
1.9.1
|
||||
2.7.4
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user