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

commit 575196093ae5636dc9858ab207aeb9e1a408581c
Author:     winesync <[email protected]>
AuthorDate: Fri Sep 11 15:53:08 2020 +0200
Commit:     Jérôme Gardou <[email protected]>
CommitDate: Wed Sep 16 10:35:39 2020 +0200

    [WINESYNC] dbghelp: Set correct values in symt_fill_sym_info (SYMBOL_INFO).
    
    Signed-off-by: Andreas Maier <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id 8d096fb5e262e5e87866d1a4a397da144a09b635 by Andreas Maier 
<[email protected]>
---
 dll/win32/dbghelp/compat.h          |  7 +++++++
 dll/win32/dbghelp/dbghelp_private.h |  5 ++++-
 dll/win32/dbghelp/elf_module.c      |  1 +
 dll/win32/dbghelp/msc.c             |  5 ++++-
 dll/win32/dbghelp/pe_module.c       | 11 ++++++-----
 dll/win32/dbghelp/rsym.c            |  4 ++--
 dll/win32/dbghelp/symbol.c          | 13 ++++++++++---
 sdk/tools/winesync/dbghelp.cfg      |  2 +-
 8 files changed, 35 insertions(+), 13 deletions(-)

diff --git a/dll/win32/dbghelp/compat.h b/dll/win32/dbghelp/compat.h
index 76ea07df7fc..4917889ca1c 100644
--- a/dll/win32/dbghelp/compat.h
+++ b/dll/win32/dbghelp/compat.h
@@ -736,6 +736,13 @@ typedef VOID IMAGEHLP_CONTEXT, *PIMAGEHLP_CONTEXT;
 #define SYMFLAG_THUNK            0x00002000
 #define SYMFLAG_TLSREL           0x00004000
 #define SYMFLAG_SLOT             0x00008000
+#define SYMFLAG_ILREL            0x00010000
+#define SYMFLAG_METADATA         0x00020000
+#define SYMFLAG_CLR_TOKEN        0x00040000
+#define SYMFLAG_NULL             0x00080000
+#define SYMFLAG_FUNC_NO_RETURN   0x00100000
+#define SYMFLAG_SYNTHETIC_ZEROBASE 0x00200000
+#define SYMFLAG_PUBLIC_CODE      0x00400000
 #define UNDNAME_COMPLETE                 (0x0000)
 #define UNDNAME_NAME_ONLY                (0x1000)
 typedef struct _TI_FINDCHILDREN_PARAMS
diff --git a/dll/win32/dbghelp/dbghelp_private.h 
b/dll/win32/dbghelp/dbghelp_private.h
index 3cf215a25e2..2138bd65154 100644
--- a/dll/win32/dbghelp/dbghelp_private.h
+++ b/dll/win32/dbghelp/dbghelp_private.h
@@ -244,6 +244,7 @@ struct symt_public
     struct symt                 symt;
     struct hash_table_elt       hash_elt;
     struct symt*                container;      /* compiland */
+    BOOL is_function;
     unsigned long               address;
     unsigned long               size;
 };
