fix
This commit is contained in:
parent
5f916cee0c
commit
ea39dcb5ef
|
@ -21,16 +21,49 @@
|
|||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
#include "debug.h"
|
||||
#ifdef WITH_DEBUG
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
#include "dll.h"
|
||||
#include <stdio.h>
|
||||
#include "../../common/my_xeb.h"
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Debug_Wait
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
_FX void Debug_Wait()
|
||||
{
|
||||
BOOL Found = SbieApi_QueryConfBool(NULL, L"WaitForDebuggerAll", FALSE) ||
|
||||
SbieDll_CheckStringInList(Dll_ImageName, NULL, L"WaitForDebugger");
|
||||
|
||||
const WCHAR *CmdLine = GetCommandLine();
|
||||
WCHAR buf[66];
|
||||
ULONG index = 0;
|
||||
while (!Found) {
|
||||
NTSTATUS status = SbieApi_QueryConfAsIs(NULL, L"WaitForDebuggerCmdLine", index, buf, 64 * sizeof(WCHAR));
|
||||
++index;
|
||||
if (NT_SUCCESS(status)) {
|
||||
if (wcsstr(CmdLine, buf) != 0) {
|
||||
Found = TRUE;
|
||||
}
|
||||
}
|
||||
else if (status != STATUS_BUFFER_TOO_SMALL)
|
||||
break;
|
||||
}
|
||||
|
||||
if (Found) {
|
||||
while (!IsDebuggerPresent()) {
|
||||
OutputDebugString(L"Waiting for Debugger\n");
|
||||
Sleep(500);
|
||||
}
|
||||
if (!SbieApi_QueryConfBool(NULL, L"WaitForDebuggerSilent", TRUE))
|
||||
__debugbreak();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef WITH_DEBUG
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -129,43 +162,6 @@ __declspec(dllimport) NTSTATUS LdrGetDllHandle(
|
|||
#endif
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Debug_Wait
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
_FX void Debug_Wait()
|
||||
{
|
||||
BOOL Found = SbieApi_QueryConfBool(NULL, L"WaitForDebuggerAll", FALSE) ||
|
||||
SbieDll_CheckStringInList(Dll_ImageName, NULL, L"WaitForDebugger");
|
||||
|
||||
const WCHAR *CmdLine = GetCommandLine();
|
||||
WCHAR buf[66];
|
||||
ULONG index = 0;
|
||||
while (!Found) {
|
||||
NTSTATUS status = SbieApi_QueryConfAsIs(NULL, L"WaitForDebuggerCmdLine", index, buf, 64 * sizeof(WCHAR));
|
||||
++index;
|
||||
if (NT_SUCCESS(status)) {
|
||||
if (wcsstr(CmdLine, buf) != 0) {
|
||||
Found = TRUE;
|
||||
}
|
||||
}
|
||||
else if (status != STATUS_BUFFER_TOO_SMALL)
|
||||
break;
|
||||
}
|
||||
|
||||
if (Found) {
|
||||
while (!IsDebuggerPresent()) {
|
||||
OutputDebugString(L"Waiting for Debugger\n");
|
||||
Sleep(500);
|
||||
}
|
||||
if (!SbieApi_QueryConfBool(NULL, L"WaitForDebuggerSilent", TRUE))
|
||||
__debugbreak();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Debug_Init
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -34,14 +34,14 @@
|
|||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void Debug_Wait();
|
||||
|
||||
|
||||
#ifdef WITH_DEBUG
|
||||
|
||||
//#define BREAK_IMAGE_1 L"java.exe" // L"jp2launcher.exe"
|
||||
#define BREAK_IMAGE_1 L"TestTarget.exe"
|
||||
|
||||
void Debug_Wait();
|
||||
|
||||
int Debug_Init(void);
|
||||
|
||||
#endif WITH_DEBUG
|
||||
|
|
Loading…
Reference in New Issue