Paul Gofman : ntdll: Store module check sum in WINE_MODREF.
Alexandre Julliard
julliard at winehq.org
Wed Oct 20 15:58:42 CDT 2021
Module: wine
Branch: master
Commit: 1ab32c6b3bfff2cdfe59a42fe1d9696de65eb4f3
URL: https://source.winehq.org/git/wine.git/?a=commit;h=1ab32c6b3bfff2cdfe59a42fe1d9696de65eb4f3
Author: Paul Gofman <pgofman at codeweavers.com>
Date: Mon Oct 18 15:06:46 2021 +0300
ntdll: Store module check sum in WINE_MODREF.
Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/loader.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 797d72aedb6..dd41d6b66d2 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -136,6 +136,7 @@ typedef struct _wine_modref
int alloc_deps;
int nDeps;
struct _wine_modref **deps;
+ ULONG CheckSum;
} WINE_MODREF;
static UINT tls_module_count; /* number of modules with TLS directory */
@@ -220,16 +221,17 @@ static RTL_UNLOAD_EVENT_TRACE unload_traces[RTL_UNLOAD_EVENT_TRACE_NUMBER];
static RTL_UNLOAD_EVENT_TRACE *unload_trace_ptr;
static unsigned int unload_trace_seq;
-static void module_push_unload_trace( const LDR_DATA_TABLE_ENTRY *ldr )
+static void module_push_unload_trace( const WINE_MODREF *wm )
{
RTL_UNLOAD_EVENT_TRACE *ptr = &unload_traces[unload_trace_seq];
+ const LDR_DATA_TABLE_ENTRY *ldr = &wm->ldr;
unsigned int len = min(sizeof(ptr->ImageName) - sizeof(WCHAR), ldr->BaseDllName.Length);
ptr->BaseAddress = ldr->DllBase;
ptr->SizeOfImage = ldr->SizeOfImage;
ptr->Sequence = unload_trace_seq;
ptr->TimeDateStamp = ldr->TimeDateStamp;
- ptr->CheckSum = ldr->CheckSum;
+ ptr->CheckSum = wm->CheckSum;
memcpy(ptr->ImageName, ldr->BaseDllName.Buffer, len);
ptr->ImageName[len / sizeof(*ptr->ImageName)] = 0;
@@ -1222,7 +1224,7 @@ static WINE_MODREF *alloc_module( HMODULE hModule, const UNICODE_STRING *nt_name
wm->ldr.Flags = LDR_DONT_RESOLVE_REFS | (builtin ? LDR_WINE_INTERNAL : 0);
wm->ldr.TlsIndex = -1;
wm->ldr.LoadCount = 1;
- wm->ldr.CheckSum = nt->OptionalHeader.CheckSum;
+ wm->CheckSum = nt->OptionalHeader.CheckSum;
wm->ldr.TimeDateStamp = nt->FileHeader.TimeDateStamp;
if (!(buffer = RtlAllocateHeap( GetProcessHeap(), 0, nt_name->Length - 3 * sizeof(WCHAR) )))
@@ -2350,7 +2352,8 @@ static WINE_MODREF *find_existing_module( HMODULE module )
{
mod = CONTAINING_RECORD( entry, LDR_DATA_TABLE_ENTRY, InMemoryOrderLinks );
if (mod->TimeDateStamp != nt->FileHeader.TimeDateStamp) continue;
- if (mod->CheckSum != nt->OptionalHeader.CheckSum) continue;
+ wm = CONTAINING_RECORD( mod, WINE_MODREF, ldr );
+ if (wm->CheckSum != nt->OptionalHeader.CheckSum) continue;
if (NtAreMappedFilesTheSame( mod->DllBase, module ) != STATUS_SUCCESS) continue;
return CONTAINING_RECORD( mod, WINE_MODREF, ldr );
}
@@ -3592,7 +3595,7 @@ static void MODULE_DecRefCount( WINE_MODREF *wm )
wm->ldr.Flags &= ~LDR_UNLOAD_IN_PROGRESS;
- module_push_unload_trace( &wm->ldr );
+ module_push_unload_trace( wm );
}
}
More information about the wine-cvs
mailing list