Thanks in advance
Oliver Daniel
gaun...@ziplink.net
--
----------------------------------------------
Jean-Michel David (514)948-2156
6019 Waverly jmd...@total.net
Montreal (Quebec) www.total.net/~clap
H2T 2Y4
----------------------------------------------
Try dbwin.zip on http://www.wdj.com/code/utilities.html
It only works with Win95, not with NT, but it includes the source code.
Dieter Schmeer
Oliver Daniel schrieb in Nachricht <681afd$4...@usenet40.supernews.com>...
There is such a thing at the URL below. It's made up of a class that you
link into your code (and can leave there in the release mode) and an EXE
that receives the output from the class. And it's free...
Cecil
--
Cecil Galbraith
CustomSoft mail to cgal...@concentric.net
Free programmer's utilities and MFC tips at
http://www.concentric.net/~cgalbrai
Paul DiLascia, who writes a column in Microsoft Systems Journal, wrote
just such an application - it's available at MSJ's ftp site (this
following is an self-extracting archive, which contains a bunch of
other self-extracting archives. The one you want is CPPQ1195.EXE.
Not sure why they don't just use winzip...):
ftp://ftp.microsoft.com/DEVELOPR/MSJ/MSJOCT95.EXE
It's pretty cool.
---
Mark Wright
Blue Frog Software, Inc
mwr...@pro-ns.net
But I just found an even cooler one. This one hooks
OutputDebugString, rather than redefining TRACE (lDiLascia's app).
Look here:
http://www.halcyon.com/ast
Only nt 4.0.
Oliver Daniel wrote in message <681afd$4...@usenet40.supernews.com>...
>Anyne know of a free/shareware utility to monitor calls to
OutputDebugString
>or use of the TRACE macro in MFC? I'm looking for a lightweight tool to
>monitor debugging info without needing the development enviroment.
>
Oliver Daniel
gaun...@ziplink.net
Compile the following code. Run without argument for help. Only tested in
NT.
Bibhas.
bib...@interlog.com
=================
#include <windows.h>
#include <stdio.h>
void
ShowDebugString(DEBUG_EVENT* DebugEv, HANDLE hProc)
{
OUTPUT_DEBUG_STRING_INFO *pI = &(DebugEv->u.DebugString);
void* aBuff = malloc(pI->nDebugStringLength);
DWORD dRead;
if (::ReadProcessMemory(
hProc, pI->lpDebugStringData, aBuff, pI->nDebugStringLength, &dRead)
== FALSE)
{
puts("Error: can't read VM memory");
return;
}
if (pI->fUnicode == 0)
{
char *buff = (char*) aBuff;
//buff[dRead] = '\0';
printf("%s", buff);
}
else
{
//puts("OOH! UBICODE");
wchar_t *buff = (wchar_t*) aBuff;
//buff[dRead] = '\0';
wprintf(L"%s", buff);
}
::free(aBuff);
}
int
main(int argc, char* argv[])
{
if (argc < 2)
{
puts("Usage: DbgConsole processID\n"
"You can get the processID from task manager");
return 1;
}
DWORD id;
DEBUG_EVENT DebugEv; // debugging event information
DWORD dwContinueStatus = DBG_CONTINUE; // exception continuation
BOOL bCont = TRUE;
HANDLE hProc = NULL;
id = atoi(argv[1]);
if (::DebugActiveProcess(id) == FALSE)
{
printf("Can't debug process ID: %d\n", id);
return 1;
}
hProc = ::OpenProcess(PROCESS_VM_READ, FALSE, id);
if (hProc == NULL)
{
printf("Can't get VM read access from process ID: %d\n", id);
return 1;
}
while (bCont)
{
// Wait for a debugging event to occur. The second parameter indicates
// that the function does not return until a debugging event occurs.
WaitForDebugEvent(&DebugEv, INFINITE);
// Process the debugging event code.
switch (DebugEv.dwDebugEventCode)
{
case EXIT_PROCESS_DEBUG_EVENT:
bCont = FALSE;
//puts("Process exited");
break;
case OUTPUT_DEBUG_STRING_EVENT:
//puts("Got string");
::ShowDebugString(&DebugEv, hProc);
break;
}
// Resume executing the thread that reported the debugging event.
ContinueDebugEvent(DebugEv.dwProcessId,
DebugEv.dwThreadId, dwContinueStatus);
}
::CloseHandle(hProc);
return 0;
}