Skip to content

Commit

Permalink
Merge pull request #1 from mrexodia/master
Browse files Browse the repository at this point in the history
break on entry point if asked by user
  • Loading branch information
therealdreg authored Mar 31, 2017
2 parents 201584f + 83f9338 commit f74433c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions x64dbgplugin/PluginTemplate/plugin.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "plugin.h"

static duint processEntry;

enum
{
MENU_HOOK,
Expand Down Expand Up @@ -29,6 +31,11 @@ PLUG_EXPORT void CBDEBUGEVENT(CBTYPE cbType, PLUG_CB_DEBUGEVENT* info)
{
}

PLUG_EXPORT void CBCREATEPROCESS(CBTYPE cbType, PLUG_CB_CREATEPROCESS* info)
{
processEntry = Script::Module::EntryFromAddr(duint(info->CreateProcessInfo->lpBaseOfImage));
}

void ExecuteNewProcessLauncher(BOOL old_process, wchar_t* path)
{
int result = IDCANCEL;
Expand Down Expand Up @@ -104,6 +111,7 @@ PLUG_EXPORT void CBMENUENTRY(CBTYPE cbType, PLUG_CB_MENUENTRY* info)
wchar_t* op_type = L"runas";

char* dis_cmd = NULL;
duint breakEntry = 0;

_itow_s(DbgGetProcessId(), actual_pid, 10);

Expand Down Expand Up @@ -131,6 +139,13 @@ PLUG_EXPORT void CBMENUENTRY(CBTYPE cbType, PLUG_CB_MENUENTRY* info)
wcscpy_s(args, actual_pid);
wcscat_s(args, L" u");
dis_cmd = "dis LdrInitializeThunk";

if(BridgeSettingGetUint("Events", "EntryBreakpoint", &breakEntry) && breakEntry)
{
char cmd[32] = "";
sprintf_s(cmd, "bp %p, ss", processEntry);
DbgCmdExecDirect(cmd);
}
break;

case MENU_NEW_PROCESS_WATCHER:
Expand Down

0 comments on commit f74433c

Please sign in to comment.