Added ntdll-LDR_IMAGE_IS_DLL patchset

This commit is contained in:
Alistair Leslie-Hughes 2020-04-11 11:11:24 +10:00
parent c4c72e90ab
commit 776306026a
4 changed files with 71 additions and 6 deletions

View File

@ -0,0 +1,45 @@
From 8fcd62774c95cecf71bac1210767dc7120e3e4ae Mon Sep 17 00:00:00 2001
From: Myah Caron <qsniyg@protonmail.com>
Date: Thu, 2 Apr 2020 06:25:23 +0000
Subject: [PATCH] ntdll: Cache LDR_IMAGE_IS_DLL for InitDLL
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48817
Signed-off-by: Myah Caron <qsniyg@protonmail.com>
---
dlls/ntdll/loader.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 7090990c638..6fe7de58854 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -133,6 +133,7 @@ typedef struct _wine_modref
int alloc_deps;
int nDeps;
struct _wine_modref **deps;
+ BOOL is_dll;
} WINE_MODREF;
/* info about the current builtin dll load */
@@ -1255,6 +1256,9 @@ static WINE_MODREF *alloc_module( HMODULE hModule, const UNICODE_STRING *nt_name
wm->ldr.EntryPoint = (char *)hModule + nt->OptionalHeader.AddressOfEntryPoint;
}
+ /* The flags can be modified later */
+ wm->is_dll = !!(wm->ldr.Flags & LDR_IMAGE_IS_DLL);
+
InsertTailList(&NtCurrentTeb()->Peb->LdrData->InLoadOrderModuleList,
&wm->ldr.InLoadOrderModuleList);
InsertTailList(&NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList,
@@ -1372,7 +1376,7 @@ static NTSTATUS MODULE_InitDLL( WINE_MODREF *wm, UINT reason, LPVOID lpReserved
if (wm->ldr.Flags & LDR_DONT_RESOLVE_REFS) return STATUS_SUCCESS;
if (wm->ldr.TlsIndex != -1) call_tls_callbacks( wm->ldr.BaseAddress, reason );
- if (!entry || !(wm->ldr.Flags & LDR_IMAGE_IS_DLL)) return STATUS_SUCCESS;
+ if (!entry || !(wm->is_dll)) return STATUS_SUCCESS;
if (TRACE_ON(relay))
{
--
2.25.1

View File

@ -0,0 +1 @@
Fixes: [48817] ntdll: Cache LDR_IMAGE_IS_DLL for InitDLL

View File

@ -1,19 +1,19 @@
From 5eeaec794d902cffb4b7911878d5913ef0a38b93 Mon Sep 17 00:00:00 2001
From 7b215b4d87481ce9e30090b6b17e2f7b48937473 Mon Sep 17 00:00:00 2001
From: Qian Hong <qhong@codeweavers.com>
Date: Wed, 9 Sep 2015 05:31:18 +0800
Subject: ntdll: Initialize mod_name to zero.
Subject: [PATCH] ntdll: Initialize mod_name to zero.
---
dlls/ntdll/loader.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 831f049..ae89819 100644
index 6fe7de58854..13e5fd3f877 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -1087,6 +1087,8 @@ static NTSTATUS MODULE_InitDLL( WINE_MODREF *wm, UINT reason, LPVOID lpReserved
@@ -1378,6 +1378,8 @@ static NTSTATUS MODULE_InitDLL( WINE_MODREF *wm, UINT reason, LPVOID lpReserved
if (wm->ldr.TlsIndex != -1) call_tls_callbacks( wm->ldr.BaseAddress, reason );
if (!entry || !(wm->ldr.Flags & LDR_IMAGE_IS_DLL)) return STATUS_SUCCESS;
if (!entry || !(wm->is_dll)) return STATUS_SUCCESS;
+ memset( mod_name, 0, sizeof(mod_name) );
+
@ -21,5 +21,5 @@ index 831f049..ae89819 100644
{
size_t len = min( wm->ldr.BaseDllName.Length, sizeof(mod_name)-sizeof(WCHAR) );
--
2.5.1
2.25.1

View File

@ -185,6 +185,7 @@ patch_enable_all ()
enable_ntdll_Hide_Wine_Exports="$1"
enable_ntdll_Interrupt_0x2e="$1"
enable_ntdll_Junction_Points="$1"
enable_ntdll_LDR_IMAGE_IS_DLL="$1"
enable_ntdll_LDR_MODULE="$1"
enable_ntdll_Manifest_Range="$1"
enable_ntdll_NtAccessCheck="$1"
@ -666,6 +667,9 @@ patch_enable ()
ntdll-Junction_Points)
enable_ntdll_Junction_Points="$2"
;;
ntdll-LDR_IMAGE_IS_DLL)
enable_ntdll_LDR_IMAGE_IS_DLL="$2"
;;
ntdll-LDR_MODULE)
enable_ntdll_LDR_MODULE="$2"
;;
@ -4661,6 +4665,21 @@ if test "$enable_ntdll_Interrupt_0x2e" -eq 1; then
) >> "$patchlist"
fi
# Patchset ntdll-LDR_IMAGE_IS_DLL
# |
# | This patchset fixes the following Wine bugs:
# | * [#48817] ntdll: Cache LDR_IMAGE_IS_DLL for InitDLL
# |
# | Modified files:
# | * dlls/ntdll/loader.c
# |
if test "$enable_ntdll_LDR_IMAGE_IS_DLL" -eq 1; then
patch_apply ntdll-LDR_IMAGE_IS_DLL/0001-ntdll-Cache-LDR_IMAGE_IS_DLL-for-InitDLL.patch
(
printf '%s\n' '+ { "Myah Caron", "ntdll: Cache LDR_IMAGE_IS_DLL for InitDLL.", 1 },';
) >> "$patchlist"
fi
# Patchset ntdll-Manifest_Range
# |
# | This patchset fixes the following Wine bugs: