Rebase against 4aa7fbe0561e6a27f098a05a63c5a7d12397e678

This commit is contained in:
Alistair Leslie-Hughes
2019-06-18 08:39:24 +10:00
parent e07b0fa042
commit b5055c0b1b
18 changed files with 116 additions and 268 deletions

View File

@@ -1,16 +1,16 @@
From 0f2ee82d68b0608b5b68fb82e001aaebdc998166 Mon Sep 17 00:00:00 2001
From 7d5594cc0b3760843d7d566e642e175a9e542a08 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 | 76 ++++++++++++++++++++++++++++++++++++++++++++
dlls/ntdll/loader.c | 65 +++++++++++++++++++++++++++++++++++++
dlls/kernel32/tests/loader.c | 76 ++++++++++++++++++++++++++++++++++++
dlls/ntdll/loader.c | 65 ++++++++++++++++++++++++++++++
include/winternl.h | 5 ++-
3 files changed, 145 insertions(+), 1 deletion(-)
diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c
index b8dc72b..63219c0 100644
index bdcb3448ab7..8e9e780bb50 100644
--- a/dlls/kernel32/tests/loader.c
+++ b/dlls/kernel32/tests/loader.c
@@ -30,6 +30,7 @@
@@ -21,7 +21,7 @@ index b8dc72b..63219c0 100644
#include "wine/test.h"
#include "delayloadhandler.h"
@@ -3858,6 +3859,79 @@ static void test_dll_file( const char *name )
@@ -3993,6 +3994,79 @@ static void test_dll_file( const char *name )
#undef OK_FIELD
}
@@ -101,7 +101,7 @@ index b8dc72b..63219c0 100644
START_TEST(loader)
{
int argc;
@@ -3925,10 +3999,12 @@ START_TEST(loader)
@@ -4061,10 +4135,12 @@ START_TEST(loader)
test_import_resolution();
test_ExitProcess();
test_InMemoryOrderModuleList();
@@ -115,10 +115,10 @@ index b8dc72b..63219c0 100644
test_Loader();
}
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 994ff6f..cc764d3 100644
index 8fe2038b346..5a3036e1246 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -93,6 +93,9 @@ static const char * const reason_names[] =
@@ -96,6 +96,9 @@ static const char * const reason_names[] =
static const WCHAR dllW[] = {'.','d','l','l',0};
@@ -128,10 +128,11 @@ index 994ff6f..cc764d3 100644
/* internal representation of 32bit modules. per process. */
typedef struct _wine_modref
{
@@ -427,6 +430,52 @@ static void call_ldr_notifications( ULONG reason, LDR_MODULE *module )
@@ -429,6 +432,52 @@ static void call_ldr_notifications( ULONG reason, LDR_MODULE *module )
}
}
/*************************************************************************
+/*************************************************************************
+ * hash_basename
+ *
+ * Calculates the bucket index of a dll using the basename.
@@ -177,11 +178,10 @@ index 994ff6f..cc764d3 100644
+ }
+}
+
+/*************************************************************************
/*************************************************************************
* get_modref
*
* Looks for the referenced HMODULE in the current process
@@ -1150,7 +1199,12 @@ static WINE_MODREF *alloc_module( HMODULE hModule, const UNICODE_STRING *nt_name
@@ -1176,7 +1225,12 @@ static WINE_MODREF *alloc_module( HMODULE hModule, const UNICODE_STRING *nt_name
&wm->ldr.InLoadOrderModuleList);
InsertTailList(&NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList,
&wm->ldr.InMemoryOrderModuleList);
@@ -194,7 +194,7 @@ index 994ff6f..cc764d3 100644
if (!(nt->OptionalHeader.DllCharacteristics & IMAGE_DLLCHARACTERISTICS_NX_COMPAT))
{
@@ -1804,6 +1858,7 @@ static void load_builtin_callback( void *module, const char *filename )
@@ -1921,6 +1975,7 @@ static void load_builtin_callback( void *module, const char *filename )
/* the module has only be inserted in the load & memory order lists */
RemoveEntryList(&wm->ldr.InLoadOrderModuleList);
RemoveEntryList(&wm->ldr.InMemoryOrderModuleList);
@@ -202,7 +202,7 @@ index 994ff6f..cc764d3 100644
/* FIXME: free the modref */
builtin_load_info->status = STATUS_DLL_NOT_FOUND;
return;
@@ -2165,6 +2220,7 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, const UNICODE_STRING *nt_nam
@@ -2288,6 +2343,7 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, const UNICODE_STRING *nt_nam
/* the module has only be inserted in the load & memory order lists */
RemoveEntryList(&wm->ldr.InLoadOrderModuleList);
RemoveEntryList(&wm->ldr.InMemoryOrderModuleList);
@@ -210,7 +210,7 @@ index 994ff6f..cc764d3 100644
/* FIXME: there are several more dangling references
* left. Including dlls loaded by this dll before the
@@ -3322,6 +3378,7 @@ static void free_modref( WINE_MODREF *wm )
@@ -3451,6 +3507,7 @@ static void free_modref( WINE_MODREF *wm )
{
RemoveEntryList(&wm->ldr.InLoadOrderModuleList);
RemoveEntryList(&wm->ldr.InMemoryOrderModuleList);
@@ -218,15 +218,15 @@ index 994ff6f..cc764d3 100644
if (wm->ldr.InInitializationOrderModuleList.Flink)
RemoveEntryList(&wm->ldr.InInitializationOrderModuleList);
@@ -3750,6 +3807,7 @@ void __wine_process_init(void)
ANSI_STRING func_name;
@@ -3937,6 +3994,7 @@ void __wine_process_init(void)
UNICODE_STRING nt_name;
void * (CDECL *init_func)(void);
INITIAL_TEB stack;
+ DWORD i;
thread_init();
@@ -3759,6 +3817,10 @@ void __wine_process_init(void)
@@ -3946,6 +4004,10 @@ void __wine_process_init(void)
load_global_options();
@@ -237,21 +237,21 @@ index 994ff6f..cc764d3 100644
/* setup the load callback and create ntdll modref */
wine_dll_set_callback( load_builtin_callback );
@@ -3801,6 +3863,9 @@ void __wine_process_init(void)
@@ -4000,6 +4062,9 @@ void __wine_process_init(void)
RemoveEntryList( &wm->ldr.InMemoryOrderModuleList );
InsertHeadList( &NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList, &wm->ldr.InMemoryOrderModuleList );
+ /* the windows version was not set yet when ntdll and kernel32 were loaded */
+ recompute_hash_map();
+
if ((status = virtual_alloc_thread_stack( NtCurrentTeb(), 0, 0, NULL )) != STATUS_SUCCESS)
if ((status = virtual_alloc_thread_stack( &stack, 0, 0, NULL )) != STATUS_SUCCESS)
{
ERR( "Main exe initialization for %s failed, status %x\n",
diff --git a/include/winternl.h b/include/winternl.h
index fb7b7c1..c522207 100644
index 4cd531a4613..0d5e0e9bd8a 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -2198,8 +2198,8 @@ typedef struct _LDR_MODULE
@@ -2225,8 +2225,8 @@ typedef struct _LDR_MODULE
ULONG Flags;
SHORT LoadCount;
SHORT TlsIndex;
@@ -261,7 +261,7 @@ index fb7b7c1..c522207 100644
ULONG TimeDateStamp;
HANDLE ActivationContext;
PVOID PatchInformation;
@@ -2209,6 +2209,9 @@ typedef struct _LDR_MODULE
@@ -2236,6 +2236,9 @@ typedef struct _LDR_MODULE
PVOID ContextInformation;
ULONG_PTR OriginalBase;
LARGE_INTEGER LoadTime;
@@ -272,5 +272,5 @@ index fb7b7c1..c522207 100644
typedef struct _LDR_DLL_LOADED_NOTIFICATION_DATA
--
1.9.1
2.17.1