Nikolay Sivov : dbgeng: Set module timestamp field.

Alexandre Julliard julliard at winehq.org
Wed Apr 24 16:33:29 CDT 2019


Module: wine
Branch: master
Commit: 173c720e59db999852f74011444c1fdb13ca0459
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=173c720e59db999852f74011444c1fdb13ca0459

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Wed Apr 24 08:35:33 2019 +0300

dbgeng: Set module timestamp field.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dbgeng/dbgeng.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/dlls/dbgeng/dbgeng.c b/dlls/dbgeng/dbgeng.c
index 569b824..95a95b6 100644
--- a/dlls/dbgeng/dbgeng.c
+++ b/dlls/dbgeng/dbgeng.c
@@ -108,13 +108,28 @@ static WORD debug_target_get_module_machine(struct target_process *target, HMODU
     ReadProcessMemory(target->handle, module, &dos, sizeof(dos), NULL);
     if (dos.e_magic == IMAGE_DOS_SIGNATURE)
     {
-        ReadProcessMemory(target->handle, (const char *)module + dos.e_lfanew + 4 /* signature */, &machine,
+        ReadProcessMemory(target->handle, (const char *)module + dos.e_lfanew + 4 /* PE signature */, &machine,
                 sizeof(machine), NULL);
     }
 
     return machine;
 }
 
+static DWORD debug_target_get_module_timestamp(struct target_process *target, HMODULE module)
+{
+    IMAGE_DOS_HEADER dos = { 0 };
+    DWORD timestamp = 0;
+
+    ReadProcessMemory(target->handle, module, &dos, sizeof(dos), NULL);
+    if (dos.e_magic == IMAGE_DOS_SIGNATURE)
+    {
+        ReadProcessMemory(target->handle, (const char *)module + dos.e_lfanew + 4 /* PE signature */ +
+                FIELD_OFFSET(IMAGE_FILE_HEADER, TimeDateStamp), &timestamp, sizeof(timestamp), NULL);
+    }
+
+    return timestamp;
+}
+
 static HRESULT debug_target_init_modules_info(struct target_process *target)
 {
     unsigned int i, count;
@@ -156,6 +171,7 @@ static HRESULT debug_target_init_modules_info(struct target_process *target)
 
             target->modules.info[i].params.Base = (ULONG_PTR)info.lpBaseOfDll;
             target->modules.info[i].params.Size = info.SizeOfImage;
+            target->modules.info[i].params.TimeDateStamp = debug_target_get_module_timestamp(target, modules[i]);
 
             GetModuleFileNameExA(target->handle, modules[i], target->modules.info[i].image_name,
                     ARRAY_SIZE(target->modules.info[i].image_name));




More information about the wine-cvs mailing list