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 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)), lpBaseOfDll(ptr(lpBaseOfDll)),
sizeOfImage(sizeOfImage), sizeOfImage(sizeOfImage),
entryPoint(ptr(entryPoint)) entryPoint(ptr(entryPoint)),
loadDllInfo(loadDllInfo)
{ {
} }
}; };

View File

@ -14,14 +14,16 @@ namespace GleeBug
ptr lpBaseOfDll; ptr lpBaseOfDll;
ptr sizeOfImage; ptr sizeOfImage;
ptr entryPoint; ptr entryPoint;
LOAD_DLL_DEBUG_INFO loadDllInfo;
/** /**
\brief Constructor. \brief Constructor.
\param lpBaseOfDll The base of DLL. \param lpBaseOfDll The base of DLL.
\param sizeOfImage Size of the image. \param sizeOfImage Size of the image.
\param entryPoint The entry point. \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), HMODULE(loadDll.lpBaseOfDll),
&modinfo, &modinfo,
sizeof(MODULEINFO)); 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 }); mProcess->dlls.insert({ Range(dll.lpBaseOfDll, dll.lpBaseOfDll + dll.sizeOfImage - 1), dll });
//call the debug event callback //call the debug event callback
@ -29,7 +29,7 @@ namespace GleeBug
if (dll != mProcess->dlls.end()) if (dll != mProcess->dlls.end())
cbUnloadDllEvent(unloadDll, dll->second); cbUnloadDllEvent(unloadDll, dll->second);
else else
cbUnloadDllEvent(unloadDll, Dll(unloadDll.lpBaseOfDll, 0, nullptr)); cbUnloadDllEvent(unloadDll, Dll(unloadDll.lpBaseOfDll, 0, nullptr, LOAD_DLL_DEBUG_INFO()));
//DLL housekeeping //DLL housekeeping
if (dll != mProcess->dlls.end()) if (dll != mProcess->dlls.end())

View File

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

View File

@ -2,10 +2,11 @@
namespace GleeBug 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), hProcess(hProcess),
dwProcessId(dwProcessId), dwProcessId(dwProcessId),
dwMainThreadId(dwMainThreadId), dwMainThreadId(dwMainThreadId),
createProcessInfo(createProcessInfo),
thread(nullptr), thread(nullptr),
systemBreakpoint(false) systemBreakpoint(false)
{ {

View File

@ -18,6 +18,7 @@ namespace GleeBug
HANDLE hProcess; HANDLE hProcess;
uint32 dwProcessId; uint32 dwProcessId;
uint32 dwMainThreadId; uint32 dwMainThreadId;
CREATE_PROCESS_DEBUG_INFO createProcessInfo; //hFile is invalid, possibly other handles too!
Thread* thread; Thread* thread;
bool systemBreakpoint; bool systemBreakpoint;
@ -34,8 +35,9 @@ namespace GleeBug
\param hProcess Process handle. \param hProcess Process handle.
\param dwProcessId Identifier for the process. \param dwProcessId Identifier for the process.
\param dwMainThreadId Identifier for the main thread. \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. \brief Read memory from the process.