added some info to Dll and Process

This commit is contained in:
mrexodia 2016-02-15 20:28:49 +01:00
parent 7953590d00
commit b6b77f2dd6
6 changed files with 15 additions and 8 deletions

View File

@ -2,10 +2,11 @@
namespace GleeBug
{
Dll::Dll(LPVOID lpBaseOfDll, ptr sizeOfImage, LPVOID entryPoint) :
Dll::Dll(LPVOID lpBaseOfDll, ptr sizeOfImage, LPVOID entryPoint, const LOAD_DLL_DEBUG_INFO & loadDllInfo) :
lpBaseOfDll(ptr(lpBaseOfDll)),
sizeOfImage(sizeOfImage),
entryPoint(ptr(entryPoint))
entryPoint(ptr(entryPoint)),
loadDllInfo(loadDllInfo)
{
}
};

View File

@ -14,14 +14,16 @@ namespace GleeBug
ptr lpBaseOfDll;
ptr sizeOfImage;
ptr entryPoint;
LOAD_DLL_DEBUG_INFO loadDllInfo;
/**
\brief Constructor.
\param lpBaseOfDll The base of DLL.
\param sizeOfImage Size of the image.
\param entryPoint The entry point.
\param loadDllInfo The DLL info on creation.
*/
explicit Dll(LPVOID lpBaseOfDll, ptr sizeOfImage, LPVOID entryPoint);
explicit Dll(LPVOID lpBaseOfDll, ptr sizeOfImage, LPVOID entryPoint, const LOAD_DLL_DEBUG_INFO & loadDllInfo);
};
};

View File

@ -11,7 +11,7 @@ namespace GleeBug
HMODULE(loadDll.lpBaseOfDll),
&modinfo,
sizeof(MODULEINFO));
Dll dll(loadDll.lpBaseOfDll, modinfo.SizeOfImage, modinfo.EntryPoint);
Dll dll(loadDll.lpBaseOfDll, modinfo.SizeOfImage, modinfo.EntryPoint, loadDll);
mProcess->dlls.insert({ Range(dll.lpBaseOfDll, dll.lpBaseOfDll + dll.sizeOfImage - 1), dll });
//call the debug event callback
@ -29,7 +29,7 @@ namespace GleeBug
if (dll != mProcess->dlls.end())
cbUnloadDllEvent(unloadDll, dll->second);
else
cbUnloadDllEvent(unloadDll, Dll(unloadDll.lpBaseOfDll, 0, nullptr));
cbUnloadDllEvent(unloadDll, Dll(unloadDll.lpBaseOfDll, 0, nullptr, LOAD_DLL_DEBUG_INFO()));
//DLL housekeeping
if (dll != mProcess->dlls.end())

View File

@ -8,7 +8,8 @@ namespace GleeBug
mProcesses.insert({ mDebugEvent.dwProcessId,
Process(createProcess.hProcess,
mDebugEvent.dwProcessId,
mDebugEvent.dwThreadId) });
mDebugEvent.dwThreadId,
createProcess) });
mProcess = &mProcesses.find(mDebugEvent.dwProcessId)->second;
//thread housekeeping (main thread is created implicitly)

View File

@ -2,10 +2,11 @@
namespace GleeBug
{
Process::Process(HANDLE hProcess, uint32 dwProcessId, uint32 dwMainThreadId) :
Process::Process(HANDLE hProcess, uint32 dwProcessId, uint32 dwMainThreadId, const CREATE_PROCESS_DEBUG_INFO & createProcessInfo) :
hProcess(hProcess),
dwProcessId(dwProcessId),
dwMainThreadId(dwMainThreadId),
createProcessInfo(createProcessInfo),
thread(nullptr),
systemBreakpoint(false)
{

View File

@ -18,6 +18,7 @@ namespace GleeBug
HANDLE hProcess;
uint32 dwProcessId;
uint32 dwMainThreadId;
CREATE_PROCESS_DEBUG_INFO createProcessInfo; //hFile is invalid, possibly other handles too!
Thread* thread;
bool systemBreakpoint;
@ -34,8 +35,9 @@ namespace GleeBug
\param hProcess Process handle.
\param dwProcessId Identifier for the process.
\param dwMainThreadId Identifier for the main thread.
\param createProcessInfo The process creation info.
*/
explicit Process(HANDLE hProcess, uint32 dwProcessId, uint32 dwMainThreadId);
explicit Process(HANDLE hProcess, uint32 dwProcessId, uint32 dwMainThreadId, const CREATE_PROCESS_DEBUG_INFO & createProcessInfo);
/**
\brief Read memory from the process.