diff --git a/patches/ntdll-DllRedirects/0005-ntdll-Implement-loader-redirection-scheme.patch b/patches/ntdll-DllRedirects/0005-ntdll-Implement-loader-redirection-scheme.patch index 04d53334..7c7db76c 100644 --- a/patches/ntdll-DllRedirects/0005-ntdll-Implement-loader-redirection-scheme.patch +++ b/patches/ntdll-DllRedirects/0005-ntdll-Implement-loader-redirection-scheme.patch @@ -1,17 +1,17 @@ -From cd1b64a0a40a8ec7aaf2cc875fe138404eb009b9 Mon Sep 17 00:00:00 2001 +From a76d12531d1183232b0c95632da2a3626bf929f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Sat, 13 Dec 2014 05:34:48 +0100 Subject: [PATCH] ntdll: Implement loader redirection scheme. --- - dlls/ntdll/loader.c | 67 +++++++++++++++++++++++++++++++++++------------------ - 1 file changed, 45 insertions(+), 22 deletions(-) + dlls/ntdll/loader.c | 72 +++++++++++++++++++++++++++++++++++++---------------- + 1 file changed, 50 insertions(+), 22 deletions(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c -index 4dc57a1175..0036593b25 100644 +index d2f0617..b417512 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c -@@ -102,6 +102,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 4dc57a1175..0036593b25 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 4dc57a1175..0036593b25 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 ); -@@ -480,7 +482,7 @@ static FARPROC find_forwarded_export( HMODULE module, const char *forward, LPCWS +@@ -478,7 +480,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 4dc57a1175..0036593b25 100644 !(wm->ldr.Flags & LDR_DONT_RESOLVE_REFS)) { if (!imports_fixup_done && current_modref) -@@ -650,7 +652,7 @@ static BOOL import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *descr, LP +@@ -649,7 +651,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 4dc57a1175..0036593b25 100644 } else /* need to allocate a larger buffer */ { -@@ -658,7 +660,7 @@ static BOOL import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *descr, LP +@@ -657,7 +659,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; @@ -65,7 +65,7 @@ index 4dc57a1175..0036593b25 100644 current_modref = prev; if (status) { -@@ -1026,7 +1028,7 @@ static NTSTATUS fixup_imports( WINE_MODREF *wm, LPCWSTR load_path ) +@@ -1031,7 +1033,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. */ @@ -74,7 +74,7 @@ index 4dc57a1175..0036593b25 100644 { WINE_MODREF *wm; const WCHAR *p; -@@ -1040,7 +1042,7 @@ static WINE_MODREF *alloc_module( HMODULE hModule, LPCWSTR filename ) +@@ -1045,7 +1047,7 @@ static WINE_MODREF *alloc_module( HMODULE hModule, LPCWSTR filename ) wm->ldr.TlsIndex = -1; wm->ldr.LoadCount = 1; @@ -83,7 +83,7 @@ index 4dc57a1175..0036593b25 100644 if ((p = strrchrW( wm->ldr.FullDllName.Buffer, '\\' ))) p++; else p = wm->ldr.FullDllName.Buffer; RtlInitUnicodeString( &wm->ldr.BaseDllName, p ); -@@ -1742,7 +1744,7 @@ static void load_builtin_callback( void *module, const char *filename ) +@@ -1657,7 +1659,7 @@ static void load_builtin_callback( void *module, const char *filename ) return; } @@ -92,7 +92,7 @@ index 4dc57a1175..0036593b25 100644 RtlFreeHeap( GetProcessHeap(), 0, fullname ); if (!wm) { -@@ -1952,8 +1954,8 @@ static BOOL is_valid_binary( HMODULE module, const pe_image_info_t *info ) +@@ -1867,8 +1869,8 @@ static BOOL is_valid_binary( HMODULE module, const pe_image_info_t *info ) /****************************************************************************** * load_native_dll (internal) */ @@ -103,7 +103,7 @@ index 4dc57a1175..0036593b25 100644 { void *module; HANDLE mapping; -@@ -1996,7 +1998,7 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file, +@@ -1911,7 +1913,7 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file, /* create the MODREF */ @@ -112,7 +112,7 @@ index 4dc57a1175..0036593b25 100644 { if (module) NtUnmapViewOfSection( NtCurrentProcess(), module ); return STATUS_NO_MEMORY; -@@ -2060,8 +2062,8 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file, +@@ -1979,8 +1981,8 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file, /*********************************************************************** * load_builtin_dll */ @@ -123,7 +123,7 @@ index 4dc57a1175..0036593b25 100644 { char error[256], dllname[MAX_PATH]; const WCHAR *name, *p; -@@ -2081,6 +2083,7 @@ static NTSTATUS load_builtin_dll( LPCWSTR load_path, LPCWSTR path, HANDLE file, +@@ -2000,6 +2002,7 @@ static NTSTATUS load_builtin_dll( LPCWSTR load_path, LPCWSTR path, HANDLE file, */ info.load_path = load_path; info.filename = NULL; @@ -131,7 +131,7 @@ index 4dc57a1175..0036593b25 100644 info.status = STATUS_SUCCESS; info.wm = NULL; -@@ -2562,7 +2565,8 @@ overflow: +@@ -2473,7 +2476,8 @@ overflow: * Load a PE style module according to the load order. * The loader_section must be locked while calling this function. */ @@ -141,7 +141,7 @@ index 4dc57a1175..0036593b25 100644 { BOOL data = flags & (LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE); enum loadorder loadorder; -@@ -2601,6 +2605,25 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_ +@@ -2512,6 +2516,30 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_ } main_exe = get_modref( NtCurrentTeb()->Peb->ImageBaseAddress ); @@ -158,16 +158,21 @@ index 4dc57a1175..0036593b25 100644 + + nts = load_dll( load_path, redirect, filename, flags, pwm ); + -+ if (handle) NtClose( handle ); -+ if (filename != buffer) RtlFreeHeap( GetProcessHeap(), 0, filename ); -+ return nts; ++ if (nts == STATUS_SUCCESS) ++ { ++ if (handle) NtClose( handle ); ++ if (filename != buffer) RtlFreeHeap( GetProcessHeap(), 0, filename ); ++ return nts; ++ } ++ else ++ ERR("Failed to load redirected DLL %s, falling back to %s\n", debugstr_w(redirect), debugstr_w(libname)); + } + } + loadorder = get_load_order( main_exe ? main_exe->ldr.BaseDllName.Buffer : NULL, filename ); if (handle && is_fake_dll( handle )) -@@ -2623,22 +2646,22 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_ +@@ -2534,22 +2562,22 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_ if (!handle) nts = STATUS_DLL_NOT_FOUND; else { @@ -195,7 +200,7 @@ index 4dc57a1175..0036593b25 100644 if (nts == STATUS_SUCCESS && loadorder == LO_DEFAULT && (MODULE_InitDLL( *pwm, DLL_WINE_PREATTACH, NULL ) != STATUS_SUCCESS)) { -@@ -2648,7 +2671,7 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_ +@@ -2559,7 +2587,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) @@ -204,7 +209,7 @@ index 4dc57a1175..0036593b25 100644 break; } -@@ -2681,7 +2704,7 @@ NTSTATUS WINAPI DECLSPEC_HOTPATCH LdrLoadDll(LPCWSTR path_name, DWORD flags, +@@ -2592,7 +2620,7 @@ NTSTATUS WINAPI DECLSPEC_HOTPATCH LdrLoadDll(LPCWSTR path_name, DWORD flags, RtlEnterCriticalSection( &loader_section ); if (!path_name) path_name = NtCurrentTeb()->Peb->ProcessParameters->DllPath.Buffer; @@ -213,7 +218,7 @@ index 4dc57a1175..0036593b25 100644 if (nts == STATUS_SUCCESS && !(wm->ldr.Flags & LDR_DONT_RESOLVE_REFS)) { -@@ -3714,7 +3737,7 @@ void __wine_process_init(void) +@@ -3553,7 +3581,7 @@ void __wine_process_init(void) /* setup the load callback and create ntdll modref */ wine_dll_set_callback( load_builtin_callback ); @@ -223,5 +228,5 @@ index 4dc57a1175..0036593b25 100644 MESSAGE( "wine: could not load kernel32.dll, status %x\n", status ); exit(1); -- -2.16.1 +2.7.4 diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 589ebb45..1565dfa4 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -1931,9 +1931,6 @@ if test "$enable_wined3d_CSMT_Main" -eq 1; then if test "$enable_d3d9_Tests" -gt 1; then abort "Patchset d3d9-Tests disabled, but wined3d-CSMT_Main depends on that." fi - if test "$enable_ntdll_DllRedirects" -gt 1; then - abort "Patchset ntdll-DllRedirects disabled, but wined3d-CSMT_Main depends on that." - fi if test "$enable_wined3d_Accounting" -gt 1; then abort "Patchset wined3d-Accounting disabled, but wined3d-CSMT_Main depends on that." fi @@ -1955,7 +1952,6 @@ if test "$enable_wined3d_CSMT_Main" -eq 1; then enable_d3d11_Deferred_Context=1 enable_d3d11_ID3D11Texture1D_Rebased=1 enable_d3d9_Tests=1 - enable_ntdll_DllRedirects=1 enable_wined3d_Accounting=1 enable_wined3d_DXTn=1 enable_wined3d_Dual_Source_Blending=1 @@ -8167,9 +8163,8 @@ fi # Patchset wined3d-CSMT_Main # | # | This patchset has the following (direct or indirect) dependencies: -# | * d3d11-ID3D11Texture1D_Rebased, d3d11-Deferred_Context, d3d9-Tests, ntdll-DllOverrides_WOW64, ntdll-Loader_Machine_Type, -# | ntdll-DllRedirects, wined3d-Accounting, wined3d-DXTn, d3d11-Depth_Bias, wined3d-Viewports, wined3d-Dual_Source_Blending, -# | wined3d-QUERY_Stubs, wined3d-Silence_FIXMEs, wined3d-UAV_Counters +# | * d3d11-ID3D11Texture1D_Rebased, d3d11-Deferred_Context, d3d9-Tests, wined3d-Accounting, wined3d-DXTn, d3d11-Depth_Bias, +# | wined3d-Viewports, wined3d-Dual_Source_Blending, wined3d-QUERY_Stubs, wined3d-Silence_FIXMEs, wined3d-UAV_Counters # | # | Modified files: # | * dlls/wined3d/cs.c, dlls/wined3d/device.c, dlls/wined3d/view.c, dlls/wined3d/wined3d_private.h diff --git a/patches/wined3d-CSMT_Main/definition b/patches/wined3d-CSMT_Main/definition index ad8ea9c6..102a8d12 100644 --- a/patches/wined3d-CSMT_Main/definition +++ b/patches/wined3d-CSMT_Main/definition @@ -7,4 +7,3 @@ Depends: wined3d-UAV_Counters Depends: wined3d-Dual_Source_Blending Depends: d3d9-Tests Depends: d3d11-Deferred_Context -Depends: ntdll-DllRedirects