Rebase against 46367d1ecc8a016ab7c7af9ec107e33c6d46fc26.

This commit is contained in:
Alistair Leslie-Hughes
2021-11-04 10:15:32 +11:00
parent fe634350d2
commit 00ab8180c0
13 changed files with 76 additions and 193 deletions

View File

@@ -1,12 +1,12 @@
From 187108be05dcf7521646c22f637627147d9bbdb3 Mon Sep 17 00:00:00 2001
From f44bf16013c0dace490308af9ce17b3ff6082abf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Mon, 3 Apr 2017 05:30:27 +0200
Subject: [PATCH] ntdll: Implement HashLinks field in LDR module data.
---
dlls/kernel32/tests/loader.c | 75 ++++++++++++++++++++++++++++++++++++
dlls/ntdll/loader.c | 41 ++++++++++++++++++++
2 files changed, 116 insertions(+)
dlls/ntdll/loader.c | 42 ++++++++++++++++++++
2 files changed, 117 insertions(+)
diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c
index 4f1b11338a6..56cd5a88e20 100644
@@ -109,7 +109,7 @@ index 4f1b11338a6..56cd5a88e20 100644
test_dll_file( "kernel32.dll" );
test_dll_file( "advapi32.dll" );
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 65d684e555c..644d531d8f8 100644
index 6dcf73295b0..8b9305ff5b6 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -129,6 +129,9 @@ struct file_id
@@ -122,7 +122,7 @@ index 65d684e555c..644d531d8f8 100644
/* internal representation of loaded modules */
typedef struct _wine_modref
{
@@ -477,6 +480,33 @@ static void call_ldr_notifications( ULONG reason, LDR_DATA_TABLE_ENTRY *module )
@@ -476,6 +479,33 @@ static void call_ldr_notifications( ULONG reason, LDR_DATA_TABLE_ENTRY *module )
}
}
@@ -156,7 +156,7 @@ index 65d684e555c..644d531d8f8 100644
/*************************************************************************
* get_modref
*
@@ -1253,7 +1283,12 @@ static WINE_MODREF *alloc_module( HMODULE hModule, const UNICODE_STRING *nt_name
@@ -1352,7 +1382,12 @@ static WINE_MODREF *alloc_module( HMODULE hModule, const UNICODE_STRING *nt_name
&wm->ldr.InLoadOrderLinks);
InsertTailList(&NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList,
&wm->ldr.InMemoryOrderLinks);
@@ -169,7 +169,7 @@ index 65d684e555c..644d531d8f8 100644
if (!(nt->OptionalHeader.DllCharacteristics & IMAGE_DLLCHARACTERISTICS_NX_COMPAT))
{
@@ -1933,6 +1968,7 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name,
@@ -2032,6 +2067,7 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name,
/* the module has only be inserted in the load & memory order lists */
RemoveEntryList(&wm->ldr.InLoadOrderLinks);
RemoveEntryList(&wm->ldr.InMemoryOrderLinks);
@@ -177,15 +177,23 @@ index 65d684e555c..644d531d8f8 100644
/* FIXME: there are several more dangling references
* left. Including dlls loaded by this dll before the
@@ -3518,6 +3554,7 @@ static void free_modref( WINE_MODREF *wm )
{
@@ -3621,6 +3657,7 @@ static void free_modref( WINE_MODREF *wm )
RemoveEntryList(&wm->ldr.InLoadOrderLinks);
RemoveEntryList(&wm->ldr.InMemoryOrderLinks);
+ RemoveEntryList(&wm->ldr.HashLinks);
if (wm->ldr.InInitializationOrderLinks.Flink)
RemoveEntryList(&wm->ldr.InInitializationOrderLinks);
@@ -3881,6 +3918,10 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
@@ -3983,6 +4020,7 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
if (!imports_fixup_done)
{
+ int i;
ANSI_STRING func_name;
WINE_MODREF *kernel32;
PEB *peb = NtCurrentTeb()->Peb;
@@ -4000,6 +4038,10 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
sizeof(peb->TlsExpansionBitmapBits) * 8 );
RtlSetBits( peb->TlsBitmap, 0, 1 ); /* TLS index 0 is reserved and should be initialized to NULL. */