Rebase against 97b420224e767b24d89722ff5efeca38a8ecf1e2.

This commit is contained in:
Zebediah Figura
2021-04-01 23:03:15 -05:00
parent 4e2dc89043
commit 545073aafa
4 changed files with 25 additions and 25 deletions

View File

@@ -1,4 +1,4 @@
From 45940635b59cf3183e26ab3ffd2b8f486161e5ad Mon Sep 17 00:00:00 2001
From 7357cb7a11d785aca554e255bc5c672c279d948f 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.
@@ -110,10 +110,10 @@ index 1db68a191a3..bec46088518 100644
test_dll_file( "kernel32.dll" );
test_dll_file( "advapi32.dll" );
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 01644df7763..8c6d05cb94e 100644
index daee7675196..659cba51768 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -112,6 +112,9 @@ struct file_id
@@ -113,6 +113,9 @@ struct file_id
BYTE ObjectId[16];
};
@@ -123,7 +123,7 @@ index 01644df7763..8c6d05cb94e 100644
/* internal representation of loaded modules */
typedef struct _wine_modref
{
@@ -450,6 +453,52 @@ static void call_ldr_notifications( ULONG reason, LDR_DATA_TABLE_ENTRY *module )
@@ -451,6 +454,52 @@ static void call_ldr_notifications( ULONG reason, LDR_DATA_TABLE_ENTRY *module )
}
}
@@ -176,7 +176,7 @@ index 01644df7763..8c6d05cb94e 100644
/*************************************************************************
* get_modref
*
@@ -1196,7 +1245,12 @@ static WINE_MODREF *alloc_module( HMODULE hModule, const UNICODE_STRING *nt_name
@@ -1197,7 +1246,12 @@ static WINE_MODREF *alloc_module( HMODULE hModule, const UNICODE_STRING *nt_name
&wm->ldr.InLoadOrderLinks);
InsertTailList(&NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList,
&wm->ldr.InMemoryOrderLinks);
@@ -189,7 +189,7 @@ index 01644df7763..8c6d05cb94e 100644
if (!(nt->OptionalHeader.DllCharacteristics & IMAGE_DLLCHARACTERISTICS_NX_COMPAT))
{
@@ -1876,6 +1930,7 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name,
@@ -1877,6 +1931,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);
@@ -197,7 +197,7 @@ index 01644df7763..8c6d05cb94e 100644
/* FIXME: there are several more dangling references
* left. Including dlls loaded by this dll before the
@@ -3277,6 +3332,7 @@ static void free_modref( WINE_MODREF *wm )
@@ -3307,6 +3362,7 @@ static void free_modref( WINE_MODREF *wm )
{
RemoveEntryList(&wm->ldr.InLoadOrderLinks);
RemoveEntryList(&wm->ldr.InMemoryOrderLinks);
@@ -205,15 +205,15 @@ index 01644df7763..8c6d05cb94e 100644
if (wm->ldr.InInitializationOrderLinks.Flink)
RemoveEntryList(&wm->ldr.InInitializationOrderLinks);
@@ -3979,6 +4035,7 @@ static NTSTATUS process_init(void)
INITIAL_TEB stack;
@@ -4024,6 +4080,7 @@ static NTSTATUS process_init(void)
{
TEB *teb = NtCurrentTeb();
PEB *peb = teb->Peb;
+ DWORD i;
peb->LdrData = &ldr;
peb->FastPebLock = &peb_lock;
@@ -4002,6 +4059,10 @@ static NTSTATUS process_init(void)
@@ -4047,6 +4104,10 @@ static NTSTATUS process_init(void)
InitializeListHead( &ldr.InMemoryOrderModuleList );
InitializeListHead( &ldr.InInitializationOrderModuleList );
@@ -221,13 +221,13 @@ index 01644df7763..8c6d05cb94e 100644
+ for (i = 0; i < HASH_MAP_SIZE; i++)
+ InitializeListHead(&hash_table[i]);
+
#ifndef _WIN64
is_wow64 = !!NtCurrentTeb64();
init_user_process_params();
load_global_options();
version_init();
@@ -4064,6 +4125,10 @@ static NTSTATUS process_init(void)
map_wow64cpu();
}
#endif
@@ -4050,6 +4111,10 @@ static NTSTATUS process_init(void)
teb->Tib.StackBase = stack.StackBase;
teb->Tib.StackLimit = stack.StackLimit;
teb->DeallocationStack = stack.DeallocationStack;
+
+ /* the windows version was not set yet when ntdll and kernel32 were loaded */
+ recompute_hash_map();
@@ -236,10 +236,10 @@ index 01644df7763..8c6d05cb94e 100644
}
diff --git a/include/winternl.h b/include/winternl.h
index fcdedaec8aa..6ea72da54f7 100644
index 9e6bde25569..0fa75e676fe 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -3040,8 +3040,8 @@ typedef struct _LDR_DATA_TABLE_ENTRY
@@ -3181,8 +3181,8 @@ typedef struct _LDR_DATA_TABLE_ENTRY
ULONG Flags;
SHORT LoadCount;
SHORT TlsIndex;