Small Tool - Debug Window

Newbie Spellweaver
Joined
Mar 1, 2012
Messages
42
Reaction score
3
Hi there
This a really small tool to display debug text from client and server
Hope this could help your debuging progress

Visual 2013 Solution, just build it yourself
View attachment DebugWindow.rar

Just a small script that handle message sent from masang
g_dbgOutwindowClassName and g_dbgOut was defined on selection build
 
Last edited:
Do you even internet?

Well, this would work with normal DbgOut messages, as written in the article.
But as you may know masang uses their "own" debug output method:

Code:
inline void DbgOutA (LPCSTR p){
    COPYDATASTRUCT cd; 
    HWND hWnd = ::FindWindow (g_dbgOutwindowClassName, g_dbgOut); 
    if (hWnd)
    {  
        cd.dwData = 0;
        cd.cbData = (strlen(p)+1)*sizeof(char);
        cd.lpData = (void *)p; 
        ::SendMessage (hWnd, WM_COPYDATA, 0, (LPARAM)&cd);  
    } 
}

It's sending messages to a window with the name: Client DebugOutput 20020805 and registered Windowclass: Client DebugOut Window

My problem now is: i can't download ther attachement, so i can't see if this release is useless or not :D
 
Sorry, because I don't know how to use the program from microsoft

Just a small script that handle message send from masang
Masang send message to a window with specific Class name and Title name.

I'll learn how to config the debugview from Microsoft, but I'm not sure it has a option to change the window and title name
 
Haha, dont rage bro.
if it's not help your case, just GTFO.
Ton of people out there even don't know how to compile the source code. It's just a little tool can help them.
I just review some of your posts and I can not find any helpful reply, just rage and scold.
Try to gentle and helpful bro.
 
Haha, dont rage bro.

Nobody is raging, i'm always chilled.

Ton of people out there even don't know how to compile the source code.

This is the main reason for them to stop dealing with it.

I just review some of your posts and I can not find any helpful reply, just rage and scold.

Gonna cry in a corner then (still, i'm not raging).

Try to gentle and helpful bro.

I help a lot of people usually, just you don't see it because all the leechers and server bitches here aren't my help target.

Have a good day.
 
OK, but why dafaqshould we use this simple tool instead of AllocConsole() ??!!

Anyway you did smth yourself so its ok that you're able to use your brain.
Cheers
 
OK, but why dafaqshould we use this simple tool instead of AllocConsole() ??!!

That is an absolutely stupid question.
Logging purposes, to say the least, let alone timestamping and not having to deal with some cheap hack-y method.

A better idea would be to use OutputDebugString(), but that is beyond the scope of this thread.
 
OK, but why dafaqshould we use this simple tool instead of AllocConsole() ??!!

Anyway you did smth yourself so its ok that you're able to use your brain.
Cheers

You can trash the console if your client crashes at boot.

That is an absolutely stupid question.
Logging purposes, to say the least, let alone timestamping and not having to deal with some cheap hack-y method.

A better idea would be to use OutputDebugString(), but that is beyond the scope of this thread.

I think that are more my hand's fingers than the guys which knows what this function does.
 
Last edited:
About one and a half year ago (before I kindly got the tip from Dragon to use Sysinternals) I wrote a similar tool in MFC... Sadly I can't find the full code for this right now but I found the C++ part of it that took care of handling the strings output by the DbgOut underlying function:

Code:
// Window Proc override
LRESULT CClientDebugOutDlg::WindowProc(UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg)
	{
		case WM_COPYDATA:
		{
			// Dispatch client Message
			COPYDATASTRUCT* pcds = (COPYDATASTRUCT*)lParam;
			if (pcds->dwData == 0)
			{
				// convert 8-byte char to 16-byte wchar_t
				LPCSTR msg = (LPCSTR)pcds->lpData;
				LPCWSTR w_msg = CA2W(msg);
				handleClientDbgMessage(w_msg);
			}
			else if (pcds->dwData == 0xFEFF)
			{
				// 16-byte char
				LPCWSTR msg = (LPCWSTR)pcds->lpData;
				handleClientDbgMessage(msg);
			}
		}
		break;
	}

	// Default Return
	return CDialogEx::WindowProc(msg, wParam, lParam);
}

void CClientDebugOutDlg::handleClientDbgMessage(std::wstring message /*alternatively: const wchar_t* message*/)
{
	// Handle the message here
}

Be aware that this code was used within a Unicode MFC environment. You can copy paste this into any MFC Unicode project by overriding this WndProc handler in your Dialog class.

You can easily make a standalone version of that using WINAPI function and implement the case switch into your custom WndProc. If you're using MBSC instead of Unicode you'd need for the other case.

If you prefer C# you could also do this via .

Might help someone to make tools...

Edit:
And ofc the window handle must be created with the wnd class "Client DebugOut Window" and the wnd caption "Client DebugOutput 20020805"
 
Back