New debug scheme with explicit debug channels declaration.

diff --git a/console/generic.c b/console/generic.c
index eb54d70..5a4bbdf 100644
--- a/console/generic.c
+++ b/console/generic.c
@@ -16,6 +16,8 @@
 #include "config.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(console)
+
 static void GENERIC_MoveLine(char row1, char row2, char col1, char col2);
 static void GENERIC_ClearLine(char row, char col1, char col2, int bgcolor,
    int attribute);
diff --git a/console/ncurses.c b/console/ncurses.c
index 84a4f21..1893730 100644
--- a/console/ncurses.c
+++ b/console/ncurses.c
@@ -24,6 +24,8 @@
 #include "debug.h"
 #include "options.h"
 
+DEFAULT_DEBUG_CHANNEL(console)
+
 #undef ERR /* Use ncurses's err() */
 #ifdef HAVE_NCURSES_H
 # include <ncurses.h>
diff --git a/console/xterm.c b/console/xterm.c
index 59d622e..b94a624 100644
--- a/console/xterm.c
+++ b/console/xterm.c
@@ -21,6 +21,8 @@
 #include "options.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(console)
+
 char console_xterm_prog[80];
 
 static BOOL wine_create_console(FILE **master, FILE **slave, int *pid);
diff --git a/controls/combo.c b/controls/combo.c
index 6b1b3f8..d99d48c 100644
--- a/controls/combo.c
+++ b/controls/combo.c
@@ -20,6 +20,8 @@
 #include "debug.h"
 #include "tweak.h"
 
+DEFAULT_DEBUG_CHANNEL(combo)
+
   /* bits in the dwKeyData */
 #define KEYDATA_ALT             0x2000
 #define KEYDATA_PREVSTATE       0x4000
diff --git a/controls/edit.c b/controls/edit.c
index 9590fe3..5b1e170 100644
--- a/controls/edit.c
+++ b/controls/edit.c
@@ -22,6 +22,10 @@
 #include "callback.h"
 #include "tweak.h"
 
+DECLARE_DEBUG_CHANNEL(combo)
+DECLARE_DEBUG_CHANNEL(edit)
+DECLARE_DEBUG_CHANNEL(relay)
+
 #define BUFLIMIT_MULTI		65534	/* maximum buffer size (not including '\0')
 					   FIXME: BTW, new specs say 65535 (do you dare ???) */
 #define BUFLIMIT_SINGLE		32766	/* maximum buffer size (not including '\0') */
diff --git a/controls/listbox.c b/controls/listbox.c
index dae876d..f64037a 100644
--- a/controls/listbox.c
+++ b/controls/listbox.c
@@ -17,6 +17,9 @@
 #include "debug.h"
 #include "tweak.h"
 
+DECLARE_DEBUG_CHANNEL(combo)
+DECLARE_DEBUG_CHANNEL(listbox)
+
 /* Unimplemented yet:
  * - LBS_NOSEL
  * - LBS_USETABSTOPS
diff --git a/controls/menu.c b/controls/menu.c
index 85d1acf..abfddaa 100644
--- a/controls/menu.c
+++ b/controls/menu.c
@@ -32,6 +32,8 @@
 
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(menu)
+
 
 /* internal popup menu window messages */
 
diff --git a/controls/scroll.c b/controls/scroll.c
index d5705cd..88ee856 100644
--- a/controls/scroll.c
+++ b/controls/scroll.c
@@ -12,6 +12,8 @@
 #include "win.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(scroll)
+
 
 static HBITMAP hUpArrow = 0;
 static HBITMAP hDnArrow = 0;
diff --git a/controls/static.c b/controls/static.c
index c7846e7..a6f21a4 100644
--- a/controls/static.c
+++ b/controls/static.c
@@ -14,6 +14,8 @@
 #include "debug.h"
 #include "tweak.h"
 
+DEFAULT_DEBUG_CHANNEL(static)
+
 static void STATIC_PaintTextfn( WND *wndPtr, HDC hdc );
 static void STATIC_PaintRectfn( WND *wndPtr, HDC hdc );
 static void STATIC_PaintIconfn( WND *wndPtr, HDC hdc );
diff --git a/controls/uitools.c b/controls/uitools.c
index c83a805..0daff1c 100644
--- a/controls/uitools.c
+++ b/controls/uitools.c
@@ -8,6 +8,8 @@
 #include "wine/winuser16.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(graphics)
+
 static const WORD wPattern_AA55[8] = { 0xaaaa, 0x5555, 0xaaaa, 0x5555,
                                        0xaaaa, 0x5555, 0xaaaa, 0x5555 };
 
diff --git a/dlls/advapi32/crypt.c b/dlls/advapi32/crypt.c
index 11c25385..34a9f53 100644
--- a/dlls/advapi32/crypt.c
+++ b/dlls/advapi32/crypt.c
@@ -6,6 +6,8 @@
 #include "wincrypt.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(advapi)
+
 /******************************************************************************
  * CryptAcquireContextA
  * Acquire a crypto provider context handle.
diff --git a/dlls/advapi32/eventlog.c b/dlls/advapi32/eventlog.c
index f0205de..54c5aae 100644
--- a/dlls/advapi32/eventlog.c
+++ b/dlls/advapi32/eventlog.c
@@ -11,6 +11,8 @@
 
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(advapi)
+
 /******************************************************************************
  * BackupEventLog32A [ADVAPI32.15]
  */
diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c
index d8501fe..5f605f3 100644
--- a/dlls/advapi32/security.c
+++ b/dlls/advapi32/security.c
@@ -11,6 +11,9 @@
 #include "ntddk.h"
 #include "debug.h"
 
