DBG: Set invalid OEP only when not a dll (and some other fixes)
This commit is contained in:
parent
570d2e51c4
commit
7876663f86
|
@ -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)
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include "symbolinfo.h"
|
||||
#include "murmurhash.h"
|
||||
#include "memory.h"
|
||||
#include "console.h"
|
||||
#include "label.h"
|
||||
|
||||
std::map<Range, MODINFO, RangeCompare> 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();
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "_global.h"
|
||||
#include "addrinfo.h"
|
||||
|
||||
struct MODSECTIONINFO
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue