RE: OutputDebugString logger by ScottLangham
ScottLangham
Tue Oct 04 11:49:02 CDT 2005
I think you can write a v. simple debugger app to get the output for a
process. Run this app instead of starting appToWatch.exe directly and you
should be able to get the output.
Very roughly... you want something along these lines:
int main()
{
HANDLE hProcess = CreateProcess( "appToWatch.exe", /*use creation flag
DEBUG_PROCESS*/ );
for(;;)
{
DEBUG_EVENT event;
WaitForDebugEvent(&event,INFINITE);
if( event.dwDebugEventCode == OUTPUT_DEBUG_STRING_EVENT )
{
char buf[512];
ReadProcessMemory( hProcess, event.u.DebugString.lpDebugStringData,
buf );
FunctionToWriteOutputToWhereYouWantEgAFile(buf);
}
}
return 0;
}
"teejbee@hotmail.com" wrote:
> Hi All,
> I am trying to write a utility for PocketPC 2003 that logs the
> OutputDebugString messages to a file. In Windows 2000, I could do that
> by the standard approach, where by opening a memory mapped file
> "DBWIN_BUFFER" and reading the buffer from there. Synchronization is
> taken care by two named events "DBWIN_DATA_READY" and
> "DBWIN_BUFFER_READY".
> But this method does not work under Windows CE. Can anybody help me
> on how to read the debug messages sent using OutputDebugString?
>
> Thanks,
> TJB
>
>