1
0
Fork 0

DBG: Set invalid OEP only when not a dll (and some other fixes)

This commit is contained in:
Nukem 2015-07-15 21:29:13 -04:00
parent 570d2e51c4
commit 7876663f86
3 changed files with 13 additions and 9 deletions

View File

@ -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)

View File

@ -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();

View File

@ -1,7 +1,6 @@
#pragma once
#include "_global.h"
#include "addrinfo.h"
struct MODSECTIONINFO
{