From 8cb648a7fdc4773a6b63dccda78b4248cf82155e Mon Sep 17 00:00:00 2001 From: Dreg Date: Sat, 8 Apr 2017 00:00:28 +0200 Subject: [PATCH] Serialized auto patchers --- x64dbgplugin/PluginTemplate/plugin.cpp | 32 ++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/x64dbgplugin/PluginTemplate/plugin.cpp b/x64dbgplugin/PluginTemplate/plugin.cpp index 6915dd7..8bab270 100644 --- a/x64dbgplugin/PluginTemplate/plugin.cpp +++ b/x64dbgplugin/PluginTemplate/plugin.cpp @@ -191,7 +191,21 @@ PLUG_EXPORT void CBCREATEPROCESS(CBTYPE cbType, PLUG_CB_CREATEPROCESS* info) if (FileExistW(cpids_x32_path) || FileExistW(cpids_x64_path)) { - ShellExecuteW(NULL, L"runas", exe, args, cur_path, SW_SHOWNORMAL); + SHELLEXECUTEINFOW shell_args = { 0 }; + + shell_args.cbSize = sizeof(shell_args); + shell_args.nShow = SW_SHOWNORMAL; + shell_args.lpVerb = L"runas"; + shell_args.fMask = SEE_MASK_NOCLOSEPROCESS; + shell_args.lpDirectory = cur_path; + shell_args.lpParameters = args; + shell_args.lpFile = exe; + + ShellExecuteExW(&shell_args); + + WaitForSingleObject(shell_args.hProcess, INFINITE); + + CloseHandle(shell_args.hProcess); } } @@ -229,7 +243,21 @@ PLUG_EXPORT void CBCREATEPROCESS(CBTYPE cbType, PLUG_CB_CREATEPROCESS* info) wcscat_s(args, L" l"); } - ShellExecuteW(NULL, L"runas", exe, args, path, SW_SHOWNORMAL); + SHELLEXECUTEINFOW shell_args = { 0 }; + + shell_args.cbSize = sizeof(shell_args); + shell_args.nShow = SW_SHOWNORMAL; + shell_args.lpVerb = L"runas"; + shell_args.fMask = SEE_MASK_NOCLOSEPROCESS; + shell_args.lpDirectory = path; + shell_args.lpParameters = args; + shell_args.lpFile = exe; + + ShellExecuteExW(&shell_args); + + WaitForSingleObject(shell_args.hProcess, INFINITE); + + CloseHandle(shell_args.hProcess); } } }