mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-01-28 22:04:43 -08:00
Udpated ntdll-DllRedirects patchset
This commit is contained in:
parent
75654525c4
commit
341fc2c260
@ -1,27 +1,26 @@
|
||||
From 219c4257ae314f8e2abe1e1567232336cdbbbdb4 Mon Sep 17 00:00:00 2001
|
||||
From 964df09f462ea704710aff50633ecbd7024884f7 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Sat, 13 Dec 2014 02:57:41 +0100
|
||||
Subject: ntdll: Move code to determine module basename into separate function.
|
||||
Subject: [PATCH] ntdll: Move code to determine module basename into separate
|
||||
function.
|
||||
|
||||
---
|
||||
dlls/ntdll/loadorder.c | 48 ++++++++++++++++++++++++++++++++----------------
|
||||
1 file changed, 32 insertions(+), 16 deletions(-)
|
||||
dlls/ntdll/loadorder.c | 44 ++++++++++++++++++++++++++++++--------------
|
||||
1 file changed, 30 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/loadorder.c b/dlls/ntdll/loadorder.c
|
||||
index 8250692..fbaa2d6 100644
|
||||
index 2d50fc4..eb27d60 100644
|
||||
--- a/dlls/ntdll/loadorder.c
|
||||
+++ b/dlls/ntdll/loadorder.c
|
||||
@@ -452,25 +452,17 @@ static enum loadorder get_load_order_value( HANDLE std_key, HANDLE app_key, cons
|
||||
@@ -452,23 +452,15 @@ static enum loadorder get_load_order_value( HANDLE std_key, HANDLE app_key, cons
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
- * get_load_order (internal)
|
||||
+ * get_module_basename
|
||||
+ * get_module_basename (internal)
|
||||
*
|
||||
- * Return the loadorder of a module.
|
||||
- * The system directory and '.dll' extension is stripped from the path.
|
||||
+ * Determine the module basename. The caller is responsible for releasing
|
||||
+ * the memory.
|
||||
* Return the loadorder of a module.
|
||||
* The system directory and '.dll' extension is stripped from the path.
|
||||
*/
|
||||
-enum loadorder get_load_order( const WCHAR *app_name, const WCHAR *path )
|
||||
+static WCHAR* get_module_basename( const WCHAR *path, WCHAR **basename )
|
||||
@ -29,20 +28,18 @@ index 8250692..fbaa2d6 100644
|
||||
- enum loadorder ret = LO_INVALID;
|
||||
- HANDLE std_key, app_key = 0;
|
||||
- WCHAR *module, *basename;
|
||||
UNICODE_STRING path_str;
|
||||
+ WCHAR *module;
|
||||
int len;
|
||||
|
||||
-
|
||||
- if (!init_done) init_load_order();
|
||||
- std_key = get_standard_key();
|
||||
- if (app_name) app_key = get_app_key( app_name );
|
||||
-
|
||||
- TRACE("looking for %s\n", debugstr_w(path));
|
||||
-
|
||||
+ WCHAR *module;
|
||||
|
||||
/* Strip path information if the module resides in the system directory
|
||||
*/
|
||||
RtlInitUnicodeString( &path_str, path );
|
||||
@@ -481,12 +473,36 @@ enum loadorder get_load_order( const WCHAR *app_name, const WCHAR *path )
|
||||
@@ -479,12 +471,36 @@ enum loadorder get_load_order( const WCHAR *app_name, const WCHAR *path )
|
||||
if (!strchrW( p, '\\' ) && !strchrW( p, '/' )) path = p;
|
||||
}
|
||||
|
||||
|
@ -1,15 +1,15 @@
|
||||
From 61fb04be5f07b22582095cbf7ed0f16408eeac53 Mon Sep 17 00:00:00 2001
|
||||
From 0683c1a5e5093e865f2d3b76db7a5e269155c964 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Sat, 13 Dec 2014 03:18:35 +0100
|
||||
Subject: ntdll: Implement get_redirect function.
|
||||
Subject: [PATCH] ntdll: Implement get_redirect function.
|
||||
|
||||
---
|
||||
dlls/ntdll/loadorder.c | 120 +++++++++++++++++++++++++++++++++++++++++++++---
|
||||
dlls/ntdll/loadorder.c | 118 +++++++++++++++++++++++++++++++++++++++++++++---
|
||||
dlls/ntdll/ntdll_misc.h | 1 +
|
||||
2 files changed, 114 insertions(+), 7 deletions(-)
|
||||
2 files changed, 112 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/loadorder.c b/dlls/ntdll/loadorder.c
|
||||
index fbaa2d6..c7c4592 100644
|
||||
index eb27d60..9f536ff 100644
|
||||
--- a/dlls/ntdll/loadorder.c
|
||||
+++ b/dlls/ntdll/loadorder.c
|
||||
@@ -344,11 +344,11 @@ static HANDLE open_app_reg_key( const WCHAR *sub_key, const WCHAR *app_name )
|
||||
@ -82,11 +82,12 @@ index fbaa2d6..c7c4592 100644
|
||||
* get_registry_string
|
||||
*
|
||||
* Load a registry string for a given module.
|
||||
@@ -452,6 +487,34 @@ static enum loadorder get_load_order_value( HANDLE std_key, HANDLE app_key, cons
|
||||
@@ -450,6 +485,32 @@ static enum loadorder get_load_order_value( HANDLE std_key, HANDLE app_key, cons
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
+ * get_redirect_value
|
||||
+ /***************************************************************************
|
||||
+ * get_redirect_value
|
||||
+ *
|
||||
+ * Get the redirect value for the exact specified module string, looking in:
|
||||
+ * 1. The per-application DllRedirects key
|
||||
@ -111,13 +112,10 @@ index fbaa2d6..c7c4592 100644
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/***************************************************************************
|
||||
* get_module_basename
|
||||
*
|
||||
* Determine the module basename. The caller is responsible for releasing
|
||||
@@ -496,10 +559,10 @@ enum loadorder get_load_order( const WCHAR *app_name, const WCHAR *path )
|
||||
|
||||
/***************************************************************************
|
||||
* get_module_basename (internal)
|
||||
@@ -494,10 +555,10 @@ enum loadorder get_load_order( const WCHAR *app_name, const WCHAR *path )
|
||||
WCHAR *module, *basename;
|
||||
|
||||
if (!init_done) init_load_order();
|
||||
@ -131,7 +129,7 @@ index fbaa2d6..c7c4592 100644
|
||||
|
||||
if (!(module = get_module_basename(path, &basename)))
|
||||
return ret;
|
||||
@@ -533,3 +596,46 @@ enum loadorder get_load_order( const WCHAR *app_name, const WCHAR *path )
|
||||
@@ -531,3 +592,46 @@ enum loadorder get_load_order( const WCHAR *app_name, const WCHAR *path )
|
||||
RtlFreeHeap( GetProcessHeap(), 0, module );
|
||||
return ret;
|
||||
}
|
||||
@ -179,10 +177,10 @@ index fbaa2d6..c7c4592 100644
|
||||
+ return ret;
|
||||
+}
|
||||
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
|
||||
index aac9320..aa2e660 100644
|
||||
index 561e23f..3c2424c 100644
|
||||
--- a/dlls/ntdll/ntdll_misc.h
|
||||
+++ b/dlls/ntdll/ntdll_misc.h
|
||||
@@ -202,6 +202,7 @@ enum loadorder
|
||||
@@ -258,6 +258,7 @@ enum loadorder
|
||||
};
|
||||
|
||||
extern enum loadorder get_load_order( const WCHAR *app_name, const WCHAR *path ) DECLSPEC_HIDDEN;
|
||||
|
@ -1,17 +1,17 @@
|
||||
From 0015fe086c802ef0e65a10f5e8a98a434967c617 Mon Sep 17 00:00:00 2001
|
||||
From 4db7fb3b3ddb536939776a5a285c808229f98e06 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: ntdll: Implement loader redirection scheme.
|
||||
Subject: [PATCH] ntdll: Implement loader redirection scheme.
|
||||
|
||||
---
|
||||
dlls/ntdll/loader.c | 66 +++++++++++++++++++++++++++++++++++------------------
|
||||
1 file changed, 44 insertions(+), 22 deletions(-)
|
||||
dlls/ntdll/loader.c | 65 ++++++++++++++++++++++++++++++++++++-----------------
|
||||
1 file changed, 44 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
|
||||
index 0e862f9..a7e92b8 100644
|
||||
index 86a9a82..e2213be 100644
|
||||
--- a/dlls/ntdll/loader.c
|
||||
+++ b/dlls/ntdll/loader.c
|
||||
@@ -97,6 +97,7 @@ struct builtin_load_info
|
||||
@@ -100,6 +100,7 @@ struct builtin_load_info
|
||||
{
|
||||
const WCHAR *load_path;
|
||||
const WCHAR *filename;
|
||||
@ -19,7 +19,7 @@ index 0e862f9..a7e92b8 100644
|
||||
NTSTATUS status;
|
||||
WINE_MODREF *wm;
|
||||
};
|
||||
@@ -127,7 +128,8 @@ static WINE_MODREF *cached_modref;
|
||||
@@ -125,7 +126,8 @@ static WINE_MODREF *cached_modref;
|
||||
static WINE_MODREF *current_modref;
|
||||
static WINE_MODREF *last_failed_modref;
|
||||
|
||||
@ -29,7 +29,7 @@ index 0e862f9..a7e92b8 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 );
|
||||
@@ -523,7 +525,7 @@ static FARPROC find_forwarded_export( HM
|
||||
@@ -449,7 +451,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 0e862f9..a7e92b8 100644
|
||||
!(wm->ldr.Flags & LDR_DONT_RESOLVE_REFS))
|
||||
{
|
||||
if (!imports_fixup_done && current_modref)
|
||||
@@ -706,7 +708,7 @@ static BOOL import_dll( HMODULE module,
|
||||
@@ -619,7 +621,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 0e862f9..a7e92b8 100644
|
||||
}
|
||||
else /* need to allocate a larger buffer */
|
||||
{
|
||||
@@ -714,7 +716,7 @@ static BOOL import_dll( HMODULE module,
|
||||
@@ -627,7 +629,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,7 @@ index 0e862f9..a7e92b8 100644
|
||||
RtlFreeHeap( GetProcessHeap(), 0, ptr );
|
||||
}
|
||||
|
||||
@@ -1043,7 +1045,7 @@ static NTSTATUS fixup_imports( WINE_MODR
|
||||
@@ -952,7 +954,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 +65,7 @@ index 0e862f9..a7e92b8 100644
|
||||
{
|
||||
WINE_MODREF *wm;
|
||||
const WCHAR *p;
|
||||
@@ -1065,7 +1067,7 @@ static WINE_MODREF *alloc_module( HMODUL
|
||||
@@ -974,7 +976,7 @@ static WINE_MODREF *alloc_module( HMODULE hModule, LPCWSTR filename )
|
||||
wm->ldr.TimeDateStamp = 0;
|
||||
wm->ldr.ActivationContext = 0;
|
||||
|
||||
@ -74,7 +74,7 @@ index 0e862f9..a7e92b8 100644
|
||||
if ((p = strrchrW( wm->ldr.FullDllName.Buffer, '\\' ))) p++;
|
||||
else p = wm->ldr.FullDllName.Buffer;
|
||||
RtlInitUnicodeString( &wm->ldr.BaseDllName, p );
|
||||
@@ -1811,7 +1813,7 @@ static void load_builtin_callback( void
|
||||
@@ -1679,7 +1681,7 @@ static void load_builtin_callback( void *module, const char *filename )
|
||||
return;
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ index 0e862f9..a7e92b8 100644
|
||||
RtlFreeHeap( GetProcessHeap(), 0, fullname );
|
||||
if (!wm)
|
||||
{
|
||||
@@ -2012,8 +2014,8 @@ static BOOL is_valid_binary( const pe_im
|
||||
@@ -1880,8 +1882,8 @@ static BOOL is_valid_binary( const pe_image_info_t *info )
|
||||
/******************************************************************************
|
||||
* load_native_dll (internal)
|
||||
*/
|
||||
@ -94,7 +94,7 @@ index 0e862f9..a7e92b8 100644
|
||||
{
|
||||
void *module;
|
||||
HANDLE mapping;
|
||||
@@ -2056,7 +2058,7 @@ static NTSTATUS load_native_dll( LPCWSTR
|
||||
@@ -1924,7 +1926,7 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file,
|
||||
|
||||
/* create the MODREF */
|
||||
|
||||
@ -103,7 +103,7 @@ index 0e862f9..a7e92b8 100644
|
||||
{
|
||||
if (module) NtUnmapViewOfSection( NtCurrentProcess(), module );
|
||||
return STATUS_NO_MEMORY;
|
||||
@@ -2115,8 +2117,8 @@ static NTSTATUS load_native_dll( LPCWSTR
|
||||
@@ -1983,8 +1985,8 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file,
|
||||
/***********************************************************************
|
||||
* load_builtin_dll
|
||||
*/
|
||||
@ -114,7 +114,7 @@ index 0e862f9..a7e92b8 100644
|
||||
{
|
||||
char error[256], dllname[MAX_PATH];
|
||||
const WCHAR *name, *p;
|
||||
@@ -2136,6 +2138,7 @@ static NTSTATUS load_builtin_dll( LPCWST
|
||||
@@ -2004,6 +2006,7 @@ static NTSTATUS load_builtin_dll( LPCWSTR load_path, LPCWSTR path, HANDLE file,
|
||||
*/
|
||||
info.load_path = load_path;
|
||||
info.filename = NULL;
|
||||
@ -122,7 +122,7 @@ index 0e862f9..a7e92b8 100644
|
||||
info.status = STATUS_SUCCESS;
|
||||
info.wm = NULL;
|
||||
|
||||
@@ -2583,7 +2586,8 @@ overflow:
|
||||
@@ -2451,7 +2454,8 @@ overflow:
|
||||
* Load a PE style module according to the load order.
|
||||
* The loader_section must be locked while calling this function.
|
||||
*/
|
||||
@ -132,7 +132,7 @@ index 0e862f9..a7e92b8 100644
|
||||
{
|
||||
BOOL data = flags & (LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE);
|
||||
enum loadorder loadorder;
|
||||
@@ -2621,6 +2625,25 @@ static NTSTATUS load_dll( LPCWSTR load_p
|
||||
@@ -2489,6 +2493,25 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_
|
||||
}
|
||||
|
||||
main_exe = get_modref( NtCurrentTeb()->Peb->ImageBaseAddress );
|
||||
@ -158,7 +158,7 @@ index 0e862f9..a7e92b8 100644
|
||||
loadorder = get_load_order( main_exe ? main_exe->ldr.BaseDllName.Buffer : NULL, filename );
|
||||
|
||||
if (handle && is_fake_dll( handle ))
|
||||
@@ -2643,22 +2666,22 @@ static NTSTATUS load_dll( LPCWSTR load_p
|
||||
@@ -2511,22 +2534,22 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_
|
||||
if (!handle) nts = STATUS_DLL_NOT_FOUND;
|
||||
else
|
||||
{
|
||||
@ -186,7 +186,7 @@ index 0e862f9..a7e92b8 100644
|
||||
if (nts == STATUS_SUCCESS && loadorder == LO_DEFAULT &&
|
||||
(MODULE_InitDLL( *pwm, DLL_WINE_PREATTACH, NULL ) != STATUS_SUCCESS))
|
||||
{
|
||||
@@ -2668,7 +2691,7 @@ static NTSTATUS load_dll( LPCWSTR load_p
|
||||
@@ -2536,7 +2559,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 +195,7 @@ index 0e862f9..a7e92b8 100644
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2701,7 +2724,7 @@ NTSTATUS WINAPI DECLSPEC_HOTPATCH LdrLoa
|
||||
@@ -2569,7 +2592,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 +204,7 @@ index 0e862f9..a7e92b8 100644
|
||||
|
||||
if (nts == STATUS_SUCCESS && !(wm->ldr.Flags & LDR_DONT_RESOLVE_REFS))
|
||||
{
|
||||
@@ -3771,7 +3794,7 @@ void __wine_process_init(void)
|
||||
@@ -3598,7 +3621,7 @@ void __wine_process_init(void)
|
||||
/* setup the load callback and create ntdll modref */
|
||||
wine_dll_set_callback( load_builtin_callback );
|
||||
|
||||
@ -214,4 +214,5 @@ index 0e862f9..a7e92b8 100644
|
||||
MESSAGE( "wine: could not load kernel32.dll, status %x\n", status );
|
||||
exit(1);
|
||||
--
|
||||
2.9.0
|
||||
1.9.1
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user