diff --git a/GleeBug/Debugger.Loop.cpp b/GleeBug/Debugger.Loop.cpp
index 3a72e94..a87df81 100644
--- a/GleeBug/Debugger.Loop.cpp
+++ b/GleeBug/Debugger.Loop.cpp
@@ -2,53 +2,53 @@
namespace GleeBug
{
- void Debugger::createProcessEvent(CREATE_PROCESS_DEBUG_INFO* CreateProcess)
+ void Debugger::createProcessEvent(CREATE_PROCESS_DEBUG_INFO* createProcess)
{
- log("Debugger::createProcessEvent");
+ cbCreateProcessEvent(createProcess);
}
- void Debugger::exitProcessEvent(EXIT_PROCESS_DEBUG_INFO* ExitProcess)
+ void Debugger::exitProcessEvent(EXIT_PROCESS_DEBUG_INFO* exitProcess)
{
- log("Debugger::exitProcessEvent");
if (_debugEvent.dwProcessId == _mainProcess.ProcessId)
{
_breakDebugger = true;
}
+ cbExitProcessEvent(exitProcess);
}
- void Debugger::createThreadEvent(CREATE_THREAD_DEBUG_INFO* CreateThread)
+ void Debugger::createThreadEvent(CREATE_THREAD_DEBUG_INFO* createThread)
{
- log("Debugger::createThreadEvent");
+ cbCreateThreadEvent(createThread);
}
- void Debugger::exitThreadEvent(EXIT_THREAD_DEBUG_INFO* ExitThread)
+ void Debugger::exitThreadEvent(EXIT_THREAD_DEBUG_INFO* exitThread)
{
- log("Debugger::exitThreadEvent");
+ cbExitThreadEvent(exitThread);
}
- void Debugger::loadDllEvent(LOAD_DLL_DEBUG_INFO* LoadDll)
+ void Debugger::loadDllEvent(LOAD_DLL_DEBUG_INFO* loadDll)
{
- log("Debugger::loadDllEvent");
+ cbLoadDllEvent(loadDll);
}
- void Debugger::unloadDllEvent(UNLOAD_DLL_DEBUG_INFO* UnloadDll)
+ void Debugger::unloadDllEvent(UNLOAD_DLL_DEBUG_INFO* unloadDll)
{
- log("Debugger::unloadDllEvent");
+ cbUnloadDllEvent(unloadDll);
}
- void Debugger::exceptionEvent(EXCEPTION_DEBUG_INFO* Exception)
+ void Debugger::exceptionEvent(EXCEPTION_DEBUG_INFO* exceptionInfo)
{
- log("Debugger::exceptionEvent");
+ cbExceptionEvent(exceptionInfo);
}
- void Debugger::debugStringEvent(OUTPUT_DEBUG_STRING_INFO* DebugString)
+ void Debugger::debugStringEvent(OUTPUT_DEBUG_STRING_INFO* debugString)
{
- log("Debugger::debugStringEvent");
+ cbDebugStringEvent(debugString);
}
- void Debugger::ripEvent(RIP_INFO* Rip)
+ void Debugger::ripEvent(RIP_INFO* rip)
{
- log("Debugger::ripEvent");
+ cbRipEvent(rip);
}
void Debugger::Start()
diff --git a/GleeBug/Debugger.h b/GleeBug/Debugger.h
index 340360a..0c42de3 100644
--- a/GleeBug/Debugger.h
+++ b/GleeBug/Debugger.h
@@ -52,18 +52,27 @@ namespace GleeBug
const ProcessInfo & GetMainProcess();
protected:
- void createProcessEvent(CREATE_PROCESS_DEBUG_INFO* CreateProcess);
- void exitProcessEvent(EXIT_PROCESS_DEBUG_INFO* ExitProcess);
- void createThreadEvent(CREATE_THREAD_DEBUG_INFO* CreateThread);
- void exitThreadEvent(EXIT_THREAD_DEBUG_INFO* ExitThread);
- void loadDllEvent(LOAD_DLL_DEBUG_INFO* LoadDll);
- void unloadDllEvent(UNLOAD_DLL_DEBUG_INFO* UnloadDll);
- void exceptionEvent(EXCEPTION_DEBUG_INFO* Exception);
- void debugStringEvent(OUTPUT_DEBUG_STRING_INFO* DebugString);
- void ripEvent(RIP_INFO* Rip);
- void log(std::string msg);
+ virtual void cbCreateProcessEvent(CREATE_PROCESS_DEBUG_INFO* createProcess) {};
+ virtual void cbExitProcessEvent(EXIT_PROCESS_DEBUG_INFO* exitProcess) {};
+ virtual void cbCreateThreadEvent(CREATE_THREAD_DEBUG_INFO* createThread) {};
+ virtual void cbExitThreadEvent(EXIT_THREAD_DEBUG_INFO* exitThread) {};
+ virtual void cbLoadDllEvent(LOAD_DLL_DEBUG_INFO* loadDll) {};
+ virtual void cbUnloadDllEvent(UNLOAD_DLL_DEBUG_INFO* unloadDll) {};
+ virtual void cbExceptionEvent(EXCEPTION_DEBUG_INFO* exceptionInfo) {};
+ virtual void cbDebugStringEvent(OUTPUT_DEBUG_STRING_INFO* debugString) {};
+ virtual void cbRipEvent(RIP_INFO* rip) {};
+
+ virtual void createProcessEvent(CREATE_PROCESS_DEBUG_INFO* createProcess);
+ virtual void exitProcessEvent(EXIT_PROCESS_DEBUG_INFO* exitProcess);
+ virtual void createThreadEvent(CREATE_THREAD_DEBUG_INFO* createThread);
+ virtual void exitThreadEvent(EXIT_THREAD_DEBUG_INFO* exitThread);
+ virtual void loadDllEvent(LOAD_DLL_DEBUG_INFO* loadDll);
+ virtual void unloadDllEvent(UNLOAD_DLL_DEBUG_INFO* unloadDll);
+ virtual void exceptionEvent(EXCEPTION_DEBUG_INFO* exceptionInfo);
+ virtual void debugStringEvent(OUTPUT_DEBUG_STRING_INFO* debugString);
+ virtual void ripEvent(RIP_INFO* rip);
+ virtual void log(std::string msg);
- private:
ProcessInfo _mainProcess;
DWORD _continueStatus;
bool _breakDebugger;
diff --git a/GleeBug/GleeBug.vcxproj b/GleeBug/GleeBug.vcxproj
index 6273092..53afd54 100644
--- a/GleeBug/GleeBug.vcxproj
+++ b/GleeBug/GleeBug.vcxproj
@@ -104,6 +104,7 @@
true
true
true
+ MultiThreaded
true
@@ -118,6 +119,7 @@
true
true
true
+ MultiThreaded
true
@@ -135,6 +137,7 @@
+
diff --git a/GleeBug/GleeBug.vcxproj.filters b/GleeBug/GleeBug.vcxproj.filters
index 58fab4c..3d5c2b9 100644
--- a/GleeBug/GleeBug.vcxproj.filters
+++ b/GleeBug/GleeBug.vcxproj.filters
@@ -13,32 +13,41 @@
{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+ {20ccba34-8c87-490a-8bd3-5195e625d009}
+
+
+ {91ea9bea-4704-4816-a885-8afd0e3ff974}
+
Source Files
- Source Files
+ Source Files\GleeBug
- Source Files
+ Source Files\GleeBug
- Source Files
+ Source Files\GleeBug
- Source Files
+ Source Files\GleeBug
- Header Files
-
-
- Header Files
+ Header Files\GleeBug
+ Header Files\GleeBug
+
+
+ Header Files\GleeBug
+
+
Header Files
diff --git a/GleeBug/MyDebugger.h b/GleeBug/MyDebugger.h
new file mode 100644
index 0000000..6a6fb5a
--- /dev/null
+++ b/GleeBug/MyDebugger.h
@@ -0,0 +1,55 @@
+#ifndef _MYDEBUGGER_H
+#define _MYDEBUGGER_H
+
+#include "Debugger.h"
+
+class MyDebugger : public GleeBug::Debugger
+{
+protected:
+ virtual void cbCreateProcessEvent(CREATE_PROCESS_DEBUG_INFO* createProcess)
+ {
+ printf("Process %d created with entry 0x%p\n", _debugEvent.dwProcessId, createProcess->lpStartAddress);
+ };
+
+ virtual void cbExitProcessEvent(EXIT_PROCESS_DEBUG_INFO* exitProcess)
+ {
+ printf("Process %d terminated with exit code 0x%08X\n", _debugEvent.dwProcessId, exitProcess->dwExitCode);
+ }
+
+ virtual void cbCreateThreadEvent(CREATE_THREAD_DEBUG_INFO* createThread)
+ {
+ printf("Thread %d created with entry 0x%p\n", _debugEvent.dwThreadId, createThread->lpStartAddress);
+ };
+
+ virtual void cbExitThreadEvent(EXIT_THREAD_DEBUG_INFO* exitThread)
+ {
+ printf("Thread %d terminated with exit code 0x%08X\n", _debugEvent.dwThreadId, exitThread->dwExitCode);
+ };
+
+ virtual void cbLoadDllEvent(LOAD_DLL_DEBUG_INFO* loadDll)
+ {
+ printf("DLL loaded at 0x%p\n", loadDll->lpBaseOfDll);
+ };
+
+ virtual void cbUnloadDllEvent(UNLOAD_DLL_DEBUG_INFO* unloadDll)
+ {
+ printf("DLL 0x%p unloaded\n", unloadDll->lpBaseOfDll);
+ };
+
+ virtual void cbExceptionEvent(EXCEPTION_DEBUG_INFO* exceptionInfo)
+ {
+ printf("Exception with code 0x%08X\n", exceptionInfo->ExceptionRecord);
+ };
+
+ virtual void cbDebugStringEvent(OUTPUT_DEBUG_STRING_INFO* debugString)
+ {
+ printf("Debug string at 0x%p with length %d\n", debugString->lpDebugStringData, debugString->nDebugStringLength);
+ };
+
+ virtual void cbRipEvent(RIP_INFO* rip)
+ {
+ printf("RIP event type 0x%X, error 0x%X", rip->dwType, rip->dwError);
+ };
+};
+
+#endif //_MYDEBUGGER_H
\ No newline at end of file
diff --git a/GleeBug/main.cpp b/GleeBug/main.cpp
index c175a3d..d1574dc 100644
--- a/GleeBug/main.cpp
+++ b/GleeBug/main.cpp
@@ -1,17 +1,20 @@
#include
#include "Debugger.h"
+#include "MyDebugger.h"
+
+using namespace GleeBug;
int main()
{
wchar_t szFilePath[256] = L"c:\\CodeBlocks\\arma_cert_bin_info\\bin\\arma_cert_bin_info.exe";
wchar_t szCommandLine[256] = L"";
wchar_t szCurrentDir[256] = L"c:\\CodeBlocks\\arma_cert_bin_info\\bin";
- GleeBug::Debugger dbg;
+ MyDebugger dbg;
if (dbg.Init(szFilePath, szCommandLine, szCurrentDir))
{
- printf("Debugger::Init success! PID: %X\n", dbg.GetMainProcess().ProcessId);
+ puts("Debugger::Init success!");
dbg.Start();
- printf("Debugger::Start finished!");
+ puts("Debugger::Start finished!");
}
else
{