http://technet.microsoft.com/zh-CN/sysinternals
http://technet.microsoft.com/en-us/sysinternals/bb896647
我们利用debugView 命令可以自动生成log文件,而且是atomic。
cmd -h就可以看到了。
用ShellExeccute
从codeProject 搜索debugview
刚找到一些 http://www.codeproject.com/Articles/13345/DbMon-NET-A-simple-NET-OutputDebugString-capturer
http://www.codeproject.com/Articles/1053/Using-an-output-stream-for-debugging
===============================================
看到Mechanism-of-OutputDebugString,
最重要是的http://unixwiz.net/techtips/OutputDebugString.txt
/* * pseudocode for OutputDebugString * * from KERNEL32.DLL ver 5.0.2195.6794 * * Reverse engineered by Steve Friedl (steve@unixwiz.net) */ void OutputDebugStringA(LPTSTR *lpString) { DBWIN_buffer *pDBBuffer = 0; HANDLE hFileMap = 0; HANDLE hBufferEvent = 0; HANDLE hDataEvent = 0; // if we can't make or acquire the mutex, we're done if ( hDbwinMutex == 0 ) hDbwinMutex = setup_mutex(); if ( hDbwinMutex == 0) return; (void) WaitForSingleObject(hDbwinMutex, INFINITE); hFileMap = OpenFileMapping(FILE_MAP_WRITE, FALSE, "DBWIN_BUFFER"); pDBBuffer = (DBWIN_buffer *) MapViewOfFile( hFileMap, FILE_MAP_READ|FILE_MAP_WRITE, 0, // file offset high 0, // file offset low 0 ); // # of bytes to map (entire file) hBufferEvent = OpenEvent( SYNCHRONIZE, FALSE, "DBWIN_BUFFER_READY"); hDataEvent = OpenEvent( EVENT_MODIFY_STATE, FALSE, "DBWIN_DATA_READY"); const char *p = lpString; int len = strlen(lpString); while ( len > 0 ) { if ( WaitForSingleObject(hBufferEvent, 10*1000) != WAIT_OBJECT_0 ) { /* ERROR: give up */ break; } // populate the shared memory segment. The string // is limited to 4k or so. pBuffer->dwProcessId = GetCurrentProcessId(); int n = min(len, sizeof(pBuffer->data)-1); memcpy(pBuffer->data, p, n); pBuffer->data[n] = '