1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
#include <Windows.h>
#include <string>
#include <iostream>
#include <vector>
int main(){
STARTUPINFO si = {0};
PROCESS_INFORMATION pi = {0};
si.cb = sizeof(si);
char filename[]= "Notepad.exe";
auto result = CreateProcess(filename, NULL, NULL, NULL, FALSE, DEBUG_PROCESS, NULL, NULL, &si, &pi);
DEBUG_EVENT debugEvent = { 0 };
bool continueDebugging = true;
while (continueDebugging) {
if(WaitForDebugEvent(&debugEvent, INFINITE)){
printf("DBG: Exception: %x, Addr: %p, FirstChance: %d\n", debugEvent.u.Exception.ExceptionRecord.ExceptionCode,
debugEvent.u.Exception.ExceptionRecord.ExceptionAddress, debugEvent.u.Exception.dwFirstChance);
std::cout << "Event " << debugEvent.u.CreateThread.lpThreadLocalBase << std::endl;
std::cout << std::hex << "New Thread - " << debugEvent.dwThreadId;
std::cout << std::hex << "Assembler read address - " << ?????? ;
auto continueStatus = DBG_CONTINUE;
ContinueDebugEvent(debugEvent.dwProcessId, debugEvent.dwThreadId, continueStatus);
}
}
std::cout << "Done." << std::endl;
std::string s;
std::getline(std::cin, s);
return 0;
} |
Partager