+12
-11
@@ -13,6 +13,9 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#else
|
#else
|
||||||
#include <consoleapi.h>
|
#include <consoleapi.h>
|
||||||
|
|
||||||
|
// from: WinBase.h
|
||||||
|
#define CREATE_NO_WINDOW 0x08000000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <processenv.h>
|
#include <processenv.h>
|
||||||
@@ -20,9 +23,6 @@
|
|||||||
#include <processthreadsapi.h>
|
#include <processthreadsapi.h>
|
||||||
#include <handleapi.h>
|
#include <handleapi.h>
|
||||||
|
|
||||||
// from: WinBase.h
|
|
||||||
#define CREATE_NO_WINDOW 0x08000000
|
|
||||||
|
|
||||||
bool running = true;
|
bool running = true;
|
||||||
TinyMITMProxy* proxy = nullptr;
|
TinyMITMProxy* proxy = nullptr;
|
||||||
ProxyConfigurator* conf = nullptr;
|
ProxyConfigurator* conf = nullptr;
|
||||||
@@ -58,10 +58,11 @@ void StartWatchdog()
|
|||||||
"rundll32.exe user32.dll,UpdatePerUserSystemParameters;\"",
|
"rundll32.exe user32.dll,UpdatePerUserSystemParameters;\"",
|
||||||
pid);
|
pid);
|
||||||
|
|
||||||
STARTUPINFOA si = {sizeof(si)};
|
STARTUPINFOA si;
|
||||||
PROCESS_INFORMATION pi;
|
PROCESS_INFORMATION pi;
|
||||||
RtlZeroMemory(&si, sizeof(si));
|
RtlZeroMemory(&si, sizeof(si));
|
||||||
RtlZeroMemory(&pi, sizeof(pi));
|
RtlZeroMemory(&pi, sizeof(pi));
|
||||||
|
si.cb = sizeof(si);
|
||||||
|
|
||||||
CreateProcessA(NULL, const_cast<char*>(psCommand.c_str()), NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &si,
|
CreateProcessA(NULL, const_cast<char*>(psCommand.c_str()), NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &si,
|
||||||
&pi);
|
&pi);
|
||||||
@@ -130,14 +131,14 @@ int main()
|
|||||||
SetConsoleCtrlHandler(consoleHandler, TRUE);
|
SetConsoleCtrlHandler(consoleHandler, TRUE);
|
||||||
StartWatchdog();
|
StartWatchdog();
|
||||||
|
|
||||||
__try
|
// __try
|
||||||
{
|
// {
|
||||||
if (!run()) return 1;
|
if (!run()) return 1;
|
||||||
}
|
// }
|
||||||
__except (EXCEPTION_EXECUTE_HANDLER)
|
// __except (EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
// {
|
||||||
if (conf) conf->clearProxy();
|
// if (conf) conf->clearProxy();
|
||||||
}
|
// }
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user