mirror of https://github.com/x64dbg/GleeBug
add debug print functionality
This commit is contained in:
parent
66c06075b5
commit
7343c99cfa
|
|
@ -195,6 +195,7 @@
|
|||
<ClInclude Include="Debugger.Thread.Registers.h" />
|
||||
<ClInclude Include="Debugger.Thread.Registers.Register.h" />
|
||||
<ClInclude Include="GleeBug.h" />
|
||||
<ClInclude Include="oprintf.h" />
|
||||
<ClInclude Include="Static.BufferFile.h" />
|
||||
<ClInclude Include="Static.File.h" />
|
||||
<ClInclude Include="Static.Global.h" />
|
||||
|
|
|
|||
|
|
@ -190,6 +190,9 @@
|
|||
<ClInclude Include="zyan-disassembler-engine\include\Zydis\Zydis.h">
|
||||
<Filter>Header Files\Zydis</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="oprintf.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="zyan-disassembler-engine\include\Zydis\Internal\GeneratedTypes.inc">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static inline void oprintf(const char* format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
static char dprintf_msg[66000];
|
||||
*dprintf_msg = 0;
|
||||
vsnprintf_s(dprintf_msg, sizeof(dprintf_msg), format, args);
|
||||
if(GetConsoleWindow() == NULL)
|
||||
AllocConsole();
|
||||
auto hOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
DWORD w;
|
||||
WriteFile(hOut, dprintf_msg, strlen(dprintf_msg), &w, nullptr);
|
||||
}
|
||||
|
||||
static inline void oputs(const char* text)
|
||||
{
|
||||
oprintf("%s\n", text);
|
||||
}
|
||||
|
||||
static inline void oprintf_args(_In_z_ _Printf_format_string_ const char* Format, va_list Args)
|
||||
{
|
||||
char buffer[16384];
|
||||
vsnprintf_s(buffer, _TRUNCATE, Format, Args);
|
||||
oprintf("%s", buffer);
|
||||
}
|
||||
Loading…
Reference in New Issue