https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e2e4ea2f5f0bebd00f156fb92d223f733f8a856b

commit e2e4ea2f5f0bebd00f156fb92d223f733f8a856b
Author:     winesync <[email protected]>
AuthorDate: Fri Sep 11 17:10:39 2020 +0200
Commit:     Jérôme Gardou <[email protected]>
CommitDate: Wed Sep 16 10:35:46 2020 +0200

    [WINESYNC] dbghelp: Call GetSystemInfo in DllMain.
    
    Signed-off-by: Jacek Caban <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id 7544b9f6fb0bf39c714452968e20e478efaa104a by Jacek Caban 
<[email protected]>
---
 dll/win32/dbghelp/dbghelp.c         | 17 +++++++++++++++++
 dll/win32/dbghelp/dbghelp_private.h |  3 +++
 dll/win32/dbghelp/elf_module.c      |  2 --
 dll/win32/dbghelp/macho_module.c    |  2 --
 sdk/tools/winesync/dbghelp.cfg      |  2 +-
 5 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/dll/win32/dbghelp/dbghelp.c b/dll/win32/dbghelp/dbghelp.c
index b59ee6a269c..da1649b80a9 100644
--- a/dll/win32/dbghelp/dbghelp.c
+++ b/dll/win32/dbghelp/dbghelp.c
@@ -73,9 +73,26 @@ WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
 
 unsigned   dbghelp_options = SYMOPT_UNDNAME;
 BOOL       dbghelp_opt_native = FALSE;
+#ifndef __REACTOS__
+SYSTEM_INFO sysinfo;
+#endif
 
 static struct process* process_first /* = NULL */;
 
+#ifndef __REACTOS__
+BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
+{
+    switch (reason)
+    {
+    case DLL_PROCESS_ATTACH:
+        GetSystemInfo(&sysinfo);
+        DisableThreadLibraryCalls(instance);
+        break;
+    }
+    return TRUE;
+}
+#endif
+
 /******************************************************************
  *             process_find_by_handle
  *
diff --git a/dll/win32/dbghelp/dbghelp_private.h 
b/dll/win32/dbghelp/dbghelp_private.h
index aecde06ac62..bfb193635e7 100644
--- a/dll/win32/dbghelp/dbghelp_private.h
+++ b/dll/win32/dbghelp/dbghelp_private.h
@@ -128,6 +128,9 @@ void*    hash_table_iter_up(struct hash_table_iter* hti) 
DECLSPEC_HIDDEN;
 
 extern unsigned dbghelp_options DECLSPEC_HIDDEN;
 extern BOOL     dbghelp_opt_native DECLSPEC_HIDDEN;
+#ifndef __REACTOS__
+extern SYSTEM_INFO sysinfo DECLSPEC_HIDDEN;
+#endif
 
 enum location_kind {loc_error,          /* reg is the error code */
                     loc_unavailable,    /* location is not available */
diff --git a/dll/win32/dbghelp/elf_module.c b/dll/win32/dbghelp/elf_module.c
index 142f2f036af..5a6bef947ac 100644
--- a/dll/win32/dbghelp/elf_module.c
+++ b/dll/win32/dbghelp/elf_module.c
@@ -137,7 +137,6 @@ struct elf_module_info
 static const char* elf_map_section(struct image_section_map* ism)
 {
     struct elf_file_map*        fmap = &ism->fmap->u.elf;
-    SYSTEM_INFO sysinfo;
     SIZE_T ofst, size;
     HANDLE mapping;
 
@@ -152,7 +151,6 @@ static const char* elf_map_section(struct 
image_section_map* ism)
     }
 
     /* align required information on allocation granularity */
-    GetSystemInfo(&sysinfo);
     ofst = fmap->sect[ism->sidx].shdr.sh_offset & 
~(sysinfo.dwAllocationGranularity - 1);
     size = fmap->sect[ism->sidx].shdr.sh_offset + 
fmap->sect[ism->sidx].shdr.sh_size - ofst;
     if (!(mapping = CreateFileMappingW(fmap->handle, NULL, PAGE_READONLY, 0, 
ofst + size, NULL)))
diff --git a/dll/win32/dbghelp/macho_module.c b/dll/win32/dbghelp/macho_module.c
index 725363b316f..f10dc78eec8 100644
--- a/dll/win32/dbghelp/macho_module.c
+++ b/dll/win32/dbghelp/macho_module.c
@@ -164,11 +164,9 @@ static void macho_calc_range(const struct macho_file_map* 
fmap, unsigned long of
                              unsigned long len, unsigned long* 
out_aligned_offset,
                              unsigned long* out_aligned_end, unsigned long* 
out_misalign)
 {
-    SYSTEM_INFO sysinfo;
     unsigned long pagemask;
     unsigned long file_offset, misalign;
 
-    GetSystemInfo(&sysinfo);
     pagemask = sysinfo.dwAllocationGranularity - 1;
     file_offset = fmap->arch_offset + offset;
     misalign = file_offset & pagemask;
diff --git a/sdk/tools/winesync/dbghelp.cfg b/sdk/tools/winesync/dbghelp.cfg
index ae9cbda6d4c..aa34cee7d51 100644
--- a/sdk/tools/winesync/dbghelp.cfg
+++ b/sdk/tools/winesync/dbghelp.cfg
@@ -4,4 +4,4 @@ files:
   include/dbghelp.h: sdk/include/psdk/dbghelp.h
   include/wine/mscvpdb.h: sdk/include/reactos/wine/mscvpdb.h
 tags:
-  wine: ebf57f01f4890b726a0af702ab7751258f5ab03d
+  wine: 7544b9f6fb0bf39c714452968e20e478efaa104a

Reply via email to