Hi,
I'm wondering -- since OutputDebugString is problematic inside hooks, has anyone written an alternative OutputDebugString + DbgView tool, for example by using SendIpcMessage?
OutputDebugString replacement
-
- Posts: 380
- Joined: Sat Dec 11, 2004 2:11 am
- Location: San Francisco Bay Area, CA USA
- Contact:
I log messages using SendMessage(WM_COPYDATA, ...) and wrote a viewer app similar to DbgView to receive the messages and display the strings. I could post that, if there's any interest.
The advantage of this is that it works in file hooks like CreateFile() which is not permissible to call OutputDebugString() due to that function internally calling CreateFile() and causing recursion. Of course, my solution has the same issue when used in hooks like for SendMessage!
-- David
The advantage of this is that it works in file hooks like CreateFile() which is not permissible to call OutputDebugString() due to that function internally calling CreateFile() and causing recursion. Of course, my solution has the same issue when used in hooks like for SendMessage!
-- David
It's OK, I ended up writing an app that does just this. Thanks anyway:
CreateIpcQueueEx("MyDebug", GetDbgMsg, 1);
...
VOID _stdcall
GetDbgMsg(
LPCSTR Name,
PVOID pMessageBuf,
DWORD cbMessageBuf,
PVOID pAnswerBuf,
DWORD cbAnswerBuf )
{
OutputDebugString((WCHAR*)pMessageBuf);
}
...
ShellExecute(0, NULL, L"DbgView.exe", NULL, NULL, SW_SHOWMAXIMIZED);
while (TRUE)
{
Sleep(500);
}
CreateIpcQueueEx("MyDebug", GetDbgMsg, 1);
...
VOID _stdcall
GetDbgMsg(
LPCSTR Name,
PVOID pMessageBuf,
DWORD cbMessageBuf,
PVOID pAnswerBuf,
DWORD cbAnswerBuf )
{
OutputDebugString((WCHAR*)pMessageBuf);
}
...
ShellExecute(0, NULL, L"DbgView.exe", NULL, NULL, SW_SHOWMAXIMIZED);
while (TRUE)
{
Sleep(500);
}
-
- Posts: 46
- Joined: Fri Apr 28, 2006 1:17 pm