Fixed compile errors when building with -Werror

NOTE: Tests are skipped.
This commit is contained in:
Alistair Leslie-Hughes
2021-06-08 09:15:19 +10:00
parent 8a3554ad85
commit daec2e3662
18 changed files with 373 additions and 74 deletions

View File

@@ -1,13 +1,13 @@
From 78e8d51910a41db9a31ec350228989a0c65cf899 Mon Sep 17 00:00:00 2001
From 2849190768a826d888577c820c52a593b660b64e 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 | 60 +++++++++++++++++++++++++++++
dlls/ntdll/loader.c | 41 ++++++++++++++++++++
include/winternl.h | 2 +-
3 files changed, 136 insertions(+), 1 deletion(-)
3 files changed, 117 insertions(+), 1 deletion(-)
diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c
index 1db68a191a3..bec46088518 100644
@@ -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 7a714a5aa6d..996a749ebaa 100644
index f3a37d4e8a6..eb0f3f8741c 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -113,6 +113,9 @@ struct file_id
@@ -124,6 +124,9 @@ struct file_id
BYTE ObjectId[16];
};
@@ -123,7 +123,7 @@ index 7a714a5aa6d..996a749ebaa 100644
/* internal representation of loaded modules */
typedef struct _wine_modref
{
@@ -458,6 +461,52 @@ static void call_ldr_notifications( ULONG reason, LDR_DATA_TABLE_ENTRY *module )
@@ -469,6 +472,33 @@ static void call_ldr_notifications( ULONG reason, LDR_DATA_TABLE_ENTRY *module )
}
}
@@ -153,30 +153,11 @@ index 7a714a5aa6d..996a749ebaa 100644
+
+ return hash & (HASH_MAP_SIZE-1);
+}
+
+/*************************************************************************
+ * recompute_hash_maps
+ *
+ * Recomputes the LDR hash map (necessary when windows version changes).
+ */
+static void recompute_hash_map(void)
+{
+ LIST_ENTRY *mark, *entry;
+ LDR_DATA_TABLE_ENTRY *mod;
+
+ mark = &NtCurrentTeb()->Peb->LdrData->InLoadOrderModuleList;
+ for (entry = mark->Flink; entry != mark; entry = entry->Flink)
+ {
+ mod = CONTAINING_RECORD(entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
+ RemoveEntryList( &mod->HashLinks );
+ InsertTailList( &hash_table[hash_basename(mod->BaseDllName.Buffer)], &mod->HashLinks );
+ }
+}
+
/*************************************************************************
* get_modref
*
@@ -1204,7 +1253,12 @@ static WINE_MODREF *alloc_module( HMODULE hModule, const UNICODE_STRING *nt_name
@@ -1245,7 +1275,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 +170,7 @@ index 7a714a5aa6d..996a749ebaa 100644
if (!(nt->OptionalHeader.DllCharacteristics & IMAGE_DLLCHARACTERISTICS_NX_COMPAT))
{
@@ -1884,6 +1938,7 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name,
@@ -1925,6 +1960,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 +178,7 @@ index 7a714a5aa6d..996a749ebaa 100644
/* FIXME: there are several more dangling references
* left. Including dlls loaded by this dll before the
@@ -3314,6 +3369,7 @@ static void free_modref( WINE_MODREF *wm )
@@ -3427,6 +3463,7 @@ static void free_modref( WINE_MODREF *wm )
{
RemoveEntryList(&wm->ldr.InLoadOrderLinks);
RemoveEntryList(&wm->ldr.InMemoryOrderLinks);
@@ -205,7 +186,7 @@ index 7a714a5aa6d..996a749ebaa 100644
if (wm->ldr.InInitializationOrderLinks.Flink)
RemoveEntryList(&wm->ldr.InInitializationOrderLinks);
@@ -3641,6 +3697,10 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
@@ -3751,6 +3788,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. */
@@ -217,10 +198,10 @@ index 7a714a5aa6d..996a749ebaa 100644
load_global_options();
version_init();
diff --git a/include/winternl.h b/include/winternl.h
index 298ebbc2d36..64aac3f955d 100644
index 7221c0632b0..b8227b4583f 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -3183,8 +3183,8 @@ typedef struct _LDR_DATA_TABLE_ENTRY
@@ -3310,8 +3310,8 @@ typedef struct _LDR_DATA_TABLE_ENTRY
ULONG Flags;
SHORT LoadCount;
SHORT TlsIndex;