diff --git a/x64_dbg_dbg/AnalysisPass.cpp b/x64_dbg_dbg/AnalysisPass.cpp index 14ee53a7..a545e626 100644 --- a/x64_dbg_dbg/AnalysisPass.cpp +++ b/x64_dbg_dbg/AnalysisPass.cpp @@ -14,7 +14,7 @@ AnalysisPass::AnalysisPass(uint VirtualStart, uint VirtualEnd, BBlockArray & Mai // Read remote instruction data to local memory m_DataSize = VirtualEnd - VirtualStart; - m_Data = (unsigned char*)BridgeAlloc(m_DataSize); + m_Data = (unsigned char*)emalloc(m_DataSize, "AnalysisPass:m_Data"); if(!MemRead(VirtualStart, m_Data, m_DataSize)) { @@ -26,7 +26,7 @@ AnalysisPass::AnalysisPass(uint VirtualStart, uint VirtualEnd, BBlockArray & Mai AnalysisPass::~AnalysisPass() { if(m_Data) - BridgeFree(m_Data); + efree(m_Data); } BasicBlock* AnalysisPass::FindBBlockInRange(uint Address) diff --git a/x64_dbg_dbg/module.cpp b/x64_dbg_dbg/module.cpp index 817f515c..dd22a6d8 100644 --- a/x64_dbg_dbg/module.cpp +++ b/x64_dbg_dbg/module.cpp @@ -4,7 +4,6 @@ #include "symbolinfo.h" #include "murmurhash.h" #include "memory.h" -#include "console.h" #include "label.h" std::map modinfo; @@ -15,11 +14,17 @@ void GetModuleInfo(MODINFO & Info, ULONG_PTR FileMapVA) uint moduleOEP = GetPE32DataFromMappedFile(FileMapVA, 0, UE_OEP); // Fix a problem where the OEP is set to zero (non-existent). - // OEP can't start at the PE header/offset 0. - if(moduleOEP) - Info.entry = moduleOEP + Info.base; - else - Info.entry = 0; + // OEP can't start at the PE header/offset 0 -- except if module is an EXE. + Info.entry = moduleOEP + Info.base; + + if(!moduleOEP) + { + WORD characteristics = (WORD)GetPE32DataFromMappedFile(FileMapVA, 0, UE_CHARACTERISTICS); + + // If this wasn't an exe, invalidate the entry point + if((characteristics & IMAGE_FILE_DLL) == IMAGE_FILE_DLL) + Info.entry = 0; + } // Enumerate all PE sections Info.sections.clear(); diff --git a/x64_dbg_dbg/module.h b/x64_dbg_dbg/module.h index cfeb5286..9a37681f 100644 --- a/x64_dbg_dbg/module.h +++ b/x64_dbg_dbg/module.h @@ -1,7 +1,6 @@ #pragma once #include "_global.h" -#include "addrinfo.h" struct MODSECTIONINFO {