@@ -755,7 +756,9 @@ extern struct symt_public*
                     symt_new_public(struct module* module,
                                     struct symt_compiland* parent,
                                     const char* typename,
-                                    unsigned long address, unsigned size) 
DECLSPEC_HIDDEN;
+                                    BOOL is_function,
+                                    unsigned long address,
+                                    unsigned size) DECLSPEC_HIDDEN;
 extern struct symt_data*
                     symt_new_global_variable(struct module* module,
                                              struct symt_compiland* parent,
diff --git a/dll/win32/dbghelp/elf_module.c b/dll/win32/dbghelp/elf_module.c
index 6b8d47a1e40..96b16fd5c0c 100644
--- a/dll/win32/dbghelp/elf_module.c
+++ b/dll/win32/dbghelp/elf_module.c
@@ -927,6 +927,7 @@ static int elf_new_public_symbols(struct module* module, 
const struct hash_table
     while ((ste = hash_table_iter_up(&hti)))
     {
         symt_new_public(module, ste->compiland, ste->ht_elt.name,
+                        FALSE,
                         module->reloc_delta + ste->sym.st_value,
                         ste->sym.st_size);
     }
diff --git a/dll/win32/dbghelp/msc.c b/dll/win32/dbghelp/msc.c
index ae51884abc6..adb66d68809 100644
--- a/dll/win32/dbghelp/msc.c
+++ b/dll/win32/dbghelp/msc.c
@@ -2072,6 +2072,7 @@ static BOOL codeview_snarf_public(const struct 
msc_debug_info* msc_dbg, const BY
             {
                 symt_new_public(msc_dbg->module, compiland,
                                 terminate_string(&sym->public_v1.p_name),
+                                sym->public_v1.symtype == SYMTYPE_FUNCTION,
                                 codeview_get_address(msc_dbg, 
sym->public_v1.segment, sym->public_v1.offset), 1);
             }
             break;
@@ -2080,6 +2081,7 @@ static BOOL codeview_snarf_public(const struct 
msc_debug_info* msc_dbg, const BY
             {
                 symt_new_public(msc_dbg->module, compiland,
                                 terminate_string(&sym->public_v2.p_name),
+                                sym->public_v2.symtype == SYMTYPE_FUNCTION,
                                 codeview_get_address(msc_dbg, 
sym->public_v2.segment, sym->public_v2.offset), 1);
             }
             break;
@@ -2089,6 +2091,7 @@ static BOOL codeview_snarf_public(const struct 
msc_debug_info* msc_dbg, const BY
             {
                 symt_new_public(msc_dbg->module, compiland,
                                 sym->public_v3.name,
+                                sym->public_v3.symtype == SYMTYPE_FUNCTION,
                                 codeview_get_address(msc_dbg, 
sym->public_v3.segment, sym->public_v3.offset), 1);
             }
             break;
@@ -2885,7 +2888,7 @@ static BOOL pdb_process_file(const struct process* pcs,
     if (ret)
     {
         struct pdb_module_info*     pdb_info = 
msc_dbg->module->format_info[DFI_PDB]->u.pdb_info;
-        msc_dbg->module->module.SymType = SymCv;
+        msc_dbg->module->module.SymType = SymPdb;
         if (pdb_info->pdb_files[0].kind == PDB_JG)
             msc_dbg->module->module.PdbSig = 
pdb_info->pdb_files[0].u.jg.timestamp;
         else
diff --git a/dll/win32/dbghelp/pe_module.c b/dll/win32/dbghelp/pe_module.c
index 6d0a9a6b5f9..eca81bf9876 100644
--- a/dll/win32/dbghelp/pe_module.c
+++ b/dll/win32/dbghelp/pe_module.c
@@ -444,7 +444,7 @@ static BOOL pe_load_coff_symbol_table(struct module* module)
                                                source_new(module, NULL, 
lastfilename));
 
             if (!(dbghelp_options & SYMOPT_NO_PUBLICS))
-                symt_new_public(module, compiland, name,
+                symt_new_public(module, compiland, name, FALSE,
                                 module->module.BaseOfImage + 
sect[isym->SectionNumber - 1].VirtualAddress +
                                      isym->Value,
                                 1);
@@ -674,11 +674,11 @@ static BOOL pe_load_export_debug_info(const struct 
process* pcs, struct module*
 #if 0
     /* Add start of DLL (better use the (yet unimplemented) Exe SymTag for 
this) */
     /* FIXME: module.ModuleName isn't correctly set yet if it's passed in 
SymLoadModule */
-    symt_new_public(module, NULL, module->module.ModuleName, base, 1);
+    symt_new_public(module, NULL, module->module.ModuleName, FALSE, base, 1);
 #endif
     
     /* Add entry point */
-    symt_new_public(module, NULL, "EntryPoint", 
+    symt_new_public(module, NULL, "EntryPoint", FALSE,
                     base + nth->OptionalHeader.AddressOfEntryPoint, 1);
 #if 0
     /* FIXME: we'd better store addresses linked to sections rather than 
@@ -689,7 +689,7 @@ static BOOL pe_load_export_debug_info(const struct process* 
pcs, struct module*
         ((char*)&nth->OptionalHeader + nth->FileHeader.SizeOfOptionalHeader);
     for (i = 0; i < nth->FileHeader.NumberOfSections; i++, section++) 
     {
-       symt_new_public(module, NULL, section->Name, 
+       symt_new_public(module, NULL, section->Name, FALSE,
                         RtlImageRvaToVa(nth, mapping, section->VirtualAddress, 
NULL), 1);
     }
 #endif
@@ -715,6 +715,7 @@ static BOOL pe_load_export_debug_info(const struct process* 
pcs, struct module*
                 if (!names[i]) continue;
                 symt_new_public(module, NULL,
                                 RtlImageRvaToVa(nth, mapping, names[i], NULL),
+                                FALSE,
                                 base + functions[ordinals[i]], 1);
             }
 
@@ -726,7 +727,7 @@ static BOOL pe_load_export_debug_info(const struct process* 
pcs, struct module*
                     if ((ordinals[j] == i) && names[j]) break;
                 if (j < exports->NumberOfNames) continue;
                 snprintf(buffer, sizeof(buffer), "%d", i + exports->Base);
-                symt_new_public(module, NULL, buffer, base + 
(DWORD)functions[i], 1);
+                symt_new_public(module, NULL, buffer, FALSE, base + 
(DWORD)functions[i], 1);
             }
         }
     }
diff --git a/dll/win32/dbghelp/rsym.c b/dll/win32/dbghelp/rsym.c
index 9b7bf4ee1d7..cc04ecee4a4 100644
--- a/dll/win32/dbghelp/rsym.c
+++ b/dll/win32/dbghelp/rsym.c
@@ -49,7 +49,7 @@ static void rsym_finalize_function(struct module* module, 
struct symt_function*
     {
         loc.kind = loc_absolute;
         loc.offset = il.Address - func->address;
-        symt_add_function_point(module, func, SymTagFuncDebugStart, 
+        symt_add_function_point(module, func, SymTagFuncDebugStart,
                                 &loc, NULL);
     }
 }
@@ -125,7 +125,7 @@ BOOL rsym_parse(struct module* module, unsigned long 
load_offset,
                     if (use_raw_address(SymbolName))
                         Address = Entry->Address;
 
-                    symt_new_public(module, NULL, SymbolName, Address, Size);
+                    symt_new_public(module, NULL, SymbolName, FALSE, Address, 
Size);
                 }
                 else
                 {
diff --git a/dll/win32/dbghelp/symbol.c b/dll/win32/dbghelp/symbol.c
index 2a0710b658d..38d2a5b7291 100644
--- a/dll/win32/dbghelp/symbol.c
+++ b/dll/win32/dbghelp/symbol.c
@@ -226,6 +226,7 @@ struct symt_compiland* symt_new_compiland(struct module* 
module,
 struct symt_public* symt_new_public(struct module* module, 
                                     struct symt_compiland* compiland,
                                     const char* name,
+                                    BOOL is_function,
                                     unsigned long address, unsigned size)
 {
     struct symt_public* sym;
@@ -241,6 +242,7 @@ struct symt_public* symt_new_public(struct module* module,
         sym->symt.tag      = SymTagPublicSymbol;
         sym->hash_elt.name = pool_strdup(&module->pool, name);
         sym->container     = compiland ? &compiland->symt : NULL;
+        sym->is_function   = is_function;
         sym->address       = address;
         sym->size          = size;
         symt_add_module_ht(module, (struct symt_ht*)sym);
@@ -697,11 +699,16 @@ static void symt_fill_sym_info(struct module_pair* pair,
         }
         break;
     case SymTagPublicSymbol:
-        sym_info->Flags |= SYMFLAG_EXPORT;
-        symt_get_address(sym, &sym_info->Address);
+        {
+            const struct symt_public* pub = (const struct symt_public*)sym;
+            if (pub->is_function)
+                sym_info->Flags |= SYMFLAG_PUBLIC_CODE;
+            else
+                sym_info->Flags |= SYMFLAG_EXPORT;
+            symt_get_address(sym, &sym_info->Address);
+        }
         break;
     case SymTagFunction:
-        sym_info->Flags |= SYMFLAG_FUNCTION;
         symt_get_address(sym, &sym_info->Address);
         break;
     case SymTagThunk:
diff --git a/sdk/tools/winesync/dbghelp.cfg b/sdk/tools/winesync/dbghelp.cfg
index bf5358ef159..9c666dfc02c 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: 3b01149d8677fa86addfb67414d793684779c5ce
+  wine: 8d096fb5e262e5e87866d1a4a397da144a09b635

Reply via email to