+DECLARE_DEBUG_CHANNEL(advapi)
+DECLARE_DEBUG_CHANNEL(security)
+
 #define CallWin32ToNt(func) \
 	{ NTSTATUS ret; \
 	  ret = (func); \
diff --git a/dlls/advapi32/service.c b/dlls/advapi32/service.c
index 849522b..56082a4 100644
--- a/dlls/advapi32/service.c
+++ b/dlls/advapi32/service.c
@@ -11,6 +11,8 @@
 #include "heap.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(advapi)
+
 /* FIXME: Where do these belong? */
 typedef DWORD	SERVICE_STATUS_HANDLE;
 typedef VOID (WINAPI *LPHANDLER_FUNCTION)( DWORD dwControl);
diff --git a/dlls/avifil32/avifile.c b/dlls/avifil32/avifile.c
index 7b2e9cc..f8efb63 100644
--- a/dlls/avifil32/avifile.c
+++ b/dlls/avifil32/avifile.c
@@ -14,6 +14,10 @@
 #include "debugstr.h"
 #include "debug.h"
 
+DECLARE_DEBUG_CHANNEL(avifile)
+DECLARE_DEBUG_CHANNEL(msvideo)
+DECLARE_DEBUG_CHANNEL(relay)
+
 typedef struct IAVIStreamImpl {
 	/* IUnknown stuff */
 	ICOM_VTABLE(IAVIStream)*	lpvtbl;
diff --git a/dlls/comctl32/animate.c b/dlls/comctl32/animate.c
index 05f1b2f..7fb5c72 100644
--- a/dlls/comctl32/animate.c
+++ b/dlls/comctl32/animate.c
@@ -19,6 +19,8 @@
 #include "animate.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(animate)
+
 #define ANIMATE_GetInfoPtr(hwnd) ((ANIMATE_INFO *)GetWindowLongA (hwnd, 0))
 
 
diff --git a/dlls/comctl32/comboex.c b/dlls/comctl32/comboex.c
index 54a4415..d4a6ba5 100644
--- a/dlls/comctl32/comboex.c
+++ b/dlls/comctl32/comboex.c
@@ -21,6 +21,8 @@
 #include "comboex.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(comboex)
+
 #define ID_CB_EDIT    1001
 
 #define COMBOEX_GetInfoPtr(wndPtr) ((COMBOEX_INFO *)GetWindowLongA (hwnd, 0))
diff --git a/dlls/comctl32/comctl32undoc.c b/dlls/comctl32/comctl32undoc.c
index 37b0ce5..afa5bfe 100644
--- a/dlls/comctl32/comctl32undoc.c
+++ b/dlls/comctl32/comctl32undoc.c
@@ -22,6 +22,8 @@
 #include "heap.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(commctrl)
+
 
 extern HANDLE COMCTL32_hHeap; /* handle to the private heap */
 
diff --git a/dlls/comctl32/commctrl.c b/dlls/comctl32/commctrl.c
index f02a9c4..5f0c621 100644
--- a/dlls/comctl32/commctrl.c
+++ b/dlls/comctl32/commctrl.c
@@ -33,6 +33,8 @@
 #include "debug.h"
 #include "winerror.h"
 
+DEFAULT_DEBUG_CHANNEL(commctrl)
+
 
 HANDLE COMCTL32_hHeap = (HANDLE)NULL;
 DWORD    COMCTL32_dwProcessesAttached = 0;
diff --git a/dlls/comctl32/datetime.c b/dlls/comctl32/datetime.c
index 02a5785..ed22a25 100644
--- a/dlls/comctl32/datetime.c
+++ b/dlls/comctl32/datetime.c
@@ -19,6 +19,8 @@
 #include "datetime.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(datetime)
+
 
 #define DATETIME_GetInfoPtr(hwnd) ((DATETIME_INFO *)GetWindowLongA (hwnd, 0))
 
diff --git a/dlls/comctl32/draglist.c b/dlls/comctl32/draglist.c
index e45ec70..43fe498 100644
--- a/dlls/comctl32/draglist.c
+++ b/dlls/comctl32/draglist.c
@@ -15,6 +15,8 @@
 #include "commctrl.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(commctrl)
+
 
 BOOL WINAPI MakeDragList (HWND hwndLB)
 {
diff --git a/dlls/comctl32/flatsb.c b/dlls/comctl32/flatsb.c
index ab9dfb3..d58f707 100644
--- a/dlls/comctl32/flatsb.c
+++ b/dlls/comctl32/flatsb.c
@@ -20,6 +20,9 @@
 #include "flatsb.h" 
 #include "debug.h"
 
+DECLARE_DEBUG_CHANNEL(commctrl)
+DECLARE_DEBUG_CHANNEL(datetime)
+
 
 #define FlatSB_GetInfoPtr(hwnd) ((FLATSB_INFO*)GetWindowLongA (hwnd, 0))
 
diff --git a/dlls/comctl32/header.c b/dlls/comctl32/header.c
index 45edb5b..82fe395 100644
--- a/dlls/comctl32/header.c
+++ b/dlls/comctl32/header.c
@@ -26,6 +26,8 @@
 #include "header.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(header)
+
 
 #define __HDM_LAYOUT_HACK__
 
diff --git a/dlls/comctl32/hotkey.c b/dlls/comctl32/hotkey.c
index 7a3eb97..cb5c06d 100644
--- a/dlls/comctl32/hotkey.c
+++ b/dlls/comctl32/hotkey.c
@@ -18,6 +18,8 @@
 #include "hotkey.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(hotkey)
+
 
 #define HOTKEY_GetInfoPtr(hwnd) ((HOTKEY_INFO *)GetWindowLongA (hwnd, 0))
 
diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c
index 8e9f7af..ba5100f 100644
--- a/dlls/comctl32/imagelist.c
+++ b/dlls/comctl32/imagelist.c
@@ -36,6 +36,8 @@
 #include "commctrl.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(imagelist)
+
 
 #define _MAX(a,b) (((a)>(b))?(a):(b))
 #define _MIN(a,b) (((a)>(b))?(b):(a))
diff --git a/dlls/comctl32/ipaddress.c b/dlls/comctl32/ipaddress.c
index 5aadeb0..88ed8fa 100644
--- a/dlls/comctl32/ipaddress.c
+++ b/dlls/comctl32/ipaddress.c
@@ -29,6 +29,8 @@
 #include "heap.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(ipaddress)
+
 
 #define IPADDRESS_GetInfoPtr(hwnd) ((IPADDRESS_INFO *)GetWindowLongA (hwnd, 0))
 
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index bb5585c..c1347e5 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -53,6 +53,8 @@
 #include "listview.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(listview)
+
 /*
  * constants 
  */
diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c
index e52da7d..5089882 100644
--- a/dlls/comctl32/monthcal.c
+++ b/dlls/comctl32/monthcal.c
@@ -19,6 +19,8 @@
 #include "monthcal.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(monthcal)
+
 
 #define MONTHCAL_GetInfoPtr(hwnd) ((MONTHCAL_INFO *)GetWindowLongA (hwnd, 0))
 
diff --git a/dlls/comctl32/nativefont.c b/dlls/comctl32/nativefont.c
index 0e569a4..176b5e0 100644
--- a/dlls/comctl32/nativefont.c
+++ b/dlls/comctl32/nativefont.c
@@ -18,6 +18,8 @@
 #include "nativefont.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(nativefont)
+
 
 #define NATIVEFONT_GetInfoPtr(hwnd) ((NATIVEFONT_INFO *)GetWindowLongA (hwnd, 0))
 
diff --git a/dlls/comctl32/pager.c b/dlls/comctl32/pager.c
index 11c0d97..23903fc 100644
--- a/dlls/comctl32/pager.c
+++ b/dlls/comctl32/pager.c
@@ -18,6 +18,8 @@
 #include "pager.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(pager)
+
 
 #define PAGER_GetInfoPtr(hwnd) ((PAGER_INFO *)GetWindowLongA(hwnd, 0))
 
diff --git a/dlls/comctl32/progress.c b/dlls/comctl32/progress.c
index 74f65e8..0bf5504 100644
--- a/dlls/comctl32/progress.c
+++ b/dlls/comctl32/progress.c
@@ -11,6 +11,8 @@
 #include "progress.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(progress)
+
 
 /* Control configuration constants */
 
diff --git a/dlls/comctl32/propsheet.c b/dlls/comctl32/propsheet.c
index fb72cd9..2cf8505 100644
--- a/dlls/comctl32/propsheet.c
+++ b/dlls/comctl32/propsheet.c
@@ -14,6 +14,8 @@
 #include "propsheet.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(propsheet)
+
 
 LRESULT WINAPI
 PROPSHEET_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
diff --git a/dlls/comctl32/rebar.c b/dlls/comctl32/rebar.c
index d87abc4..f98f4d4 100644
--- a/dlls/comctl32/rebar.c
+++ b/dlls/comctl32/rebar.c
@@ -26,6 +26,8 @@
 #include "sysmetrics.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(rebar)
+
 
 /* fDraw flags */
 #define DRAW_GRIPPER    1
diff --git a/dlls/comctl32/status.c b/dlls/comctl32/status.c
index e466188..0d2917c 100644
--- a/dlls/comctl32/status.c
+++ b/dlls/comctl32/status.c
@@ -10,6 +10,8 @@
 #include "status.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(statusbar)
+
 /*
  * Run tests using Waite Group Windows95 API Bible Vol. 1&2
  * The second cdrom contains executables drawstat.exe,gettext.exe,
diff --git a/dlls/comctl32/tab.c b/dlls/comctl32/tab.c
index 6e42659..aabf7e8 100644
--- a/dlls/comctl32/tab.c
+++ b/dlls/comctl32/tab.c
@@ -18,6 +18,8 @@
 #include "tab.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(tab)
+
 /******************************************************************************
  * Positioning constants
  */
diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c
index 893224c..5e772b5 100644
--- a/dlls/comctl32/toolbar.c
+++ b/dlls/comctl32/toolbar.c
@@ -35,6 +35,8 @@
 #include "toolbar.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(toolbar)
+
 /* #define __NEW_WRAP_CODE__ */
 
 #define SEPARATOR_WIDTH    8
diff --git a/dlls/comctl32/tooltips.c b/dlls/comctl32/tooltips.c
index a8618eb..ab337dd 100644
--- a/dlls/comctl32/tooltips.c
+++ b/dlls/comctl32/tooltips.c
@@ -21,6 +21,8 @@
 #include "tooltips.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(tooltips)
+
 #define ID_TIMERSHOW   1    /* show delay timer */
 #define ID_TIMERPOP    2    /* auto pop timer */
 #define ID_TIMERLEAVE  3    /* tool leave timer */
diff --git a/dlls/comctl32/trackbar.c b/dlls/comctl32/trackbar.c
index b5f1256..844d8d3 100644
--- a/dlls/comctl32/trackbar.c
+++ b/dlls/comctl32/trackbar.c
@@ -29,6 +29,8 @@
 #include "trackbar.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(trackbar)
+
 
 #define TRACKBAR_GetInfoPtr(wndPtr) ((TRACKBAR_INFO *)GetWindowLongA (hwnd,0))
 
diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c
index 404f70d..f41b565 100644
--- a/dlls/comctl32/treeview.c
+++ b/dlls/comctl32/treeview.c
@@ -46,6 +46,8 @@
 #include "treeview.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(treeview)
+
 /* ffs should be in <string.h>. */
 
 /* Defines, since they do not need to return previous state, and nr
diff --git a/dlls/comctl32/updown.c b/dlls/comctl32/updown.c
index 6817a18..e2dac08 100644
--- a/dlls/comctl32/updown.c
+++ b/dlls/comctl32/updown.c
@@ -38,6 +38,8 @@
 #include "updown.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(updown)
+
 /* Control configuration constants */
 
 #define INITIAL_DELAY    500 /* initial timer until auto-increment kicks in */
diff --git a/dlls/commdlg/colordlg.c b/dlls/commdlg/colordlg.c
index 2e2d69e..f336890 100644
--- a/dlls/commdlg/colordlg.c
+++ b/dlls/commdlg/colordlg.c
@@ -22,6 +22,8 @@
 #include "winproc.h"
 #include "cderr.h"
 
+DEFAULT_DEBUG_CHANNEL(commdlg)
+
 /***********************************************************************
  *           ChooseColor   (COMMDLG.5)
  */
diff --git a/dlls/commdlg/filedlg.c b/dlls/commdlg/filedlg.c
index b1fec07..4a5507c 100644
--- a/dlls/commdlg/filedlg.c
+++ b/dlls/commdlg/filedlg.c
@@ -24,6 +24,8 @@
 #include "winproc.h"
 #include "cderr.h"
 
+DEFAULT_DEBUG_CHANNEL(commdlg)
+
 static HICON16 hFolder = 0;
 static HICON16 hFolder2 = 0;
 static HICON16 hFloppy = 0;
diff --git a/dlls/commdlg/finddlg.c b/dlls/commdlg/finddlg.c
index bf4cd03..19e9e3f 100644
--- a/dlls/commdlg/finddlg.c
+++ b/dlls/commdlg/finddlg.c
@@ -21,6 +21,8 @@
 #include "debug.h"
 #include "winproc.h"
 
+DEFAULT_DEBUG_CHANNEL(commdlg)
+
 
 /***********************************************************************
  *           FindText16   (COMMDLG.11)
diff --git a/dlls/commdlg/fontdlg.c b/dlls/commdlg/fontdlg.c
index 64f6736..c0f768d 100644
--- a/dlls/commdlg/fontdlg.c
+++ b/dlls/commdlg/fontdlg.c
@@ -24,6 +24,8 @@
 #include "winproc.h"
 #include "cderr.h"
 
+DEFAULT_DEBUG_CHANNEL(commdlg)
+
 static HBITMAP16 hBitmapTT = 0; 
 
 
diff --git a/dlls/commdlg/generic.c b/dlls/commdlg/generic.c
index 688ca62..ba24fa5 100644
--- a/dlls/commdlg/generic.c
+++ b/dlls/commdlg/generic.c
@@ -17,6 +17,8 @@
 #include "debug.h"
 #include "winproc.h"
 
+DEFAULT_DEBUG_CHANNEL(commdlg)
+
 
 #define COMDLG32_LAST_ERROR_NOT_ALLOCATED 0xF684F684
 static DWORD		COMDLG32_TlsIndex  = COMDLG32_LAST_ERROR_NOT_ALLOCATED;
diff --git a/dlls/commdlg/printdlg.c b/dlls/commdlg/printdlg.c
index 57112d2..2af5516 100644
--- a/dlls/commdlg/printdlg.c
+++ b/dlls/commdlg/printdlg.c
@@ -23,6 +23,8 @@
 #include "winproc.h"
 #include "cderr.h"
 
+DEFAULT_DEBUG_CHANNEL(commdlg)
+
 /***********************************************************************
  *           PrintDlg16   (COMMDLG.20)
  */
diff --git a/dlls/imagehlp/access.c b/dlls/imagehlp/access.c
index 73ca4d7..793245c 100644
--- a/dlls/imagehlp/access.c
+++ b/dlls/imagehlp/access.c
@@ -12,6 +12,8 @@
 #include "debug.h"
 #include "imagehlp.h"
 
+DEFAULT_DEBUG_CHANNEL(imagehlp)
+
 /***********************************************************************
  *           Data
  */
diff --git a/dlls/imagehlp/debug.c b/dlls/imagehlp/debug.c
index 5d7e829..8dc01e6 100644
--- a/dlls/imagehlp/debug.c
+++ b/dlls/imagehlp/debug.c
@@ -10,6 +10,8 @@
 #include "debug.h"
 #include "imagehlp.h"
 
+DEFAULT_DEBUG_CHANNEL(imagehlp)
+
 /***********************************************************************
  *           FindDebugInfoFile32 (IMAGEHLP.5)
  */
diff --git a/dlls/imagehlp/imagehlp_main.c b/dlls/imagehlp/imagehlp_main.c
index 387028f..4cf79b5 100644
--- a/dlls/imagehlp/imagehlp_main.c
+++ b/dlls/imagehlp/imagehlp_main.c
@@ -10,6 +10,8 @@
 #include "windef.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(imagehlp)
+
 /**********************************************************************/
 
 HANDLE IMAGEHLP_hHeap = (HANDLE) NULL;
diff --git a/dlls/imagehlp/integrity.c b/dlls/imagehlp/integrity.c
index d92d3f9..cbfd64e 100644
--- a/dlls/imagehlp/integrity.c
+++ b/dlls/imagehlp/integrity.c
@@ -10,6 +10,8 @@
 #include "imagehlp.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(imagehlp)
+
 /***********************************************************************
  *           ImageAddCertificate32 (IMAGEHLP.10)
  */
diff --git a/dlls/imagehlp/modify.c b/dlls/imagehlp/modify.c
index 4e21a41..fde8b53 100644
--- a/dlls/imagehlp/modify.c
+++ b/dlls/imagehlp/modify.c
@@ -10,6 +10,8 @@
 #include "debug.h"
 #include "imagehlp.h"
 
+DEFAULT_DEBUG_CHANNEL(imagehlp)
+
 /***********************************************************************
  *           BindImage32 (IMAGEHLP.1)
  */
diff --git a/dlls/imagehlp/symbol.c b/dlls/imagehlp/symbol.c
index ddcb0ea..7be5387 100644
--- a/dlls/imagehlp/symbol.c
+++ b/dlls/imagehlp/symbol.c
@@ -10,6 +10,8 @@
 #include "debug.h"
 #include "imagehlp.h"
 
+DEFAULT_DEBUG_CHANNEL(imagehlp)
+
 /***********************************************************************
  *           SymCleanup32 (IMAGEHLP.37)
  */
diff --git a/dlls/msacm/msacm_main.c b/dlls/msacm/msacm_main.c
index 837418a..77c196f 100644
--- a/dlls/msacm/msacm_main.c
+++ b/dlls/msacm/msacm_main.c
@@ -9,6 +9,8 @@
 #include "msacm.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(msacm)
+
 /***********************************************************************
  *           ACMGETVERSION (MSACM.7)
  */
diff --git a/dlls/msacm32/driver.c b/dlls/msacm32/driver.c
index 0843a05..15bb225 100644
--- a/dlls/msacm32/driver.c
+++ b/dlls/msacm32/driver.c
@@ -16,6 +16,8 @@
 #include "msacmdrv.h"
 #include "winreg.h"
 
+DEFAULT_DEBUG_CHANNEL(msacm)
+
 /***********************************************************************
  *           acmDriverAddA (MSACM32.2)
  */
diff --git a/dlls/msacm32/filter.c b/dlls/msacm32/filter.c
index 7420343..67d6604 100644
--- a/dlls/msacm32/filter.c
+++ b/dlls/msacm32/filter.c
@@ -11,6 +11,8 @@
 #include "msacmdrv.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(msacm)
+
 /***********************************************************************
  *           acmFilterChooseA (MSACM32.13)
  */
diff --git a/dlls/msacm32/format.c b/dlls/msacm32/format.c
index 1dc04ab..0d06c81 100644
--- a/dlls/msacm32/format.c
+++ b/dlls/msacm32/format.c
@@ -12,6 +12,8 @@
 #include "msacm.h"
 #include "msacmdrv.h"
 
+DEFAULT_DEBUG_CHANNEL(msacm)
+
 /***********************************************************************
  *           acmFormatChooseA (MSACM32.23)
  */
diff --git a/dlls/msacm32/msacm32_main.c b/dlls/msacm32/msacm32_main.c
index 739f3ca..d306545 100644
--- a/dlls/msacm32/msacm32_main.c
+++ b/dlls/msacm32/msacm32_main.c
@@ -12,6 +12,8 @@
 #include "msacmdrv.h"
 #include "winversion.h"
 
+DEFAULT_DEBUG_CHANNEL(msacm)
+
 /**********************************************************************/
 
 static DWORD MSACM_dwProcessesAttached = 0;
diff --git a/dlls/msacm32/stream.c b/dlls/msacm32/stream.c
index 125882f..ec7e848 100644
--- a/dlls/msacm32/stream.c
+++ b/dlls/msacm32/stream.c
@@ -12,6 +12,8 @@
 #include "msacm.h"
 #include "msacmdrv.h"
 
+DEFAULT_DEBUG_CHANNEL(msacm)
+
 /***********************************************************************
  *           acmStreamClose (MSACM32.37)
  */
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index fdceac1..c37b0c8 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -4,6 +4,8 @@
 
 #include "ntddk.h"
 
+DEFAULT_DEBUG_CHANNEL(ntdll)
+
 /**************************************************************************
  *                 NtOpenFile				[NTDLL.127]
  * FUNCTION: Opens a file
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index d085ca1..b84dbb1 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -15,6 +15,8 @@
 
 #include "ntddk.h"
 
+DEFAULT_DEBUG_CHANNEL(ntdll)
+
 /* move to winbase.h */
 typedef VOID (CALLBACK *PTIMERAPCROUTINE)(LPVOID lpArgToCompletionRoutine,DWORD dwTimerLowValue,DWORD dwTimerHighValue);   
 
diff --git a/dlls/ntdll/om.c b/dlls/ntdll/om.c
index dc9a3b0..954e560 100644
--- a/dlls/ntdll/om.c
+++ b/dlls/ntdll/om.c
@@ -8,6 +8,8 @@
 
 #include "ntddk.h"
 
+DEFAULT_DEBUG_CHANNEL(ntdll)
+
 /* move to somewhere */
 typedef void * POBJDIR_INFORMATION;
 
diff --git a/dlls/ntdll/reg.c b/dlls/ntdll/reg.c
index 542dcf9..3089330 100644
--- a/dlls/ntdll/reg.c
+++ b/dlls/ntdll/reg.c
@@ -7,6 +7,8 @@
 
 #include "ntddk.h"
 
+DEFAULT_DEBUG_CHANNEL(ntdll)
+
 
 /******************************************************************************
  * NtCreateKey [NTDLL]
diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c
index 1b2aa48..d0c8c93 100644
--- a/dlls/ntdll/rtl.c
+++ b/dlls/ntdll/rtl.c
@@ -18,6 +18,8 @@
 #include "ntddk.h"
 #include "winreg.h"
 
+DEFAULT_DEBUG_CHANNEL(ntdll)
+
 
 /*
  *	resource functions
diff --git a/dlls/ntdll/rtlstr.c b/dlls/ntdll/rtlstr.c
index 8a177eb..9dc3602 100644
--- a/dlls/ntdll/rtlstr.c
+++ b/dlls/ntdll/rtlstr.c
@@ -18,6 +18,8 @@
 #include "debug.h"
 
 #include "ntddk.h"
+
+DEFAULT_DEBUG_CHANNEL(ntdll)
 /*
  *	STRING FUNCTIONS
  */
diff --git a/dlls/ntdll/sec.c b/dlls/ntdll/sec.c
index 89bbea1..9414b9f 100644
--- a/dlls/ntdll/sec.c
+++ b/dlls/ntdll/sec.c
@@ -25,6 +25,8 @@
 #include "ntddk.h"
 #include "winreg.h"
 
+DEFAULT_DEBUG_CHANNEL(ntdll)
+
 /*
  *	SID FUNCTIONS
  */
diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c
index af6c1e9..293c893 100644
--- a/dlls/ntdll/sync.c
+++ b/dlls/ntdll/sync.c
@@ -10,6 +10,8 @@
 
 #include "ntddk.h"
 
+DEFAULT_DEBUG_CHANNEL(ntdll)
+
 /*
  *	Semaphore
  */
diff --git a/dlls/ntdll/time.c b/dlls/ntdll/time.c
index b749edc..41572cd 100644
--- a/dlls/ntdll/time.c
+++ b/dlls/ntdll/time.c
@@ -8,11 +8,12 @@
  * 
  */
 
-#include <ntddk.h>
-
 #include <string.h>
-#include <debug.h>
-#include <file.h>
+#include "ntddk.h"
+#include "debug.h"
+#include "file.h"
+
+DEFAULT_DEBUG_CHANNEL(ntdll)
 
 #define TICKSPERSEC        10000000
 #define TICKSPERMSEC       10000
diff --git a/dlls/psapi/psapi_main.c b/dlls/psapi/psapi_main.c
index 5deae7c..4837c47 100644
--- a/dlls/psapi/psapi_main.c
+++ b/dlls/psapi/psapi_main.c
@@ -10,6 +10,8 @@
 #include "debug.h"
 #include "psapi.h"
 
+DEFAULT_DEBUG_CHANNEL(psapi)
+
 #include <string.h>
 
 /***********************************************************************
diff --git a/dlls/rasapi32/rasapi.c b/dlls/rasapi32/rasapi.c
index 5e01c8a..884a4b7 100644
--- a/dlls/rasapi32/rasapi.c
+++ b/dlls/rasapi32/rasapi.c
@@ -8,6 +8,8 @@
 #include "ras.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(ras)
+
 /**************************************************************************
  *                 RasEnumConnections32A			[RASAPI32.544]
  */
diff --git a/dlls/shell32/brsfolder.c b/dlls/shell32/brsfolder.c
index ed47633..40f8db5 100644
--- a/dlls/shell32/brsfolder.c
+++ b/dlls/shell32/brsfolder.c
@@ -23,6 +23,8 @@
 #include "pidl.h"
 #include "shell32_main.h"
 
+DEFAULT_DEBUG_CHANNEL(shell)
+
 #define		IDD_TREEVIEW 99
 
 static HWND		hwndTreeView;
diff --git a/dlls/shell32/classes.c b/dlls/shell32/classes.c
index f76f64b..02a3cf4 100644
--- a/dlls/shell32/classes.c
+++ b/dlls/shell32/classes.c
@@ -13,6 +13,8 @@
 #include "shlobj.h"
 #include "shell32_main.h"
 
+DEFAULT_DEBUG_CHANNEL(shell)
+
 BOOL HCR_MapTypeToValue ( LPCSTR szExtension, LPSTR szFileType, DWORD len)
 {	HKEY	hkey;
 
diff --git a/dlls/shell32/contmenu.c b/dlls/shell32/contmenu.c
index c11ad0b..58c352c 100644
--- a/dlls/shell32/contmenu.c
+++ b/dlls/shell32/contmenu.c
@@ -16,6 +16,8 @@
 
 #include "shell32_main.h"
 
+DEFAULT_DEBUG_CHANNEL(shell)
+
 /**************************************************************************
 *  IContextMenu Implementation
 */
diff --git a/dlls/shell32/dataobject.c b/dlls/shell32/dataobject.c
index 3859476..05f900b 100644
--- a/dlls/shell32/dataobject.c
+++ b/dlls/shell32/dataobject.c
@@ -13,6 +13,8 @@
 #include "shell32_main.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(shell)
+
 UINT cfShellIDList=0;
 UINT cfFileGroupDesc=0;
 UINT cfFileContents=0;
diff --git a/dlls/shell32/enumidlist.c b/dlls/shell32/enumidlist.c
index cb1ae17..2d8d8d3 100644
--- a/dlls/shell32/enumidlist.c
+++ b/dlls/shell32/enumidlist.c
@@ -15,6 +15,8 @@
 #include "shlguid.h"
 #include "shell32_main.h"
 
+DEFAULT_DEBUG_CHANNEL(shell)
+
 typedef struct tagENUMLIST
 {
 	struct tagENUMLIST	*pNext;
diff --git a/dlls/shell32/folders.c b/dlls/shell32/folders.c
index 32efd6c..aed0792 100644
--- a/dlls/shell32/folders.c
+++ b/dlls/shell32/folders.c
@@ -16,6 +16,8 @@
 #include "pidl.h"
 #include "shell32_main.h"
 
+DEFAULT_DEBUG_CHANNEL(shell)
+
 
 /***********************************************************************
 *   IExtractIconA implementation
diff --git a/dlls/shell32/iconcache.c b/dlls/shell32/iconcache.c
index 3795f29..72d071e 100644
--- a/dlls/shell32/iconcache.c
+++ b/dlls/shell32/iconcache.c
@@ -17,6 +17,8 @@
 #include "pidl.h"
 #include "shell32_main.h"
 
+DEFAULT_DEBUG_CHANNEL(shell)
+
 #pragma pack(1)
 
 typedef struct
diff --git a/dlls/shell32/pidl.c b/dlls/shell32/pidl.c
index 919b7b0..6a50a7b 100644
--- a/dlls/shell32/pidl.c
+++ b/dlls/shell32/pidl.c
@@ -24,6 +24,9 @@
 
 #include "pidl.h"
 
+DECLARE_DEBUG_CHANNEL(pidl)
+DECLARE_DEBUG_CHANNEL(shell)
+
 void pdump (LPCITEMIDLIST pidl)
 {	DWORD type;
 	CHAR * szData;
diff --git a/dlls/shell32/regstream.c b/dlls/shell32/regstream.c
index 4e26644..5e3050c 100644
--- a/dlls/shell32/regstream.c
+++ b/dlls/shell32/regstream.c
@@ -14,6 +14,8 @@
 #include "pidl.h"
 #include "shell32_main.h"
 
+DEFAULT_DEBUG_CHANNEL(shell)
+
 typedef struct 
 {	ICOM_VTABLE(IStream)* lpvtbl;
 	DWORD		ref;
diff --git a/dlls/shell32/shell32_main.c b/dlls/shell32/shell32_main.c
index 5377e9c..ed37acb 100644
--- a/dlls/shell32/shell32_main.c
+++ b/dlls/shell32/shell32_main.c
@@ -27,6 +27,9 @@
 
 #include "shlguid.h"
 
+DECLARE_DEBUG_CHANNEL(exec)
+DECLARE_DEBUG_CHANNEL(shell)
+
 /*************************************************************************
  * CommandLineToArgvW			[SHELL32.7]
  */
diff --git a/dlls/shell32/shelllink.c b/dlls/shell32/shelllink.c
index 82da3fb..6b8af51 100644
--- a/dlls/shell32/shelllink.c
+++ b/dlls/shell32/shelllink.c
@@ -19,6 +19,8 @@
 #include "shell32_main.h"
 #include "shlguid.h"
 
+DEFAULT_DEBUG_CHANNEL(shell)
+
 /* link file formats */
 
 #pragma (1);
diff --git a/dlls/shell32/shellole.c b/dlls/shell32/shellole.c
index 07585f6..cdcea4a 100644
--- a/dlls/shell32/shellole.c
+++ b/dlls/shell32/shellole.c
@@ -25,6 +25,8 @@
 
 #include "shell32_main.h"
 
+DEFAULT_DEBUG_CHANNEL(shell)
+
 /*************************************************************************
  *
  */
diff --git a/dlls/shell32/shellord.c b/dlls/shell32/shellord.c
index 956f367..3192d55 100644
--- a/dlls/shell32/shellord.c
+++ b/dlls/shell32/shellord.c
@@ -16,6 +16,8 @@
 #include "shlobj.h"
 #include "shell32_main.h"
 
+DEFAULT_DEBUG_CHANNEL(shell)
+
 /*************************************************************************
  * SHChangeNotifyRegister			[SHELL32.2]
  *
diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c
index d0bba2e..db4248a 100644
--- a/dlls/shell32/shellpath.c
+++ b/dlls/shell32/shellpath.c
@@ -13,6 +13,8 @@
 #include "shlobj.h"
 #include "shell32_main.h"
 
+DEFAULT_DEBUG_CHANNEL(shell)
+
 /*************************************************************************
  * PathIsRoot [SHELL32.29]
  */
diff --git a/dlls/shell32/shlfolder.c b/dlls/shell32/shlfolder.c
index 250366d..e484f8e 100644
--- a/dlls/shell32/shlfolder.c
+++ b/dlls/shell32/shlfolder.c
@@ -21,6 +21,8 @@
 #include "wine/obj_shellfolder.h"
 #include "shell32_main.h"
 
+DEFAULT_DEBUG_CHANNEL(shell)
+
 /***************************************************************************
  * IDropTarget interface definition for the ShellFolder
  */
diff --git a/dlls/shell32/shlmenu.c b/dlls/shell32/shlmenu.c
index 35077e5..ce64400 100644
--- a/dlls/shell32/shlmenu.c
+++ b/dlls/shell32/shlmenu.c
@@ -14,6 +14,8 @@
 
 #include "pidl.h"
 
+DEFAULT_DEBUG_CHANNEL(shell)
+
 BOOL WINAPI FileMenu_DeleteAllItems (HMENU hMenu);
 
 /*************************************************************************
diff --git a/dlls/shell32/shlview.c b/dlls/shell32/shlview.c
index b1f03ae..e5fe7b7 100644
--- a/dlls/shell32/shlview.c
+++ b/dlls/shell32/shlview.c
@@ -29,6 +29,8 @@
 #include "pidl.h"
 #include "shell32_main.h"
 
+DEFAULT_DEBUG_CHANNEL(shell)
+
 typedef struct 
 {	ICOM_VTABLE(IShellView)* lpvtbl;
 	DWORD		ref;
diff --git a/dlls/tapi32/assisted.c b/dlls/tapi32/assisted.c
index dd7d8d2..07cf8e1 100644
--- a/dlls/tapi32/assisted.c
+++ b/dlls/tapi32/assisted.c
@@ -9,6 +9,8 @@
 #include "tapi.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(tapi)
+
 DWORD WINAPI tapiGetLocationInfo(LPSTR lpszCountryCode, LPSTR lpszCityCode)
 {
     char temp[30];
diff --git a/dlls/tapi32/line.c b/dlls/tapi32/line.c
index fd6d4b8..c2785a2 100644
--- a/dlls/tapi32/line.c
+++ b/dlls/tapi32/line.c
@@ -12,6 +12,9 @@
 #include "tapi.h"
 #include "debug.h"
 
+DECLARE_DEBUG_CHANNEL(comm)
+DECLARE_DEBUG_CHANNEL(tapi)
+
 DWORD WINAPI lineAccept(HCALL hCall, LPCSTR lpsUserUserInfo, DWORD dwSize)
 {
     FIXME(tapi, "(%04x, %s, %ld): stub.\n", hCall, lpsUserUserInfo, dwSize);
diff --git a/dlls/tapi32/phone.c b/dlls/tapi32/phone.c
index 7d17b46..9333933 100644
--- a/dlls/tapi32/phone.c
+++ b/dlls/tapi32/phone.c
@@ -9,6 +9,8 @@
 #include "tapi.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(tapi)
+
 static LPPHONE PHONE_Alloc(void)
 {
     return 0;
diff --git a/dlls/ver/ver16.c b/dlls/ver/ver16.c
index 25d7689..df4de96 100644
--- a/dlls/ver/ver16.c
+++ b/dlls/ver/ver16.c
@@ -10,6 +10,8 @@
 #include "ver.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(ver)
+
 
 /*************************************************************************
  * GetFileResourceSize16                     [VER.2]
diff --git a/dlls/version/info.c b/dlls/version/info.c
index f28c0c9..5f23b9a 100644
--- a/dlls/version/info.c
+++ b/dlls/version/info.c
@@ -17,6 +17,8 @@
 #include "ver.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(ver)
+
 
 /******************************************************************************
  *
diff --git a/dlls/version/install.c b/dlls/version/install.c
index fbbe844..1cceb31 100644
--- a/dlls/version/install.c
+++ b/dlls/version/install.c
@@ -18,6 +18,8 @@
 #include "xmalloc.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(ver)
+
 
 /******************************************************************************
  *
diff --git a/dlls/version/resource.c b/dlls/version/resource.c
index 13cfb90..fb242d0 100644
--- a/dlls/version/resource.c
+++ b/dlls/version/resource.c
@@ -19,6 +19,8 @@
 #include "peexe.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(ver)
+
 
 /***********************************************************************
  *           read_xx_header         [internal]
diff --git a/dlls/winaspi/winaspi16.c b/dlls/winaspi/winaspi16.c
index e5052af..0c670eb 100644
--- a/dlls/winaspi/winaspi16.c
+++ b/dlls/winaspi/winaspi16.c
@@ -17,6 +17,8 @@
 #include "selectors.h"
 #include "miscemu.h"
 
+DEFAULT_DEBUG_CHANNEL(aspi)
+
 
 /* FIXME!
  * 1) Residual byte length reporting not handled
diff --git a/dlls/wnaspi32/winaspi32.c b/dlls/wnaspi32/winaspi32.c
index 754a117..d2e870b 100644
--- a/dlls/wnaspi32/winaspi32.c
+++ b/dlls/wnaspi32/winaspi32.c
@@ -15,6 +15,8 @@
 #include "heap.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(aspi)
+
 
 /* FIXME!
  * 1) Residual byte length reporting not handled
diff --git a/files/directory.c b/files/directory.c
index 7997363..aa6926e 100644
--- a/files/directory.c
+++ b/files/directory.c
@@ -25,6 +25,9 @@
 #include "options.h"
 #include "debug.h"
 
+DECLARE_DEBUG_CHANNEL(dosfs)
+DECLARE_DEBUG_CHANNEL(file)
+
 static DOS_FULL_NAME DIR_Windows;
 static DOS_FULL_NAME DIR_System;
 
diff --git a/files/dos_fs.c b/files/dos_fs.c
index 330ac4d..3e5a281 100644
--- a/files/dos_fs.c
+++ b/files/dos_fs.c
@@ -33,6 +33,9 @@
 #include "options.h"
 #include "debug.h"
 
+DECLARE_DEBUG_CHANNEL(dosfs)
+DECLARE_DEBUG_CHANNEL(file)
+
 /* Define the VFAT ioctl to get both short and long file names */
 /* FIXME: is it possible to get this to work on other systems? */
 #ifdef linux
diff --git a/files/drive.c b/files/drive.c
index 78806f4..93c2c1d 100644
--- a/files/drive.c
+++ b/files/drive.c
@@ -44,6 +44,9 @@
 #include "task.h"
 #include "debug.h"
 
+DECLARE_DEBUG_CHANNEL(dosfs)
+DECLARE_DEBUG_CHANNEL(file)
+
 typedef struct
 {
     char     *root;      /* root dir in Unix format without trailing / */
diff --git a/files/file.c b/files/file.c
index f9851dd..91b8da8 100644
--- a/files/file.c
+++ b/files/file.c
@@ -46,6 +46,8 @@
 #include "server/request.h"
 #include "server.h"
 
+DEFAULT_DEBUG_CHANNEL(file)
+
 #if defined(MAP_ANONYMOUS) && !defined(MAP_ANON)
 #define MAP_ANON MAP_ANONYMOUS
 #endif
diff --git a/files/profile.c b/files/profile.c
index 0bceb87..2f357bf 100644
--- a/files/profile.c
+++ b/files/profile.c
@@ -19,6 +19,8 @@
 #include "debug.h"
 #include "options.h"
 
+DEFAULT_DEBUG_CHANNEL(profile)
+
 typedef struct tagPROFILEKEY
 {
     char                  *name;
diff --git a/graphics/bitblt.c b/graphics/bitblt.c
index a775bdd..552f181 100644
--- a/graphics/bitblt.c
+++ b/graphics/bitblt.c
@@ -7,6 +7,10 @@
 #include "dc.h"
 #include "debug.h"
 
+DECLARE_DEBUG_CHANNEL(bitblt)
+DECLARE_DEBUG_CHANNEL(bitmap)
+DECLARE_DEBUG_CHANNEL(gdi)
+
 
 /***********************************************************************
  *           PatBlt16    (GDI.29)
diff --git a/graphics/d3dcommon.c b/graphics/d3dcommon.c
index 5a31652..1c68872 100644
--- a/graphics/d3dcommon.c
+++ b/graphics/d3dcommon.c
@@ -12,6 +12,8 @@
 
 #include "d3d_private.h"
 
+DEFAULT_DEBUG_CHANNEL(ddraw)
+
 #ifdef HAVE_MESAGL
 
 static void _dump_renderstate(D3DRENDERSTATETYPE type,
diff --git a/graphics/d3ddevices.c b/graphics/d3ddevices.c
index 8ab7d53..5dc3071 100644
--- a/graphics/d3ddevices.c
+++ b/graphics/d3ddevices.c
@@ -16,6 +16,8 @@
 
 #include "d3d_private.h"
 
+DEFAULT_DEBUG_CHANNEL(ddraw)
+
 /* Define this variable if you have an unpatched Mesa 3.0 (patches are available
    on Mesa's home page) or version 3.1b.
 
diff --git a/graphics/d3dexecutebuffer.c b/graphics/d3dexecutebuffer.c
index 4539ec1..f24a552 100644
--- a/graphics/d3dexecutebuffer.c
+++ b/graphics/d3dexecutebuffer.c
@@ -16,6 +16,8 @@
 
 #include "d3d_private.h"
 
+DEFAULT_DEBUG_CHANNEL(ddraw)
+
 #ifdef HAVE_MESAGL
 
 /* Structure to store the 'semi transformed' vertices */
diff --git a/graphics/d3dlight.c b/graphics/d3dlight.c
index ae9b3a0..4455e53 100644
--- a/graphics/d3dlight.c
+++ b/graphics/d3dlight.c
@@ -15,6 +15,8 @@
 
 #include "d3d_private.h"
 
+DEFAULT_DEBUG_CHANNEL(ddraw)
+
 #ifdef HAVE_MESAGL
 
 static ICOM_VTABLE(IDirect3DLight) light_vtable;
diff --git a/graphics/d3dmaterial.c b/graphics/d3dmaterial.c
index b25f4b6..86fd96b 100644
--- a/graphics/d3dmaterial.c
+++ b/graphics/d3dmaterial.c
@@ -14,6 +14,8 @@
 
 #include "d3d_private.h"
 
+DEFAULT_DEBUG_CHANNEL(ddraw)
+
 #ifdef HAVE_MESAGL
 
 static ICOM_VTABLE(IDirect3DMaterial2) material2_vtable;
diff --git a/graphics/d3dtexture.c b/graphics/d3dtexture.c
index 5f4fea0..b961b59 100644
--- a/graphics/d3dtexture.c
+++ b/graphics/d3dtexture.c
@@ -16,6 +16,8 @@
 
 #include "d3d_private.h"
 
+DEFAULT_DEBUG_CHANNEL(ddraw)
+
 #ifdef HAVE_MESAGL
 
 /* Define this if you want to save to a file all the textures used by a game
diff --git a/graphics/d3dviewport.c b/graphics/d3dviewport.c
index b7f1d3c..aabfccf 100644
--- a/graphics/d3dviewport.c
+++ b/graphics/d3dviewport.c
@@ -14,6 +14,8 @@
 
 #include "d3d_private.h"
 
+DEFAULT_DEBUG_CHANNEL(ddraw)
+
 
 #ifdef HAVE_MESAGL
 
diff --git a/graphics/ddraw.c b/graphics/ddraw.c
index 1450a3a..f37fd94 100644
--- a/graphics/ddraw.c
+++ b/graphics/ddraw.c
@@ -67,6 +67,8 @@
 #include "ddraw_private.h"
 #include "d3d_private.h"
 
+DEFAULT_DEBUG_CHANNEL(ddraw)
+
 /* define this if you want to play Diablo using XF86DGA. (bug workaround) */
 #undef DIABLO_HACK
 
diff --git a/graphics/dispdib.c b/graphics/dispdib.c
index f382073..2b741b8 100644
--- a/graphics/dispdib.c
+++ b/graphics/dispdib.c
@@ -11,6 +11,8 @@
 #include "vga.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(ddraw)
+
 static int dispdib_multi = 0;
 
 static WORD DISPDIB_Begin(WORD wFlags)
diff --git a/graphics/driver.c b/graphics/driver.c
index aeddb96..9fc239b 100644
--- a/graphics/driver.c
+++ b/graphics/driver.c
@@ -7,6 +7,8 @@
 #include "gdi.h"
 #include "heap.h"
 #include "debug.h"
+
+DEFAULT_DEBUG_CHANNEL(driver)
 #include <string.h>
 
 typedef struct tagGRAPHICS_DRIVER
diff --git a/graphics/env.c b/graphics/env.c
index d788f7e..024721a 100644
--- a/graphics/env.c
+++ b/graphics/env.c
@@ -13,6 +13,8 @@
 #include "debug.h"
 #include "heap.h"
 
+DEFAULT_DEBUG_CHANNEL(gdi)
+
 typedef struct {
         ATOM atom;
 	HGLOBAL16 handle;
diff --git a/graphics/escape.c b/graphics/escape.c
index f1f952f..613e0b1 100644
--- a/graphics/escape.c
+++ b/graphics/escape.c
@@ -12,6 +12,9 @@
 #include "dc.h"
 #include <debug.h>
 
+DECLARE_DEBUG_CHANNEL(driver)
+DECLARE_DEBUG_CHANNEL(gdi)
+
 
 INT16 WINAPI Escape16( HDC16 hdc, INT16 nEscape, INT16 cbInput,
                        SEGPTR lpszInData, SEGPTR lpvOutData )
diff --git a/graphics/fontengine.c b/graphics/fontengine.c
index 9b672dc..1698383 100644
--- a/graphics/fontengine.c
+++ b/graphics/fontengine.c
@@ -12,6 +12,8 @@
 #include "font.h"
 #include "debug.h"     
 
+DEFAULT_DEBUG_CHANNEL(font)
+
 
 
 /* **************************************************************** 
diff --git a/graphics/mapping.c b/graphics/mapping.c
index ee9a090..15b6160 100644
--- a/graphics/mapping.c
+++ b/graphics/mapping.c
@@ -7,6 +7,8 @@
 #include "dc.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(gdi)
+
 
 /***********************************************************************
  *           MAPPING_FixIsotropic
diff --git a/graphics/metafiledrv/bitblt.c b/graphics/metafiledrv/bitblt.c
index bceef25..f4c0347 100644
--- a/graphics/metafiledrv/bitblt.c
+++ b/graphics/metafiledrv/bitblt.c
@@ -9,6 +9,8 @@
 #include "heap.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(metafile)
+
 /***********************************************************************
  *           MFDRV_PatBlt
  */
diff --git a/graphics/metafiledrv/graphics.c b/graphics/metafiledrv/graphics.c
index d744bc4..85f8ddb 100644
--- a/graphics/metafiledrv/graphics.c
+++ b/graphics/metafiledrv/graphics.c
@@ -13,6 +13,8 @@
 #include "heap.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(metafile)
+
 /**********************************************************************
  *	     MFDRV_MoveToEx
  */
diff --git a/graphics/metafiledrv/init.c b/graphics/metafiledrv/init.c
index de9c932..1d89419 100644
--- a/graphics/metafiledrv/init.c
+++ b/graphics/metafiledrv/init.c
@@ -13,6 +13,8 @@
 #include "metafiledrv.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(metafile)
+
 #include <string.h>
 
 static const DC_FUNCTIONS MFDRV_Funcs =
diff --git a/graphics/metafiledrv/objects.c b/graphics/metafiledrv/objects.c
index d64c02e..7d8f103 100644
--- a/graphics/metafiledrv/objects.c
+++ b/graphics/metafiledrv/objects.c
@@ -14,6 +14,9 @@
 #include "debug.h"
 #include "heap.h"
 
+DECLARE_DEBUG_CHANNEL(gdi)
+DECLARE_DEBUG_CHANNEL(metafile)
+
 /***********************************************************************
  *           MFDRV_BITMAP_SelectObject
  */
diff --git a/graphics/metafiledrv/text.c b/graphics/metafiledrv/text.c
index 2f155dd..943b190 100644
--- a/graphics/metafiledrv/text.c
+++ b/graphics/metafiledrv/text.c
@@ -10,6 +10,8 @@
 #include "debug.h"
 #include "heap.h"
 
+DEFAULT_DEBUG_CHANNEL(metafile)
+
 
 /******************************************************************
  *         MFDRV_MetaExtTextOut
diff --git a/graphics/painting.c b/graphics/painting.c
index 310d93b..858ab37 100644
--- a/graphics/painting.c
+++ b/graphics/painting.c
@@ -18,6 +18,8 @@
 #include "winuser.h"
 #include "wine/winuser16.h"
 
+DEFAULT_DEBUG_CHANNEL(gdi)
+
 
 /***********************************************************************
  *           LineTo16    (GDI.19)
diff --git a/graphics/path.c b/graphics/path.c
index 49b049c..b10b464 100644
--- a/graphics/path.c
+++ b/graphics/path.c
@@ -21,6 +21,8 @@
 #include "debug.h"
 #include "path.h"
 
+DEFAULT_DEBUG_CHANNEL(gdi)
+
 /* Notes on the implementation
  *
  * The implementation is based on dynamically resizable arrays of points and
diff --git a/graphics/psdrv/afm.c b/graphics/psdrv/afm.c
index 4edbf49..96d76ef 100644
--- a/graphics/psdrv/afm.c
+++ b/graphics/psdrv/afm.c
@@ -12,6 +12,8 @@
 #include "options.h"
 #include "debug.h"
 #include "heap.h"
+
+DEFAULT_DEBUG_CHANNEL(psdrv)
 #include <ctype.h>
 
 /* ptr to fonts for which we have afm files */
diff --git a/graphics/psdrv/bitmap.c b/graphics/psdrv/bitmap.c
index 450d72a..e083af4 100644
--- a/graphics/psdrv/bitmap.c
+++ b/graphics/psdrv/bitmap.c
@@ -11,6 +11,8 @@
 #include "bitmap.h"
 #include "winbase.h"
 
+DEFAULT_DEBUG_CHANNEL(psdrv)
+
 
 /***************************************************************************
  *                PSDRV_WriteImageHeader
diff --git a/graphics/psdrv/brush.c b/graphics/psdrv/brush.c
index 58c1647..69dbb03 100644
--- a/graphics/psdrv/brush.c
+++ b/graphics/psdrv/brush.c
@@ -10,6 +10,8 @@
 #include "debug.h"
 #include "gdi.h"
 
+DEFAULT_DEBUG_CHANNEL(psdrv)
+
 /***********************************************************************
  *           PSDRV_BRUSH_SelectObject
  */
diff --git a/graphics/psdrv/color.c b/graphics/psdrv/color.c
index 79b7e58..a5a56e5 100644
--- a/graphics/psdrv/color.c
+++ b/graphics/psdrv/color.c
@@ -8,6 +8,8 @@
 #include "psdrv.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(psdrv)
+
 /**********************************************************************
  *	     PSDRV_CmpColor
  *
diff --git a/graphics/psdrv/driver.c b/graphics/psdrv/driver.c
index bb8a7e7..ca4f755 100644
--- a/graphics/psdrv/driver.c
+++ b/graphics/psdrv/driver.c
@@ -16,6 +16,8 @@
 #include "winuser.h"
 #include "winspool.h"
 
+DEFAULT_DEBUG_CHANNEL(psdrv)
+
 static LONG Resolutions[][2] = { {600,600} };
 
 
diff --git a/graphics/psdrv/escape.c b/graphics/psdrv/escape.c
index ebe97e3..9ae28cc 100644
--- a/graphics/psdrv/escape.c
+++ b/graphics/psdrv/escape.c
@@ -8,6 +8,8 @@
 #include "debug.h"
 #include "winspool.h"
 
+DEFAULT_DEBUG_CHANNEL(psdrv)
+
 
 INT PSDRV_Escape( DC *dc, INT nEscape, INT cbInput, 
                               SEGPTR lpInData, SEGPTR lpOutData )
diff --git a/graphics/psdrv/font.c b/graphics/psdrv/font.c
index d0e21c6..2bb614d 100644
--- a/graphics/psdrv/font.c
+++ b/graphics/psdrv/font.c
@@ -9,6 +9,8 @@
 #include "psdrv.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(psdrv)
+
 
 
 /***********************************************************************
diff --git a/graphics/psdrv/graphics.c b/graphics/psdrv/graphics.c
index a7f970e..9177977 100644
--- a/graphics/psdrv/graphics.c
+++ b/graphics/psdrv/graphics.c
@@ -17,6 +17,8 @@
 #include "debug.h"
 #include "winspool.h"
 
+DEFAULT_DEBUG_CHANNEL(psdrv)
+
 /**********************************************************************
  *	     PSDRV_MoveToEx
  */
diff --git a/graphics/psdrv/init.c b/graphics/psdrv/init.c
index b12ff68..da202cd 100644
--- a/graphics/psdrv/init.c
+++ b/graphics/psdrv/init.c
@@ -14,6 +14,8 @@
 #include "winspool.h"
 #include "winerror.h"
 
+DEFAULT_DEBUG_CHANNEL(psdrv)
+
 static BOOL PSDRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
                                LPCSTR output, const DEVMODE16* initData );
 static BOOL PSDRV_DeleteDC( DC *dc );
diff --git a/graphics/psdrv/objects.c b/graphics/psdrv/objects.c
index 143caae..81e1095 100644
--- a/graphics/psdrv/objects.c
+++ b/graphics/psdrv/objects.c
@@ -12,6 +12,8 @@
 #include "bitmap.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(psdrv)
+
 /***********************************************************************
  *           PSDRV_BITMAP_SelectObject
  */
diff --git a/graphics/psdrv/pen.c b/graphics/psdrv/pen.c
index c10ac33..78c83f7 100644
--- a/graphics/psdrv/pen.c
+++ b/graphics/psdrv/pen.c
@@ -9,6 +9,8 @@
 #include "psdrv.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(psdrv)
+
 static char PEN_dash[]       = "50 30";     /* -----   -----   -----  */
 static char PEN_dot[]        = "20";      /* --  --  --  --  --  -- */
 static char PEN_dashdot[]    = "40 30 20 30";  /* ----   --   ----   --  */
diff --git a/graphics/psdrv/ppd.c b/graphics/psdrv/ppd.c
index 84ce9e5..213babe 100644
--- a/graphics/psdrv/ppd.c
+++ b/graphics/psdrv/ppd.c
@@ -13,6 +13,8 @@
 #include "psdrv.h"
 #include "winspool.h"
 
+DEFAULT_DEBUG_CHANNEL(psdrv)
+
 typedef struct {
 char	*key;
 char	*option;
diff --git a/graphics/psdrv/ps.c b/graphics/psdrv/ps.c
index 3b1bd80..6a2822f 100644
--- a/graphics/psdrv/ps.c
+++ b/graphics/psdrv/ps.c
@@ -11,6 +11,8 @@
 #include "winspool.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(psdrv)
+
 static char psheader[] = /* title llx lly urx ury orientation */
 "%%!PS-Adobe-3.0\n"
 "%%%%Creator: Wine PostScript Driver\n"
diff --git a/graphics/psdrv/text.c b/graphics/psdrv/text.c
index 79410ad..411930e 100644
--- a/graphics/psdrv/text.c
+++ b/graphics/psdrv/text.c
@@ -9,6 +9,8 @@
 #include "debug.h"
 #include "winspool.h"
 
+DEFAULT_DEBUG_CHANNEL(psdrv)
+
 /***********************************************************************
  *           PSDRV_ExtTextOut
  */
diff --git a/graphics/ttydrv/init.c b/graphics/ttydrv/init.c
index ce8c082..295667f 100644
--- a/graphics/ttydrv/init.c
+++ b/graphics/ttydrv/init.c
@@ -13,6 +13,8 @@
 #include "palette.h"
 #include "ttydrv.h"
 
+DEFAULT_DEBUG_CHANNEL(ttydrv)
+
 static const DC_FUNCTIONS TTYDRV_DC_Driver =
 {
   NULL,                /* pArc */
diff --git a/graphics/vga.c b/graphics/vga.c
index fef9469..bb212c3 100644
--- a/graphics/vga.c
+++ b/graphics/vga.c
@@ -14,6 +14,8 @@
 #include "ddraw.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(ddraw)
+
 static IDirectDraw *lpddraw = NULL;
 static IDirectDrawSurface *lpddsurf;
 static IDirectDrawPalette *lpddpal;
diff --git a/graphics/win16drv/brush.c b/graphics/win16drv/brush.c
index b6650d5..2adce14 100644
--- a/graphics/win16drv/brush.c
+++ b/graphics/win16drv/brush.c
@@ -10,6 +10,8 @@
 #include "heap.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(win16drv)
+
 HBRUSH WIN16DRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush,
                                       BRUSHOBJ * brush )
 {
diff --git a/graphics/win16drv/font.c b/graphics/win16drv/font.c
index 2996ac5..c3f0722 100644
--- a/graphics/win16drv/font.c
+++ b/graphics/win16drv/font.c
@@ -13,6 +13,8 @@
 #include "heap.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(win16drv)
+
 
 /***********************************************************************
  *           WIN16DRV_GetTextExtentPoint
diff --git a/graphics/win16drv/graphics.c b/graphics/win16drv/graphics.c
index 4546dce..530a3cb 100644
--- a/graphics/win16drv/graphics.c
+++ b/graphics/win16drv/graphics.c
@@ -9,6 +9,8 @@
 #include "win16drv.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(win16drv)
+
 /**********************************************************************
  *	     WIN16DRV_MoveToEx
  */
diff --git a/graphics/win16drv/init.c b/graphics/win16drv/init.c
index f8f9b7e..77a947d 100644
--- a/graphics/win16drv/init.c
+++ b/graphics/win16drv/init.c
@@ -17,6 +17,8 @@
 #include "debug.h"
 #include "dc.h"
 
+DEFAULT_DEBUG_CHANNEL(win16drv)
+
 #define SUPPORT_REALIZED_FONTS 1
 #pragma pack(1)
 typedef struct
diff --git a/graphics/win16drv/objects.c b/graphics/win16drv/objects.c
index 564da70..ad6d823 100644
--- a/graphics/win16drv/objects.c
+++ b/graphics/win16drv/objects.c
@@ -12,6 +12,8 @@
 #include "pen.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(gdi)
+
 
 extern HBITMAP WIN16DRV_BITMAP_SelectObject( DC * dc, HBITMAP hbitmap,
                                              BITMAPOBJ * bmp );
diff --git a/graphics/win16drv/pen.c b/graphics/win16drv/pen.c
index e222a03..00cadcc 100644
--- a/graphics/win16drv/pen.c
+++ b/graphics/win16drv/pen.c
@@ -9,6 +9,8 @@
 #include "heap.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(win16drv)
+
 /***********************************************************************
  *           PEN_SelectObject
  */
diff --git a/graphics/win16drv/prtdrv.c b/graphics/win16drv/prtdrv.c
index 15315e3..efa4e8b 100644
--- a/graphics/win16drv/prtdrv.c
+++ b/graphics/win16drv/prtdrv.c
@@ -19,6 +19,8 @@
 #include "bitmap.h"
 #include "pen.h"
 
+DEFAULT_DEBUG_CHANNEL(win16drv)
+
 #define MAX_PRINTER_DRIVERS 	16
 static LOADED_PRINTER_DRIVER *gapLoadedPrinterDrivers[MAX_PRINTER_DRIVERS];
 
diff --git a/graphics/win16drv/text.c b/graphics/win16drv/text.c
index 76ea034..580a152 100644
--- a/graphics/win16drv/text.c
+++ b/graphics/win16drv/text.c
@@ -11,6 +11,8 @@
 #include "gdi.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(win16drv)
+
 /***********************************************************************
  *           WIN16DRV_ExtTextOut
  */
diff --git a/graphics/wing.c b/graphics/wing.c
index fd30439..21d468e 100644
--- a/graphics/wing.c
+++ b/graphics/wing.c
@@ -19,6 +19,8 @@
 #include "windef.h"
 #include "wine/winuser16.h"
 
+DEFAULT_DEBUG_CHANNEL(wing)
+
 
 typedef enum WING_DITHER_TYPE
 {
diff --git a/graphics/x11drv/bitblt.c b/graphics/x11drv/bitblt.c
index f3bc765..565f1d7 100644
--- a/graphics/x11drv/bitblt.c
+++ b/graphics/x11drv/bitblt.c
@@ -24,6 +24,8 @@
 #include "debug.h"
 #include "xmalloc.h" /* for XCREATEIMAGE macro */
 
+DEFAULT_DEBUG_CHANNEL(bitblt)
+
 
 #define DST 0   /* Destination drawable */
 #define SRC 1   /* Source drawable */
diff --git a/graphics/x11drv/bitmap.c b/graphics/x11drv/bitmap.c
index 1820aa2..9fd6cb5 100644
--- a/graphics/x11drv/bitmap.c
+++ b/graphics/x11drv/bitmap.c
@@ -25,6 +25,8 @@
 #include "x11drv.h"
 #include "wine/winuser16.h"
 
+DEFAULT_DEBUG_CHANNEL(x11drv)
+
   /* GCs used for B&W and color bitmap operations */
 GC BITMAP_monoGC = 0, BITMAP_colorGC = 0;
 
diff --git a/graphics/x11drv/brush.c b/graphics/x11drv/brush.c
index cb564d7..95f406d 100644
--- a/graphics/x11drv/brush.c
+++ b/graphics/x11drv/brush.c
@@ -20,6 +20,8 @@
 #include "monitor.h"
 #include "local.h"
 
+DEFAULT_DEBUG_CHANNEL(gdi)
+
 static const char HatchBrushes[NB_HATCH_STYLES + 1][8] =
 {
     { 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00 }, /* HS_HORIZONTAL */
diff --git a/graphics/x11drv/clipping.c b/graphics/x11drv/clipping.c
index 0827a35..04a7028 100644
--- a/graphics/x11drv/clipping.c
+++ b/graphics/x11drv/clipping.c
@@ -18,6 +18,8 @@
 #include "heap.h"
 #include "local.h"
 
+DEFAULT_DEBUG_CHANNEL(x11drv)
+
 /***********************************************************************
  *           X11DRV_SetDeviceClipping
  *           Copy RECT32s to a temporary buffer of XRectangles and call
diff --git a/graphics/x11drv/dib.c b/graphics/x11drv/dib.c
index 5cd93ea..040e05c 100644
--- a/graphics/x11drv/dib.c
+++ b/graphics/x11drv/dib.c
@@ -22,6 +22,9 @@
 #include "global.h"
 #include "xmalloc.h" /* for XCREATEIMAGE macro */
 
+DECLARE_DEBUG_CHANNEL(bitmap)
+DECLARE_DEBUG_CHANNEL(x11drv)
+
 static int bitmapDepthTable[] = { 8, 1, 32, 16, 24, 15, 4, 0 };
 static int ximageDepthTable[] = { 0, 0, 0,  0,  0,  0,  0 };
 
diff --git a/graphics/x11drv/graphics.c b/graphics/x11drv/graphics.c
index 4c687cc..3ed747f 100644
--- a/graphics/x11drv/graphics.c
+++ b/graphics/x11drv/graphics.c
@@ -43,6 +43,8 @@
 #include "debug.h"
 #include "xmalloc.h"
 
+DEFAULT_DEBUG_CHANNEL(graphics)
+
 #define ABS(x)    ((x)<0?(-(x)):(x))
 
   /* ROP code to GC function conversion */
diff --git a/graphics/x11drv/init.c b/graphics/x11drv/init.c
index ac34bfc..a2eadf9 100644
--- a/graphics/x11drv/init.c
+++ b/graphics/x11drv/init.c
@@ -21,6 +21,8 @@
 #include "winnt.h"
 #include "x11drv.h"
 
+DEFAULT_DEBUG_CHANNEL(x11drv)
+
 static BOOL X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
                                LPCSTR output, const DEVMODE16* initData );
 static BOOL X11DRV_DeleteDC( DC *dc );
diff --git a/graphics/x11drv/objects.c b/graphics/x11drv/objects.c
index 627557f..add1de9 100644
--- a/graphics/x11drv/objects.c
+++ b/graphics/x11drv/objects.c
@@ -17,6 +17,8 @@
 #include "local.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(gdi)
+
 
 extern HBITMAP X11DRV_BITMAP_SelectObject( DC * dc, HBITMAP hbitmap,
                                              BITMAPOBJ * bmp );
diff --git a/graphics/x11drv/oembitmap.c b/graphics/x11drv/oembitmap.c
index d809515..0df3d71 100644
--- a/graphics/x11drv/oembitmap.c
+++ b/graphics/x11drv/oembitmap.c
@@ -80,6 +80,10 @@
 #include "bitmaps/obm_restore_95"
 #include "bitmaps/obm_restored_95"
 
+DECLARE_DEBUG_CHANNEL(bitmap)
+DECLARE_DEBUG_CHANNEL(cursor)
+DECLARE_DEBUG_CHANNEL(x11drv)
+
 
 #define OBM_FIRST  OBM_CLOSED  /* First OEM bitmap */
 #define OBM_LAST   OBM_OLD_CLOSE   /* Last OEM bitmap */
diff --git a/graphics/x11drv/palette.c b/graphics/x11drv/palette.c
index 7ae90dc..571c22d 100644
--- a/graphics/x11drv/palette.c
+++ b/graphics/x11drv/palette.c
@@ -24,6 +24,8 @@
 #include "xmalloc.h"
 #include "x11drv.h"
 
+DEFAULT_DEBUG_CHANNEL(palette)
+
 /* Palette indexed mode:
  *	logical palette -> mapping -> pixel
  *				     
diff --git a/graphics/x11drv/text.c b/graphics/x11drv/text.c
index 9120fcc..ca6bf18 100644
--- a/graphics/x11drv/text.c
+++ b/graphics/x11drv/text.c
@@ -20,6 +20,8 @@
 #include "x11font.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(text)
+
 #define SWAP_INT(a,b)  { int t = a; a = b; b = t; }
 #define IROUND(x) (int)((x)>0? (x)+0.5 : (x) - 0.5)
 
diff --git a/graphics/x11drv/xfont.c b/graphics/x11drv/xfont.c
index 36d05b8..677dc62 100644
--- a/graphics/x11drv/xfont.c
+++ b/graphics/x11drv/xfont.c
@@ -33,6 +33,8 @@
 #include "debug.h"
 #include "ldt.h"
 
+DEFAULT_DEBUG_CHANNEL(font)
+
 #ifndef X_DISPLAY_MISSING
 
 #define X_PFONT_MAGIC		(0xFADE0000)
diff --git a/if1632/builtin.c b/if1632/builtin.c
index f66f150..b824e49 100644
--- a/if1632/builtin.c
+++ b/if1632/builtin.c
@@ -23,6 +23,8 @@
 #include "task.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(module)
+
 /* Built-in modules descriptors */
 /* Don't change these structures! (see tools/build.c) */
 
diff --git a/if1632/dummy.c b/if1632/dummy.c
index dd200d0..9fc3695 100644
--- a/if1632/dummy.c
+++ b/if1632/dummy.c
@@ -5,6 +5,8 @@
 #include "windef.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(relay)
+
 long WINAPI stub_GDI_379(HDC16 hdc) { FIXME(relay, "STARTPAGE: stub\n"); return 1; }
 long WINAPI stub_GDI_381(HDC16 hdc, SEGPTR proc) { FIXME(relay, "SETABORTPROC: stub\n"); return 1; }
 long WINAPI stub_GDI_382(void) { FIXME(relay, "ABORTPROC: stub\n"); return 1; }
diff --git a/if1632/relay.c b/if1632/relay.c
index afe9d2c..d854ec2 100644
--- a/if1632/relay.c
+++ b/if1632/relay.c
@@ -17,6 +17,8 @@
 #include "debug.h"
 #include "main.h"
 
+DEFAULT_DEBUG_CHANNEL(relay)
+
 
 /***********************************************************************
  *           RELAY_Init
diff --git a/if1632/snoop.c b/if1632/snoop.c
index 9c687c1..b172755 100644
--- a/if1632/snoop.c
+++ b/if1632/snoop.c
@@ -16,6 +16,8 @@
 #include "debugstr.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(snoop)
+
 #ifdef __i386__
 
 #pragma pack(1)
diff --git a/if1632/thunk.c b/if1632/thunk.c
index 89a1f3b..6665962 100644
--- a/if1632/thunk.c
+++ b/if1632/thunk.c
@@ -26,6 +26,10 @@
 #include "keyboard.h"
 #include "debug.h"
 
+DECLARE_DEBUG_CHANNEL(relay)
+DECLARE_DEBUG_CHANNEL(system)
+DECLARE_DEBUG_CHANNEL(thunk)
+
 
 /* List of the 16-bit callback functions. This list is used  */
 /* by the build program to generate the file if1632/callto16.S */
diff --git a/include/debug.h b/include/debug.h
index 6c9ae80..db1e55f 100644
--- a/include/debug.h
+++ b/include/debug.h
@@ -1,166 +1,2 @@
-/* Do not modify this file -- it is automatically generated! */
-
-#ifndef __WINE_DEBUGTOOLS_H
+#define OLD_DEBUG_MACROS
 #include "debugtools.h"
-#endif
-
-/* Definitions for channels identifiers */
-#define dbch_accel 0
-#define dbch_advapi 1
-#define dbch_animate 2
-#define dbch_aspi 3
-#define dbch_atom 4
-#define dbch_avifile 5
-#define dbch_bitblt 6
-#define dbch_bitmap 7
-#define dbch_caret 8
-#define dbch_cdaudio 9
-#define dbch_class 10
-#define dbch_clipboard 11
-#define dbch_clipping 12
-#define dbch_combo 13
-#define dbch_comboex 14
-#define dbch_comm 15
-#define dbch_commctrl 16
-#define dbch_commdlg 17
-#define dbch_console 18
-#define dbch_crtdll 19
-#define dbch_cursor 20
-#define dbch_datetime 21
-#define dbch_dc 22
-#define dbch_dde 23
-#define dbch_ddeml 24
-#define dbch_ddraw 25
-#define dbch_debug 26
-#define dbch_delayhlp 27
-#define dbch_dialog 28
-#define dbch_dinput 29
-#define dbch_dll 30
-#define dbch_dosfs 31
-#define dbch_dosmem 32
-#define dbch_dplay 33
-#define dbch_driver 34
-#define dbch_dsound 35
-#define dbch_edit 36
-#define dbch_event 37
-#define dbch_exec 38
-#define dbch_file 39
-#define dbch_fixup 40
-#define dbch_font 41
-#define dbch_gdi 42
-#define dbch_global 43
-#define dbch_graphics 44
-#define dbch_header 45
-#define dbch_heap 46
-#define dbch_hook 47
-#define dbch_hotkey 48
-#define dbch_icon 49
-#define dbch_imagehlp 50
-#define dbch_imagelist 51
-#define dbch_imm 52
-#define dbch_int 53
-#define dbch_int10 54
-#define dbch_int16 55
-#define dbch_int17 56
-#define dbch_int19 57
-#define dbch_int21 58
-#define dbch_int31 59
-#define dbch_io 60
-#define dbch_ipaddress 61
-#define dbch_key 62
-#define dbch_keyboard 63
-#define dbch_ldt 64
-#define dbch_listbox 65
-#define dbch_listview 66
-#define dbch_local 67
-#define dbch_mci 68
-#define dbch_mcianim 69
-#define dbch_mciavi 70
-#define dbch_mcimidi 71
-#define dbch_mciwave 72
-#define dbch_mdi 73
-#define dbch_menu 74
-#define dbch_message 75
-#define dbch_metafile 76
-#define dbch_midi 77
-#define dbch_mmaux 78
-#define dbch_mmio 79
-#define dbch_mmsys 80
-#define dbch_mmtime 81
-#define dbch_module 82
-#define dbch_monthcal 83
-#define dbch_mpr 84
-#define dbch_msacm 85
-#define dbch_msg 86
-#define dbch_msvideo 87
-#define dbch_nativefont 88
-#define dbch_nonclient 89
-#define dbch_ntdll 90
-#define dbch_ole 91
-#define dbch_pager 92
-#define dbch_palette 93
-#define dbch_pidl 94
-#define dbch_print 95
-#define dbch_process 96
-#define dbch_profile 97
-#define dbch_progress 98
-#define dbch_prop 99
-#define dbch_propsheet 100
-#define dbch_psapi 101
-#define dbch_psdrv 102
-#define dbch_ras 103
-#define dbch_rebar 104
-#define dbch_reg 105
-#define dbch_region 106
-#define dbch_relay 107
-#define dbch_resource 108
-#define dbch_scroll 109
-#define dbch_security 110
-#define dbch_segment 111
-#define dbch_selector 112
-#define dbch_sem 113
-#define dbch_sendmsg 114
-#define dbch_server 115
-#define dbch_shell 116
-#define dbch_shm 117
-#define dbch_snoop 118
-#define dbch_sound 119
-#define dbch_static 120
-#define dbch_statusbar 121
-#define dbch_stress 122
-#define dbch_string 123
-#define dbch_syscolor 124
-#define dbch_system 125
-#define dbch_tab 126
-#define dbch_tapi 127
-#define dbch_task 128
-#define dbch_text 129
-#define dbch_thread 130
-#define dbch_thunk 131
-#define dbch_timer 132
-#define dbch_toolbar 133
-#define dbch_toolhelp 134
-#define dbch_tooltips 135
-#define dbch_trackbar 136
-#define dbch_treeview 137
-#define dbch_ttydrv 138
-#define dbch_tweak 139
-#define dbch_unknown 140
-#define dbch_updown 141
-#define dbch_ver 142
-#define dbch_virtual 143
-#define dbch_vxd 144
-#define dbch_wave 145
-#define dbch_win 146
-#define dbch_win16drv 147
-#define dbch_win32 148
-#define dbch_wing 149
-#define dbch_winsock 150
-#define dbch_wnet 151
-#define dbch_x11 152
-#define dbch_x11drv 153
-/* Definitions for classes identifiers */
-#define dbcl_fixme 0
-#define dbcl_err 1
-#define dbcl_warn 2
-#define dbcl_trace 3
diff --git a/include/debugdefs.h b/include/debugdefs.h
index 6a240f4..021ea00 100644
--- a/include/debugdefs.h
+++ b/include/debugdefs.h
@@ -1,13 +1,171 @@
 /* Do not modify this file -- it is automatically generated! */
 
-#ifndef __WINE_DEBUGTOOLS_H
 #include "debugtools.h"
-#endif
+
+#define DEBUG_CLASS_COUNT __DBCL_COUNT
+
+#ifdef DEBUG_RUNTIME
+
+const char * const debug_cl_name[] = { "fixme", "err", "warn", "trace" };
+
+int dbch_accel = 0;
+int dbch_advapi = 1;
+int dbch_animate = 2;
+int dbch_aspi = 3;
+int dbch_atom = 4;
+int dbch_avifile = 5;
+int dbch_bitblt = 6;
+int dbch_bitmap = 7;
+int dbch_caret = 8;
+int dbch_cdaudio = 9;
+int dbch_class = 10;
+int dbch_clipboard = 11;
+int dbch_clipping = 12;
+int dbch_combo = 13;
+int dbch_comboex = 14;
+int dbch_comm = 15;
+int dbch_commctrl = 16;
+int dbch_commdlg = 17;
+int dbch_console = 18;
+int dbch_crtdll = 19;
+int dbch_cursor = 20;
+int dbch_datetime = 21;
+int dbch_dc = 22;
+int dbch_dde = 23;
+int dbch_ddeml = 24;
+int dbch_ddraw = 25;
+int dbch_debug = 26;
+int dbch_delayhlp = 27;
+int dbch_dialog = 28;
+int dbch_dinput = 29;
+int dbch_dll = 30;
+int dbch_dosfs = 31;
+int dbch_dosmem = 32;
+int dbch_dplay = 33;
+int dbch_driver = 34;
+int dbch_dsound = 35;
+int dbch_edit = 36;
+int dbch_elfdll = 37;
+int dbch_event = 38;
+int dbch_exec = 39;
+int dbch_file = 40;
+int dbch_fixup = 41;
+int dbch_font = 42;
+int dbch_gdi = 43;
+int dbch_global = 44;
+int dbch_graphics = 45;
+int dbch_header = 46;
+int dbch_heap = 47;
+int dbch_hook = 48;
+int dbch_hotkey = 49;
+int dbch_icon = 50;
+int dbch_imagehlp = 51;
+int dbch_imagelist = 52;
+int dbch_imm = 53;
+int dbch_int = 54;
+int dbch_int10 = 55;
+int dbch_int16 = 56;
+int dbch_int17 = 57;
+int dbch_int19 = 58;
+int dbch_int21 = 59;
+int dbch_int31 = 60;
+int dbch_io = 61;
+int dbch_ipaddress = 62;
+int dbch_key = 63;
+int dbch_keyboard = 64;
+int dbch_ldt = 65;
+int dbch_listbox = 66;
+int dbch_listview = 67;
+int dbch_local = 68;
+int dbch_mci = 69;
+int dbch_mcianim = 70;
+int dbch_mciavi = 71;
+int dbch_mcimidi = 72;
+int dbch_mciwave = 73;
+int dbch_mdi = 74;
+int dbch_menu = 75;
+int dbch_message = 76;
+int dbch_metafile = 77;
+int dbch_midi = 78;
+int dbch_mmaux = 79;
+int dbch_mmio = 80;
+int dbch_mmsys = 81;
+int dbch_mmtime = 82;
+int dbch_module = 83;
+int dbch_monthcal = 84;
+int dbch_mpr = 85;
+int dbch_msacm = 86;
+int dbch_msg = 87;
+int dbch_msvideo = 88;
+int dbch_nativefont = 89;
+int dbch_nonclient = 90;
+int dbch_ntdll = 91;
+int dbch_ole = 92;
+int dbch_pager = 93;
+int dbch_palette = 94;
+int dbch_pidl = 95;
+int dbch_print = 96;
+int dbch_process = 97;
+int dbch_profile = 98;
+int dbch_progress = 99;
+int dbch_prop = 100;
+int dbch_propsheet = 101;
+int dbch_psapi = 102;
+int dbch_psdrv = 103;
+int dbch_ras = 104;
+int dbch_rebar = 105;
+int dbch_reg = 106;
+int dbch_region = 107;
+int dbch_relay = 108;
+int dbch_resource = 109;
+int dbch_scroll = 110;
+int dbch_security = 111;
+int dbch_segment = 112;
+int dbch_selector = 113;
+int dbch_sem = 114;
+int dbch_sendmsg = 115;
+int dbch_server = 116;
+int dbch_shell = 117;
+int dbch_shm = 118;
+int dbch_snoop = 119;
+int dbch_sound = 120;
+int dbch_static = 121;
+int dbch_statusbar = 122;
+int dbch_stress = 123;
+int dbch_string = 124;
+int dbch_syscolor = 125;
+int dbch_system = 126;
+int dbch_tab = 127;
+int dbch_tapi = 128;
+int dbch_task = 129;
+int dbch_text = 130;
+int dbch_thread = 131;
+int dbch_thunk = 132;
+int dbch_timer = 133;
+int dbch_toolbar = 134;
+int dbch_toolhelp = 135;
+int dbch_tooltips = 136;
+int dbch_trackbar = 137;
+int dbch_treeview = 138;
+int dbch_ttydrv = 139;
+int dbch_tweak = 140;
+int dbch_updown = 141;
+int dbch_ver = 142;
+int dbch_virtual = 143;
+int dbch_vxd = 144;
+int dbch_wave = 145;
+int dbch_win = 146;
+int dbch_win16drv = 147;
+int dbch_win32 = 148;
+int dbch_wing = 149;
+int dbch_winsock = 150;
+int dbch_wnet = 151;
+int dbch_x11 = 152;
+int dbch_x11drv = 153;
 
 #define DEBUG_CHANNEL_COUNT 154
-#ifdef DEBUG_RUNTIME
-short debug_msg_enabled[][DEBUG_CLASS_COUNT] = {
-{1, 1, 0, 0},
+
+char debug_msg_enabled[DEBUG_CHANNEL_COUNT][DEBUG_CLASS_COUNT] = {
 {1, 1, 0, 0},
 {1, 1, 0, 0},
 {1, 1, 0, 0},
@@ -161,8 +319,10 @@
 {1, 1, 0, 0},
 {1, 1, 0, 0},
 {1, 1, 0, 0},
+{1, 1, 0, 0}
 };
-const char* debug_ch_name[] = {
+
+const char * const debug_ch_name[DEBUG_CHANNEL_COUNT] = {
 "accel",
 "advapi",
 "animate",
@@ -200,6 +360,7 @@
 "driver",
 "dsound",
 "edit",
+"elfdll",
 "event",
 "exec",
 "file",
@@ -303,7 +464,6 @@
 "treeview",
 "ttydrv",
 "tweak",
-"unknown",
 "updown",
 "ver",
 "virtual",
@@ -316,13 +476,7 @@
 "winsock",
 "wnet",
 "x11",
-"x11drv",
-};
-const char* debug_cl_name[] = {
-"fixme",
-"err",
-"warn",
-"trace",
+"x11drv"
 };
 
 #endif /*DEBUG_RUNTIME*/
diff --git a/include/debugstr.h b/include/debugstr.h
index 599d8ca..fd71240 100644
--- a/include/debugstr.h
+++ b/include/debugstr.h
@@ -7,12 +7,18 @@
    quotes.  The string will be valid for some time, but not indefinitely
    as strings are re-used.  */
 
-LPSTR debugstr_an (LPCSTR s, int n);
-LPSTR debugstr_a (LPCSTR s);
-LPSTR debugstr_wn (LPCWSTR s, int n);
-LPSTR debugstr_w (LPCWSTR s);
-LPSTR debugres_a (LPCSTR res);
-LPSTR debugres_w (LPCWSTR res);
-void debug_dumpstr (LPCSTR s);
+extern LPSTR debugstr_an (LPCSTR s, int n);
+extern LPSTR debugstr_a (LPCSTR s);
+extern LPSTR debugstr_wn (LPCWSTR s, int n);
+extern LPSTR debugstr_w (LPCWSTR s);
+extern LPSTR debugres_a (LPCSTR res);
+extern LPSTR debugres_w (LPCWSTR res);
+extern void debug_dumpstr (LPCSTR s);
+
+#ifdef __GNUC__
+extern int dbg_printf(const char *format, ...) __attribute__((format (printf,1,2)));
+#else
+extern int dbg_printf(const char *format, ...);
+#endif
 
 #endif /* __WINE_DEBUGSTR_H */
diff --git a/include/debugtools.h b/include/debugtools.h
index 4216753..c1fdfa3 100644
--- a/include/debugtools.h
+++ b/include/debugtools.h
@@ -9,11 +9,32 @@
 #include "debugstr.h"
 
 #define DEBUG_RUNTIME
-#define stddeb  stderr
 
-#define DEBUG_CLASS_COUNT 4
+/* Internal definitions (do not use these directly) */
 
-extern short debug_msg_enabled[][DEBUG_CLASS_COUNT];
+enum __DEBUG_CLASS { __DBCL_FIXME, __DBCL_ERR, __DBCL_WARN, __DBCL_TRACE, __DBCL_COUNT };
+
+extern char debug_msg_enabled[][__DBCL_COUNT];
+
+extern const char * const debug_cl_name[__DBCL_COUNT];
+extern const char * const debug_ch_name[];
+
+#define __DEBUGGING(dbcl,dbch) (debug_msg_enabled[(dbch)][(dbcl)])
+
+#ifndef __GNUC__
+#define __FUNCTION__ ""
+#endif
+
+#define __DPRINTF(dbcl,dbch) \
+  (!__DEBUGGING(dbcl,dbch) || \
+     (dbg_printf("%s:%s:%s ", debug_cl_name[(dbcl)], debug_ch_name[(dbch)], __FUNCTION__),0)) \
+    ? 0 : dbg_printf
+
+#define __DUMMY_DPRINTF() 1 ? 0 : ((int (*)(char *, ...)) NULL)
+
+
+/* Exported definitions and macros */
+
 
 #define dbg_str(name) debug_str_##name
 #define dbg_buf(name) debug_buf_##name
@@ -27,59 +48,59 @@
 #define dsprintf(name, format, args...) \
   dbg_buf(name)+=sprintf(dbg_buf(name), format, ## args)
 
-#define dbg_ch_index(ch) (dbch_##ch)
-#define dbg_cl_index(cl) (dbcl_##cl)
-
-#define DEBUGGING(cl, ch) \
-  (dbg_ch_index(ch) >=0 && dbg_cl_index(cl) >= 0 && \
-   debug_msg_enabled[dbg_ch_index(ch)][dbg_cl_index(cl)])
-
-#define DPRINTF(format, args...) fprintf(stddeb, format, ## args)
-
-#define DPRINTF_(cl, ch, format, args...) \
-  do {if(!DEBUGGING(cl, ch)) ; \
-  else DPRINTF(# cl ":" # ch ":%s " format, __FUNCTION__ , ## args); } while (0)
-
 /* use configure to allow user to compile out debugging messages */
 
 #ifndef NO_TRACE_MSGS
-#define TRACE(ch, fmt, args...) DPRINTF_(trace, ch, fmt, ## args)
+#define TRACE        __DPRINTF(__DBCL_TRACE,DBCH_DEFAULT)
+#define TRACE_(ch)   __DPRINTF(__DBCL_TRACE,dbch_##ch)
+#define TRACE_ON(ch) __DEBUGGING(__DBCL_TRACE,dbch_##ch)
 #else
-#define TRACE(ch, fmt, args...) do { } while (0)
+#define TRACE_(ch)   __DUMMY_DPRINTF
+#define TRACE_ON(ch) 0
 #endif /* NO_TRACE_MSGS */
 
 #ifndef NO_DEBUG_MSGS
-#define WARN(ch, fmt, args...)  DPRINTF_(warn,  ch, fmt, ## args)
-#define FIXME(ch, fmt, args...) DPRINTF_(fixme, ch, fmt, ## args)
-#define DUMP(format, args...)   DPRINTF(format, ## args)
+#define WARN         __DPRINTF(__DBCL_WARN,DBCH_DEFAULT)
+#define WARN_(ch)    __DPRINTF(__DBCL_WARN,dbch_##ch)
+#define WARN_ON(ch)  __DEBUGGING(__DBCL_WARN,dbch_##ch)
+#define FIXME        __DPRINTF(__DBCL_FIXME,DBCH_DEFAULT)
+#define FIXME_(ch)   __DPRINTF(__DBCL_FIXME,dbch_##ch)
+#define FIXME_ON(ch) __DEBUGGING(__DBCL_FIXME,dbch_##ch)
 #else
-#define WARN(ch, fmt, args...) do { } while (0)
-#define FIXME(ch, fmt, args...) do { } while (0)
-#define DUMP(format, args...) do { } while (0)
+#define WARN         __DUMMY_DPRINTF
+#define WARN_(ch)    __DUMMY_DPRINTF
+#define WARN_ON(ch)  0
+#define FIXME        __DUMMY_DPRINTF
+#define FIXME_(ch)   __DUMMY_DPRINTF
+#define FIXME_ON(ch) 0
 #endif /* NO_DEBUG_MSGS */
 
 /* define error macro regardless of what is configured */
 /* Solaris got an 'ERR' define in <sys/reg.h> */
 #undef ERR
-#define ERR(ch, fmt, args...)   DPRINTF_(err, ch, fmt, ## args)
+#define ERR        __DPRINTF(__DBCL_ERR,DBCH_DEFAULT)
+#define ERR_(ch)   __DPRINTF(__DBCL_ERR,dbch_##ch)
+#define ERR_ON(ch) __DEBUGGING(__DBCL_ERR,dbch_##ch)
+
+#define DECLARE_DEBUG_CHANNEL(ch) \
+    extern const int dbch_##ch;
+#define DEFAULT_DEBUG_CHANNEL(ch) \
+    extern const int dbch_##ch; static const int *const DBCH_DEFAULT = &dbch_##ch;
+
+#ifdef OLD_DEBUG_MACROS
+/* transition macros */
+#undef TRACE
+#undef WARN
+#undef FIXME
+#undef ERR
+#define TRACE(ch, fmt, args...) TRACE_(ch)(fmt, ## args)
+#define WARN(ch, fmt, args...)  WARN_(ch)(fmt, ## args)
+#define FIXME(ch, fmt, args...) FIXME_(ch)(fmt, ## args)
+#define ERR(ch, fmt, args...)   ERR_(ch)(fmt, ## args)
 #define MSG(format, args...)    fprintf(stderr, format, ## args)
-
-/* if the debug message is compiled out, make these return false */
-#ifndef NO_TRACE_MSGS
-#define TRACE_ON(ch)  DEBUGGING(trace, ch)
-#else
-#define TRACE_ON(ch) 0
-#endif /* NO_TRACE_MSGS */
-
-#ifndef NO_DEBUG_MSGS
-#define WARN_ON(ch)   DEBUGGING(warn, ch)
-#define FIXME_ON(ch)  DEBUGGING(fixme, ch)
-#else
-#define WARN_ON(ch) 0
-#define FIXME_ON(ch) 0
-#endif /* NO_DEBUG_MSGS */
-
-#define ERR_ON(ch)    DEBUGGING(err, ch)
+#define DPRINTF dbg_printf
+#define DUMP dbg_printf
+#endif
 
 #endif  /* __WINE__ */
 
diff --git a/ipc/dde_atom.c b/ipc/dde_atom.c
index f1cd4bf..01080a7 100644
--- a/ipc/dde_atom.c
+++ b/ipc/dde_atom.c
@@ -17,6 +17,8 @@
 #include "ldt.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(atom)
+
 typedef struct
 {
 	WORD        count;
diff --git a/ipc/dde_atom_test.c b/ipc/dde_atom_test.c
index 4391569..8038f40 100644
--- a/ipc/dde_atom_test.c
+++ b/ipc/dde_atom_test.c
@@ -13,6 +13,10 @@
 #include "dde_atom.h"
 #include "shm_main_blk.h"
 #include <debug.h>
+
+DECLARE_DEBUG_CHANNEL(atom)
+DECLARE_DEBUG_CHANNEL(sem)
+DECLARE_DEBUG_CHANNEL(shm)
 #define TOGETHER (DDE_ATOMS/5)
 
 
diff --git a/ipc/dde_mem.c b/ipc/dde_mem.c
index 9edd2e0..d6d3693 100644
--- a/ipc/dde_mem.c
+++ b/ipc/dde_mem.c
@@ -18,6 +18,9 @@
 #include "dde_mem.h"
 #include "bit_array.h"
 
+DECLARE_DEBUG_CHANNEL(dde)
+DECLARE_DEBUG_CHANNEL(global)
+
 #define SEGPTR2HANDLE_INFO(sptr) ( (struct handle_info*)PTR_SEG_TO_LIN(sptr) )
 
 #define HINFO2DATAPTR(h_info_ptr) ( (void*) ( (char*)h_info_ptr +           \
diff --git a/ipc/dde_proc.c b/ipc/dde_proc.c
index 54f9314..fb25bda 100644
--- a/ipc/dde_proc.c
+++ b/ipc/dde_proc.c
@@ -29,6 +29,9 @@
 #include "debug.h"
 #include "xmalloc.h"
 
+DECLARE_DEBUG_CHANNEL(dde)
+DECLARE_DEBUG_CHANNEL(msg)
+
 int curr_proc_idx= -1;
 
 enum stop_wait_op stop_wait_op=CONT;
diff --git a/ipc/shm_block.c b/ipc/shm_block.c
index 25e3881..fa9546f 100644
--- a/ipc/shm_block.c
+++ b/ipc/shm_block.c
@@ -24,6 +24,8 @@
 #include "dde_proc.h"
 #include "xmalloc.h"
 
+DEFAULT_DEBUG_CHANNEL(shm)
+
 /* How each shmid is maped to local pointer */
 /* Only attached shm blocks are in this construct */
 struct local_shm_map *shm_map=NULL;
diff --git a/ipc/shm_main_blk.c b/ipc/shm_main_blk.c
index 4458f5c..a92ad31 100644
--- a/ipc/shm_main_blk.c
+++ b/ipc/shm_main_blk.c
@@ -23,6 +23,8 @@
 #include "shm_main_blk.h"
 #include "shm_semaph.h"
 
+DEFAULT_DEBUG_CHANNEL(shm)
+
 #define WineKey (   'W'+((int)'i'<<8)+((int)'n'<<16)+((int)'e'<<24)  )
 #define SHM_KEY_RANGE 8
 
diff --git a/ipc/shm_semaph.c b/ipc/shm_semaph.c
index d63f1e5..2dce9b1 100644
--- a/ipc/shm_semaph.c
+++ b/ipc/shm_semaph.c
@@ -16,6 +16,8 @@
 #include <errno.h>
 #include "debug.h"
 #include "shm_semaph.h"
+
+DEFAULT_DEBUG_CHANNEL(sem)
 #define SEM_READ  0
 #define SEM_WRITE 1
 
diff --git a/loader/dos/dosvm.c b/loader/dos/dosvm.c
index 3e79361..31cb259 100644
--- a/loader/dos/dosvm.c
+++ b/loader/dos/dosvm.c
@@ -32,6 +32,10 @@
 #include "dosmod.h"
 #include "debug.h"
 
+DECLARE_DEBUG_CHANNEL(int)
+DECLARE_DEBUG_CHANNEL(module)
+DECLARE_DEBUG_CHANNEL(relay)
+
 #ifdef MZ_SUPPORTED
 
 #include <sys/mman.h>
diff --git a/loader/dos/module.c b/loader/dos/module.c
index 2ac543c..64aea5d 100644
--- a/loader/dos/module.c
+++ b/loader/dos/module.c
@@ -34,6 +34,8 @@
 #include "options.h"
 #include "server.h"
 
+DEFAULT_DEBUG_CHANNEL(module)
+
 #ifdef MZ_SUPPORTED
 
 #include <sys/mman.h>
diff --git a/loader/elf.c b/loader/elf.c
index be7369e..50dfae6 100644
--- a/loader/elf.c
+++ b/loader/elf.c
@@ -26,6 +26,8 @@
 #include "debug.h"
 #include "winerror.h"
 
+DEFAULT_DEBUG_CHANNEL(win32)
+
 WINE_MODREF *ELF_CreateDummyModule( LPCSTR libname, LPCSTR modname )
 {
 	PIMAGE_DOS_HEADER	dh;
diff --git a/loader/elfdll.c b/loader/elfdll.c
index 62b0eac..7d45fc3 100644
--- a/loader/elfdll.c
+++ b/loader/elfdll.c
@@ -19,6 +19,9 @@
 #include "debug.h"
 #include "winerror.h"
 
+DECLARE_DEBUG_CHANNEL(elfdll)
+DECLARE_DEBUG_CHANNEL(win32)
+
 #if defined(HAVE_LIBDL) && defined(HAVE_DLFCN_H)
 #include <dlfcn.h>
 
diff --git a/loader/libres.c b/loader/libres.c
index d2ed8a1..79b4cbb 100644
--- a/loader/libres.c
+++ b/loader/libres.c
@@ -12,6 +12,8 @@
 #include "heap.h"
 #include "xmalloc.h"
 
+DEFAULT_DEBUG_CHANNEL(resource)
+
 typedef struct RLE
 {
     const wrc_resource32_t * const * Resources;  /* NULL-terminated array of pointers */
diff --git a/loader/loadorder.c b/loader/loadorder.c
index 31c55ab..365befc 100644
--- a/loader/loadorder.c
+++ b/loader/loadorder.c
@@ -15,6 +15,8 @@
 #include "heap.h"
 #include "options.h"
 
+DEFAULT_DEBUG_CHANNEL(module)
+
 
 /* #define DEBUG_LOADORDER */
 
diff --git a/loader/main.c b/loader/main.c
index e7b34ba..17def50 100644
--- a/loader/main.c
+++ b/loader/main.c
@@ -48,6 +48,8 @@
 #include "cursoricon.h"
 #include "loadorder.h"
 
+DEFAULT_DEBUG_CHANNEL(server)
+
 int __winelib = 1;  /* Winelib run-time flag */
 
 /***********************************************************************
diff --git a/loader/module.c b/loader/module.c
index 30e5bdc..f9de51c 100644
--- a/loader/module.c
+++ b/loader/module.c
@@ -32,6 +32,9 @@
 #include "loadorder.h"
 #include "elfdll.h"
 
+DECLARE_DEBUG_CHANNEL(module)
+DECLARE_DEBUG_CHANNEL(win32)
+
 
 /*************************************************************************
  *		MODULE32_LookupHMODULE
diff --git a/loader/ne/convert.c b/loader/ne/convert.c
index 8091ff9..a97af8e 100644
--- a/loader/ne/convert.c
+++ b/loader/ne/convert.c
@@ -10,6 +10,8 @@
 #include "debug.h"
 #include "debugtools.h"
 
+DEFAULT_DEBUG_CHANNEL(resource)
+
 /**********************************************************************
  *	    ConvertDialog32To16   (KERNEL.615)
  */
diff --git a/loader/ne/module.c b/loader/ne/module.c
index ae88eb0..d8b90ae 100644
--- a/loader/ne/module.c
+++ b/loader/ne/module.c
@@ -30,6 +30,8 @@
 #include "loadorder.h"
 #include "elfdll.h"
 
+DEFAULT_DEBUG_CHANNEL(module)
+
 FARPROC16 (*fnSNOOP16_GetProcAddress16)(HMODULE16,DWORD,FARPROC16) = NULL;
 void (*fnSNOOP16_RegisterDLL)(NE_MODULE*,LPCSTR) = NULL;
 
diff --git a/loader/ne/resource.c b/loader/ne/resource.c
index ddf33ee..6bd6215 100644
--- a/loader/ne/resource.c
+++ b/loader/ne/resource.c
@@ -23,6 +23,8 @@
 #include "callback.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(resource)
+
 #define NEXT_TYPEINFO(pTypeInfo) ((NE_TYPEINFO *)((char*)((pTypeInfo) + 1) + \
                                    (pTypeInfo)->count * sizeof(NE_NAMEINFO)))
 
diff --git a/loader/ne/segment.c b/loader/ne/segment.c
index 48585cc..5ba6484 100644
--- a/loader/ne/segment.c
+++ b/loader/ne/segment.c
@@ -28,6 +28,11 @@
 #include "debug.h"
 #include "xmalloc.h"
 
+DECLARE_DEBUG_CHANNEL(dll)
+DECLARE_DEBUG_CHANNEL(fixup)
+DECLARE_DEBUG_CHANNEL(module)
+DECLARE_DEBUG_CHANNEL(segment)
+
 #define SEL(x) GlobalHandleToSel16(x)
 
 /***********************************************************************
diff --git a/loader/pe_image.c b/loader/pe_image.c
index 4b71368..031d80d 100644
--- a/loader/pe_image.c
+++ b/loader/pe_image.c
@@ -58,6 +58,13 @@
 #include "snoop.h"
 #include "debug.h"
 
+DECLARE_DEBUG_CHANNEL(delayhlp)
+DECLARE_DEBUG_CHANNEL(fixup)
+DECLARE_DEBUG_CHANNEL(module)
+DECLARE_DEBUG_CHANNEL(relay)
+DECLARE_DEBUG_CHANNEL(segment)
+DECLARE_DEBUG_CHANNEL(win32)
+
 
 /* convert PE image VirtualAddress to Real Address */
 #define RVA(x) ((unsigned int)load_addr+(unsigned int)(x))
diff --git a/loader/resource.c b/loader/resource.c
index 1e4b998..7c5811f 100644
--- a/loader/resource.c
+++ b/loader/resource.c
@@ -32,6 +32,9 @@
 #include "winerror.h"
 #include "debugstr.h"
 
+DECLARE_DEBUG_CHANNEL(accel)
+DECLARE_DEBUG_CHANNEL(resource)
+
 extern WORD WINE_LanguageId;
 
 #define HRSRC_MAP_BLOCKSIZE 16
diff --git a/loader/task.c b/loader/task.c
index 75dd7bf..97f2ab5 100644
--- a/loader/task.c
+++ b/loader/task.c
@@ -38,6 +38,10 @@
 #include "dde_proc.h"
 #include "server.h"
 
+DECLARE_DEBUG_CHANNEL(relay)
+DECLARE_DEBUG_CHANNEL(task)
+DECLARE_DEBUG_CHANNEL(toolhelp)
+
   /* Min. number of thunks allocated when creating a new segment */
 #define MIN_THUNKS  32
 
diff --git a/memory/atom.c b/memory/atom.c
index 64e93fe..2ade444 100644
--- a/memory/atom.c
+++ b/memory/atom.c
@@ -29,6 +29,8 @@
 #include "dde_atom.h"
 #endif
 
+DEFAULT_DEBUG_CHANNEL(atom)
+
 #define DEFAULT_ATOMTABLE_SIZE    37
 #define MIN_STR_ATOM              0xc000
 #define MAX_ATOM_LEN              255
diff --git a/memory/global.c b/memory/global.c
index 21da1fc..ce57bb1 100644
--- a/memory/global.c
+++ b/memory/global.c
@@ -22,6 +22,8 @@
 #include "debug.h"
 #include "winerror.h"
 
+DEFAULT_DEBUG_CHANNEL(global)
+
   /* Global arena block */
 typedef struct
 {
diff --git a/memory/heap.c b/memory/heap.c
index e6b195d..dfd174c 100644
--- a/memory/heap.c
+++ b/memory/heap.c
@@ -19,6 +19,8 @@
 #include "toolhelp.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(heap)
+
 /* Note: the heap data structures are based on what Pietrek describes in his
  * book 'Windows 95 System Programming Secrets'. The layout is not exactly
  * the same, but could be easily adapted if it turns out some programs
diff --git a/memory/ldt.c b/memory/ldt.c
index e4bd230..f36411e 100644
--- a/memory/ldt.c
+++ b/memory/ldt.c
@@ -11,6 +11,8 @@
 #include "ldt.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(ldt)
+
 #ifdef __i386__
 
 #ifdef linux
diff --git a/memory/local.c b/memory/local.c
index 02bd1c7..aed93aa 100644
--- a/memory/local.c
+++ b/memory/local.c
@@ -27,6 +27,9 @@
 #include "debug.h"
 #include "callback.h"
 
+DECLARE_DEBUG_CHANNEL(heap)
+DECLARE_DEBUG_CHANNEL(local)
+
 typedef struct
 {
 /* Arena header */
diff --git a/memory/selector.c b/memory/selector.c
index fd2ba90..964c3cc 100644
--- a/memory/selector.c
+++ b/memory/selector.c
@@ -13,6 +13,8 @@
 #include "process.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(selector)
+
 
 /***********************************************************************
  *           AllocSelectorArray   (KERNEL.206)
diff --git a/memory/string.c b/memory/string.c
index f59950f..2fd55e8 100644
--- a/memory/string.c
+++ b/memory/string.c
@@ -15,6 +15,8 @@
 #include "debug.h"
 #include "winnls.h"
 
+DEFAULT_DEBUG_CHANNEL(string)
+
 static const BYTE STRING_Oem2Ansi[256] =
 "\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\244"
 "\020\021\022\023\266\247\026\027\030\031\032\033\034\035\036\037"
diff --git a/memory/virtual.c b/memory/virtual.c
index 0b57c5e..ef5d69d 100644
--- a/memory/virtual.c
+++ b/memory/virtual.c
@@ -23,6 +23,8 @@
 #include "server.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(virtual)
+
 #ifndef MS_SYNC
 #define MS_SYNC 0
 #endif
diff --git a/misc/callback.c b/misc/callback.c
index 2c3085a..71b8b53 100644
--- a/misc/callback.c
+++ b/misc/callback.c
@@ -15,6 +15,8 @@
 #include "debug.h"
 #include "win.h"
 
+DEFAULT_DEBUG_CHANNEL(relay)
+
 
 /**********************************************************************
  *	     CALLBACK_CallWndProc
diff --git a/misc/cdrom.c b/misc/cdrom.c
index 8d26cef..fe4e0b4 100644
--- a/misc/cdrom.c
+++ b/misc/cdrom.c
@@ -13,6 +13,8 @@
 #include "cdrom.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(cdaudio)
+
 #if defined(__NetBSD__)
 # define CDAUDIO_DEV "/dev/rcd0d"
 #elif defined(__FreeBSD__)
diff --git a/misc/comm.c b/misc/comm.c
index 296d700..dfcce60 100644
--- a/misc/comm.c
+++ b/misc/comm.c
@@ -69,6 +69,8 @@
 
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(comm)
+
 #ifndef TIOCINQ
 #define	TIOCINQ FIONREAD
 #endif
diff --git a/misc/cpu.c b/misc/cpu.c
index 2077f06..8a07175 100644
--- a/misc/cpu.c
+++ b/misc/cpu.c
@@ -17,6 +17,8 @@
 #include "winreg.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(reg)
+
 static BYTE PF[64] = {0,};
 
 /***********************************************************************
diff --git a/misc/crtdll.c b/misc/crtdll.c
index 0507573..5ca6819 100644
--- a/misc/crtdll.c
+++ b/misc/crtdll.c
@@ -51,6 +51,8 @@
 #include "options.h"
 #include "winnls.h"
 
+DEFAULT_DEBUG_CHANNEL(crtdll)
+
 /* windows.h RAND_MAX is smaller than normal RAND_MAX */
 #define CRTDLL_RAND_MAX         0x7fff 
 
diff --git a/misc/ddeml.c b/misc/ddeml.c
index 045c0fc..f9739b3 100644
--- a/misc/ddeml.c
+++ b/misc/ddeml.c
@@ -19,6 +19,8 @@
 #include "debug.h"
 #include "winnt.h"
 
+DEFAULT_DEBUG_CHANNEL(ddeml)
+
 /* Has defined in atom.c file.
  */
 #define MAX_ATOM_LEN              255
diff --git a/misc/debugstr.c b/misc/debugstr.c
index b751b46..73a4a71 100644
--- a/misc/debugstr.c
+++ b/misc/debugstr.c
@@ -1,7 +1,10 @@
-#include "debugstr.h"
-#include "xmalloc.h"
-#include <stdlib.h>
+#include <stdarg.h>
 #include <stdio.h>
+#include <stdlib.h>
+
+#include "debugstr.h"
+#include "debugtools.h"
+#include "xmalloc.h"
 
 /* ---------------------------------------------------------------------- */
 
@@ -182,3 +185,16 @@
   fputc ('"', stderr);
 }
 
+/* ---------------------------------------------------------------------- */
+
+int dbg_printf(const char *format, ...)
+{
+    int ret;
+    va_list valist;
+
+    va_start(valist, format);
+    ret = vfprintf(stderr, format, valist);
+    va_end(valist);
+    return ret;
+}
+
diff --git a/misc/imm.c b/misc/imm.c
index c0de86b..47e9927 100644
--- a/misc/imm.c
+++ b/misc/imm.c
@@ -12,6 +12,8 @@
 #include "winversion.h"
 #include "imm.h"
 
+DEFAULT_DEBUG_CHANNEL(imm)
+
 /***********************************************************************
  *           ImmAssociateContext32 (IMM32.1)
  */
diff --git a/misc/lstr.c b/misc/lstr.c
index 048bb6b..084fdca 100644
--- a/misc/lstr.c
+++ b/misc/lstr.c
@@ -34,6 +34,8 @@
 #include "module.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(resource)
+
 extern const WORD OLE2NLS_CT_CType3_LUT[]; /* FIXME: does not belong here */
 
 
diff --git a/misc/lzexpand.c b/misc/lzexpand.c
index 0a902d8..5fab3fe 100644
--- a/misc/lzexpand.c
+++ b/misc/lzexpand.c
@@ -18,6 +18,8 @@
 #include "lzexpand.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(file)
+
 
 /* The readahead length of the decompressor. Reading single bytes
  * using _lread() would be SLOW.
diff --git a/misc/network.c b/misc/network.c
index 0396801..691e036 100644
--- a/misc/network.c
+++ b/misc/network.c
@@ -21,6 +21,9 @@
 #include "debug.h"
 #include "heap.h"
 
+DECLARE_DEBUG_CHANNEL(mpr)
+DECLARE_DEBUG_CHANNEL(wnet)
+
 /********************************************************************
  *  WNetAddConnection16 [USER.517]  Directs a local device to net
  * 
diff --git a/misc/printdrv.c b/misc/printdrv.c
index b2171b5..969759d 100644
--- a/misc/printdrv.c
+++ b/misc/printdrv.c
@@ -15,6 +15,9 @@
 #include "winreg.h"
 #include "debug.h"
 
+DECLARE_DEBUG_CHANNEL(gdi)
+DECLARE_DEBUG_CHANNEL(print)
+
 CRITICAL_SECTION PRINT32_RegistryBlocker;
 
 static char PrinterModel[]	= "Printer Model";
diff --git a/misc/registry.c b/misc/registry.c
index 4c37e1e..529388d 100644
--- a/misc/registry.c
+++ b/misc/registry.c
@@ -44,6 +44,9 @@
 #include "winreg.h"
 #include "winversion.h"
 
+DECLARE_DEBUG_CHANNEL(reg)
+DECLARE_DEBUG_CHANNEL(string)
+
 static void REGISTRY_Init(void);
 /* FIXME: following defines should be configured global ... */
 
diff --git a/misc/shell.c b/misc/shell.c
index 95c80eb..325ecc7 100644
--- a/misc/shell.c
+++ b/misc/shell.c
@@ -26,6 +26,9 @@
 #include "winreg.h"
 #include "imagelist.h"
 
+DECLARE_DEBUG_CHANNEL(exec)
+DECLARE_DEBUG_CHANNEL(shell)
+
 /* .ICO file ICONDIR definitions */
 
 #pragma pack(1)
diff --git a/misc/sound.c b/misc/sound.c
index 3fd2bc1..97d5622 100644
--- a/misc/sound.c
+++ b/misc/sound.c
@@ -7,6 +7,8 @@
 #include "wine/winesound.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(sound)
+
 INT16 WINAPI OpenSound16(void)
 {
   FIXME(sound, "(void): stub\n");
diff --git a/misc/spooler.c b/misc/spooler.c
index a595f1c..56ab4d7 100644
--- a/misc/spooler.c
+++ b/misc/spooler.c
@@ -21,6 +21,8 @@
 #include "winerror.h"
 #include "xmalloc.h"
 
+DEFAULT_DEBUG_CHANNEL(print)
+
 /**********************************************************************
  *           QueryAbort   (GDI.155)
  *
diff --git a/misc/spy.c b/misc/spy.c
index 41804d2..008b132 100644
--- a/misc/spy.c
+++ b/misc/spy.c
@@ -15,6 +15,8 @@
 #include "debug.h"
 #include "spy.h"
 
+DEFAULT_DEBUG_CHANNEL(message)
+
 #define SPY_MAX_MSGNUM   WM_USER
 #define SPY_INDENT_UNIT  4  /* 4 spaces */
 
diff --git a/misc/stress.c b/misc/stress.c
index db380ea..373c6eb 100644
--- a/misc/stress.c
+++ b/misc/stress.c
@@ -2,6 +2,8 @@
 #include "stress.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(stress)
+
 
 int WINAPI AllocDiskSpace(long lLeft, UINT16 uDrive)
 {
diff --git a/misc/system.c b/misc/system.c
index f7e7708..14f73b9 100644
--- a/misc/system.c
+++ b/misc/system.c
@@ -9,6 +9,8 @@
 #include "services.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(system)
+
 typedef struct
 {
     SYSTEMTIMERPROC callback;  /* NULL if not in use */
diff --git a/misc/toolhelp.c b/misc/toolhelp.c
index 0455d9b..5580428 100644
--- a/misc/toolhelp.c
+++ b/misc/toolhelp.c
@@ -19,6 +19,8 @@
 #include "server.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(toolhelp)
+
 
 /* FIXME: to make this working, we have to callback all these registered 
  * functions from all over the WINE code. Someone with more knowledge than
diff --git a/misc/tweak.c b/misc/tweak.c
index 69a63d6..c538ca6 100644
--- a/misc/tweak.c
+++ b/misc/tweak.c
@@ -34,6 +34,8 @@
 #include "options.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(tweak)
+
 /* General options */
 
 WINE_LOOK TWEAK_WineLook = WIN31_LOOK;
diff --git a/misc/version.c b/misc/version.c
index c471d16..5795542 100644
--- a/misc/version.c
+++ b/misc/version.c
@@ -18,6 +18,8 @@
 #include "neexe.h"
 #include "winversion.h"
 
+DEFAULT_DEBUG_CHANNEL(ver)
+
 typedef struct
 {
     LONG             getVersion16; 
diff --git a/misc/win32s16.c b/misc/win32s16.c
index 8cc147d..afe644d 100644
--- a/misc/win32s16.c
+++ b/misc/win32s16.c
@@ -10,6 +10,8 @@
 #include "windef.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(dll)
+
 void WINAPI BootTask16()
 {
 	MSG("BootTask(): should only be used by WIN32S.EXE.\n");
diff --git a/misc/windebug.c b/misc/windebug.c
index a4ac9a8..0e4a01e 100644
--- a/misc/windebug.c
+++ b/misc/windebug.c
@@ -10,6 +10,8 @@
 #include "module.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(dll)
+
 /***********************************************************************
  *           WinNotify       (WINDEBUG.3)
  *  written without _any_ docu
diff --git a/misc/winsock.c b/misc/winsock.c
index 1eb8b2c..2d55165 100644
--- a/misc/winsock.c
+++ b/misc/winsock.c
@@ -60,6 +60,8 @@
 #include "miscemu.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(winsock)
+
 #define DEBUG_SOCKADDR 0
 #define dump_sockaddr(a) \
         DUMP("sockaddr_in: family %d, address %s, port %d\n", \
diff --git a/misc/winsock_async.c b/misc/winsock_async.c
index 7d66e5f..03f8084 100644
--- a/misc/winsock_async.c
+++ b/misc/winsock_async.c
@@ -69,6 +69,8 @@
 #include "miscemu.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(winsock)
+
 #pragma pack(4)
 
 /* ----------------------------------- helper functions - */
diff --git a/misc/wsprintf.c b/misc/wsprintf.c
index 65785c6..dc282a0 100644
--- a/misc/wsprintf.c
+++ b/misc/wsprintf.c
@@ -12,6 +12,8 @@
 #include "stackframe.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(string)
+
 
 #define WPRINTF_LEFTALIGN   0x0001  /* Align output on the left ('-' prefix) */
 #define WPRINTF_PREFIX_HEX  0x0002  /* Prefix hex with 0x ('#' prefix) */
diff --git a/miscemu/emulate.c b/miscemu/emulate.c
index bd587df..511f0b7 100644
--- a/miscemu/emulate.c
+++ b/miscemu/emulate.c
@@ -2,6 +2,8 @@
 #include "miscemu.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(int)
+
 struct Win87EmInfoStruct
 {
     unsigned short Version;
diff --git a/miscemu/instr.c b/miscemu/instr.c
index 3639bf0..8a90162 100644
--- a/miscemu/instr.c
+++ b/miscemu/instr.c
@@ -14,6 +14,9 @@
 #include "selectors.h"
 #include "debug.h"
 
+DECLARE_DEBUG_CHANNEL(int)
+DECLARE_DEBUG_CHANNEL(io)
+
 
 #define IS_V86(context) (EFL_sig(context)&V86_FLAG)
 #define IS_SEL_32(context,seg) \
diff --git a/msdos/dosconf.c b/msdos/dosconf.c
index 8243916..0170720 100644
--- a/msdos/dosconf.c
+++ b/msdos/dosconf.c
@@ -16,6 +16,8 @@
 #include "options.h"
 #include "file.h"
 
+DEFAULT_DEBUG_CHANNEL(profile)
+
 
 static int DOSCONF_Device(char **confline);
 static int DOSCONF_Dos(char **confline);
diff --git a/msdos/dosmem.c b/msdos/dosmem.c
index e06c537..9699184 100644
--- a/msdos/dosmem.c
+++ b/msdos/dosmem.c
@@ -18,6 +18,9 @@
 #include "task.h"
 #include "debug.h"
 
+DECLARE_DEBUG_CHANNEL(dosmem)
+DECLARE_DEBUG_CHANNEL(selector)
+
 HANDLE16 DOSMEM_BiosDataSeg;  /* BIOS data segment at 0x40:0 */
 HANDLE16 DOSMEM_BiosSysSeg;   /* BIOS ROM segment at 0xf000:0 */
 
diff --git a/msdos/dpmi.c b/msdos/dpmi.c
index 70fa650..8fc7e7d 100644
--- a/msdos/dpmi.c
+++ b/msdos/dpmi.c
@@ -22,6 +22,8 @@
 #include "callback.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(int31)
+
 #define DOS_GET_DRIVE(reg) ((reg) ? (reg) - 1 : DRIVE_GetCurrentDrive())
 
 void CreateBPB(int drive, BYTE *data, BOOL16 limited);  /* defined in int21.c */
diff --git a/msdos/int09.c b/msdos/int09.c
index 19f1640..d112451 100644
--- a/msdos/int09.c
+++ b/msdos/int09.c
@@ -10,6 +10,8 @@
 #include "debug.h"
 #include "dosexe.h"
 
+DEFAULT_DEBUG_CHANNEL(int)
+
 typedef struct {
   BYTE queuelen,queue[15];
 } KBDSYSTEM;
diff --git a/msdos/int10.c b/msdos/int10.c
index 0881ca9..d9fd019 100644
--- a/msdos/int10.c
+++ b/msdos/int10.c
@@ -8,6 +8,8 @@
 #include "debug.h"
 #include "console.h"
 
+DEFAULT_DEBUG_CHANNEL(int10)
+
 static void conv_text_mode_attributes(char attribute, int *fg, int *bg,
        int *wattribute);
 static void write_char_attribute_at_cursor(char output, char page_num, 
diff --git a/msdos/int13.c b/msdos/int13.c
index 96fa236..c577fa4 100644
--- a/msdos/int13.c
+++ b/msdos/int13.c
@@ -16,6 +16,8 @@
 #include "debug.h"
 #include "drive.h"
 
+DEFAULT_DEBUG_CHANNEL(int)
+
 /**********************************************************************
  *	    INT_Int13Handler
  *
diff --git a/msdos/int15.c b/msdos/int15.c
index 7875a7f..472735f 100644
--- a/msdos/int15.c
+++ b/msdos/int15.c
@@ -6,6 +6,8 @@
 #include "miscemu.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(int)
+
 
 /**********************************************************************
  *	    INT_Int15Handler
diff --git a/msdos/int16.c b/msdos/int16.c
index 8875ab5..da9102f 100644
--- a/msdos/int16.c
+++ b/msdos/int16.c
@@ -13,6 +13,8 @@
 #include "debug.h"
 #include "winuser.h"
 
+DEFAULT_DEBUG_CHANNEL(int16)
+
 /**********************************************************************
  *	    INT_Int16Handler
  *
diff --git a/msdos/int17.c b/msdos/int17.c
index 70ae034..a366b7b 100644
--- a/msdos/int17.c
+++ b/msdos/int17.c
@@ -10,6 +10,8 @@
 #include "drive.h"
 #include "winnt.h"
 
+DEFAULT_DEBUG_CHANNEL(int17)
+
 /**********************************************************************
  *          INT_Int17Handler
  *
diff --git a/msdos/int19.c b/msdos/int19.c
index 44d9f69..9cc4a2a 100644
--- a/msdos/int19.c
+++ b/msdos/int19.c
@@ -6,6 +6,8 @@
 #include "miscemu.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(int19)
+
 
 /**********************************************************************
  *          INT_Int19Handler
diff --git a/msdos/int1a.c b/msdos/int1a.c
index 3504f67..21daa6e 100644
--- a/msdos/int1a.c
+++ b/msdos/int1a.c
@@ -9,6 +9,8 @@
 #include "miscemu.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(int)
+
 #define	BCD_TO_BIN(x) ((x&15) + (x>>4)*10)
 #define BIN_TO_BCD(x) ((x%10) + ((x/10)<<4))
 
diff --git a/msdos/int21.c b/msdos/int21.c
index 3295d23..6b58779 100644
--- a/msdos/int21.c
+++ b/msdos/int21.c
@@ -33,6 +33,8 @@
 #include "module.h"
 #include "debug.h"
 #include "console.h"
+
+DEFAULT_DEBUG_CHANNEL(int21)
 #if defined(__svr4__) || defined(_SCO_DS)
 /* SVR4 DOESNT do locking the same way must implement properly */
 #define LOCK_EX 0
diff --git a/msdos/int25.c b/msdos/int25.c
index f7c806b..c967334 100644
--- a/msdos/int25.c
+++ b/msdos/int25.c
@@ -12,6 +12,8 @@
 #include "drive.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(int)
+
 
 /**********************************************************************
  *	    INT_Int25Handler
diff --git a/msdos/int26.c b/msdos/int26.c
index 41a507d..a38d355 100644
--- a/msdos/int26.c
+++ b/msdos/int26.c
@@ -11,6 +11,8 @@
 #include "drive.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(int)
+
 /**********************************************************************
  *	    INT_Int26Handler
  *
diff --git a/msdos/int2f.c b/msdos/int2f.c
index e74064d..2031b85 100644
--- a/msdos/int2f.c
+++ b/msdos/int2f.c
@@ -24,6 +24,8 @@
 #include "debug.h"
 #include "cdrom.h"
 
+DEFAULT_DEBUG_CHANNEL(int)
+
 /* base WPROCS.DLL ordinal number for VxDs */
 #define VXD_BASE 400
 
diff --git a/msdos/int33.c b/msdos/int33.c
index 3401928..7a65186 100644
--- a/msdos/int33.c
+++ b/msdos/int33.c
@@ -8,6 +8,8 @@
 #include "dosexe.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(int)
+
 typedef struct {
   DWORD x, y, but;
   FARPROC16 callback;
diff --git a/msdos/int5c.c b/msdos/int5c.c
index 3498f1c..60b2b7e 100644
--- a/msdos/int5c.c
+++ b/msdos/int5c.c
@@ -8,6 +8,8 @@
 #include "miscemu.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(int)
+
 
 /***********************************************************************
  *           NetBIOSCall  (KERNEL.103)
diff --git a/msdos/interrupts.c b/msdos/interrupts.c
index afd3160..38810cf 100644
--- a/msdos/interrupts.c
+++ b/msdos/interrupts.c
@@ -10,6 +10,8 @@
 #include "msdos.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(int)
+
 static FARPROC16 INT_Vectors[256];
 
 
diff --git a/msdos/ioports.c b/msdos/ioports.c
index 49a9f10..7794014 100644
--- a/msdos/ioports.c
+++ b/msdos/ioports.c
@@ -24,6 +24,8 @@
 #include "debug.h"
 #include "miscemu.h"
 
+DEFAULT_DEBUG_CHANNEL(int)
+
 static WORD tmr_8253_countmax[3] = {0xffff, 0x12, 1}; /* [2] needs to be 1 ! */
 /* if byte_toggle is TRUE, then hi byte has already been written */
 static BOOL16 tmr_8253_byte_toggle[3] = {FALSE, FALSE, FALSE};
diff --git a/msdos/vxd.c b/msdos/vxd.c
index 29dd3f8..a3ca0ff 100644
--- a/msdos/vxd.c
+++ b/msdos/vxd.c
@@ -19,6 +19,8 @@
 #include "file.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(vxd)
+
 
 #define VXD_BARF(context,name) \
     DUMP( "vxd %s: unknown/not implemented parameters:\n" \
diff --git a/msdos/xms.c b/msdos/xms.c
index 17802fa..389c0a4 100644
--- a/msdos/xms.c
+++ b/msdos/xms.c
@@ -16,6 +16,8 @@
 #include "debug.h"
 #include "selectors.h"
 
+DEFAULT_DEBUG_CHANNEL(int31)
+
 typedef struct {
  WORD Handle;
  DWORD Offset;
diff --git a/multimedia/audio.c b/multimedia/audio.c
index 11af169..f613fce 100644
--- a/multimedia/audio.c
+++ b/multimedia/audio.c
@@ -26,6 +26,8 @@
 #include "ldt.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(wave)
+
 #ifdef HAVE_OSS
 
 #define SOUND_DEV "/dev/dsp"
@@ -1234,7 +1236,6 @@
 
 	TRACE(wave, "recording buf#%u=%p size=%lu \n",
 	      count, lpData, (*lpWaveHdr)->dwBufferLength);
-	fflush(stddeb);
 
 	bytesRead = read(WInDev[wDevID].unixdev, lpData, (*lpWaveHdr)->dwBufferLength);
 
@@ -1256,7 +1257,6 @@
 	count++;
     }
     TRACE(wave, "end of recording !\n");
-    fflush(stddeb);
     return MMSYSERR_NOERROR;
 }
 
@@ -1304,7 +1304,6 @@
     TRACE(wave, "nSamplesPerSec=%lu\n", WInDev[wDevID].format.wf.nSamplesPerSec); 
     TRACE(wave, "nChannels=%u\n", WInDev[wDevID].format.wf.nChannels); 
     TRACE(wave, "nAvgBytesPerSec=%lu\n", WInDev[wDevID].format.wf.nAvgBytesPerSec); 
-    fflush(stddeb);
     switch (lpTime->wType) {
     case TIME_BYTES:
 	lpTime->u.cb = WInDev[wDevID].dwTotalRecorded;
diff --git a/multimedia/dplay.c b/multimedia/dplay.c
index 1344596..7fe4e3a 100644
--- a/multimedia/dplay.c
+++ b/multimedia/dplay.c
@@ -14,6 +14,8 @@
 #include "heap.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(dplay)
+
 /*****************************************************************************
  * Predeclare the interface implementation structures
  */
diff --git a/multimedia/dsound.c b/multimedia/dsound.c
index 4be0828..267424c 100644
--- a/multimedia/dsound.c
+++ b/multimedia/dsound.c
@@ -69,6 +69,8 @@
 #include "thread.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(dsound)
+
 
 /*****************************************************************************
  * Predeclare the interface implementation structures
diff --git a/multimedia/init.c b/multimedia/init.c
index d404432..af9b1e0 100644
--- a/multimedia/init.c
+++ b/multimedia/init.c
@@ -16,6 +16,9 @@
 #include "options.h"
 #include "debug.h"
 
+DECLARE_DEBUG_CHANNEL(mci)
+DECLARE_DEBUG_CHANNEL(midi)
+
 #ifdef HAVE_OSS
 
 extern int 		MODM_NUMDEVS;
diff --git a/multimedia/joystick.c b/multimedia/joystick.c
index 930ec12..9ddff52 100644
--- a/multimedia/joystick.c
+++ b/multimedia/joystick.c
@@ -23,6 +23,8 @@
 #include "mmsystem.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(mmsys)
+
 #define MAXJOYDRIVERS	4
 
 static int count_use[MAXJOYDRIVERS] = {0, 0, 0, 0};
diff --git a/multimedia/mci.c b/multimedia/mci.c
index d96db0f..d78c00d 100644
--- a/multimedia/mci.c
+++ b/multimedia/mci.c
@@ -20,6 +20,8 @@
 #include "digitalv.h"
 #include "wine/winbase16.h"
 
+DEFAULT_DEBUG_CHANNEL(mci)
+
 WINE_MCIDRIVER mciDrv[MAXMCIDRIVERS];
 
 int	mciInstalledCount;
diff --git a/multimedia/mcianim.c b/multimedia/mcianim.c
index e5fd2b1..2076b5b 100644
--- a/multimedia/mcianim.c
+++ b/multimedia/mcianim.c
@@ -17,6 +17,8 @@
 #include "multimedia.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(mcianim)
+
 #define MAX_ANIMDRV 		2
 
 #define ANIMFRAMES_PERSEC 	30
diff --git a/multimedia/mciavi.c b/multimedia/mciavi.c
index a5f4e84..f56d8b3 100644
--- a/multimedia/mciavi.c
+++ b/multimedia/mciavi.c
@@ -16,6 +16,10 @@
 #include "digitalv.h"
 #include "options.h"
 
+DECLARE_DEBUG_CHANNEL(cdaudio)
+DECLARE_DEBUG_CHANNEL(mciavi)
+DECLARE_DEBUG_CHANNEL(mcimidi)
+
 typedef struct {
     int			nUseCount;          	/* Incremented for each shared open          */
     BOOL16  		fShareable;         	/* TRUE if first open was shareable 	     */
diff --git a/multimedia/mcicda.c b/multimedia/mcicda.c
index a38c950..188a3a2 100644
--- a/multimedia/mcicda.c
+++ b/multimedia/mcicda.c
@@ -13,6 +13,8 @@
 #include "debug.h"
 #include "cdrom.h"
 
+DEFAULT_DEBUG_CHANNEL(cdaudio)
+
 typedef struct {
     int     		nUseCount;          /* Incremented for each shared open */
     BOOL16  		fShareable;         /* TRUE if first open was shareable */
diff --git a/multimedia/mcimidi.c b/multimedia/mcimidi.c
index 371b7ad..ddda820 100644
--- a/multimedia/mcimidi.c
+++ b/multimedia/mcimidi.c
@@ -31,6 +31,9 @@
 #include "debug.h"
 #include "heap.h"
 
+DECLARE_DEBUG_CHANNEL(mcimidi)
+DECLARE_DEBUG_CHANNEL(midi)
+
 typedef struct {
     DWORD		dwFirst;		/* offset in file of track */
     DWORD		dwLast;			/* number of bytes in file of track */
diff --git a/multimedia/mcistring.c b/multimedia/mcistring.c
index 7e734fb..b471e3d 100644
--- a/multimedia/mcistring.c
+++ b/multimedia/mcistring.c
@@ -27,6 +27,8 @@
 #include "debug.h"
 #include "xmalloc.h"
 
+DEFAULT_DEBUG_CHANNEL(mci)
+
 /* The reason why I just don't lowercase the keywords array in 
  * mciSendString is left as an exercise to the reader.
  */
diff --git a/multimedia/mciwave.c b/multimedia/mciwave.c
index dd07848..216fae6 100644
--- a/multimedia/mciwave.c
+++ b/multimedia/mciwave.c
@@ -27,6 +27,8 @@
 #include "heap.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(mciwave)
+
 #define MAX_MCIWAVEDRV 	(1)
 
 typedef struct {
diff --git a/multimedia/midi.c b/multimedia/midi.c
index aef23d6..8728529 100644
--- a/multimedia/midi.c
+++ b/multimedia/midi.c
@@ -30,6 +30,8 @@
 #include "heap.h"
 #include "ldt.h"
 
+DEFAULT_DEBUG_CHANNEL(midi)
+
 typedef struct {
 #ifndef HAVE_OSS
     int			unixdev;
diff --git a/multimedia/mixer.c b/multimedia/mixer.c
index dc95558..1809595 100644
--- a/multimedia/mixer.c
+++ b/multimedia/mixer.c
@@ -18,6 +18,8 @@
 #include "multimedia.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(mmaux)
+
 #ifdef HAVE_OSS
 #define MIXER_DEV "/dev/mixer"
 
diff --git a/multimedia/mmaux.c b/multimedia/mmaux.c
index 88b27ee..134f038 100644
--- a/multimedia/mmaux.c
+++ b/multimedia/mmaux.c
@@ -16,6 +16,8 @@
 #include "multimedia.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(mmaux)
+
 #define MIXER_DEV "/dev/mixer"
 
 static int	NumDev = 6;
diff --git a/multimedia/mmio.c b/multimedia/mmio.c
index 9a996f3..73d0dca 100644
--- a/multimedia/mmio.c
+++ b/multimedia/mmio.c
@@ -18,6 +18,8 @@
 #include "debug.h"
 #include "xmalloc.h"
 
+DEFAULT_DEBUG_CHANNEL(mmio)
+
 /**************************************************************************
  *               mmioDosIOProc           [internal]
  */
diff --git a/multimedia/mmsystem.c b/multimedia/mmsystem.c
index 3ee27a0..424e210 100644
--- a/multimedia/mmsystem.c
+++ b/multimedia/mmsystem.c
@@ -34,6 +34,9 @@
 #include "debugstr.h"
 #include "debug.h"
 
+DECLARE_DEBUG_CHANNEL(mmaux)
+DECLARE_DEBUG_CHANNEL(mmsys)
+
 UINT16 WINAPI midiGetErrorText(UINT16 uError, LPSTR lpText, UINT16 uSize);
 static UINT16 waveGetErrorText(UINT16 uError, LPSTR lpText, UINT16 uSize);
 LONG   WINAPI DrvDefDriverProc(DWORD dwDevID, HDRVR16 hDrv, WORD wMsg, 
diff --git a/multimedia/msvideo.c b/multimedia/msvideo.c
index 3455dab..d3c372b 100644
--- a/multimedia/msvideo.c
+++ b/multimedia/msvideo.c
@@ -12,6 +12,8 @@
 #include "driver.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(msvideo)
+
 /****************************************************************************
  *		VideoForWindowsVersion		[MSVFW.2][MSVIDEO.2]
  * Returns the version in major.minor form.
diff --git a/multimedia/time.c b/multimedia/time.c
index 7471672..d7d41b2 100644
--- a/multimedia/time.c
+++ b/multimedia/time.c
@@ -17,6 +17,9 @@
 #include "options.h"
 #include "debug.h"
 
+DECLARE_DEBUG_CHANNEL(mmsys)
+DECLARE_DEBUG_CHANNEL(mmtime)
+
 #define USE_FAKE_MM_TIMERS
 
 static MMTIME16 mmSysTimeMS;
diff --git a/objects/bitmap.c b/objects/bitmap.c
index e0cf1d1..4af0b61 100644
--- a/objects/bitmap.c
+++ b/objects/bitmap.c
@@ -20,6 +20,9 @@
 #include "monitor.h"
 #include "wine/winuser16.h"
 
+DECLARE_DEBUG_CHANNEL(bitmap)
+DECLARE_DEBUG_CHANNEL(resource)
+
 BITMAP_DRIVER *BITMAP_Driver = NULL;
 
 
diff --git a/objects/brush.c b/objects/brush.c
index baaec06..2e53cad 100644
--- a/objects/brush.c
+++ b/objects/brush.c
@@ -10,6 +10,8 @@
 #include "bitmap.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(gdi)
+
 
 /***********************************************************************
  *           CreateBrushIndirect16    (GDI.50)
diff --git a/objects/clipping.c b/objects/clipping.c
index a6d623f..172acda 100644
--- a/objects/clipping.c
+++ b/objects/clipping.c
@@ -11,6 +11,9 @@
 #include "debug.h"
 #include "wine/winuser16.h"
 
+DECLARE_DEBUG_CHANNEL(clipping)
+DECLARE_DEBUG_CHANNEL(region)
+
 #define UPDATE_DIRTY_DC(dc) \
  do { \
    if ((dc)->hookProc && !((dc)->w.flags & (DC_SAVED | DC_MEMORY))) \
diff --git a/objects/color.c b/objects/color.c
index e074faa..bb9633a 100644
--- a/objects/color.c
+++ b/objects/color.c
@@ -10,6 +10,8 @@
 #include "palette.h"
 #include "windef.h"
 
+DEFAULT_DEBUG_CHANNEL(palette)
+
 
 /***********************************************************************
  * System color space. 
diff --git a/objects/cursoricon.c b/objects/cursoricon.c
index 7509af6..dc7c80f 100644
--- a/objects/cursoricon.c
+++ b/objects/cursoricon.c
@@ -51,6 +51,9 @@
 #include "message.h"
 #include "winerror.h"
 
+DECLARE_DEBUG_CHANNEL(cursor)
+DECLARE_DEBUG_CHANNEL(icon)
+
 static HCURSOR hActiveCursor = 0;  /* Active cursor */
 static INT CURSOR_ShowCount = 0;   /* Cursor display count */
 static RECT CURSOR_ClipRect;       /* Cursor clipping rect */
diff --git a/objects/dc.c b/objects/dc.c
index 5f8a41f..0a4b071 100644
--- a/objects/dc.c
+++ b/objects/dc.c
@@ -21,6 +21,8 @@
 #include "winerror.h"
 #include "wine/winuser16.h"
 
+DEFAULT_DEBUG_CHANNEL(dc)
+
 /***********************************************************************
  *           DC_Init_DC_INFO
  *
diff --git a/objects/dib.c b/objects/dib.c
index 3f4fabc..5d10b56 100644
--- a/objects/dib.c
+++ b/objects/dib.c
@@ -12,6 +12,8 @@
 #include "monitor.h"
 #include "palette.h"
 
+DEFAULT_DEBUG_CHANNEL(bitmap)
+
 /***********************************************************************
  *           DIB_GetDIBWidthBytes
  *
diff --git a/objects/enhmetafile.c b/objects/enhmetafile.c
index d0c7b10..8457605 100644
--- a/objects/enhmetafile.c
+++ b/objects/enhmetafile.c
@@ -11,6 +11,8 @@
 #include "winerror.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(metafile)
+
 /*****************************************************************************
  *          GetEnhMetaFile32A (GDI32.174)
  *
diff --git a/objects/font.c b/objects/font.c
index da151b2..106bc76 100644
--- a/objects/font.c
+++ b/objects/font.c
@@ -15,6 +15,9 @@
 #include "debug.h"
 #include "winerror.h"
 
+DECLARE_DEBUG_CHANNEL(font)
+DECLARE_DEBUG_CHANNEL(gdi)
+
 #define ENUM_UNICODE	0x00000001
 
 typedef struct
diff --git a/objects/gdiobj.c b/objects/gdiobj.c
index 0ab9f85..85dc5e8 100644
--- a/objects/gdiobj.c
+++ b/objects/gdiobj.c
@@ -24,6 +24,8 @@
 #include "debug.h"
 #include "gdi.h"
 
+DEFAULT_DEBUG_CHANNEL(gdi)
+
 /**********************************************************************/
 
 GDI_DRIVER *GDI_Driver = NULL;
diff --git a/objects/metafile.c b/objects/metafile.c
index 8f35e12..0fd0486 100644
--- a/objects/metafile.c
+++ b/objects/metafile.c
@@ -41,6 +41,8 @@
 #include "debug.h"
 #include "global.h"
 
+DEFAULT_DEBUG_CHANNEL(metafile)
+
 /******************************************************************
  *         MF_AddHandle
  *
diff --git a/objects/palette.c b/objects/palette.c
index 245a60a..cc51a5a 100644
--- a/objects/palette.c
+++ b/objects/palette.c
@@ -18,6 +18,8 @@
 #include "debug.h"
 #include "wine/winuser16.h"
 
+DEFAULT_DEBUG_CHANNEL(palette)
+
 PALETTE_DRIVER *PALETTE_Driver = NULL;
 
 FARPROC pfnSelectPalette = NULL;
diff --git a/objects/pen.c b/objects/pen.c
index 3621c33..c4b1a62 100644
--- a/objects/pen.c
+++ b/objects/pen.c
@@ -8,6 +8,8 @@
 #include "pen.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(gdi)
+
 
 
 /***********************************************************************
diff --git a/objects/region.c b/objects/region.c
index 0ee4c8e..17142fb 100644
--- a/objects/region.c
+++ b/objects/region.c
@@ -89,6 +89,8 @@
 #include "heap.h"
 #include "dc.h"
 
+DEFAULT_DEBUG_CHANNEL(region)
+
 typedef void (*voidProcp)();
 
 /* Note the parameter order is different from the X11 equivalents */
diff --git a/objects/text.c b/objects/text.c
index 286824a..727e891 100644
--- a/objects/text.c
+++ b/objects/text.c
@@ -16,6 +16,8 @@
 #include "cache.h"
 #include "debugstr.h"
 
+DEFAULT_DEBUG_CHANNEL(text)
+
 #define TAB     9
 #define LF     10
 #define CR     13
diff --git a/ole/antimoniker.c b/ole/antimoniker.c
index 9fd1833..9d537c3 100644
--- a/ole/antimoniker.c
+++ b/ole/antimoniker.c
@@ -14,6 +14,8 @@
 #include "objbase.h"
 #include "wine/obj_inplace.h"
 
+DEFAULT_DEBUG_CHANNEL(ole)
+
 /* AntiMoniker data structure */
 typedef struct AntiMonikerImpl{
 
diff --git a/ole/bindctx.c b/ole/bindctx.c
index 3057fd1..355a23a 100644
--- a/ole/bindctx.c
+++ b/ole/bindctx.c
@@ -11,6 +11,8 @@
 #include "debug.h"
 #include "heap.h"
 
+DEFAULT_DEBUG_CHANNEL(ole)
+
 /* represent the first size table and it's increment block size */
 #define  BLOCK_TAB_SIZE 10 
 #define  MAX_TAB_SIZE   0xFFFFFFFF
diff --git a/ole/compobj.c b/ole/compobj.c
index 4fa8f0b..1966f84 100644
--- a/ole/compobj.c
+++ b/ole/compobj.c
@@ -51,6 +51,8 @@
 
 #include "ifs.h"
 #include "compobj.h"
+
+DEFAULT_DEBUG_CHANNEL(ole)
 /****************************************************************************
  *  COM External Lock structures and methods declaration
  *
diff --git a/ole/compositemoniker.c b/ole/compositemoniker.c
index 31c90fe..400ee24 100644
--- a/ole/compositemoniker.c
+++ b/ole/compositemoniker.c
@@ -15,6 +15,8 @@
 #include "wine/obj_inplace.h"
 #include "ole2.h"
 
+DEFAULT_DEBUG_CHANNEL(ole)
+
 #define  BLOCK_TAB_SIZE 5 /* represent the first size table and it's increment block size */
 
 /* CompositeMoniker data structure */
diff --git a/ole/filemoniker.c b/ole/filemoniker.c
index a8eb1b7..3188f74 100644
--- a/ole/filemoniker.c
+++ b/ole/filemoniker.c
@@ -15,6 +15,8 @@
 #include "wine/obj_storage.h"
 #include "wine/obj_base.h"
 
+DEFAULT_DEBUG_CHANNEL(ole)
+
 /* filemoniker data structure */
 typedef struct FileMonikerImpl{
 
diff --git a/ole/ifs.c b/ole/ifs.c
index e87309d..91e9549 100644
--- a/ole/ifs.c
+++ b/ole/ifs.c
@@ -19,6 +19,8 @@
 
 #include "ifs.h"
 
+DEFAULT_DEBUG_CHANNEL(relay)
+
 /* --- IUnknown implementation */
 
 typedef struct
diff --git a/ole/itemmoniker.c b/ole/itemmoniker.c
index 64db628..8633d95 100644
--- a/ole/itemmoniker.c
+++ b/ole/itemmoniker.c
@@ -14,6 +14,8 @@
 #include "objbase.h"
 #include "wine/obj_inplace.h"
 
+DEFAULT_DEBUG_CHANNEL(ole)
+
 /* ItemMoniker data structure */
 typedef struct ItemMonikerImpl{
 
diff --git a/ole/moniker.c b/ole/moniker.c
index 44c968d..719219a 100644
--- a/ole/moniker.c
+++ b/ole/moniker.c
@@ -11,6 +11,8 @@
 #include "debug.h"
 #include "heap.h"
 
+DEFAULT_DEBUG_CHANNEL(ole)
+
 #define  BLOCK_TAB_SIZE 20 /* represent the first size table and it's increment block size */
 
 /* define the structure of the running object table elements */
diff --git a/ole/ole2.c b/ole/ole2.c
index b947d2e..8533303 100644
--- a/ole/ole2.c
+++ b/ole/ole2.c
@@ -18,6 +18,8 @@
 #include "debug.h"
 #include "ole2ver.h"
 
+DEFAULT_DEBUG_CHANNEL(ole)
+
 /******************************************************************************
  * These are static/global variables and internal data structures that the 
  * OLE module uses to maintain it's state.
diff --git a/ole/ole2disp.c b/ole/ole2disp.c
index f3e8f72..8632980 100644
--- a/ole/ole2disp.c
+++ b/ole/ole2disp.c
@@ -13,6 +13,8 @@
 #include "ldt.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(ole)
+
 /* This implementation of the BSTR API is 16-bit only. It
    represents BSTR as a 16:16 far pointer, and the strings
    as ISO-8859 */
diff --git a/ole/ole2nls.c b/ole/ole2nls.c
index 86a83f5..836cb35 100644
--- a/ole/ole2nls.c
+++ b/ole/ole2nls.c
@@ -17,6 +17,11 @@
 #include "debug.h"
 #include "main.h"
 
+DECLARE_DEBUG_CHANNEL(file)
+DECLARE_DEBUG_CHANNEL(ole)
+DECLARE_DEBUG_CHANNEL(string)
+DECLARE_DEBUG_CHANNEL(win32)
+
 struct NLS_langlocale {
 	const int lang;
 	struct NLS_localevar {
diff --git a/ole/ole2stubs.c b/ole/ole2stubs.c
index 5a48565..b1ef486 100644
--- a/ole/ole2stubs.c
+++ b/ole/ole2stubs.c
@@ -7,6 +7,8 @@
 #include "ole2.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(ole)
+
 /******************************************************************************
  *               OleCreateFromData        [OLE32.92]
  */
diff --git a/ole/olecli.c b/ole/olecli.c
index 909e537..9279f5d 100644
--- a/ole/olecli.c
+++ b/ole/olecli.c
@@ -13,6 +13,8 @@
 #include "objidl.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(ole)
+
 
 extern LONG	OLE_current_handle;
 
diff --git a/ole/oledlg.c b/ole/oledlg.c
index 960fa14..f7835d4 100644
--- a/ole/oledlg.c
+++ b/ole/oledlg.c
@@ -10,6 +10,8 @@
 #include "oledlg.h"
 #include "debug.h"
 #include "ole2.h"
+
+DEFAULT_DEBUG_CHANNEL(ole)
 /***********************************************************************
  *           OleUIAddVerbMenu32A (OLEDLG.1)
  */
diff --git a/ole/olefont.c b/ole/olefont.c
index e3a1743..5640fa1 100644
--- a/ole/olefont.c
+++ b/ole/olefont.c
@@ -15,6 +15,8 @@
 #include "debug.h"
 #include "heap.h"
 
+DEFAULT_DEBUG_CHANNEL(ole)
+
 /***********************************************************************
  * Declaration of constants used when serializing the font object.
  */
diff --git a/ole/oleobj.c b/ole/oleobj.c
index b7bc6b9..9157e2a 100644
--- a/ole/oleobj.c
+++ b/ole/oleobj.c
@@ -11,6 +11,8 @@
 #include "oleidl.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(ole)
+
 
 /**************************************************************************
  *  IOleAdviseHolder Implementation
diff --git a/ole/olesvr.c b/ole/olesvr.c
index 5b216bf..f1f4238 100644
--- a/ole/olesvr.c
+++ b/ole/olesvr.c
@@ -10,6 +10,8 @@
 #include "ole.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(ole)
+
 LONG	OLE_current_handle;
 
 /******************************************************************************
diff --git a/ole/safearray.c b/ole/safearray.c
index 52cbde3..31d3bda 100644
--- a/ole/safearray.c
+++ b/ole/safearray.c
@@ -16,6 +16,8 @@
 #include "wine/obj_base.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(ole)
+
 /* Localy used methods */
 static INT  
 endOfDim(LONG *coor, SAFEARRAYBOUND *mat, LONG dim, LONG realDim);
diff --git a/ole/stg_stream.c b/ole/stg_stream.c
index 5780f62..906c8bb 100644
--- a/ole/stg_stream.c
+++ b/ole/stg_stream.c
@@ -20,6 +20,8 @@
 
 #include "storage32.h"
 
+DEFAULT_DEBUG_CHANNEL(ole)
+
 
 /*
  * Virtual function table for the StgStreamImpl class.
diff --git a/ole/storage.c b/ole/storage.c
index d9abc1d..1f381d4 100644
--- a/ole/storage.c
+++ b/ole/storage.c
@@ -23,6 +23,9 @@
 #include "ldt.h"
 #include "debug.h"
 
+DECLARE_DEBUG_CHANNEL(ole)
+DECLARE_DEBUG_CHANNEL(relay)
+
 struct storage_header {
 	BYTE	magic[8];	/* 00: magic */
 	BYTE	unknown1[36];	/* 08: unknown */
diff --git a/ole/storage32.c b/ole/storage32.c
index 24e45e9..3b585df 100644
--- a/ole/storage32.c
+++ b/ole/storage32.c
@@ -27,6 +27,8 @@
 #include "storage32.h"
 #include "ole2.h"
 
+DEFAULT_DEBUG_CHANNEL(ole)
+
 #define FILE_BEGIN 0
 
 static const char rootPropertyName[] = "Root Entry";
diff --git a/ole/typelib.c b/ole/typelib.c
index 504a5c8..b4bf48d 100644
--- a/ole/typelib.c
+++ b/ole/typelib.c
@@ -17,6 +17,8 @@
 #include "debug.h"
 #include "winversion.h"
 
+DEFAULT_DEBUG_CHANNEL(ole)
+
 /****************************************************************************
  *		QueryPathOfRegTypeLib16	[TYPELIB.14]
  *
diff --git a/ole/variant.c b/ole/variant.c
index 4bccf49..681a078 100644
--- a/ole/variant.c
+++ b/ole/variant.c
@@ -27,6 +27,8 @@
 #include "winerror.h"
 #include "parsedt.h"
 
+DEFAULT_DEBUG_CHANNEL(ole)
+
 #include <string.h>
 #include <stdlib.h>
 #include <math.h>
diff --git a/relay32/builtin32.c b/relay32/builtin32.c
index a8421a3..fd22414 100644
--- a/relay32/builtin32.c
+++ b/relay32/builtin32.c
@@ -17,6 +17,9 @@
 #include "snoop.h"
 #include "winerror.h"
 
+DECLARE_DEBUG_CHANNEL(relay)
+DECLARE_DEBUG_CHANNEL(win32)
+
 typedef struct
 {
     BYTE  call;                    /* 0xe8 call callfrom32 (relative) */
diff --git a/relay32/relay386.c b/relay32/relay386.c
index 50c96819..ef96419 100644
--- a/relay32/relay386.c
+++ b/relay32/relay386.c
@@ -14,6 +14,8 @@
 #include "debug.h"
 #include "main.h"
 
+DEFAULT_DEBUG_CHANNEL(relay)
+
 char **debug_relay_excludelist = NULL, **debug_relay_includelist = NULL;
 
 #ifdef __i386__
diff --git a/relay32/snoop.c b/relay32/snoop.c
index 645ecd5..2852150 100644
--- a/relay32/snoop.c
+++ b/relay32/snoop.c
@@ -19,6 +19,8 @@
 #include "debugstr.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(snoop)
+
 char **debug_snoop_excludelist = NULL, **debug_snoop_includelist = NULL;
 
 #ifdef __i386__
diff --git a/relay32/utthunk.c b/relay32/utthunk.c
index 9be4261..139ba33 100644
--- a/relay32/utthunk.c
+++ b/relay32/utthunk.c
@@ -13,6 +13,8 @@
 #include "debug.h"
 #include "debugstr.h"
 
+DEFAULT_DEBUG_CHANNEL(thunk)
+
 #pragma pack(1)
 
 typedef struct
diff --git a/scheduler/critsection.c b/scheduler/critsection.c
index 1c0c024..1f1d410 100644
--- a/scheduler/critsection.c
+++ b/scheduler/critsection.c
@@ -15,6 +15,8 @@
 #include "debug.h"
 #include "thread.h"
 
+DEFAULT_DEBUG_CHANNEL(win32)
+
 
 /***********************************************************************
  *           InitializeCriticalSection   (KERNEL32.472) (NTDLL.406)
diff --git a/scheduler/process.c b/scheduler/process.c
index 5811498..52488d0 100644
--- a/scheduler/process.c
+++ b/scheduler/process.c
@@ -25,6 +25,10 @@
 #include "callback.h"
 #include "debug.h"
 
+DECLARE_DEBUG_CHANNEL(process)
+DECLARE_DEBUG_CHANNEL(relay)
+DECLARE_DEBUG_CHANNEL(win32)
+
 
 /* The initial process PDB */
 static PDB initial_pdb;
diff --git a/scheduler/services.c b/scheduler/services.c
index a4f8de5..5cb2a03 100644
--- a/scheduler/services.c
+++ b/scheduler/services.c
@@ -10,6 +10,8 @@
 #include "services.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(timer)
+
 
 #define SERVICE_USE_OBJECT      0x0001
 #define SERVICE_USE_TIMEOUT     0x0002
diff --git a/scheduler/sysdeps.c b/scheduler/sysdeps.c
index 002462d..764a366 100644
--- a/scheduler/sysdeps.c
+++ b/scheduler/sysdeps.c
@@ -30,6 +30,8 @@
 #include "winbase.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(thread)
+
 #ifdef linux
 #define HAVE_CLONE_SYSCALL
 #endif
diff --git a/scheduler/syslevel.c b/scheduler/syslevel.c
index 5b3588e..321e40f 100644
--- a/scheduler/syslevel.c
+++ b/scheduler/syslevel.c
@@ -10,6 +10,8 @@
 #include "stackframe.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(win32)
+
 static CRITICAL_SECTION Win16Mutex;
 static SEGPTR segpWin16Mutex;
 
diff --git a/scheduler/thread.c b/scheduler/thread.c
index c3a39b2..87404f3 100644
--- a/scheduler/thread.c
+++ b/scheduler/thread.c
@@ -25,6 +25,8 @@
 #include "queue.h"
 #include "hook.h"
 
+DEFAULT_DEBUG_CHANNEL(thread)
+
 #ifndef __i386__
 THDB *pCurrentThread;
 #endif
diff --git a/tools/find_debug_channels b/tools/find_debug_channels
old mode 100644
new mode 100755
index c5e72e9..ac6d741
--- a/tools/find_debug_channels
+++ b/tools/find_debug_channels
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # This script scans the whole source code for symbols of the form 
 # 'xxx(yyy' where:
@@ -28,23 +28,20 @@
 # or add /dev/null as another argument.
 #
 # Dimitrie O. Paun <dimi@cs.toronto.edu>
+# Patrik Stridvall <ps@leissner.se>
 #
 
 case "$#" in
     0 | 1)  files=${1:-'*.c'}
-	    if [ ${files#*/} = "$files" ]; then
-		files=$(find . -name "$files" -print)
+	    if [ `echo $files | sed 's/^\(.*\)\/$/\1/g'` = "$files" ]; then
+		files=`find . -name "$files" -print`
 	    fi;;
     *    )  files="$@";;
 esac
 
 (
-grep -h "TRACE *(" $files /dev/null | \
-    sed 's/.*TRACE *( *\([A-Za-z0-9_]*\).*/\1/g'
-grep -h "ERR *(" $files /dev/null | \
-    sed 's/.*ERR *( *\([A-Za-z0-9_]*\).*/\1/g'
-grep -h "FIXME *(" $files /dev/null | \
-    sed 's/.*FIXME *( *\([A-Za-z0-9_]*\).*/\1/g'
-grep -h "WARN *(" $files /dev/null | \
-    sed 's/.*WARN *( *\([A-Za-z0-9_]*\).*/\1/g'
+grep -h "DECLARE_DEBUG_CHANNEL *(" $files /dev/null | \
+    sed 's/.*DECLARE_DEBUG_CHANNEL( *\([A-Za-z0-9_]*\) *).*/\1/g'
+grep -h "DEFAULT_DEBUG_CHANNEL *(" $files /dev/null | \
+    sed 's/.*DEFAULT_DEBUG_CHANNEL( *\([A-Za-z0-9_]*\) *).*/\1/g'
 ) | sort | uniq
diff --git a/tools/make_X11wrappers b/tools/make_X11wrappers
index 4ecffae..a4d6df0 100755
--- a/tools/make_X11wrappers
+++ b/tools/make_X11wrappers
@@ -109,6 +109,8 @@
 $x11_incl#include <X11/$extensions_dir$name.h>
 #include "debug.h"
 #include "x11drv.h"
+
+DEFAULT_DEBUG_CHANNEL(x11)
 END
 
     if($name eq "xpm") {	# Handle as special case.
diff --git a/tools/make_debug b/tools/make_debug
index 2c1d5c6..2c6feae 100755
--- a/tools/make_debug
+++ b/tools/make_debug
@@ -1,90 +1,72 @@
-#!/bin/bash
+#!/bin/sh
 #
-# This script generates the required files for supporting the debug
+# This script generates the required file for supporting the debug
 # channels used throught the code.
-# The generated files are 
+# The generated file is
 #   include/debugdefs.h
-#   include/debug.h
 # The script must be run in the root directory of the project.
 #
 # Dimitrie O. Paun <dimi@cs.toronto.edu>
+# Patrik Stridvall <ps@leissner.se>
 #
-DEBUG_H="include/debug.h"
-DEBUG_DEFS_H="include/debugdefs.h"
 
-DEBUG_CHANNELS="$( tools/find_debug_channels )"
-DEBUG_CLASSES="fixme err warn trace"
+DEBUG_CHANNELS=`tools/find_debug_channels`
 
-{
-    cat <<EOF
+exec > include/debugdefs.h
+
+cat <<EOF
 /* Do not modify this file -- it is automatically generated! */
 
-#ifndef __WINE_DEBUGTOOLS_H
 #include "debugtools.h"
-#endif
 
-EOF
-    echo "/* Definitions for channels identifiers */"
+#define DEBUG_CLASS_COUNT __DBCL_COUNT
 
-    chno=0
-    for ch in $DEBUG_CHANNELS
-    do
-	echo "#define dbch_${ch} $chno"
-	let chno=$chno+1
-    done
-
-    echo "/* Definitions for classes identifiers */"
-    clno=0
-    for cl in $DEBUG_CLASSES
-    do
-	echo "#define dbcl_${cl} $clno"
-	let clno=$clno+1
-    done
-} > $DEBUG_H
-
-# Now, on the last step, we proceed to construct
-# the definitions to be used by the main function.
-# These will be stored in include/debugdefs.h
-{
-    cat <<EOF
-/* Do not modify this file -- it is automatically generated! */
-
-#ifndef __WINE_DEBUGTOOLS_H
-#include "debugtools.h"
-#endif
-
-#define DEBUG_CHANNEL_COUNT $chno
 #ifdef DEBUG_RUNTIME
-short debug_msg_enabled[][DEBUG_CLASS_COUNT] = {
+
+const char * const debug_cl_name[] = { "fixme", "err", "warn", "trace" };
+
 EOF
 
-    for ch in $DEBUG_CHANNELS
-    do
+chno=0
+for ch in $DEBUG_CHANNELS
+do
+    echo "int dbch_$ch = $chno;"
+    chno=`expr $chno + 1`
+done
+echo
+echo "#define DEBUG_CHANNEL_COUNT $chno"
+
+count=1
+echo
+echo 'char debug_msg_enabled[DEBUG_CHANNEL_COUNT][DEBUG_CLASS_COUNT] = {'
+for ch in $DEBUG_CHANNELS
+do
+    if [ "${count}" != "${chno}" ]; then
 	echo "{1, 1, 0, 0},"
-    done
-    echo '};'
+    else
+	echo "{1, 1, 0, 0}"
+    fi
+    count=`expr $count + 1`
+done
+echo '};'
 
-    echo 'const char* debug_ch_name[] = {'
-    for ch in $DEBUG_CHANNELS
-    do
-	echo "\"${ch}\","
-    done
-    echo '};'
-    
-    echo 'const char* debug_cl_name[] = {'
-    for ch in $DEBUG_CLASSES
-    do
-	echo "\"${ch}\","
-    done
-    echo '};'
+count=1
+echo
+echo 'const char * const debug_ch_name[DEBUG_CHANNEL_COUNT] = {'
+for ch in $DEBUG_CHANNELS
+do
+    if [ "${count}" != "${chno}" ]; then
+	echo "\"${ch}\",";
+    else
+    echo "\"${ch}\"";
+    fi
+    count=`expr $count + 1`
+done
+echo '};'
 
-    cat <<EOF
+cat <<EOF
 
 #endif /*DEBUG_RUNTIME*/
 
 /* end of automatically generated debug.h */
 EOF
-
-} > $DEBUG_DEFS_H
-
-
diff --git a/tsx11/ts_xf86dga.c b/tsx11/ts_xf86dga.c
index 393bf15..089a7ee 100644
--- a/tsx11/ts_xf86dga.c
+++ b/tsx11/ts_xf86dga.c
@@ -15,6 +15,8 @@
 #include "debug.h"
 #include "x11drv.h"
 
+DEFAULT_DEBUG_CHANNEL(x11)
+
 Bool TSXF86DGAQueryVersion(Display*a0,int*a1,int*a2)
 {
   Bool r;
diff --git a/tsx11/ts_xf86vmode.c b/tsx11/ts_xf86vmode.c
index c3775f9..4f36b13 100644
--- a/tsx11/ts_xf86vmode.c
+++ b/tsx11/ts_xf86vmode.c
@@ -18,6 +18,8 @@
 #include "debug.h"
 #include "x11drv.h"
 
+DEFAULT_DEBUG_CHANNEL(x11)
+
 Bool TSXF86VidModeQueryVersion(Display*a0,int*a1,int*a2)
 {
   Bool r;
diff --git a/tsx11/ts_xlib.c b/tsx11/ts_xlib.c
index d4b6a48..b5ac61d 100644
--- a/tsx11/ts_xlib.c
+++ b/tsx11/ts_xlib.c
@@ -13,6 +13,8 @@
 #include "debug.h"
 #include "x11drv.h"
 
+DEFAULT_DEBUG_CHANNEL(x11)
+
 XFontStruct * TSXLoadQueryFont(Display* a0, const  char* a1)
 {
   XFontStruct * r;
diff --git a/tsx11/ts_xpm.c b/tsx11/ts_xpm.c
index a7a1803..619266b 100644
--- a/tsx11/ts_xpm.c
+++ b/tsx11/ts_xpm.c
@@ -14,6 +14,8 @@
 #include "debug.h"
 #include "x11drv.h"
 
+DEFAULT_DEBUG_CHANNEL(x11)
+
 int TSXpmCreatePixmapFromData(Display *a0, Drawable a1, char **a2, Pixmap *a3, Pixmap *a4, XpmAttributes *a5)
 {
   int r;
diff --git a/tsx11/ts_xresource.c b/tsx11/ts_xresource.c
index ba5c542..17841c6 100644
--- a/tsx11/ts_xresource.c
+++ b/tsx11/ts_xresource.c
@@ -14,6 +14,8 @@
 #include "debug.h"
 #include "x11drv.h"
 
+DEFAULT_DEBUG_CHANNEL(x11)
+
 XrmQuark  TSXrmUniqueQuark(void)
 {
   XrmQuark  r;
diff --git a/tsx11/ts_xshm.c b/tsx11/ts_xshm.c
index e2f7b39..e92f10c 100644
--- a/tsx11/ts_xshm.c
+++ b/tsx11/ts_xshm.c
@@ -15,6 +15,8 @@
 #include "debug.h"
 #include "x11drv.h"
 
+DEFAULT_DEBUG_CHANNEL(x11)
+
 Bool TSXShmQueryExtension(Display *a0)
 {
   Bool r;
diff --git a/tsx11/ts_xutil.c b/tsx11/ts_xutil.c
index fa227cc..61655ce 100644
--- a/tsx11/ts_xutil.c
+++ b/tsx11/ts_xutil.c
@@ -15,6 +15,8 @@
 #include "debug.h"
 #include "x11drv.h"
 
+DEFAULT_DEBUG_CHANNEL(x11)
+
 XClassHint * TSXAllocClassHint(void)
 {
   XClassHint * r;
diff --git a/win32/code_page.c b/win32/code_page.c
index 041340b..6e89be1 100644
--- a/win32/code_page.c
+++ b/win32/code_page.c
@@ -10,6 +10,8 @@
 #include "heap.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(win32)
+
 
 /******************************************************************************
  * GetACP [KERNEL32.276]  Gets current ANSI code-page identifier.
diff --git a/win32/console.c b/win32/console.c
index d416fa2..4f66be4 100644
--- a/win32/console.c
+++ b/win32/console.c
@@ -48,6 +48,8 @@
 #include "server/request.h"
 #include "server.h"
 
+DEFAULT_DEBUG_CHANNEL(console)
+
 
 /* FIXME:  Should be in an internal header file.  OK, so which one?
    Used by CONSOLE_makecomplex. */
diff --git a/win32/device.c b/win32/device.c
index 9abb5df..06f042b 100644
--- a/win32/device.c
+++ b/win32/device.c
@@ -32,6 +32,8 @@
 #include "miscemu.h"
 #include "server.h"
 
+DEFAULT_DEBUG_CHANNEL(win32)
+
 
 static BOOL DeviceIo_VTDAPI(DWORD dwIoControlCode, 
 			      LPVOID lpvInBuffer, DWORD cbInBuffer,
diff --git a/win32/except.c b/win32/except.c
index d65cf6e..75e154e 100644
--- a/win32/except.c
+++ b/win32/except.c
@@ -41,6 +41,9 @@
 #include "except.h"
 #include "stackframe.h"
 
+DECLARE_DEBUG_CHANNEL(relay)
+DECLARE_DEBUG_CHANNEL(win32)
+
 #define TEB_EXCEPTION_FRAME(pcontext) \
     ((PEXCEPTION_FRAME)((TEB *)GET_SEL_BASE((pcontext)->SegFs))->except)
 
diff --git a/win32/file.c b/win32/file.c
index da22d01..93c757c 100644
--- a/win32/file.c
+++ b/win32/file.c
@@ -22,6 +22,8 @@
 #include "heap.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(file)
+
 DWORD ErrnoToLastError(int errno_num);
 
 /***********************************************************************
diff --git a/win32/init.c b/win32/init.c
index ce0bdb3..6404433 100644
--- a/win32/init.c
+++ b/win32/init.c
@@ -15,6 +15,8 @@
 #include "task.h"
 #include "debug.h"
 #include "process.h"
+
+DEFAULT_DEBUG_CHANNEL(win32)
   
 /***********************************************************************
  *              GetStartupInfoA         (KERNEL32.273)
diff --git a/win32/kernel32.c b/win32/kernel32.c
index 919f3c6..44d13ff 100644
--- a/win32/kernel32.c
+++ b/win32/kernel32.c
@@ -28,6 +28,10 @@
 #include "syslevel.h"
 #include "winerror.h"
 
+DECLARE_DEBUG_CHANNEL(dosmem)
+DECLARE_DEBUG_CHANNEL(thunk)
+DECLARE_DEBUG_CHANNEL(win32)
+
 
 /***********************************************************************
  *                                                                     *
diff --git a/win32/newfns.c b/win32/newfns.c
index fe50432..7720b0d 100644
--- a/win32/newfns.c
+++ b/win32/newfns.c
@@ -16,6 +16,9 @@
 #include "debug.h"
 #include "debugstr.h"
 
+DECLARE_DEBUG_CHANNEL(debug)
+DECLARE_DEBUG_CHANNEL(win32)
+
 
 /****************************************************************************
  *		QueryPerformanceCounter (KERNEL32.564)
diff --git a/win32/ordinals.c b/win32/ordinals.c
index dc1dc13..d740acd 100644
--- a/win32/ordinals.c
+++ b/win32/ordinals.c
@@ -17,6 +17,11 @@
 #include "stackframe.h"
 #include "debug.h"
 
+DECLARE_DEBUG_CHANNEL(dosmem)
+DECLARE_DEBUG_CHANNEL(thread)
+DECLARE_DEBUG_CHANNEL(win)
+DECLARE_DEBUG_CHANNEL(win32)
+
 /**********************************************************************
  *           WOWGetDescriptor        (KERNEL32.88) (WOW32.1)
  */
diff --git a/win32/process.c b/win32/process.c
index d5e1379..98325b9 100644
--- a/win32/process.c
+++ b/win32/process.c
@@ -18,6 +18,8 @@
 #include "toolhelp.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(win32)
+
 
 /**********************************************************************
  *  ContinueDebugEvent [KERNEL32.146]
diff --git a/win32/time.c b/win32/time.c
index f3b0fb2..8607102 100644
--- a/win32/time.c
+++ b/win32/time.c
@@ -12,6 +12,8 @@
 #include "winerror.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(win32)
+
 /***********************************************************************
  *              GetLocalTime            (KERNEL32.228)
  */
diff --git a/windows/caret.c b/windows/caret.c
index b0f04d3..d66a03b 100644
--- a/windows/caret.c
+++ b/windows/caret.c
@@ -10,6 +10,8 @@
 #include "module.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(caret)
+
 typedef struct
 {
     HWND     hwnd;
diff --git a/windows/class.c b/windows/class.c
index 31689e3..6f7f645 100644
--- a/windows/class.c
+++ b/windows/class.c
@@ -26,6 +26,8 @@
 #include "winerror.h"
 #include "wine/winuser16.h"
 
+DEFAULT_DEBUG_CHANNEL(class)
+
 
 static CLASS *firstClass = NULL;
 
diff --git a/windows/clipboard.c b/windows/clipboard.c
index 031fc08..b64e169 100644
--- a/windows/clipboard.c
+++ b/windows/clipboard.c
@@ -21,6 +21,8 @@
 #include "xmalloc.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(clipboard)
+
 #define  CF_REGFORMATBASE 	0xC000
 
 /**************************************************************************
diff --git a/windows/dce.c b/windows/dce.c
index da386ea..a136310 100644
--- a/windows/dce.c
+++ b/windows/dce.c
@@ -30,6 +30,8 @@
 #include "debug.h"
 #include "wine/winuser16.h"
 
+DEFAULT_DEBUG_CHANNEL(dc)
+
 #define NB_DCE    5  /* Number of DCEs created at startup */
 
 static DCE *firstDCE = 0;
diff --git a/windows/defwnd.c b/windows/defwnd.c
index 8c641a0..f39a649 100644
--- a/windows/defwnd.c
+++ b/windows/defwnd.c
@@ -19,6 +19,8 @@
 #include "tweak.h"
 #include "wine/winuser16.h"
 
+DEFAULT_DEBUG_CHANNEL(win)
+
   /* Last COLOR id */
 #define COLOR_MAX   COLOR_BTNHIGHLIGHT
 
diff --git a/windows/dialog.c b/windows/dialog.c
index 411147f..46b6b06 100644
--- a/windows/dialog.c
+++ b/windows/dialog.c
@@ -23,6 +23,8 @@
 #include "sysmetrics.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(dialog)
+
 
   /* Dialog control information */
 typedef struct
diff --git a/windows/dinput.c b/windows/dinput.c
index 800e489..09ddadf 100644
--- a/windows/dinput.c
+++ b/windows/dinput.c
@@ -34,6 +34,8 @@
 #include "mouse.h"
 #include "sysmetrics.h"
 
+DEFAULT_DEBUG_CHANNEL(dinput)
+
 extern BYTE InputKeyStateTable[256];
 extern int min_keycode, max_keycode;
 extern WORD keyc2vkey[256];
diff --git a/windows/display.c b/windows/display.c
index 9f1b7cf..16e3735 100644
--- a/windows/display.c
+++ b/windows/display.c
@@ -11,6 +11,8 @@
 #include "windef.h"
 #include "wine/winuser16.h"
 
+DEFAULT_DEBUG_CHANNEL(cursor)
+
 /***********************************************************************
  *           DISPLAY_Inquire			(DISPLAY.101)
  */
diff --git a/windows/driver.c b/windows/driver.c
index f18fe0d..0350270 100644
--- a/windows/driver.c
+++ b/windows/driver.c
@@ -18,6 +18,8 @@
 #include "debug.h"
 #include "mmsystem.h"
 
+DEFAULT_DEBUG_CHANNEL(driver)
+
 static LPWINE_DRIVER	lpDrvItemList = NULL;
 
 /* TODO list :
diff --git a/windows/focus.c b/windows/focus.c
index de081ef..50f792d 100644
--- a/windows/focus.c
+++ b/windows/focus.c
@@ -14,6 +14,8 @@
 #include "task.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(win)
+
 
 /*****************************************************************
  *	         FOCUS_SwitchFocus 
diff --git a/windows/hook.c b/windows/hook.c
index 3fa7db8..e599677 100644
--- a/windows/hook.c
+++ b/windows/hook.c
@@ -26,6 +26,8 @@
 #include "winproc.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(hook)
+
 #pragma pack(1)
 
   /* Hook data (pointed to by a HHOOK) */
diff --git a/windows/input.c b/windows/input.c
index 17233d7..6642c21 100644
--- a/windows/input.c
+++ b/windows/input.c
@@ -31,6 +31,12 @@
 #include "winerror.h"
 #include "task.h"
 
+DECLARE_DEBUG_CHANNEL(accel)
+DECLARE_DEBUG_CHANNEL(event)
+DECLARE_DEBUG_CHANNEL(key)
+DECLARE_DEBUG_CHANNEL(keyboard)
+DECLARE_DEBUG_CHANNEL(win)
+
 static BOOL InputEnabled = TRUE;
 static BOOL SwappedButtons = FALSE;
 
diff --git a/windows/keyboard.c b/windows/keyboard.c
index e941485..7080f13 100644
--- a/windows/keyboard.c
+++ b/windows/keyboard.c
@@ -24,6 +24,9 @@
 #include "struct32.h"
 #include "winerror.h"
 
+DECLARE_DEBUG_CHANNEL(event)
+DECLARE_DEBUG_CHANNEL(keyboard)
+
 /**********************************************************************/
 
 KEYBOARD_DRIVER *KEYBOARD_Driver = NULL;
diff --git a/windows/mdi.c b/windows/mdi.c
index e057074..17e8e23 100644
--- a/windows/mdi.c
+++ b/windows/mdi.c
@@ -28,6 +28,8 @@
 #include "tweak.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(mdi)
+
 #define MDIF_NEEDUPDATE		0x0001
 
 static HBITMAP16 hBmpClose   = 0;
diff --git a/windows/message.c b/windows/message.c
index f188849..96072a1 100644
--- a/windows/message.c
+++ b/windows/message.c
@@ -30,6 +30,10 @@
 #include "struct32.h"
 #include "debug.h"
 
+DECLARE_DEBUG_CHANNEL(key)
+DECLARE_DEBUG_CHANNEL(msg)
+DECLARE_DEBUG_CHANNEL(sendmsg)
+
 #define WM_NCMOUSEFIRST         WM_NCMOUSEMOVE
 #define WM_NCMOUSELAST          WM_NCMBUTTONDBLCLK
 
diff --git a/windows/mouse.c b/windows/mouse.c
index 115fd0c..04b7d28 100644
--- a/windows/mouse.c
+++ b/windows/mouse.c
@@ -11,6 +11,8 @@
 #include "winuser.h"
 #include "win.h"
 
+DEFAULT_DEBUG_CHANNEL(event)
+
 /**********************************************************************/
 
 MOUSE_DRIVER *MOUSE_Driver = NULL;
diff --git a/windows/msgbox.c b/windows/msgbox.c
index d71a48d..47b2670 100644
--- a/windows/msgbox.c
+++ b/windows/msgbox.c
@@ -16,6 +16,8 @@
 #include "debugstr.h"
 #include "tweak.h"
 
+DEFAULT_DEBUG_CHANNEL(dialog)
+
 /**************************************************************************
  *           MSGBOX_DlgProc
  *
diff --git a/windows/nonclient.c b/windows/nonclient.c
index ebc1b2f..fa8a0d7 100644
--- a/windows/nonclient.c
+++ b/windows/nonclient.c
@@ -27,6 +27,9 @@
 #include "shellapi.h"
 #include "cache.h"
 
+DECLARE_DEBUG_CHANNEL(nonclient)
+DECLARE_DEBUG_CHANNEL(shell)
+
 static HBITMAP16 hbitmapClose = 0;
 static HBITMAP16 hbitmapCloseD = 0;
 static HBITMAP16 hbitmapMinimize = 0;
diff --git a/windows/painting.c b/windows/painting.c
index 5cc8d3f..e4b389b 100644
--- a/windows/painting.c
+++ b/windows/painting.c
@@ -14,6 +14,9 @@
 #include "debug.h"
 #include "wine/winuser16.h"
 
+DECLARE_DEBUG_CHANNEL(nonclient)
+DECLARE_DEBUG_CHANNEL(win)
+
 /* client rect in window coordinates */
 
 #define GETCLIENTRECTW( wnd, r )	(r).left = (wnd)->rectClient.left - (wnd)->rectWindow.left; \
diff --git a/windows/property.c b/windows/property.c
index b93dd6f..0772b81 100644
--- a/windows/property.c
+++ b/windows/property.c
@@ -9,6 +9,8 @@
 #include "heap.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(prop)
+
 
 typedef struct tagPROPERTY
 {
diff --git a/windows/queue.c b/windows/queue.c
index 4d8a160..8e2bd49 100644
--- a/windows/queue.c
+++ b/windows/queue.c
@@ -21,6 +21,9 @@
 #include "debug.h"
 #include "spy.h"
 
+DECLARE_DEBUG_CHANNEL(msg)
+DECLARE_DEBUG_CHANNEL(sendmsg)
+
 #define MAX_QUEUE_SIZE   120  /* Max. size of a message queue */
 
 static HQUEUE16 hFirstQueue = 0;
diff --git a/windows/scroll.c b/windows/scroll.c
index 97523b0..2418384 100644
--- a/windows/scroll.c
+++ b/windows/scroll.c
@@ -19,6 +19,8 @@
 #include "sysmetrics.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(scroll)
+
 /*************************************************************************
  *             ScrollWindow16   (USER.61)
  */
diff --git a/windows/syscolor.c b/windows/syscolor.c
index 71254fd..f06db7e 100644
--- a/windows/syscolor.c
+++ b/windows/syscolor.c
@@ -16,6 +16,8 @@
 #include "winreg.h"
 #include "winversion.h"
 
+DEFAULT_DEBUG_CHANNEL(syscolor)
+
 static const char * const DefSysColors[] =
 {
     "Scrollbar", "224 224 224",      /* COLOR_SCROLLBAR           */
diff --git a/windows/timer.c b/windows/timer.c
index 2124c47..88bce99 100644
--- a/windows/timer.c
+++ b/windows/timer.c
@@ -10,6 +10,8 @@
 #include "winproc.h"
 #include "debug.h"
 
+DEFAULT_DEBUG_CHANNEL(timer)
+
 
 typedef struct tagTIMER
 {
diff --git a/windows/user.c b/windows/user.c
index 22dc18f..96781f1 100644
--- a/windows/user.c
+++ b/windows/user.c
@@ -30,6 +30,12 @@
 #include "process.h"
 #include "debug.h"
 
+DECLARE_DEBUG_CHANNEL(hook)
+DECLARE_DEBUG_CHANNEL(local)
+DECLARE_DEBUG_CHANNEL(system)
+DECLARE_DEBUG_CHANNEL(win)
+DECLARE_DEBUG_CHANNEL(win32)
+
 /***********************************************************************
  *           GetFreeSystemResources   (USER.284)
  */
diff --git a/windows/win.c b/windows/win.c
index 5dc7bea..7989457 100644
--- a/windows/win.c
+++ b/windows/win.c
@@ -34,6 +34,9 @@
 #include "local.h"
 #include "desktop.h"
 
+DECLARE_DEBUG_CHANNEL(msg)
+DECLARE_DEBUG_CHANNEL(win)
+
 /**********************************************************************/
 
 WND_DRIVER *WND_Driver = NULL;
diff --git a/windows/winhelp.c b/windows/winhelp.c
index 991ac5f..62d6ea6 100644
--- a/windows/winhelp.c
+++ b/windows/winhelp.c
@@ -12,6 +12,8 @@
 #include "heap.h"
 #include "ldt.h"
 
+DEFAULT_DEBUG_CHANNEL(win)
+
 
 /**********************************************************************
  *             WinHelp16   (USER.171)
diff --git a/windows/winpos.c b/windows/winpos.c
index b64e626..88f8dd4 100644
--- a/windows/winpos.c
+++ b/windows/winpos.c
@@ -24,6 +24,8 @@
 #include "local.h"
 #include "ldt.h"
 
+DEFAULT_DEBUG_CHANNEL(win)
+
 #define HAS_DLGFRAME(style,exStyle) \
     (((exStyle) & WS_EX_DLGMODALFRAME) || \
      (((style) & WS_DLGFRAME) && !((style) & WS_BORDER)))
diff --git a/windows/winproc.c b/windows/winproc.c
index 601ecf2..94bf14a 100644
--- a/windows/winproc.c
+++ b/windows/winproc.c
@@ -19,6 +19,10 @@
 #include "task.h"
 #include "thread.h"
 
+DECLARE_DEBUG_CHANNEL(msg)
+DECLARE_DEBUG_CHANNEL(relay)
+DECLARE_DEBUG_CHANNEL(win)
+
 /* Window procedure 16-to-32-bit thunk,
  * see BuildSpec16Files() in tools/build.c */
 
diff --git a/windows/x11drv/clipboard.c b/windows/x11drv/clipboard.c
index 92da752..cb07e66 100644
--- a/windows/x11drv/clipboard.c
+++ b/windows/x11drv/clipboard.c
@@ -20,6 +20,8 @@
 #include "windef.h"
 #include "x11drv.h"
 
+DEFAULT_DEBUG_CHANNEL(clipboard)
+
 extern HWND hWndClipOwner;
 extern HWND hWndClipWindow;
 extern WINE_CLIPFORMAT ClipFormats[];
diff --git a/windows/x11drv/event.c b/windows/x11drv/event.c
index 1577b8b..f4351c2 100644
--- a/windows/x11drv/event.c
+++ b/windows/x11drv/event.c
@@ -35,6 +35,9 @@
 #include "winsock.h"
 #include "windef.h"
 #include "x11drv.h"
+
+DECLARE_DEBUG_CHANNEL(event)
+DECLARE_DEBUG_CHANNEL(win)
   
 /* X context to associate a hwnd to an X window */
 extern XContext winContext;
diff --git a/windows/x11drv/keyboard.c b/windows/x11drv/keyboard.c
index 3f304c6..16f2087 100644
--- a/windows/x11drv/keyboard.c
+++ b/windows/x11drv/keyboard.c
@@ -28,6 +28,9 @@
 #include "x11drv.h"
 #include "winnls.h"
 
+DECLARE_DEBUG_CHANNEL(key)
+DECLARE_DEBUG_CHANNEL(keyboard)
+
 extern LPBYTE pKeyStateTable;
 
 int min_keycode, max_keycode, keysyms_per_keycode;
diff --git a/windows/x11drv/mouse.c b/windows/x11drv/mouse.c
index 44192b8..3fcfa0e 100644
--- a/windows/x11drv/mouse.c
+++ b/windows/x11drv/mouse.c
@@ -17,6 +17,8 @@
 #include "windef.h"
 #include "x11drv.h"
 
+DEFAULT_DEBUG_CHANNEL(cursor)
+
 /**********************************************************************/
 
 Cursor X11DRV_MOUSE_XCursor = None;    /* Current X cursor */
diff --git a/windows/x11drv/wnd.c b/windows/x11drv/wnd.c
index 1993d5e..7432f97 100644
--- a/windows/x11drv/wnd.c
+++ b/windows/x11drv/wnd.c
@@ -30,6 +30,8 @@
 #include "x11drv.h"
 #include "wine/winuser16.h"
 
+DEFAULT_DEBUG_CHANNEL(win)
+
 /**********************************************************************/
 
 extern Cursor X11DRV_MOUSE_XCursor;  /* Current X cursor */