From 749b9dd1bb4c9c915defdda21906eeff57751cb5 Mon Sep 17 00:00:00 2001 From: GoD-Tony Date: Sun, 14 Oct 2012 18:10:46 -0400 Subject: [PATCH] Added symbol lookup support to gamedata on Windows (bug 5511, r=ds). --- core/logic/GameConfigs.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/core/logic/GameConfigs.cpp b/core/logic/GameConfigs.cpp index d9044ef2..7a9aa74c 100644 --- a/core/logic/GameConfigs.cpp +++ b/core/logic/GameConfigs.cpp @@ -525,9 +525,16 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states) s_TempSig.library, m_CurFile); } else { -#if defined PLATFORM_POSIX if (s_TempSig.sig[0] == '@') { +#if defined PLATFORM_WINDOWS + MEMORY_BASIC_INFORMATION mem; + + if (VirtualQuery(addrInBase, &mem, sizeof(mem))) + final_addr = g_MemUtils.ResolveSymbol(mem.AllocationBase, &s_TempSig.sig[1]); + else + smcore.LogError("[SM] Unable to find library \"%s\" in memory (gameconf \"%s\")", s_TempSig.library, m_File); +#elif defined PLATFORM_POSIX Dl_info info; /* GNU only: returns 0 on error, inconsistent! >:[ */ if (dladdr(addrInBase, &info) != 0) @@ -550,12 +557,12 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states) s_TempSig.library, m_File); } +#endif } if (final_addr) { goto skip_find; } -#endif /* First, preprocess the signature */ unsigned char real_sig[511]; size_t real_bytes; @@ -572,9 +579,7 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states) } } -#if defined PLATFORM_POSIX skip_find: -#endif m_Sigs.replace(m_offset, final_addr); m_ParseState = PSTATE_GAMEDEFS_SIGNATURES;