Remove ntdll-Attach_Process_Dlls

Fixed by https://source.winehq.org/git/wine.git/ed893d3591802bb562d100b277f968be402af740
This commit is contained in:
Zebediah Figura 2018-02-17 18:25:45 -06:00
parent 8c1c90df75
commit 7993a8d151
5 changed files with 18 additions and 107 deletions

View File

@ -1,54 +0,0 @@
From 0cb287b9ba62ee9e353248861d4c177f7db48dcb Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Wed, 20 Jul 2016 02:21:41 +0200
Subject: ntdll: Ensure process dlls are not attached too early. (v2)
---
dlls/ntdll/loader.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 518a99f590..94668e8ba4 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -64,6 +64,7 @@ WINE_DECLARE_DEBUG_CHANNEL(pid);
typedef DWORD (CALLBACK *DLLENTRYPROC)(HMODULE,DWORD,LPVOID);
typedef void (CALLBACK *LDRENUMPROC)(LDR_MODULE *, void *, BOOLEAN *);
+static BOOL process_attaching = TRUE; /* set on process attach to avoid calling callbacks too early */
static BOOL process_detaching = FALSE; /* set on process detach to avoid deadlocks with thread detach */
static int free_lib_count; /* recursion depth of LdrUnloadDll calls */
@@ -452,7 +453,20 @@ static FARPROC find_forwarded_export( HMODULE module, const char *forward, LPCWS
if (load_dll( load_path, mod_name, 0, &wm ) == STATUS_SUCCESS &&
!(wm->ldr.Flags & LDR_DONT_RESOLVE_REFS))
{
- if (process_attach( wm, NULL ) != STATUS_SUCCESS)
+ if (process_attaching)
+ {
+ WINE_MODREF **deps, *prev = get_modref( module );
+ if (!prev->deps)
+ deps = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(*deps) );
+ else
+ deps = RtlReAllocateHeap( GetProcessHeap(), 0, prev->deps, (prev->nDeps + 1) * sizeof(*deps) );
+ if (deps)
+ {
+ prev->deps = deps;
+ prev->deps[prev->nDeps++] = wm;
+ }
+ }
+ else if (process_attach( wm, NULL ) != STATUS_SUCCESS)
{
LdrUnloadDll( wm->ldr.BaseAddress );
wm = NULL;
@@ -3005,6 +3019,7 @@ static NTSTATUS attach_process_dlls( void *wm )
{
NTSTATUS status;
+ process_attaching = FALSE;
pthread_sigmask( SIG_UNBLOCK, &server_block_set, NULL );
RtlEnterCriticalSection( &loader_section );
--
2.12.2

View File

@ -1 +0,0 @@
Fixes: [40714] Ensure process_attach callbacks are not executed too early

View File

@ -1,4 +1,3 @@
Fixes: Support for loader dll redirections
Depends: ntdll-Loader_Machine_Type
Depends: ntdll-DllOverrides_WOW64
Depends: ntdll-Attach_Process_DLLs

View File

@ -1,3 +1,2 @@
Fixes: [38656] Add support for hiding wine version information from applications
Depends: ntdll-Attach_Process_DLLs
Depends: ntdll-ThreadTime

View File

@ -229,7 +229,6 @@ patch_enable_all ()
enable_ntdll_Activation_Context="$1"
enable_ntdll_ApiSetMap="$1"
enable_ntdll_ApiSetQueryApiSetPresence="$1"
enable_ntdll_Attach_Process_DLLs="$1"
enable_ntdll_Builtin_Prot="$1"
enable_ntdll_CLI_Images="$1"
enable_ntdll_CriticalSection="$1"
@ -949,9 +948,6 @@ patch_enable ()
ntdll-ApiSetQueryApiSetPresence)
enable_ntdll_ApiSetQueryApiSetPresence="$2"
;;
ntdll-Attach_Process_DLLs)
enable_ntdll_Attach_Process_DLLs="$2"
;;
ntdll-Builtin_Prot)
enable_ntdll_Builtin_Prot="$2"
;;
@ -2595,16 +2591,12 @@ if test "$enable_ntdll_HashLinks" -eq 1; then
fi
if test "$enable_ntdll_DllRedirects" -eq 1; then
if test "$enable_ntdll_Attach_Process_DLLs" -gt 1; then
abort "Patchset ntdll-Attach_Process_DLLs disabled, but ntdll-DllRedirects depends on that."
fi
if test "$enable_ntdll_DllOverrides_WOW64" -gt 1; then
abort "Patchset ntdll-DllOverrides_WOW64 disabled, but ntdll-DllRedirects depends on that."
fi
if test "$enable_ntdll_Loader_Machine_Type" -gt 1; then
abort "Patchset ntdll-Loader_Machine_Type disabled, but ntdll-DllRedirects depends on that."
fi
enable_ntdll_Attach_Process_DLLs=1
enable_ntdll_DllOverrides_WOW64=1
enable_ntdll_Loader_Machine_Type=1
fi
@ -2643,13 +2635,9 @@ if test "$enable_ntdll_User_Shared_Data" -eq 1; then
fi
if test "$enable_ntdll_Hide_Wine_Exports" -eq 1; then
if test "$enable_ntdll_Attach_Process_DLLs" -gt 1; then
abort "Patchset ntdll-Attach_Process_DLLs disabled, but ntdll-Hide_Wine_Exports depends on that."
fi
if test "$enable_ntdll_ThreadTime" -gt 1; then
abort "Patchset ntdll-ThreadTime disabled, but ntdll-Hide_Wine_Exports depends on that."
fi
enable_ntdll_Attach_Process_DLLs=1
enable_ntdll_ThreadTime=1
fi
@ -5875,25 +5863,10 @@ if test "$enable_ntdll_ApiSetQueryApiSetPresence" -eq 1; then
) >> "$patchlist"
fi
# Patchset ntdll-Attach_Process_DLLs
# |
# | This patchset fixes the following Wine bugs:
# | * [#40714] Ensure process_attach callbacks are not executed too early
# |
# | Modified files:
# | * dlls/ntdll/loader.c
# |
if test "$enable_ntdll_Attach_Process_DLLs" -eq 1; then
patch_apply ntdll-Attach_Process_DLLs/0001-ntdll-Ensure-process-dlls-are-not-attached-too-early.patch
(
printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Ensure process dlls are not attached too early.", 2 },';
) >> "$patchlist"
fi
# Patchset ntdll-Hide_Wine_Exports
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * ntdll-Attach_Process_DLLs, ntdll-ThreadTime
# | * ntdll-ThreadTime
# |
# | This patchset fixes the following Wine bugs:
# | * [#38656] Add support for hiding wine version information from applications
@ -5931,7 +5904,7 @@ fi
# Patchset ntdll-User_Shared_Data
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * ntdll-Attach_Process_DLLs, ntdll-ThreadTime, ntdll-Hide_Wine_Exports, ntdll-x86_64_ExceptionInformation
# | * ntdll-ThreadTime, ntdll-Hide_Wine_Exports, ntdll-x86_64_ExceptionInformation
# |
# | This patchset fixes the following Wine bugs:
# | * [#29168] Update user shared data at realtime
@ -5956,8 +5929,7 @@ fi
# Patchset ntdll-Builtin_Prot
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * ntdll-Attach_Process_DLLs, ntdll-ThreadTime, ntdll-Hide_Wine_Exports, ntdll-x86_64_ExceptionInformation, ntdll-
# | User_Shared_Data
# | * ntdll-ThreadTime, ntdll-Hide_Wine_Exports, ntdll-x86_64_ExceptionInformation, ntdll-User_Shared_Data
# |
# | Modified files:
# | * dlls/ntdll/virtual.c, dlls/psapi/tests/psapi_main.c
@ -6104,7 +6076,7 @@ fi
# Patchset ntdll-DllRedirects
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * ntdll-Attach_Process_DLLs, ntdll-DllOverrides_WOW64, ntdll-Loader_Machine_Type
# | * ntdll-DllOverrides_WOW64, ntdll-Loader_Machine_Type
# |
# | Modified files:
# | * dlls/ntdll/loader.c, dlls/ntdll/loadorder.c, dlls/ntdll/ntdll_misc.h
@ -6319,7 +6291,7 @@ fi
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * mscoree-CorValidateImage, ntdll-APC_Start_Process, ntdll-CLI_Images, ntdll-LDR_MODULE, ntdll-HashLinks, ntdll-
# | Attach_Process_DLLs, ntdll-ThreadTime, ntdll-Hide_Wine_Exports, ntdll-RtlQueryPackageIdentity
# | ThreadTime, ntdll-Hide_Wine_Exports, ntdll-RtlQueryPackageIdentity
# |
# | Modified files:
# | * dlls/ntdll/loader.c, dlls/ntdll/ntdll.spec, dlls/ntdll/tests/rtl.c, include/winternl.h
@ -6544,7 +6516,7 @@ fi
# Patchset ntdll-Purist_Mode
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * ntdll-Attach_Process_DLLs, ntdll-DllOverrides_WOW64, ntdll-Loader_Machine_Type, ntdll-DllRedirects
# | * ntdll-DllOverrides_WOW64, ntdll-Loader_Machine_Type, ntdll-DllRedirects
# |
# | Modified files:
# | * dlls/ntdll/loadorder.c
@ -6637,8 +6609,7 @@ fi
# Patchset ntdll-WRITECOPY
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * ntdll-Attach_Process_DLLs, ntdll-ThreadTime, ntdll-Hide_Wine_Exports, ntdll-x86_64_ExceptionInformation, ntdll-
# | User_Shared_Data
# | * ntdll-ThreadTime, ntdll-Hide_Wine_Exports, ntdll-x86_64_ExceptionInformation, ntdll-User_Shared_Data
# |
# | This patchset fixes the following Wine bugs:
# | * [#29384] Voobly expects correct handling of WRITECOPY memory protection
@ -6665,8 +6636,7 @@ fi
# Patchset ntdll-Signal_Handler
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * ntdll-Attach_Process_DLLs, ntdll-ThreadTime, ntdll-Hide_Wine_Exports, ntdll-x86_64_ExceptionInformation, ntdll-
# | User_Shared_Data, ntdll-WRITECOPY
# | * ntdll-ThreadTime, ntdll-Hide_Wine_Exports, ntdll-x86_64_ExceptionInformation, ntdll-User_Shared_Data, ntdll-WRITECOPY
# |
# | Modified files:
# | * dlls/ntdll/signal_i386.c
@ -8695,7 +8665,7 @@ fi
# Patchset uxtheme-GTK_Theming
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * ntdll-Attach_Process_DLLs, ntdll-DllOverrides_WOW64, ntdll-Loader_Machine_Type, ntdll-DllRedirects
# | * ntdll-DllOverrides_WOW64, ntdll-Loader_Machine_Type, ntdll-DllRedirects
# |
# | Modified files:
# | * aclocal.m4, configure.ac, dlls/uxtheme-gtk/Makefile.in, dlls/uxtheme-gtk/button.c, dlls/uxtheme-gtk/combobox.c, dlls
@ -9252,8 +9222,7 @@ fi
# Patchset winebuild-Fake_Dlls
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * ntdll-Attach_Process_DLLs, ntdll-ThreadTime, ntdll-Hide_Wine_Exports, ntdll-x86_64_ExceptionInformation, ntdll-
# | User_Shared_Data
# | * ntdll-ThreadTime, ntdll-Hide_Wine_Exports, ntdll-x86_64_ExceptionInformation, ntdll-User_Shared_Data
# |
# | This patchset fixes the following Wine bugs:
# | * [#42741] Various improvements for fake dlls
@ -9508,10 +9477,10 @@ fi
# Patchset wined3d-CSMT_Helper
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * wined3d-1DTextures, d3d11-Deferred_Context, d3d9-Tests, makedep-PARENTSPEC, ntdll-Attach_Process_DLLs, ntdll-
# | DllOverrides_WOW64, ntdll-Loader_Machine_Type, ntdll-DllRedirects, wined3d-Accounting, d3d11-Depth_Bias, wined3d-
# | Copy_Resource_Typeless, wined3d-DXTn, wined3d-Core_Context, wined3d-Viewports, wined3d-Dual_Source_Blending, wined3d-
# | GenerateMips, wined3d-QUERY_Stubs, wined3d-Revert_Buffer_Upload, wined3d-Silence_FIXMEs, wined3d-UAV_Counters
# | * wined3d-1DTextures, d3d11-Deferred_Context, d3d9-Tests, makedep-PARENTSPEC, ntdll-DllOverrides_WOW64, ntdll-
# | Loader_Machine_Type, ntdll-DllRedirects, wined3d-Accounting, d3d11-Depth_Bias, wined3d-Copy_Resource_Typeless, wined3d-
# | DXTn, wined3d-Core_Context, wined3d-Viewports, wined3d-Dual_Source_Blending, wined3d-GenerateMips, wined3d-QUERY_Stubs,
# | wined3d-Revert_Buffer_Upload, wined3d-Silence_FIXMEs, wined3d-UAV_Counters
# |
# | Modified files:
# | * configure.ac, dlls/wined3d-csmt/Makefile.in, dlls/wined3d-csmt/version.rc
@ -9687,11 +9656,10 @@ fi
# Patchset wined3d-CSMT_Main
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * wined3d-1DTextures, d3d11-Deferred_Context, d3d9-Tests, makedep-PARENTSPEC, ntdll-Attach_Process_DLLs, ntdll-
# | DllOverrides_WOW64, ntdll-Loader_Machine_Type, ntdll-DllRedirects, wined3d-Accounting, d3d11-Depth_Bias, wined3d-
# | Copy_Resource_Typeless, wined3d-DXTn, wined3d-Core_Context, wined3d-Viewports, wined3d-Dual_Source_Blending, wined3d-
# | GenerateMips, wined3d-QUERY_Stubs, wined3d-Revert_Buffer_Upload, wined3d-Silence_FIXMEs, wined3d-UAV_Counters, wined3d-
# | CSMT_Helper
# | * wined3d-1DTextures, d3d11-Deferred_Context, d3d9-Tests, makedep-PARENTSPEC, ntdll-DllOverrides_WOW64, ntdll-
# | Loader_Machine_Type, ntdll-DllRedirects, wined3d-Accounting, d3d11-Depth_Bias, wined3d-Copy_Resource_Typeless, wined3d-
# | DXTn, wined3d-Core_Context, wined3d-Viewports, wined3d-Dual_Source_Blending, wined3d-GenerateMips, wined3d-QUERY_Stubs,
# | wined3d-Revert_Buffer_Upload, wined3d-Silence_FIXMEs, wined3d-UAV_Counters, wined3d-CSMT_Helper
# |
# | This patchset fixes the following Wine bugs:
# | * [#11674] Support for CSMT (command stream) to increase graphic performance