`
touchinsert
  • 浏览: 1291898 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

关于OutputDebugString的模拟

阅读更多

http://www.unixwiz.net/techtips/outputdebugstring.html这篇文章中可以知道,通过简单的几步设置,便可模拟OutputDebugString,可以用下面的代码描述:
struct dbwin_buffer {
DWORD dwProcessId;
char data[4096-sizeof(DWORD)];
};

void MyOutputDebugString(LPCTSTR lpOutputString)
{
static HANDLE hMutex = OpenMutex(MUTEX_ALL_ACCESS, // request full access
FALSE, // handle not inheritable
"DBWinMutex");
if(hMutex != NULL)
{
TSharedMem SharedMem("DBWIN_BUFFER", sizeof(struct dbwin_buffer));
if(!SharedMem.IsUnique())
{
HANDLE hBufEvent, hDataEvent;
hBufEvent = OpenEvent(EVENT_ALL_ACCESS, FALSE, "DBWIN_BUFFER_READY");
if(hBufEvent != NULL)
{
hDataEvent = OpenEvent(EVENT_ALL_ACCESS, FALSE, "DBWIN_DATA_READY");
if(hDataEvent!=NULL)
{
if(WaitForSingleObject(hBufEvent, 10000)==WAIT_OBJECT_0)
{
struct dbwin_buffer *buffer = (struct dbwin_buffer *)SharedMem.Buffer();
DWORD dwPID = GetCurrentProcessId();
memcpy(buffer, &dwPID, sizeof(DWORD));
lstrcpyn(buffer->data, lpOutputString, 4096-sizeof(DWORD));
SetEvent(hDataEvent);
}
CloseHandle(hDataEvent);
} //if(hDataEvent != NULL)
CloseHandle(hBufEvent);
} //if(hBufEvent != NULL)
} //if(!SharedMem.IsUnique())
ReleaseMutex(hMutex);
} //if(hMutex != NULL)
}
但,事实上,我在VS.NET2003的环境下,并不能向它的debugger输出任何内容,而且检测到并没有这个内存映射区域,也没有这2个Event,但同时,它仍能很好地拦截系统OutputDebugString的输出,看来它是通过API Hook之类的其它手段了。但我没有验证,尽管上面这段代码和OutputDebugString产生的输出都能很好地被LLYF DebugCapture这些程序拦截到。

分享到:
评论

相关推荐

    Dbgview OutputDebugString信息获取工具

    当Release版出现问题又不知道怎么定位的时候,此工具极其有用.IDE获取不到OutputDebugString的信息.那使用Dbgview可以很好解决这个问题. 我都是使用这个工具.

    C++ 输出调试信息和所用时间长度 outputdebugstring

    使用outputdebugstring输出调试信息,支持 流操作符 支持时间统计,极短只有十来行。codeproject上有相同功能的实现,几百上千行呢。真不知道作者是在干什么,练手吗?不像是要解决问题的杨紫。

    debugView 全局查看 Outputdebugstring

    在调试程序时,可以用Outputdebugstring 来调试,不需要下断点。 用这个工具就可以看见Outputdebugstring 的输出。 关键他是全局的,不需要挂进程。

    windows下编程的OutputDebugString测试

    windows下编程的OutputDebugString测试,结合上个共享的OutputDebugString输出捕抓工具,形成很好的调试手段。

    OutputDebugString源码

    原创的调试时用OutputDebugString打印,用debugview接收输出 在查阅了开源的操作系统mutex用法后 实现了OutputDebugString函数,并模仿tracewin界面风格实现了接收工具,类似于debugview 上传的OutputDebugString的...

    windows下OutputDebugString的捕抓工具源码

    windows下OutputDebugString的捕抓工具源码,非常方便的调试手段,windows开发必备

    第50章-再谈ReCrypt v.0.80脱壳(调戏OutputDebugString)1

    第50章-再谈ReCrypt v.0.80脱壳(调戏OutputDebugString)1

    在桌面程序中使用Printf输出调试信息

    的时候打印调试信息通常习惯是用自己封装好的函数利用 OutPutDebugString函数输出然后借助DbgView查看,但是有时候系统上其它程序也用OutPutDebugString在输出一些信息的时候,这样的话DbgView窗口上的信息就显得很...

    牛顿法潮流计算C++语言编写

    // OutputDebugString (str) #define XSQL_TRACE(str) // { OutputDebugString ("\n"); OutputDebugString(str); } #define XMEMFUNC_TRACE(str) // OutputDebugString (str) #define CHK_SUCCESS(sql_api) {\ ...

    Debug View

    Win32 OutputDebugString Win16 OutputDebugString Kernel-mode Out_Debug_String Kernel-mode _Debug_Printf_Service Under Windows NT and Win2k DebugView can capture: Win32 OutputDebugString ...

    socket 动态链接库

    OutputDebugString("套接字已存在!"); return -1; } glb_SockTCPServer = socket(AF_INET,SOCK_STREAM,0); //Create Socket res = WSAGetLastError(); if(res) { glb_SockTCPServer = NULL; ...

    vc6.0 MFC 添加控制台

    mfc中一般输出信息部方便 用到OutPutDebugString 需要用debugview来弄 不是太爽 所以 如果能搞一个控制台程序 并且使用printf 那该有多爽 在 InitInstance 中添加 下面内容 AllocConsole ; 开辟控制台 ...

    OutputDebugStrCapture

    捕获Windows下OutputDebugString API调试信息输出的CONSOLE程序。相当于DebugView的子功能。

    DebugView调试工具

    debug输出信息调试工具 debug输出信息调试工具 debug输出信息调试工具 查看outputdebugstring输出信息。

    调试工具之DebugView

    可以跟踪程序中outputdebugstring输出的信息。

    Debug监视器

    效果图:http://s2.album.sina.com.cn/pic_3/589d32f5020014rd<br><br>监视运行期程序通过API函数OutputDebugString输出的字符串

    DbgView调试信息查看器

    DbgView调试信息查看器,可以用OutputDebugString输出信息。

    关于一些调试器的反调试技术

    反调试技术 2 发现OD的处理 2 1. 窗口类名、窗口名 3 2. 检测调试器进程 4 3. 父进程是否是Explorer 5 ...21. OllyDbg:OutputDebugString() Format String Bug 27 22. TLS Callbacks 27 反反调试技术 31

    Dbgview.exe

    在dll工程中,我们use windows。... 需要输出内容的地方,使用OutputDebugString,例如 OutputDebugString(PChar('处理HookProc,Code值:'+intToStr(Code))); 打开Dbgview.exe,可以看到输出值。

    Dbgview调试工具.zip

    使用该工具可以使用Trace.Write("Trace");Debug.Write("Debug");Debugger.Log(0, null, "Debugger");OutputDebugString("OutputDebugString");在软件生成后输出调试信息

Global site tag (gtag.js) - Google Analytics