Converted to the new debugging interface (done with the help of the
script written by Patrik Stridvall).

diff --git a/loader/dos/dosvm.c b/loader/dos/dosvm.c
index 31cb259..c50ca24 100644
--- a/loader/dos/dosvm.c
+++ b/loader/dos/dosvm.c
@@ -30,7 +30,7 @@
 #include "ldt.h"
 #include "dosexe.h"
 #include "dosmod.h"
-#include "debug.h"
+#include "debugtools.h"
 
 DECLARE_DEBUG_CHANNEL(int)
 DECLARE_DEBUG_CHANNEL(module)
@@ -140,19 +140,19 @@
       /* it's an IRQ, move it to "current" list */
       event->next = lpDosTask->current;
       lpDosTask->current = event;
-      TRACE(int,"dispatching IRQ %d\n",event->irq);
+      TRACE_(int)("dispatching IRQ %d\n",event->irq);
       /* note that if DOSVM_SimulateInt calls an internal interrupt directly,
        * lpDosTask->current might be cleared (and event freed) in this very call! */
       DOSVM_SimulateInt((event->irq<8)?(event->irq+8):(event->irq-8+0x70),context,lpDosTask);
     } else {
       /* callback event */
-      TRACE(int,"dispatching callback event\n");
+      TRACE_(int)("dispatching callback event\n");
       (*event->relay)(lpDosTask,context,event->data);
       free(event);
     }
   }
   if (!SHOULD_PEND(lpDosTask->pending)) {
-    TRACE(int,"clearing Pending flag\n");
+    TRACE_(int)("clearing Pending flag\n");
     CLR_PEND(context);
   }
 }
@@ -175,7 +175,7 @@
   if (pModule && pModule->lpDosTask) {
     event = malloc(sizeof(DOSEVENT));
     if (!event) {
-      ERR(int,"out of memory allocating event entry\n");
+      ERR_(int)("out of memory allocating event entry\n");
       return;
     }
     event->irq = irq; event->priority = priority;
@@ -194,11 +194,11 @@
     
     /* get dosmod's attention to the new event, except for irq==0 where we already have it */
     if (irq && !pModule->lpDosTask->sig_sent) {
-      TRACE(int,"new event queued, signalling dosmod\n");
+      TRACE_(int)("new event queued, signalling dosmod\n");
       kill(pModule->lpDosTask->task,SIGUSR2);
       pModule->lpDosTask->sig_sent++;
     } else {
-      TRACE(int,"new event queued\n");
+      TRACE_(int)("new event queued\n");
     }
   }
 }
@@ -245,18 +245,18 @@
 
  switch (VM86_TYPE(fn)) {
   case VM86_SIGNAL:
-   TRACE(int,"DOS module caught signal %d\n",sig);
+   TRACE_(int)("DOS module caught signal %d\n",sig);
    if ((sig==SIGALRM) || (sig==SIGUSR2)) {
      if (sig==SIGALRM) {
        DOSVM_QueueEvent(0,DOS_PRIORITY_REALTIME,NULL,NULL);
      }
      if (lpDosTask->pending) {
-       TRACE(int,"setting Pending flag, interrupts are currently %s\n",
+       TRACE_(int)("setting Pending flag, interrupts are currently %s\n",
                  IF_ENABLED(&context) ? "enabled" : "disabled");
        SET_PEND(&context);
        DOSVM_SendQueuedEvents(&context,lpDosTask);
      } else {
-       TRACE(int,"no events are pending, clearing Pending flag\n");
+       TRACE_(int)("no events are pending, clearing Pending flag\n");
        CLR_PEND(&context);
      }
      if (sig==SIGUSR2) lpDosTask->sig_sent--;
@@ -284,7 +284,7 @@
    break;
   case VM86_STI:
   case VM86_PICRETURN:
-    TRACE(int,"DOS task enabled interrupts with events pending, sending events\n");
+    TRACE_(int)("DOS task enabled interrupts with events pending, sending events\n");
     DOSVM_SendQueuedEvents(&context,lpDosTask);
     break;
   case VM86_TRAP:
@@ -348,12 +348,12 @@
 
  GlobalUnlock16( GetCurrentTask() );
  if (!pModule) {
-  ERR(module,"No task is currently active!\n");
+  ERR_(module)("No task is currently active!\n");
   return -1;
  }
  if (!(lpDosTask=pModule->lpDosTask)) {
   /* MZ_CreateProcess or MZ_AllocDPMITask should have been called first */
-  ERR(module,"dosmod has not been initialized!");
+  ERR_(module)("dosmod has not been initialized!");
   return -1;
  }
 
@@ -383,11 +383,11 @@
   errno = 0;
   /* transmit VM86 structure to dosmod task */
   if (write(lpDosTask->write_pipe,&stat,sizeof(stat))!=sizeof(stat)) {
-   ERR(module,"dosmod sync lost, errno=%d, fd=%d, pid=%d\n",errno,lpDosTask->write_pipe,getpid());
+   ERR_(module)("dosmod sync lost, errno=%d, fd=%d, pid=%d\n",errno,lpDosTask->write_pipe,getpid());
    return -1;
   }
   if (write(lpDosTask->write_pipe,&VM86,sizeof(VM86))!=sizeof(VM86)) {
-   ERR(module,"dosmod sync lost, errno=%d\n",errno);
+   ERR_(module)("dosmod sync lost, errno=%d\n",errno);
    return -1;
   }
   do {
@@ -406,37 +406,37 @@
     /* nothing yet, block while waiting for something to do */
     waitret=MsgWaitForMultipleObjects(1,&(lpDosTask->hReadPipe),FALSE,INFINITE,QS_ALLINPUT);
     if (waitret==(DWORD)-1) {
-      ERR(module,"dosvm wait error=%ld\n",GetLastError());
+      ERR_(module)("dosvm wait error=%ld\n",GetLastError());
     }
   } while (waitret!=WAIT_OBJECT_0);
   /* read response */
   while (1) {
     if ((len=read(lpDosTask->read_pipe,&stat,sizeof(stat)))==sizeof(stat)) break;
     if (((errno==EINTR)||(errno==EAGAIN))&&(len<=0)) {
-     WARN(module,"rereading dosmod return code due to errno=%d, result=%d\n",errno,len);
+     WARN_(module)("rereading dosmod return code due to errno=%d, result=%d\n",errno,len);
      continue;
     }
-    ERR(module,"dosmod sync lost reading return code, errno=%d, result=%d\n",errno,len);
+    ERR_(module)("dosmod sync lost reading return code, errno=%d, result=%d\n",errno,len);
     return -1;
   }
-  TRACE(module,"dosmod return code=%d\n",stat);
+  TRACE_(module)("dosmod return code=%d\n",stat);
   while (1) {
     if ((len=read(lpDosTask->read_pipe,&VM86,sizeof(VM86)))==sizeof(VM86)) break;
     if (((errno==EINTR)||(errno==EAGAIN))&&(len<=0)) {
-     WARN(module,"rereading dosmod VM86 structure due to errno=%d, result=%d\n",errno,len);
+     WARN_(module)("rereading dosmod VM86 structure due to errno=%d, result=%d\n",errno,len);
      continue;
     }
-    ERR(module,"dosmod sync lost reading VM86 structure, errno=%d, result=%d\n",errno,len);
+    ERR_(module)("dosmod sync lost reading VM86 structure, errno=%d, result=%d\n",errno,len);
     return -1;
   }
   if ((stat&0xff)==DOSMOD_SIGNAL) {
     while (1) {
       if ((len=read(lpDosTask->read_pipe,&sig,sizeof(sig)))==sizeof(sig)) break;
       if (((errno==EINTR)||(errno==EAGAIN))&&(len<=0)) {
-	WARN(module,"rereading dosmod signal due to errno=%d, result=%d\n",errno,len);
+	WARN_(module)("rereading dosmod signal due to errno=%d, result=%d\n",errno,len);
 	continue;
       }
-      ERR(module,"dosmod sync lost reading signal, errno=%d, result=%d\n",errno,len);
+      ERR_(module)("dosmod sync lost reading signal, errno=%d, result=%d\n",errno,len);
       return -1;
     } while (0);
   } else sig=0;
@@ -462,7 +462,7 @@
     if ((port==0x20) && (val==0x20)) {
       if (pModule->lpDosTask->current) {
 	/* EOI (End Of Interrupt) */
-	TRACE(int,"received EOI for current IRQ, clearing\n");
+	TRACE_(int)("received EOI for current IRQ, clearing\n");
 	event = pModule->lpDosTask->current;
 	pModule->lpDosTask->current = event->next;
 	if (event->relay)
@@ -473,15 +473,15 @@
 	    !pModule->lpDosTask->sig_sent) {
 	  /* another event is pending, which we should probably
 	   * be able to process now, so tell dosmod about it */
-	  TRACE(int,"another event pending, signalling dosmod\n");
+	  TRACE_(int)("another event pending, signalling dosmod\n");
 	  kill(pModule->lpDosTask->task,SIGUSR2);
 	  pModule->lpDosTask->sig_sent++;
 	}
       } else {
-	WARN(int,"EOI without active IRQ\n");
+	WARN_(int)("EOI without active IRQ\n");
       }
     } else {
-      FIXME(int,"unrecognized PIC command %02x\n",val);
+      FIXME_(int)("unrecognized PIC command %02x\n",val);
     }
   }
 }
@@ -502,11 +502,11 @@
   if (!tim.tv_usec) tim.tv_usec=1;
 
   if (write(pModule->lpDosTask->write_pipe,&stat,sizeof(stat))!=sizeof(stat)) {
-   ERR(module,"dosmod sync lost, errno=%d\n",errno);
+   ERR_(module)("dosmod sync lost, errno=%d\n",errno);
    return;
   }
   if (write(pModule->lpDosTask->write_pipe,&tim,sizeof(tim))!=sizeof(tim)) {
-   ERR(module,"dosmod sync lost, errno=%d\n",errno);
+   ERR_(module)("dosmod sync lost, errno=%d\n",errno);
    return;
   }
   /* there's no return */
@@ -523,14 +523,14 @@
  GlobalUnlock16( GetCurrentTask() );
  if (pModule&&pModule->lpDosTask) {
   if (write(pModule->lpDosTask->write_pipe,&stat,sizeof(stat))!=sizeof(stat)) {
-   ERR(module,"dosmod sync lost, errno=%d\n",errno);
+   ERR_(module)("dosmod sync lost, errno=%d\n",errno);
    return 0;
   }
   /* read response */
   while (1) {
     if (read(pModule->lpDosTask->read_pipe,&tim,sizeof(tim))==sizeof(tim)) break;
     if ((errno==EINTR)||(errno==EAGAIN)) continue;
-    ERR(module,"dosmod sync lost, errno=%d\n",errno);
+    ERR_(module)("dosmod sync lost, errno=%d\n",errno);
     return 0;
   }
   return ((unsigned long long)tim.tv_usec*1193180)/1000000;
@@ -587,7 +587,7 @@
 
 int DOSVM_Enter( PCONTEXT context )
 {
- ERR(module,"DOS realmode not supported on this architecture!\n");
+ ERR_(module)("DOS realmode not supported on this architecture!\n");
  return -1;
 }
 
diff --git a/loader/elfdll.c b/loader/elfdll.c
index 22ac70f..b616413 100644
--- a/loader/elfdll.c
+++ b/loader/elfdll.c
@@ -17,7 +17,7 @@
 #include "heap.h"
 #include "wine/winbase16.h"
 #include "elfdll.h"
-#include "debug.h"
+#include "debugtools.h"
 #include "winerror.h"
 
 DECLARE_DEBUG_CHANNEL(elfdll)
@@ -83,7 +83,7 @@
 
 		if(len + namelen + 1 >= sizeof(buffer))
 		{
-			ERR(elfdll, "Buffer overflow! Check EXTRA_LD_LIBRARY_PATH or increase buffer size.\n");
+			ERR_(elfdll)("Buffer overflow! Check EXTRA_LD_LIBRARY_PATH or increase buffer size.\n");
 			return NULL;
 		}
 
@@ -96,7 +96,7 @@
 		else
 			strcpy(buffer + len, libname);
 
-		TRACE(elfdll, "Trying dlopen('%s', %d)\n", buffer, flags);
+		TRACE_(elfdll)("Trying dlopen('%s', %d)\n", buffer, flags);
 
 		handle = dlopen(buffer, flags);
 		if(handle)
@@ -206,7 +206,7 @@
 	if(!(nt->FileHeader.Characteristics & IMAGE_FILE_DLL))
 	{
 		if(PROCESS_Current()->exe_modref)
-			FIXME(elfdll, "overwriting old exe_modref... arrgh\n");
+			FIXME_(elfdll)("overwriting old exe_modref... arrgh\n");
 		PROCESS_Current()->exe_modref = wm;
 	}
 
@@ -226,7 +226,7 @@
 			}
 		}
 		if(wm == PROCESS_Current()->exe_modref)
-			ERR(elfdll, "Have to delete current exe_modref. Expect crash now\n");
+			ERR_(elfdll)("Have to delete current exe_modref. Expect crash now\n");
 		HeapFree(procheap, 0, wm->shortname);
 		HeapFree(procheap, 0, wm->longname);
 		HeapFree(procheap, 0, wm->modname);
@@ -289,7 +289,7 @@
 	dlhandle = ELFDLL_dlopen(soname, RTLD_LAZY);
 	if(!dlhandle)
 	{
-		WARN(elfdll, "Could not load %s (%s)\n", soname, dlerror());
+		WARN_(elfdll)("Could not load %s (%s)\n", soname, dlerror());
 		*err = ERROR_FILE_NOT_FOUND;
 		return NULL;
 	}
@@ -300,7 +300,7 @@
 	image = (struct elfdll_image *)dlsym(dlhandle, soname);
 	if(!image) 
 	{
-		ERR(elfdll, "Could not get elfdll image descriptor %s (%s)\n", soname, dlerror());
+		ERR_(elfdll)("Could not get elfdll image descriptor %s (%s)\n", soname, dlerror());
 		dlclose(dlhandle);
 		*err = ERROR_BAD_FORMAT;
 		return NULL;
@@ -310,7 +310,7 @@
 	hmod16 = ELFDLL_CreateNEModule(image->ne_module_start, image->ne_module_size);
 	if(!hmod16)
 	{
-		ERR(elfdll, "Could not create win16 dummy module for %s\n", path);
+		ERR_(elfdll)("Could not create win16 dummy module for %s\n", path);
 		dlclose(dlhandle);
 		*err = ERROR_OUTOFMEMORY;
 		return NULL;
@@ -321,7 +321,7 @@
 	wm = ELFDLL_CreateModref(image->pe_module_start, path);
 	if(!wm)
 	{
-		ERR(elfdll, "Could not create WINE_MODREF for %s\n", path);
+		ERR_(elfdll)("Could not create WINE_MODREF for %s\n", path);
 		GLOBAL_FreeBlock((HGLOBAL16)hmod16);
 		dlclose(dlhandle);
 		*err = ERROR_OUTOFMEMORY;
diff --git a/loader/module.c b/loader/module.c
index 07e9d1a..eae2b37 100644
--- a/loader/module.c
+++ b/loader/module.c
@@ -27,7 +27,7 @@
 #include "selectors.h"
 #include "stackframe.h"
 #include "task.h"
-#include "debug.h"
+#include "debugtools.h"
 #include "callback.h"
 #include "loadorder.h"
 #include "elfdll.h"
@@ -48,7 +48,7 @@
     	return PROCESS_Current()->exe_modref;
 
     if (!HIWORD(hmod)) {
-    	ERR(module,"tried to lookup 0x%04x in win32 module handler!\n",hmod);
+    	ERR_(module)("tried to lookup 0x%04x in win32 module handler!\n",hmod);
 	return NULL;
     }
     for ( wm = PROCESS_Current()->modref_list; wm; wm=wm->next )
@@ -76,7 +76,7 @@
         return TRUE;
 
 
-    TRACE( module, "(%s,%s,%p) - CALL\n", 
+    TRACE_(module)("(%s,%s,%p) - CALL\n", 
            wm->modname, typeName[type], lpReserved );
 
     /* Call the initialization routine */
@@ -91,12 +91,12 @@
         break;
 
     default:
-        ERR( module, "wine_modref type %d not handled.\n", wm->type );
+        ERR_(module)("wine_modref type %d not handled.\n", wm->type );
         retv = FALSE;
         break;
     }
 
-    TRACE( module, "(%s,%s,%p) - RETURN %d\n", 
+    TRACE_(module)("(%s,%s,%p) - RETURN %d\n", 
            wm->modname, typeName[type], lpReserved, retv );
 
     return retv;
@@ -145,7 +145,7 @@
          || ( wm->flags & WINE_MODREF_PROCESS_ATTACHED ) )
         return retv;
 
-    TRACE( module, "(%s,%p) - START\n", 
+    TRACE_(module)("(%s,%p) - START\n", 
            wm->modname, lpReserved );
 
     /* Tag current MODREF to prevent recursive loop */
@@ -178,7 +178,7 @@
     /* Remove recursion flag */
     wm->flags &= ~WINE_MODREF_MARKER;
 
-    TRACE( module, "(%s,%p) - END\n", 
+    TRACE_(module)("(%s,%p) - END\n", 
            wm->modname, lpReserved );
 
     return retv;
@@ -426,7 +426,7 @@
             return (FARPROC16)PrintSetupDlgProc16;
         if (!strcmp(name,"ReplaceTextDlgProc"))
             return (FARPROC16)ReplaceTextDlgProc16;
-        FIXME(module,"No mapping for %s(), add one in library/miscstubs.c\n",name);
+        FIXME_(module)("No mapping for %s(), add one in library/miscstubs.c\n",name);
         assert( FALSE );
         return NULL;
     }
@@ -439,7 +439,7 @@
         ordinal = NE_GetOrdinal( hModule, name );
         if (!(ret = NE_GetEntryPoint( hModule, ordinal )))
         {            
-            WARN( module, "%s not found\n", name );
+            WARN_(module)("%s not found\n", name );
             assert( FALSE );
         }
     }
@@ -662,7 +662,7 @@
     HFILE hfile;
     OFSTRUCT ofs;
 
-    TRACE( win32, "%s\n", lpApplicationName );
+    TRACE_(win32)("%s\n", lpApplicationName );
 
     /* Sanity check.
      */
@@ -693,7 +693,7 @@
     BOOL ret = FALSE;
     LPSTR strNew = NULL;
 
-    TRACE( win32, "%s\n", debugstr_w(lpApplicationName) );
+    TRACE_(win32)("%s\n", debugstr_w(lpApplicationName) );
 
     /* Sanity check.
      */
@@ -856,7 +856,7 @@
         hInstance = GetLastError();
         if ( hInstance < 32 ) return hInstance;
 
-        FIXME( module, "Strange error set by CreateProcess: %d\n", hInstance );
+        FIXME_(module)("Strange error set by CreateProcess: %d\n", hInstance );
         return 11;
     }
     
@@ -934,7 +934,7 @@
         	strcat(name, ".exe");
 	}
 
-        TRACE(module, "checking if file exists '%s'\n", name);
+        TRACE_(module)("checking if file exists '%s'\n", name);
 
         if (GetFileAttributesA(name)!=-1)
 	  break;      /* if file exists then all done */
@@ -947,7 +947,7 @@
     } while (1);
 
     if (after) *after = pcmd;
-    TRACE(module, "selected as file name '%s'\n    and cmdline as %s\n",
+    TRACE_(module)("selected as file name '%s'\n    and cmdline as %s\n",
             name, debugstr_a(pcmd));
     }
 
@@ -1013,7 +1013,7 @@
         	strcat(name, ".exe");
       }
 
-    TRACE(module, "selected as file name '%s'\n", name );
+    TRACE_(module)("selected as file name '%s'\n", name );
 }
 
 /**********************************************************************
@@ -1055,64 +1055,64 @@
     /* Warn if unsupported features are used */
 
     if (dwCreationFlags & DEBUG_PROCESS)
-        FIXME(module, "(%s,...): DEBUG_PROCESS ignored\n", name);
+        FIXME_(module)("(%s,...): DEBUG_PROCESS ignored\n", name);
     if (dwCreationFlags & DEBUG_ONLY_THIS_PROCESS)
-        FIXME(module, "(%s,...): DEBUG_ONLY_THIS_PROCESS ignored\n", name);
+        FIXME_(module)("(%s,...): DEBUG_ONLY_THIS_PROCESS ignored\n", name);
     if (dwCreationFlags & CREATE_SUSPENDED)
-        FIXME(module, "(%s,...): CREATE_SUSPENDED ignored\n", name);
+        FIXME_(module)("(%s,...): CREATE_SUSPENDED ignored\n", name);
     if (dwCreationFlags & DETACHED_PROCESS)
-        FIXME(module, "(%s,...): DETACHED_PROCESS ignored\n", name);
+        FIXME_(module)("(%s,...): DETACHED_PROCESS ignored\n", name);
     if (dwCreationFlags & CREATE_NEW_CONSOLE)
-        FIXME(module, "(%s,...): CREATE_NEW_CONSOLE ignored\n", name);
+        FIXME_(module)("(%s,...): CREATE_NEW_CONSOLE ignored\n", name);
     if (dwCreationFlags & NORMAL_PRIORITY_CLASS)
-        FIXME(module, "(%s,...): NORMAL_PRIORITY_CLASS ignored\n", name);
+        FIXME_(module)("(%s,...): NORMAL_PRIORITY_CLASS ignored\n", name);
     if (dwCreationFlags & IDLE_PRIORITY_CLASS)
-        FIXME(module, "(%s,...): IDLE_PRIORITY_CLASS ignored\n", name);
+        FIXME_(module)("(%s,...): IDLE_PRIORITY_CLASS ignored\n", name);
     if (dwCreationFlags & HIGH_PRIORITY_CLASS)
-        FIXME(module, "(%s,...): HIGH_PRIORITY_CLASS ignored\n", name);
+        FIXME_(module)("(%s,...): HIGH_PRIORITY_CLASS ignored\n", name);
     if (dwCreationFlags & REALTIME_PRIORITY_CLASS)
-        FIXME(module, "(%s,...): REALTIME_PRIORITY_CLASS ignored\n", name);
+        FIXME_(module)("(%s,...): REALTIME_PRIORITY_CLASS ignored\n", name);
     if (dwCreationFlags & CREATE_NEW_PROCESS_GROUP)
-        FIXME(module, "(%s,...): CREATE_NEW_PROCESS_GROUP ignored\n", name);
+        FIXME_(module)("(%s,...): CREATE_NEW_PROCESS_GROUP ignored\n", name);
     if (dwCreationFlags & CREATE_UNICODE_ENVIRONMENT)
-        FIXME(module, "(%s,...): CREATE_UNICODE_ENVIRONMENT ignored\n", name);
+        FIXME_(module)("(%s,...): CREATE_UNICODE_ENVIRONMENT ignored\n", name);
     if (dwCreationFlags & CREATE_SEPARATE_WOW_VDM)
-        FIXME(module, "(%s,...): CREATE_SEPARATE_WOW_VDM ignored\n", name);
+        FIXME_(module)("(%s,...): CREATE_SEPARATE_WOW_VDM ignored\n", name);
     if (dwCreationFlags & CREATE_SHARED_WOW_VDM)
-        FIXME(module, "(%s,...): CREATE_SHARED_WOW_VDM ignored\n", name);
+        FIXME_(module)("(%s,...): CREATE_SHARED_WOW_VDM ignored\n", name);
     if (dwCreationFlags & CREATE_DEFAULT_ERROR_MODE)
-        FIXME(module, "(%s,...): CREATE_DEFAULT_ERROR_MODE ignored\n", name);
+        FIXME_(module)("(%s,...): CREATE_DEFAULT_ERROR_MODE ignored\n", name);
     if (dwCreationFlags & CREATE_NO_WINDOW)
-        FIXME(module, "(%s,...): CREATE_NO_WINDOW ignored\n", name);
+        FIXME_(module)("(%s,...): CREATE_NO_WINDOW ignored\n", name);
     if (dwCreationFlags & PROFILE_USER)
-        FIXME(module, "(%s,...): PROFILE_USER ignored\n", name);
+        FIXME_(module)("(%s,...): PROFILE_USER ignored\n", name);
     if (dwCreationFlags & PROFILE_KERNEL)
-        FIXME(module, "(%s,...): PROFILE_KERNEL ignored\n", name);
+        FIXME_(module)("(%s,...): PROFILE_KERNEL ignored\n", name);
     if (dwCreationFlags & PROFILE_SERVER)
-        FIXME(module, "(%s,...): PROFILE_SERVER ignored\n", name);
+        FIXME_(module)("(%s,...): PROFILE_SERVER ignored\n", name);
     if (lpCurrentDirectory)
-        FIXME(module, "(%s,...): lpCurrentDirectory %s ignored\n", 
+        FIXME_(module)("(%s,...): lpCurrentDirectory %s ignored\n", 
                       name, lpCurrentDirectory);
     if (lpStartupInfo->lpDesktop)
-        FIXME(module, "(%s,...): lpStartupInfo->lpDesktop %s ignored\n", 
+        FIXME_(module)("(%s,...): lpStartupInfo->lpDesktop %s ignored\n", 
                       name, lpStartupInfo->lpDesktop);
     if (lpStartupInfo->lpTitle)
-        FIXME(module, "(%s,...): lpStartupInfo->lpTitle %s ignored\n", 
+        FIXME_(module)("(%s,...): lpStartupInfo->lpTitle %s ignored\n", 
                       name, lpStartupInfo->lpTitle);
     if (lpStartupInfo->dwFlags & STARTF_USECOUNTCHARS)
-        FIXME(module, "(%s,...): STARTF_USECOUNTCHARS (%ld,%ld) ignored\n", 
+        FIXME_(module)("(%s,...): STARTF_USECOUNTCHARS (%ld,%ld) ignored\n", 
                       name, lpStartupInfo->dwXCountChars, lpStartupInfo->dwYCountChars);
     if (lpStartupInfo->dwFlags & STARTF_USEFILLATTRIBUTE)
-        FIXME(module, "(%s,...): STARTF_USEFILLATTRIBUTE %lx ignored\n", 
+        FIXME_(module)("(%s,...): STARTF_USEFILLATTRIBUTE %lx ignored\n", 
                       name, lpStartupInfo->dwFillAttribute);
     if (lpStartupInfo->dwFlags & STARTF_RUNFULLSCREEN)
-        FIXME(module, "(%s,...): STARTF_RUNFULLSCREEN ignored\n", name);
+        FIXME_(module)("(%s,...): STARTF_RUNFULLSCREEN ignored\n", name);
     if (lpStartupInfo->dwFlags & STARTF_FORCEONFEEDBACK)
-        FIXME(module, "(%s,...): STARTF_FORCEONFEEDBACK ignored\n", name);
+        FIXME_(module)("(%s,...): STARTF_FORCEONFEEDBACK ignored\n", name);
     if (lpStartupInfo->dwFlags & STARTF_FORCEOFFFEEDBACK)
-        FIXME(module, "(%s,...): STARTF_FORCEOFFFEEDBACK ignored\n", name);
+        FIXME_(module)("(%s,...): STARTF_FORCEOFFFEEDBACK ignored\n", name);
     if (lpStartupInfo->dwFlags & STARTF_USEHOTKEY)
-        FIXME(module, "(%s,...): STARTF_USEHOTKEY ignored\n", name);
+        FIXME_(module)("(%s,...): STARTF_USEHOTKEY ignored\n", name);
 
 
     /* When in WineLib, always fork new Unix process */
@@ -1179,7 +1179,7 @@
         case SCS_PIF_BINARY:
         case SCS_POSIX_BINARY:
         case SCS_OS216_BINARY:
-            FIXME( module, "Unsupported executable type: %ld\n", type );
+            FIXME_(module)("Unsupported executable type: %ld\n", type );
             /* fall through */
     
         default:
@@ -1216,10 +1216,10 @@
     StartupInfoA.lpDesktop = HEAP_strdupWtoA (GetProcessHeap(),0,lpStartupInfo->lpDesktop);
     StartupInfoA.lpTitle = HEAP_strdupWtoA (GetProcessHeap(),0,lpStartupInfo->lpTitle);
 
-    TRACE(win32, "(%s,%s,...)\n", debugstr_w(lpApplicationName), debugstr_w(lpCommandLine));
+    TRACE_(win32)("(%s,%s,...)\n", debugstr_w(lpApplicationName), debugstr_w(lpCommandLine));
 
     if (lpStartupInfo->lpReserved)
-      FIXME(win32,"StartupInfo.lpReserved is used, please report (%s)\n", debugstr_w(lpStartupInfo->lpReserved));
+      FIXME_(win32)("StartupInfo.lpReserved is used, please report (%s)\n", debugstr_w(lpStartupInfo->lpReserved));
       
     ret = CreateProcessA(  lpApplicationNameA,  lpCommandLineA, 
                              lpProcessAttributes, lpThreadAttributes,
@@ -1278,7 +1278,7 @@
     else
       lstrcpynA( lpFileName, wm->shortname, size );
        
-    TRACE(module, "%s\n", lpFileName );
+    TRACE_(module)("%s\n", lpFileName );
     return strlen(lpFileName);
 }                   
  
@@ -1304,7 +1304,7 @@
 HMODULE WINAPI LoadLibraryEx32W16( LPCSTR libname, HANDLE16 hf,
                                        DWORD flags )
 {
-    TRACE(module,"(%s,%d,%08lx)\n",libname,hf,flags);
+    TRACE_(module)("(%s,%d,%08lx)\n",libname,hf,flags);
     return LoadLibraryExA(libname, hf,flags);
 }
 
@@ -1327,7 +1327,7 @@
 
 	if(wm && !MODULE_DllProcessAttach(wm, NULL))
 	{
-		WARN(module, "Attach failed for module '%s', \n", libname);
+		WARN_(module)("Attach failed for module '%s', \n", libname);
 		MODULE_FreeLibrary(wm);
 		SetLastError(ERROR_DLL_INIT_FAILED);
 		wm = NULL;
@@ -1363,7 +1363,7 @@
 	{
 		if(!(pwm->flags & WINE_MODREF_MARKER))
 			pwm->refCount++;
-		TRACE(module, "Already loaded module '%s' at 0x%08x, count=%d, \n", libname, pwm->module, pwm->refCount);
+		TRACE_(module)("Already loaded module '%s' at 0x%08x, count=%d, \n", libname, pwm->module, pwm->refCount);
 		LeaveCriticalSection(&PROCESS_Current()->crit_section);
 		return pwm;
 	}
@@ -1375,27 +1375,27 @@
 		switch(plo->loadorder[i])
 		{
 		case MODULE_LOADORDER_DLL:
-			TRACE(module, "Trying native dll '%s'\n", libname);
+			TRACE_(module)("Trying native dll '%s'\n", libname);
 			pwm = PE_LoadLibraryExA(libname, flags, &err);
 			break;
 
 		case MODULE_LOADORDER_ELFDLL:
-			TRACE(module, "Trying elfdll '%s'\n", libname);
+			TRACE_(module)("Trying elfdll '%s'\n", libname);
 			pwm = ELFDLL_LoadLibraryExA(libname, flags, &err);
 			break;
 
 		case MODULE_LOADORDER_SO:
-			TRACE(module, "Trying so-library '%s'\n", libname);
+			TRACE_(module)("Trying so-library '%s'\n", libname);
 			pwm = ELF_LoadLibraryExA(libname, flags, &err);
 			break;
 
 		case MODULE_LOADORDER_BI:
-			TRACE(module, "Trying built-in '%s'\n", libname);
+			TRACE_(module)("Trying built-in '%s'\n", libname);
 			pwm = BUILTIN32_LoadLibraryExA(libname, flags, &err);
 			break;
 
 		default:
-			ERR(module, "Got invalid loadorder type %d (%s index %d)\n", plo->loadorder[i], plo->modulename, i);
+			ERR_(module)("Got invalid loadorder type %d (%s index %d)\n", plo->loadorder[i], plo->modulename, i);
 		/* Fall through */
 
 		case MODULE_LOADORDER_INVALID:	/* We ignore this as it is an empty entry */
@@ -1406,7 +1406,7 @@
 		if(pwm)
 		{
 			/* Initialize DLL just loaded */
-			TRACE(module, "Loaded module '%s' at 0x%08x, \n", libname, pwm->module);
+			TRACE_(module)("Loaded module '%s' at 0x%08x, \n", libname, pwm->module);
 
 			/* Set the refCount here so that an attach failure will */
 			/* decrement the dependencies through the MODULE_FreeLibrary call. */
@@ -1420,7 +1420,7 @@
 			break;
 	}
 
-	ERR(module, "Failed to load module '%s'; error=0x%08lx, \n", libname, err);
+	ERR_(module)("Failed to load module '%s'; error=0x%08lx, \n", libname, err);
 	SetLastError(err);
 	LeaveCriticalSection(&PROCESS_Current()->crit_section);
 	return NULL;
@@ -1492,7 +1492,7 @@
 		case MODULE32_BI:	BUILTIN32_UnloadLibrary(wm);	break;
 
 		default:
-			ERR(module, "Invalid or unhandled MODREF type %d encountered (wm=%p)\n", wm->type, wm);
+			ERR_(module)("Invalid or unhandled MODREF type %d encountered (wm=%p)\n", wm->type, wm);
 		}
 	}
 }
@@ -1534,7 +1534,7 @@
         return;
 
     --wm->refCount;
-    TRACE( module, "(%s) refCount: %d\n", wm->modname, wm->refCount );
+    TRACE_(module)("(%s) refCount: %d\n", wm->modname, wm->refCount );
 
     if ( wm->refCount == 0 )
     {
@@ -1555,7 +1555,7 @@
  */
 BOOL MODULE_FreeLibrary( WINE_MODREF *wm )
 {
-    TRACE( module, "(%s) - START\n", wm->modname );
+    TRACE_(module)("(%s) - START\n", wm->modname );
 
     /* Recursively decrement reference counts */
     MODULE_DecRefCount( wm );
@@ -1565,7 +1565,7 @@
 
     MODULE_FlushModrefs();
 
-    TRACE( module, "(%s) - END\n", wm->modname );
+    TRACE_(module)("(%s) - END\n", wm->modname );
 
     return FALSE;
 }
@@ -1613,27 +1613,27 @@
     FARPROC16	ret;
 
     if (!hModule) {
-    	WARN(module,"hModule may not be 0!\n");
+    	WARN_(module)("hModule may not be 0!\n");
 	return (FARPROC16)0;
     }
     if (HIWORD(hModule))
     {
-    	WARN( module, "hModule is Win32 handle (%08x)\n", hModule );
+    	WARN_(module)("hModule is Win32 handle (%08x)\n", hModule );
 	return (FARPROC16)0;
     }
     hModule = GetExePtr( hModule );
     if (HIWORD(name)) {
         ordinal = NE_GetOrdinal( hModule, name );
-        TRACE(module, "%04x '%s'\n",
+        TRACE_(module)("%04x '%s'\n",
                         hModule, name );
     } else {
         ordinal = LOWORD(name);
-        TRACE(module, "%04x %04x\n",
+        TRACE_(module)("%04x %04x\n",
                         hModule, ordinal );
     }
     if (!ordinal) return (FARPROC16)0;
     ret = NE_GetEntryPoint( hModule, ordinal );
-    TRACE(module,"returning %08x\n",(UINT)ret);
+    TRACE_(module)("returning %08x\n",(UINT)ret);
     return ret;
 }
 
@@ -1651,20 +1651,20 @@
     if (HIWORD(name) != 0)
     {
         ordinal = NE_GetOrdinal( hModule, (LPSTR)PTR_SEG_TO_LIN(name) );
-        TRACE(module, "%04x '%s'\n",
+        TRACE_(module)("%04x '%s'\n",
                         hModule, (LPSTR)PTR_SEG_TO_LIN(name) );
     }
     else
     {
         ordinal = LOWORD(name);
-        TRACE(module, "%04x %04x\n",
+        TRACE_(module)("%04x %04x\n",
                         hModule, ordinal );
     }
     if (!ordinal) return (FARPROC16)0;
 
     ret = NE_GetEntryPoint( hModule, ordinal );
 
-    TRACE(module, "returning %08x\n", (UINT)ret );
+    TRACE_(module)("returning %08x\n", (UINT)ret );
     return ret;
 }
 
@@ -1697,9 +1697,9 @@
     FARPROC	retproc;
 
     if (HIWORD(function))
-	TRACE(win32,"(%08lx,%s)\n",(DWORD)hModule,function);
+	TRACE_(win32)("(%08lx,%s)\n",(DWORD)hModule,function);
     else
-	TRACE(win32,"(%08lx,%p)\n",(DWORD)hModule,function);
+	TRACE_(win32)("(%08lx,%p)\n",(DWORD)hModule,function);
     if (!wm) {
     	SetLastError(ERROR_INVALID_HANDLE);
         return (FARPROC)0;
@@ -1715,7 +1715,7 @@
 	if (!retproc) SetLastError(ERROR_PROC_NOT_FOUND);
 	return retproc;
     default:
-    	ERR(module,"wine_modref type %d not handled.\n",wm->type);
+    	ERR_(module)("wine_modref type %d not handled.\n",wm->type);
     	SetLastError(ERROR_INVALID_HANDLE);
     	return (FARPROC)0;
     }
diff --git a/loader/ne/segment.c b/loader/ne/segment.c
index 697ad9b..6ff87d9 100644
--- a/loader/ne/segment.c
+++ b/loader/ne/segment.c
@@ -25,7 +25,7 @@
 #include "file.h"
 #include "module.h"
 #include "stackframe.h"
-#include "debug.h"
+#include "debugtools.h"
 #include "xmalloc.h"
 
 DECLARE_DEBUG_CHANNEL(dll)
@@ -85,7 +85,7 @@
     pModuleTable = NE_MODULE_TABLE( pModule );
 
     hf = NE_OpenFile( pModule );
-    TRACE(module, "Loading segment %d, hSeg=%04x, flags=%04x\n",
+    TRACE_(module)("Loading segment %d, hSeg=%04x, flags=%04x\n",
                     segnum, pSeg->hSeg, pSeg->flags );
     SetFilePointer( hf, pSeg->filepos << pModule->alignment, NULL, SEEK_SET );
     if (pSeg->size) size = pSeg->size;
@@ -117,7 +117,7 @@
         stack16Top->bp = 0;
         stack16Top->ip = 0;
         stack16Top->cs = 0;
-	TRACE(dll,"CallLoadAppSegProc(hmodule=0x%04x,hf=0x%04x,segnum=%d\n",
+	TRACE_(dll)("CallLoadAppSegProc(hmodule=0x%04x,hf=0x%04x,segnum=%d\n",
 		pModule->self,hf,segnum );
         DuplicateHandle( GetCurrentProcess(), hf, GetCurrentProcess(), &hFile32,
                          0, FALSE, DUPLICATE_SAME_ACCESS );
@@ -125,7 +125,7 @@
  	new_hSeg = Callbacks->CallLoadAppSegProc(selfloadheader->LoadAppSeg,
                                                     pModule->self, hFile16,
                                                     segnum );
-	TRACE(dll,"Ret CallLoadAppSegProc: hSeg = 0x%04x\n",new_hSeg);
+	TRACE_(dll)("Ret CallLoadAppSegProc: hSeg = 0x%04x\n",new_hSeg);
         _lclose16( hFile16 );
  	if (SEL(new_hSeg) != SEL(old_hSeg)) {
  	  /* Self loaders like creating their own selectors; 
@@ -137,7 +137,7 @@
  		   pSeg->minsize ? pSeg->minsize : 0x10000);
  	    FreeSelector16(SEL(new_hSeg));
  	    pSeg->hSeg = old_hSeg;
- 	    TRACE(module, "New hSeg allocated for dgroup segment:Old=%d,New=%d\n", 
+ 	    TRACE_(module)("New hSeg allocated for dgroup segment:Old=%d,New=%d\n", 
                 old_hSeg, new_hSeg);
  	  } else {
  	    FreeSelector16(SEL(pSeg->hSeg));
@@ -180,11 +180,11 @@
     ReadFile(hf, &count, sizeof(count), &res, NULL);
     if (!count) return TRUE;
 
-    TRACE(fixup, "Fixups for %.*s, segment %d, hSeg %04x\n",
+    TRACE_(fixup)("Fixups for %.*s, segment %d, hSeg %04x\n",
                    *((BYTE *)pModule + pModule->name_table),
                    (char *)pModule + pModule->name_table + 1,
                    segnum, pSeg->hSeg );
-    TRACE(segment, "Fixups for %.*s, segment %d, hSeg %04x\n",
+    TRACE_(segment)("Fixups for %.*s, segment %d, hSeg %04x\n",
                    *((BYTE *)pModule + pModule->name_table),
                    (char *)pModule + pModule->name_table + 1,
                    segnum, pSeg->hSeg );
@@ -193,7 +193,7 @@
     if (!ReadFile( hf, reloc_entries, count * sizeof(struct relocation_entry_s), &res, NULL) ||
         (res != count * sizeof(struct relocation_entry_s)))
     {
-        WARN(fixup, "Unable to read relocation information\n" );
+        WARN_(fixup)("Unable to read relocation information\n" );
         return FALSE;
     }
 
@@ -222,14 +222,14 @@
             {
                 NE_MODULE *pTarget = NE_GetPtr( module );
                 if (!pTarget)
-                    WARN(module, "Module not found: %04x, reference %d of module %*.*s\n",
+                    WARN_(module)("Module not found: %04x, reference %d of module %*.*s\n",
                              module, rep->target1, 
                              *((BYTE *)pModule + pModule->name_table),
                              *((BYTE *)pModule + pModule->name_table),
                              (char *)pModule + pModule->name_table + 1 );
                 else
                 {
-                    ERR(fixup, "No implementation for %.*s.%d, setting to 0xdeadbeef\n",
+                    ERR_(fixup)("No implementation for %.*s.%d, setting to 0xdeadbeef\n",
                             *((BYTE *)pTarget + pTarget->name_table),
                             (char *)pTarget + pTarget->name_table + 1,
                             ordinal );
@@ -239,7 +239,7 @@
             if (TRACE_ON(fixup))
             {
                 NE_MODULE *pTarget = NE_GetPtr( module );
-                TRACE( fixup, "%d: %.*s.%d=%04x:%04x %s\n", i + 1, 
+                TRACE_(fixup)("%d: %.*s.%d=%04x:%04x %s\n", i + 1, 
                        *((BYTE *)pTarget + pTarget->name_table),
                        (char *)pTarget + pTarget->name_table + 1,
                        ordinal, HIWORD(address), LOWORD(address),
@@ -259,7 +259,7 @@
             if (ERR_ON(fixup) && !address)
             {
                 NE_MODULE *pTarget = NE_GetPtr( module );
-                ERR(fixup, "No implementation for %.*s.%s, setting to 0xdeadbeef\n",
+                ERR_(fixup)("No implementation for %.*s.%s, setting to 0xdeadbeef\n",
                     *((BYTE *)pTarget + pTarget->name_table),
                     (char *)pTarget + pTarget->name_table + 1, func_name );
             }
@@ -267,7 +267,7 @@
             if (TRACE_ON(fixup))
             {
 	        NE_MODULE *pTarget = NE_GetPtr( module );
-                TRACE( fixup, "%d: %.*s.%s=%04x:%04x %s\n", i + 1, 
+                TRACE_(fixup)("%d: %.*s.%s=%04x:%04x %s\n", i + 1, 
                        *((BYTE *)pTarget + pTarget->name_table),
                        (char *)pTarget + pTarget->name_table + 1,
                        func_name, HIWORD(address), LOWORD(address),
@@ -285,7 +285,7 @@
                 address = (FARPROC16)PTR_SEG_OFF_TO_SEGPTR( SEL(pSegTable[rep->target1-1].hSeg), rep->target2 );
 	    }
 	    
-	    TRACE( fixup,"%d: %04x:%04x %s\n", 
+	    TRACE_(fixup)("%d: %04x:%04x %s\n", 
                    i + 1, HIWORD(address), LOWORD(address),
                    NE_GetRelocAddrName( rep->address_type, additive ) );
 	    break;
@@ -299,7 +299,7 @@
 	     * successfully emulate the coprocessor if it doesn't
 	     * exist.
 	     */
-	    TRACE( fixup, "%d: TYPE %d, OFFSET %04x, TARGET %04x %04x %s\n",
+	    TRACE_(fixup)("%d: TYPE %d, OFFSET %04x, TARGET %04x %04x %s\n",
                    i + 1, rep->relocation_type, rep->offset,
                    rep->target1, rep->target2,
                    NE_GetRelocAddrName( rep->address_type, additive ) );
@@ -314,14 +314,14 @@
         {
             char module[10];
             GetModuleName16( pModule->self, module, sizeof(module) );
-            ERR( fixup, "WARNING: module %s: unknown reloc addr type = 0x%02x. Please report.\n",
+            ERR_(fixup)("WARNING: module %s: unknown reloc addr type = 0x%02x. Please report.\n",
                  module, rep->address_type );
         }
 
         if (additive)
         {
             sp = PTR_SEG_OFF_TO_LIN( SEL(pSeg->hSeg), offset );
-            TRACE( fixup,"    %04x:%04x\n", offset, *sp );
+            TRACE_(fixup)("    %04x:%04x\n", offset, *sp );
             switch (rep->address_type & 0x7f)
             {
             case NE_RADDR_LOWBYTE:
@@ -337,7 +337,7 @@
             case NE_RADDR_SELECTOR:
 		/* Borland creates additive records with offset zero. Strange, but OK */
                 if (*sp)
-                    ERR(fixup,"Additive selector to %04x.Please report\n",*sp);
+                    ERR_(fixup)("Additive selector to %04x.Please report\n",*sp);
 		else
                     *sp = HIWORD(address);
                 break;
@@ -351,7 +351,7 @@
             {
                 sp = PTR_SEG_OFF_TO_LIN( SEL(pSeg->hSeg), offset );
                 next_offset = *sp;
-                TRACE( fixup,"    %04x:%04x\n", offset, *sp );
+                TRACE_(fixup)("    %04x:%04x\n", offset, *sp );
                 switch (rep->address_type & 0x7f)
                 {
                 case NE_RADDR_LOWBYTE:
@@ -380,7 +380,7 @@
     return TRUE;
 
 unknown:
-    WARN(fixup, "WARNING: %d: unknown ADDR TYPE %d,  "
+    WARN_(fixup)("WARNING: %d: unknown ADDR TYPE %d,  "
          "TYPE %d,  OFFSET %04x,  TARGET %04x %04x\n",
          i + 1, rep->address_type, rep->relocation_type, 
          rep->offset, rep->target1, rep->target2);
@@ -409,7 +409,7 @@
         DWORD oldstack;
         WORD saved_hSeg = pSegTable[pModule->dgroup - 1].hSeg;
 
-        TRACE(module, "%.*s is a self-loading module!\n",
+        TRACE_(module)("%.*s is a self-loading module!\n",
 		     *((BYTE*)pModule + pModule->name_table),
 		     (char *)pModule + pModule->name_table + 1);
         if (!NE_LoadSegment( pModule, 1 )) return FALSE;
@@ -436,10 +436,10 @@
         DuplicateHandle( GetCurrentProcess(), NE_OpenFile(pModule),
                          GetCurrentProcess(), &hf, 0, FALSE, DUPLICATE_SAME_ACCESS );
         hFile16 = FILE_AllocDosHandle( hf );
-        TRACE(dll,"CallBootAppProc(hModule=0x%04x,hf=0x%04x)\n",
+        TRACE_(dll)("CallBootAppProc(hModule=0x%04x,hf=0x%04x)\n",
               pModule->self,hFile16);
         Callbacks->CallBootAppProc(selfloadheader->BootApp, pModule->self,hFile16);
-	TRACE(dll,"Return from CallBootAppProc\n");
+	TRACE_(dll)("Return from CallBootAppProc\n");
         _lclose16(hf);
         /* some BootApp procs overwrite the segment handle of dgroup */
         pSegTable[pModule->dgroup - 1].hSeg = saved_hSeg;
@@ -470,7 +470,7 @@
     WORD dgroup, num_entries, sel = SEL(pSegTable[segnum-1].hSeg);
     BYTE *pSeg, *pFunc;
 
-    TRACE(module, "(%d);\n", segnum);
+    TRACE_(module)("(%d);\n", segnum);
 
     if (pSegTable[segnum-1].flags & NE_SEGFLAGS_DATA)
 {
@@ -485,7 +485,7 @@
     bundle = (ET_BUNDLE *)((BYTE *)pModule+pModule->entry_table);
 
     do {
-	TRACE(module, "num_entries: %d, bundle: %p, next: %04x, pSeg: %p\n", bundle->last - bundle->first, bundle, bundle->next, pSeg);
+	TRACE_(module)("num_entries: %d, bundle: %p, next: %04x, pSeg: %p\n", bundle->last - bundle->first, bundle, bundle->next, pSeg);
 	if (!(num_entries = bundle->last - bundle->first))
 	    return;
 	entry = (ET_ENTRY *)((BYTE *)bundle+6);
@@ -495,12 +495,12 @@
 	    if (entry->segnum == segnum)
         {
 		pFunc = ((BYTE *)pSeg+entry->offs);
-		TRACE(module, "pFunc: %p, *(DWORD *)pFunc: %08lx, num_entries: %d\n", pFunc, *(DWORD *)pFunc, num_entries);
+		TRACE_(module)("pFunc: %p, *(DWORD *)pFunc: %08lx, num_entries: %d\n", pFunc, *(DWORD *)pFunc, num_entries);
 		if (*(pFunc+2) == 0x90)
         {
 		    if (*(WORD *)pFunc == 0x581e) /* push ds, pop ax */
 		    {
-			TRACE(module, "patch %04x:%04x -> mov ax, ds\n", sel, entry->offs);
+			TRACE_(module)("patch %04x:%04x -> mov ax, ds\n", sel, entry->offs);
 			*(WORD *)pFunc = 0xd88c; /* mov ax, ds */
         }
 
@@ -508,7 +508,7 @@
                         {
 			if ((entry->flags & 2)) /* public data ? */
                         {
-			    TRACE(module, "patch %04x:%04x -> mov ax, dgroup [%04x]\n", sel, entry->offs, dgroup);
+			    TRACE_(module)("patch %04x:%04x -> mov ax, dgroup [%04x]\n", sel, entry->offs, dgroup);
 			    *pFunc = 0xb8; /* mov ax, */
 			    *(WORD *)(pFunc+1) = dgroup;
                     }
@@ -516,7 +516,7 @@
 			if ((pModule->flags & NE_FFLAGS_MULTIPLEDATA)
 			&& (entry->flags & 1)) /* exported ? */
                     {
-			    TRACE(module, "patch %04x:%04x -> nop, nop\n", sel, entry->offs);
+			    TRACE_(module)("patch %04x:%04x -> nop, nop\n", sel, entry->offs);
 			    *(WORD *)pFunc = 0x9090; /* nop, nop */
 			}
                     }
@@ -541,7 +541,7 @@
     NE_MODULE *pModule = NE_GetPtr(FarGetOwner16(sel));
     SEGTABLEENTRY *pSegTable = NE_SEG_TABLE(pModule);
 
-    TRACE(module, "(%04x);\n", hSeg);
+    TRACE_(module)("(%04x);\n", hSeg);
 
     /* find the segment number of the module that belongs to hSeg */
     for (segnum = 1; segnum <= pModule->seg_count; segnum++)
@@ -565,7 +565,7 @@
 {
     WORD segnum;
 
-    TRACE(module, "(%04x)\n", pModule->self );
+    TRACE_(module)("(%04x)\n", pModule->self );
 
     if (pModule->flags & NE_FFLAGS_SELFLOAD)
 	NE_FixupSegmentPrologs(pModule, 1);
@@ -587,7 +587,7 @@
         if (pModule->flags & NE_FFLAGS_MULTIPLEDATA || pModule->dgroup)
         {
             /* Not SINGLEDATA */
-            ERR(dll, "Library is not marked SINGLEDATA\n");
+            ERR_(dll)("Library is not marked SINGLEDATA\n");
             exit(1);
         }
         else  /* DATA NONE DLL */
@@ -662,7 +662,7 @@
 
 
     pModule->cs = 0;  /* Don't initialize it twice */
-    TRACE(dll, "Calling LibMain, cs:ip=%04lx:%04x ds=%04lx di=%04x cx=%04x\n", 
+    TRACE_(dll)("Calling LibMain, cs:ip=%04lx:%04x ds=%04lx di=%04x cx=%04x\n", 
                  CS_reg(&context), IP_reg(&context), DS_reg(&context),
                  DI_reg(&context), CX_reg(&context) );
     Callbacks->CallRegisterShortProc( &context, 0 );
@@ -707,7 +707,7 @@
     *(DWORD *)(stack - 14) = 0;             /* dwReserved1 */
     *(WORD *) (stack - 16) = 0;             /* wReserved2 */
 
-    TRACE(dll, "Calling DllEntryPoint, cs:ip=%04lx:%04x\n",
+    TRACE_(dll)("Calling DllEntryPoint, cs:ip=%04lx:%04x\n",
           CS_reg(&context), IP_reg(&context));
 
     Callbacks->CallRegisterShortProc( &context, 16 );
diff --git a/loader/pe_image.c b/loader/pe_image.c
index 031d80d..ab2aa26 100644
--- a/loader/pe_image.c
+++ b/loader/pe_image.c
@@ -56,7 +56,7 @@
 #include "global.h"
 #include "task.h"
 #include "snoop.h"
-#include "debug.h"
+#include "debugtools.h"
 
 DECLARE_DEBUG_CHANNEL(delayhlp)
 DECLARE_DEBUG_CHANNEL(fixup)
@@ -87,15 +87,15 @@
   IMAGE_EXPORT_DIRECTORY *pe_exports = (IMAGE_EXPORT_DIRECTORY*)RVA(rva_start);
 
   Module = (char*)RVA(pe_exports->Name);
-  TRACE(win32,"*******EXPORT DATA*******\n");
-  TRACE(win32,"Module name is %s, %ld functions, %ld names\n", 
+  TRACE_(win32)("*******EXPORT DATA*******\n");
+  TRACE_(win32)("Module name is %s, %ld functions, %ld names\n", 
 	       Module, pe_exports->NumberOfFunctions, pe_exports->NumberOfNames);
 
   ordinal=(u_short*) RVA(pe_exports->AddressOfNameOrdinals);
   functions=function=(u_long*) RVA(pe_exports->AddressOfFunctions);
   name=(u_char**) RVA(pe_exports->AddressOfNames);
 
-  TRACE(win32," Ord    RVA     Addr   Name\n" );
+  TRACE_(win32)(" Ord    RVA     Addr   Name\n" );
   for (i=0;i<pe_exports->NumberOfFunctions;i++, function++)
   {
       if (!*function) continue;  /* No such function */
@@ -110,7 +110,7 @@
 	    dsprintf(win32, "  %s", (char*)RVA(name[j]) );
 	if ((*function >= rva_start) && (*function <= rva_end))
 	  dsprintf(win32, " (forwarded -> %s)", (char *)RVA(*function));
-	TRACE(win32,"%s\n", dbg_str(win32));
+	TRACE_(win32)("%s\n", dbg_str(win32));
       }
   }
 }
@@ -139,15 +139,15 @@
 	char				* forward;
 
 	if (HIWORD(funcName))
-		TRACE(win32,"(%s)\n",funcName);
+		TRACE_(win32)("(%s)\n",funcName);
 	else
-		TRACE(win32,"(%d)\n",(int)funcName);
+		TRACE_(win32)("(%d)\n",(int)funcName);
 	if (!exports) {
 		/* Not a fatal problem, some apps do
 		 * GetProcAddress(0,"RegisterPenApp") which triggers this
 		 * case.
 		 */
-		WARN(win32,"Module %08x(%s)/MODREF %p doesn't have a exports table.\n",wm->module,wm->modname,pem);
+		WARN_(win32)("Module %08x(%s)/MODREF %p doesn't have a exports table.\n",wm->module,wm->modname,pem);
 		return NULL;
 	}
 	ordinal	= (u_short*)  RVA(exports->AddressOfNameOrdinals);
@@ -178,7 +178,7 @@
 	} else 	{
 		int i;
 		if (LOWORD(funcName)-exports->Base > exports->NumberOfFunctions) {
-			TRACE(win32,"	ordinal %d out of range!\n",
+			TRACE_(win32)("	ordinal %d out of range!\n",
                                       LOWORD(funcName));
 			return NULL;
 		}
@@ -234,12 +234,12 @@
         modname = "<unknown>";
 
     /* OK, now dump the import list */
-    TRACE(win32, "Dumping imports list\n");
+    TRACE_(win32)("Dumping imports list\n");
 
     /* first, count the number of imported non-internal modules */
     pe_imp = pem->pe_import;
     if (!pe_imp) 
-    	ERR(win32, "no import directory????\n");
+    	ERR_(win32)("no import directory????\n");
 
     /* We assume that we have at least one import with !0 characteristics and
      * detect broken imports with all characteristsics 0 (notably Borland) and
@@ -283,7 +283,7 @@
 	    wmImp = MODULE_LoadLibraryExA( buffer, 0, 0 );
 	}
 	if (!wmImp) {
-	    ERR (module, "Module %s not found\n", name);
+	    ERR_(module)("Module %s not found\n", name);
 	    return 1;
 	}
         wm->deps[i++] = wmImp;
@@ -291,7 +291,7 @@
 	/* FIXME: forwarder entries ... */
 
 	if (pe_imp->u.OriginalFirstThunk != 0) { /* original MS style */
-	    TRACE(win32, "Microsoft style imports used\n");
+	    TRACE_(win32)("Microsoft style imports used\n");
 	    import_list =(PIMAGE_THUNK_DATA) RVA(pe_imp->u.OriginalFirstThunk);
 	    thunk_list = (PIMAGE_THUNK_DATA) RVA(pe_imp->FirstThunk);
 
@@ -299,23 +299,23 @@
 		if (IMAGE_SNAP_BY_ORDINAL(import_list->u1.Ordinal)) {
 		    int ordinal = IMAGE_ORDINAL(import_list->u1.Ordinal);
 
-		    TRACE(win32, "--- Ordinal %s,%d\n", name, ordinal);
+		    TRACE_(win32)("--- Ordinal %s,%d\n", name, ordinal);
 		    thunk_list->u1.Function=MODULE_GetProcAddress(
                         wmImp->module, (LPCSTR)ordinal, TRUE
 		    );
 		    if (!thunk_list->u1.Function) {
-			ERR(win32,"No implementation for %s.%d, setting to 0xdeadbeef\n",
+			ERR_(win32)("No implementation for %s.%d, setting to 0xdeadbeef\n",
 				name, ordinal);
                         thunk_list->u1.Function = (FARPROC)0xdeadbeef;
 		    }
 		} else {		/* import by name */
 		    pe_name = (PIMAGE_IMPORT_BY_NAME)RVA(import_list->u1.AddressOfData);
-		    TRACE(win32, "--- %s %s.%d\n", pe_name->Name, name, pe_name->Hint);
+		    TRACE_(win32)("--- %s %s.%d\n", pe_name->Name, name, pe_name->Hint);
 		    thunk_list->u1.Function=MODULE_GetProcAddress(
                         wmImp->module, pe_name->Name, TRUE
 		    );
 		    if (!thunk_list->u1.Function) {
-			ERR(win32,"No implementation for %s.%d(%s), setting to 0xdeadbeef\n",
+			ERR_(win32)("No implementation for %s.%d(%s), setting to 0xdeadbeef\n",
 				name,pe_name->Hint,pe_name->Name);
                         thunk_list->u1.Function = (FARPROC)0xdeadbeef;
 		    }
@@ -324,31 +324,31 @@
 		thunk_list++;
 	    }
 	} else {	/* Borland style */
-	    TRACE(win32, "Borland style imports used\n");
+	    TRACE_(win32)("Borland style imports used\n");
 	    thunk_list = (PIMAGE_THUNK_DATA) RVA(pe_imp->FirstThunk);
 	    while (thunk_list->u1.Ordinal) {
 		if (IMAGE_SNAP_BY_ORDINAL(thunk_list->u1.Ordinal)) {
 		    /* not sure about this branch, but it seems to work */
 		    int ordinal = IMAGE_ORDINAL(thunk_list->u1.Ordinal);
 
-		    TRACE(win32,"--- Ordinal %s.%d\n",name,ordinal);
+		    TRACE_(win32)("--- Ordinal %s.%d\n",name,ordinal);
 		    thunk_list->u1.Function=MODULE_GetProcAddress(
                         wmImp->module, (LPCSTR) ordinal, TRUE
 		    );
 		    if (!thunk_list->u1.Function) {
-			ERR(win32, "No implementation for %s.%d, setting to 0xdeadbeef\n",
+			ERR_(win32)("No implementation for %s.%d, setting to 0xdeadbeef\n",
 				name,ordinal);
                         thunk_list->u1.Function = (FARPROC)0xdeadbeef;
 		    }
 		} else {
 		    pe_name=(PIMAGE_IMPORT_BY_NAME) RVA(thunk_list->u1.AddressOfData);
-		    TRACE(win32,"--- %s %s.%d\n",
+		    TRACE_(win32)("--- %s %s.%d\n",
 		   		  pe_name->Name,name,pe_name->Hint);
 		    thunk_list->u1.Function=MODULE_GetProcAddress(
                         wmImp->module, pe_name->Name, TRUE
 		    );
 		    if (!thunk_list->u1.Function) {
-		    	ERR(win32, "No implementation for %s.%d, setting to 0xdeadbeef\n",
+		    	ERR_(win32)("No implementation for %s.%d, setting to 0xdeadbeef\n",
 				name, pe_name->Hint);
                         thunk_list->u1.Function = (FARPROC)0xdeadbeef;
 		    }
@@ -365,11 +365,11 @@
     int i,vma_size = 0;
     IMAGE_SECTION_HEADER *pe_seg = PE_SECTIONS(hModule);
 
-    TRACE(win32, "Dump of segment table\n");
-    TRACE(win32, "   Name    VSz  Vaddr     SzRaw   Fileadr  *Reloc *Lineum #Reloc #Linum Char\n");
+    TRACE_(win32)("Dump of segment table\n");
+    TRACE_(win32)("   Name    VSz  Vaddr     SzRaw   Fileadr  *Reloc *Lineum #Reloc #Linum Char\n");
     for (i = 0; i< PE_HEADER(hModule)->FileHeader.NumberOfSections; i++)
     {
-        TRACE(win32, "%8s: %4.4lx %8.8lx %8.8lx %8.8lx %8.8lx %8.8lx %4.4x %4.4x %8.8lx\n", 
+        TRACE_(win32)("%8s: %4.4lx %8.8lx %8.8lx %8.8lx %8.8lx %8.8lx %4.4x %4.4x %8.8lx\n", 
                       pe_seg->Name, 
                       pe_seg->Misc.VirtualSize,
                       pe_seg->VirtualAddress,
@@ -401,14 +401,14 @@
 		char *page = (char*) RVA(r->VirtualAddress);
 		int count = (r->SizeOfBlock - 8)/2;
 		int i;
-		TRACE(fixup, "%x relocations for page %lx\n",
+		TRACE_(fixup)("%x relocations for page %lx\n",
 			count, r->VirtualAddress);
 		/* patching in reverse order */
 		for(i=0;i<count;i++)
 		{
 			int offset = r->TypeOffset[i] & 0xFFF;
 			int type = r->TypeOffset[i] >> 12;
-			TRACE(fixup,"patching %x type %x\n", offset, type);
+			TRACE_(fixup)("patching %x type %x\n", offset, type);
 			switch(type)
 			{
 			case IMAGE_REL_BASED_ABSOLUTE: break;
@@ -429,13 +429,13 @@
 #endif
 				break;
 			case IMAGE_REL_BASED_HIGHADJ:
-				FIXME(win32, "Don't know what to do with IMAGE_REL_BASED_HIGHADJ\n");
+				FIXME_(win32)("Don't know what to do with IMAGE_REL_BASED_HIGHADJ\n");
 				break;
 			case IMAGE_REL_BASED_MIPS_JMPADDR:
-				FIXME(win32, "Is this a MIPS machine ???\n");
+				FIXME_(win32)("Is this a MIPS machine ???\n");
 				break;
 			default:
-				FIXME(win32, "Unknown fixup type\n");
+				FIXME_(win32)("Unknown fixup type\n");
 				break;
 			}
 		}
@@ -478,14 +478,14 @@
                                     0, 0, NULL );
     if (!mapping)
     {
-        WARN( win32, "CreateFileMapping error %ld\n", GetLastError() );
+        WARN_(win32)("CreateFileMapping error %ld\n", GetLastError() );
         return 0;
     }
     hModule = (HMODULE)MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, 0 );
     CloseHandle( mapping );
     if (!hModule)
     {
-        WARN( win32, "MapViewOfFile error %ld\n", GetLastError() );
+        WARN_(win32)("MapViewOfFile error %ld\n", GetLastError() );
         return 0;
     }
     nt = PE_HEADER( hModule );
@@ -493,7 +493,7 @@
     /* Check signature */
     if ( nt->Signature != IMAGE_NT_SIGNATURE )
     {
-        WARN(win32, "image doesn't have PE signature, but 0x%08lx\n",
+        WARN_(win32)("image doesn't have PE signature, but 0x%08lx\n",
                     nt->Signature );
         goto error;
     }
@@ -501,19 +501,19 @@
     /* Check architecture */
     if ( nt->FileHeader.Machine != IMAGE_FILE_MACHINE_I386 )
     {
-        MSG("Trying to load PE image for unsupported architecture (");
+        MESSAGE("Trying to load PE image for unsupported architecture (");
         switch (nt->FileHeader.Machine)
         {
-        case IMAGE_FILE_MACHINE_UNKNOWN: MSG("Unknown"); break;
-        case IMAGE_FILE_MACHINE_I860:    MSG("I860"); break;
-        case IMAGE_FILE_MACHINE_R3000:   MSG("R3000"); break;
-        case IMAGE_FILE_MACHINE_R4000:   MSG("R4000"); break;
-        case IMAGE_FILE_MACHINE_R10000:  MSG("R10000"); break;
-        case IMAGE_FILE_MACHINE_ALPHA:   MSG("Alpha"); break;
-        case IMAGE_FILE_MACHINE_POWERPC: MSG("PowerPC"); break;
-        default: MSG("Unknown-%04x", nt->FileHeader.Machine); break;
+        case IMAGE_FILE_MACHINE_UNKNOWN: MESSAGE("Unknown"); break;
+        case IMAGE_FILE_MACHINE_I860:    MESSAGE("I860"); break;
+        case IMAGE_FILE_MACHINE_R3000:   MESSAGE("R3000"); break;
+        case IMAGE_FILE_MACHINE_R4000:   MESSAGE("R4000"); break;
+        case IMAGE_FILE_MACHINE_R10000:  MESSAGE("R10000"); break;
+        case IMAGE_FILE_MACHINE_ALPHA:   MESSAGE("Alpha"); break;
+        case IMAGE_FILE_MACHINE_POWERPC: MESSAGE("PowerPC"); break;
+        default: MESSAGE("Unknown-%04x", nt->FileHeader.Machine); break;
         }
-        MSG(")\n");
+        MESSAGE(")\n");
         goto error;
     }
 
@@ -535,7 +535,7 @@
     /* Check file size */
     if ( file_size && file_size < rawsize )
     {
-        ERR( win32, "PE module is too small (header: %d, filesize: %d), "
+        ERR_(win32)("PE module is too small (header: %d, filesize: %d), "
                     "probably truncated download?\n", 
                     rawsize, file_size );
         goto error;
@@ -544,7 +544,7 @@
     /* Check entrypoint address */
     aoep = nt->OptionalHeader.AddressOfEntryPoint;
     if (aoep && (aoep < lowest_va))
-        FIXME( win32, "WARNING: '%s' has an invalid entrypoint (0x%08lx) "
+        FIXME_(win32)("WARNING: '%s' has an invalid entrypoint (0x%08lx) "
                       "below the first virtual address (0x%08x) "
                       "(possible Virus Infection or broken binary)!\n",
                        ofs->szPathName, aoep, lowest_va );
@@ -565,7 +565,7 @@
             reloc = dir->VirtualAddress;
         else 
         {
-            FIXME( win32,
+            FIXME_(win32)(
                    "FATAL: Need to relocate %s, but no relocation records present (%s). Try to run that file directly !\n",
                    ofs->szPathName,
                    (nt->FileHeader.Characteristics&IMAGE_FILE_RELOCS_STRIPPED)?
@@ -578,9 +578,9 @@
 					 PAGE_EXECUTE_READWRITE );
     }
 
-    TRACE( win32, "Load addr is %lx (base %lx), range %x\n",
+    TRACE_(win32)("Load addr is %lx (base %lx), range %x\n",
                   load_addr, nt->OptionalHeader.ImageBase, vma_size );
-    TRACE( segment, "Loading %s at %lx, range %x\n",
+    TRACE_(segment)("Loading %s at %lx, range %x\n",
                     ofs->szPathName, load_addr, vma_size );
 
     /* Store the NT header at the load addr */
@@ -676,38 +676,38 @@
         pe_resource = (PIMAGE_RESOURCE_DIRECTORY)RVA(dir->VirtualAddress);
 
     dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_EXCEPTION;
-    if (dir->Size) FIXME( win32, "Exception directory ignored\n" );
+    if (dir->Size) FIXME_(win32)("Exception directory ignored\n" );
 
     dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_SECURITY;
-    if (dir->Size) FIXME( win32, "Security directory ignored\n" );
+    if (dir->Size) FIXME_(win32)("Security directory ignored\n" );
 
     /* IMAGE_DIRECTORY_ENTRY_BASERELOC handled in PE_LoadImage */
     /* IMAGE_DIRECTORY_ENTRY_DEBUG handled by debugger */
 
     dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_DEBUG;
-    if (dir->Size) TRACE( win32, "Debug directory ignored\n" );
+    if (dir->Size) TRACE_(win32)("Debug directory ignored\n" );
 
     dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_COPYRIGHT;
-    if (dir->Size) FIXME( win32, "Copyright string ignored\n" );
+    if (dir->Size) FIXME_(win32)("Copyright string ignored\n" );
 
     dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_GLOBALPTR;
-    if (dir->Size) FIXME( win32, "Global Pointer (MIPS) ignored\n" );
+    if (dir->Size) FIXME_(win32)("Global Pointer (MIPS) ignored\n" );
 
     /* IMAGE_DIRECTORY_ENTRY_TLS handled in PE_TlsInit */
 
     dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG;
-    if (dir->Size) FIXME (win32, "Load Configuration directory ignored\n" );
+    if (dir->Size) FIXME_(win32)("Load Configuration directory ignored\n" );
 
     dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT;
-    if (dir->Size) TRACE( win32, "Bound Import directory ignored\n" );
+    if (dir->Size) TRACE_(win32)("Bound Import directory ignored\n" );
 
     dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_IAT;
-    if (dir->Size) TRACE( win32, "Import Address Table directory ignored\n" );
+    if (dir->Size) TRACE_(win32)("Import Address Table directory ignored\n" );
 
     dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT;
     if (dir->Size)
     {
-		TRACE( win32, "Delayed import, stub calls LoadLibrary\n" );
+		TRACE_(win32)("Delayed import, stub calls LoadLibrary\n" );
 		/*
 		 * Nothing to do here.
 		 */
@@ -719,23 +719,23 @@
 		{
 		ImgDelayDescr *pe_delay = NULL;
         pe_delay = (PImgDelayDescr)RVA(dir->VirtualAddress);
-        TRACE(delayhlp,"pe_delay->grAttrs = %08x\n", pe_delay->grAttrs);
-        TRACE(delayhlp,"pe_delay->szName = %s\n", pe_delay->szName);
-        TRACE(delayhlp,"pe_delay->phmod = %08x\n", pe_delay->phmod);
-        TRACE(delayhlp,"pe_delay->pIAT = %08x\n", pe_delay->pIAT);
-        TRACE(delayhlp,"pe_delay->pINT = %08x\n", pe_delay->pINT);
-        TRACE(delayhlp,"pe_delay->pBoundIAT = %08x\n", pe_delay->pBoundIAT);
-        TRACE(delayhlp,"pe_delay->pUnloadIAT = %08x\n", pe_delay->pUnloadIAT);
-        TRACE(delayhlp,"pe_delay->dwTimeStamp = %08x\n", pe_delay->dwTimeStamp);
+        TRACE_(delayhlp)("pe_delay->grAttrs = %08x\n", pe_delay->grAttrs);
+        TRACE_(delayhlp)("pe_delay->szName = %s\n", pe_delay->szName);
+        TRACE_(delayhlp)("pe_delay->phmod = %08x\n", pe_delay->phmod);
+        TRACE_(delayhlp)("pe_delay->pIAT = %08x\n", pe_delay->pIAT);
+        TRACE_(delayhlp)("pe_delay->pINT = %08x\n", pe_delay->pINT);
+        TRACE_(delayhlp)("pe_delay->pBoundIAT = %08x\n", pe_delay->pBoundIAT);
+        TRACE_(delayhlp)("pe_delay->pUnloadIAT = %08x\n", pe_delay->pUnloadIAT);
+        TRACE_(delayhlp)("pe_delay->dwTimeStamp = %08x\n", pe_delay->dwTimeStamp);
         }
 #endif /* ImgDelayDescr */
 	}
 
     dir = nt->OptionalHeader.DataDirectory+IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR;
-    if (dir->Size) FIXME( win32, "Unknown directory 14 ignored\n" );
+    if (dir->Size) FIXME_(win32)("Unknown directory 14 ignored\n" );
 
     dir = nt->OptionalHeader.DataDirectory+15;
-    if (dir->Size) FIXME( win32, "Unknown directory 15 ignored\n" );
+    if (dir->Size) FIXME_(win32)("Unknown directory 15 ignored\n" );
 
 
     /* Allocate and fill WINE_MODREF */
@@ -785,7 +785,7 @@
     if ( !(nt->FileHeader.Characteristics & IMAGE_FILE_DLL) )
     {
         if ( PROCESS_Current()->exe_modref )
-            FIXME( win32, "overwriting old exe_modref... arrgh\n" );
+            FIXME_(win32)("overwriting old exe_modref... arrgh\n" );
         PROCESS_Current()->exe_modref = wm;
     }
 
@@ -881,7 +881,7 @@
 	/* Create 32-bit MODREF */
 	if ( !(wm = PE_CreateModule( hModule32, &ofs, flags, builtin )) )
 	{
-		ERR(win32,"can't load %s\n",ofs.szPathName);
+		ERR_(win32)("can't load %s\n",ofs.szPathName);
 		FreeLibrary16( hModule16 );
 		*err = ERROR_OUTOFMEMORY;
 		return NULL;
@@ -960,7 +960,7 @@
  */
 int PE_UnloadImage( HMODULE hModule )
 {
-	FIXME(win32,"stub.\n");
+	FIXME_(win32)("stub.\n");
 	/* free resources, image, unmap */
 	return 1;
 }
@@ -980,7 +980,7 @@
         (PE_HEADER(wm->module)->OptionalHeader.AddressOfEntryPoint)
     ) {
         DLLENTRYPROC entry = (void*)RVA_PTR( wm->module,OptionalHeader.AddressOfEntryPoint );
-        TRACE(relay, "CallTo32(entryproc=%p,module=%08x,type=%ld,res=%p)\n",
+        TRACE_(relay)("CallTo32(entryproc=%p,module=%08x,type=%ld,res=%p)\n",
                        entry, wm->module, type, lpReserved );
 
         retv = entry( wm->module, type, lpReserved );
@@ -1031,7 +1031,7 @@
 		       (PIMAGE_TLS_CALLBACK *)pdir->AddressOfCallBacks;
 
 		     if (*cbs)
-		       FIXME(win32, "TLS Callbacks aren't going to be called\n");
+		       FIXME_(win32)("TLS Callbacks aren't going to be called\n");
 		}
 
 		TlsSetValue( pem->tlsindex, mem );
diff --git a/loader/resource.c b/loader/resource.c
index 7c5811f..017ddcc 100644
--- a/loader/resource.c
+++ b/loader/resource.c
@@ -27,7 +27,7 @@
 #include "process.h"
 #include "module.h"
 #include "file.h"
-#include "debug.h"
+#include "debugtools.h"
 #include "libres.h"
 #include "winerror.h"
 #include "debugstr.h"
@@ -67,7 +67,7 @@
         if ( !(map = (HRSRC_MAP *)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, 
                                              sizeof(HRSRC_MAP) ) ) )
         {
-            ERR( resource, "Cannot allocate HRSRC map\n" );
+            ERR_(resource)("Cannot allocate HRSRC map\n" );
             return 0;
         }
         pModule->hRsrcMap = (LPVOID)map;
@@ -86,7 +86,7 @@
                                                     (map->nAlloc + HRSRC_MAP_BLOCKSIZE) 
                                                     * sizeof(HRSRC_ELEM) ) ))
         {
-            ERR( resource, "Cannot grow HRSRC map\n" );
+            ERR_(resource)("Cannot grow HRSRC map\n" );
             return 0;
         }
         map->elem = newElem;
@@ -138,7 +138,7 @@
     WINE_MODREF *wm    = pModule && pModule->module32? 
                          MODULE32_LookupHMODULE( pModule->module32 ) : NULL;
 
-    TRACE( resource, "(%08x %s, %08x%s, %08x%s, %04x, %s, %s)\n",
+    TRACE_(resource)("(%08x %s, %08x%s, %08x%s, %04x, %s, %s)\n",
            hModule, NE_MODULE_NAME(pModule),
            (UINT)type, HIWORD(type)? (bUnicode? debugstr_w((LPWSTR)type) : debugstr_a(type)) : "",
            (UINT)name, HIWORD(name)? (bUnicode? debugstr_w((LPWSTR)name) : debugstr_a(name)) : "",
@@ -173,7 +173,7 @@
             break;
 	
         default:
-            ERR( resource, "unknown module type %d\n", wm->type );
+            ERR_(resource)("unknown module type %d\n", wm->type );
             break;
         }
 
@@ -229,7 +229,7 @@
     WINE_MODREF *wm    = pModule && pModule->module32? 
                          MODULE32_LookupHMODULE( pModule->module32 ) : NULL;
 
-    TRACE( resource, "(%08x %s, %08x, %s)\n",
+    TRACE_(resource)("(%08x %s, %08x, %s)\n",
            hModule, NE_MODULE_NAME(pModule), hRsrc, bRet16? "NE" : "PE" );
 
     if ( !pModule || !hRsrc ) return 0;
@@ -252,7 +252,7 @@
             break;
 
         default:
-            ERR( resource, "unknown module type %d\n", wm->type );
+            ERR_(resource)("unknown module type %d\n", wm->type );
             break;
         }
     }
@@ -280,7 +280,7 @@
     WINE_MODREF *wm    = pModule && pModule->module32? 
                          MODULE32_LookupHMODULE( pModule->module32 ) : NULL;
 
-    TRACE( resource, "(%08x %s, %08x, %s)\n",
+    TRACE_(resource)("(%08x %s, %08x, %s)\n",
            hModule, NE_MODULE_NAME(pModule), hRsrc, bRet16? "NE" : "PE" );
 
     if ( !pModule || !hRsrc ) return HFILE_ERROR;
@@ -293,7 +293,7 @@
         HRSRC hRsrc32 = HIWORD(hRsrc)? hRsrc : MapHRsrc16To32( pModule, hRsrc );
 #endif
 
-        FIXME( resource, "32-bit modules not yet supported.\n" );
+        FIXME_(resource)("32-bit modules not yet supported.\n" );
         hFile = HFILE_ERROR;
 
         /* If we need to return a 16-bit file handle, convert it */
@@ -328,7 +328,7 @@
     WINE_MODREF *wm    = pModule && pModule->module32? 
                          MODULE32_LookupHMODULE( pModule->module32 ) : NULL;
 
-    TRACE( resource, "(%08x %s, %08x, %s)\n",
+    TRACE_(resource)("(%08x %s, %08x, %s)\n",
            hModule, NE_MODULE_NAME(pModule), hRsrc, bRet16? "NE" : "PE" );
 
     if ( !pModule || !hRsrc ) return 0;
@@ -351,7 +351,7 @@
             break;
 
         default:
-            ERR( resource, "unknown module type %d\n", wm->type );
+            ERR_(resource)("unknown module type %d\n", wm->type );
             break;
         }
 
@@ -387,14 +387,14 @@
 {
     LPVOID bits = NULL;
 
-    TRACE( resource, "(%08x, %s)\n", handle, bRet16? "NE" : "PE" );
+    TRACE_(resource)("(%08x, %s)\n", handle, bRet16? "NE" : "PE" );
 
     if ( HIWORD( handle ) )
     {
         /* 32-bit memory handle */
 
         if ( bRet16 )
-            FIXME( resource, "can't return SEGPTR to 32-bit resource %08x.\n", handle );
+            FIXME_(resource)("can't return SEGPTR to 32-bit resource %08x.\n", handle );
         else
             bits = (LPVOID)handle;
     }
@@ -421,7 +421,7 @@
 {
     HGLOBAL retv = handle;
 
-    TRACE( resource, "(%08x)\n", handle );
+    TRACE_(resource)("(%08x)\n", handle );
 
     if ( HIWORD( handle ) )
     {
@@ -594,18 +594,18 @@
     HRSRC16	hRsrc;
 
     if (HIWORD(lpTableName))
-        TRACE(accel, "%04x '%s'\n",
+        TRACE_(accel)("%04x '%s'\n",
                       instance, (char *)PTR_SEG_TO_LIN( lpTableName ) );
     else
-        TRACE(accel, "%04x %04x\n",
+        TRACE_(accel)("%04x %04x\n",
                        instance, LOWORD(lpTableName) );
 
     if (!(hRsrc = FindResource16( instance, lpTableName, RT_ACCELERATOR16 ))) {
-      WARN(accel, "couldn't find accelerator table resource\n");
+      WARN_(accel)("couldn't find accelerator table resource\n");
       return 0;
     }
 
-    TRACE(accel, "returning HACCEL 0x%x\n", hRsrc);
+    TRACE_(accel)("returning HACCEL 0x%x\n", hRsrc);
     return LoadResource16(instance,hRsrc);
 }
 
@@ -625,15 +625,15 @@
     DWORD size;
 
     if (HIWORD(lpTableName))
-        TRACE(accel, "%p '%s'\n",
+        TRACE_(accel)("%p '%s'\n",
                       (LPVOID)instance, (char *)( lpTableName ) );
     else
-        TRACE(accel, "%p 0x%04x\n",
+        TRACE_(accel)("%p 0x%04x\n",
                        (LPVOID)instance, LOWORD(lpTableName) );
 
     if (!(hRsrc = FindResourceW( instance, lpTableName, RT_ACCELERATORW )))
     {
-      WARN(accel, "couldn't find accelerator table resource\n");
+      WARN_(accel)("couldn't find accelerator table resource\n");
     } else {
       hMem = LoadResource( instance, hRsrc );
       size = SizeofResource( instance, hRsrc );
@@ -653,7 +653,7 @@
 	accel16[i-1].fVirt |= 0x80;
       }
     }
-    TRACE(accel, "returning HACCEL 0x%x\n", hRsrc);
+    TRACE_(accel)("returning HACCEL 0x%x\n", hRsrc);
     return hRetval;
 }
 
@@ -693,7 +693,7 @@
   /* Do parameter checking to avoid the explosions and the screaming
      as far as possible. */
   if((dst && (entries < 1)) || (src == (HACCEL)NULL) || !accel) {
-    WARN(accel, "Application sent invalid parameters (%p %p %d).\n",
+    WARN_(accel)("Application sent invalid parameters (%p %p %d).\n",
 	 (LPVOID)src, (LPVOID)dst, entries);
     return 0;
   }
@@ -703,7 +703,7 @@
   i=0;
   while(!done) {
     /* Spit out some debugging information. */
-    TRACE(accel, "accel %d: type 0x%02x, event '%c', IDval 0x%04x.\n",
+    TRACE_(accel)("accel %d: type 0x%02x, event '%c', IDval 0x%04x.\n",
 	  i, accel[i].fVirt, accel[i].key, accel[i].cmd);
 
     /* Copy data to the destination structure array (if dst == NULL,
@@ -746,21 +746,21 @@
   /* Do parameter checking just in case someone's trying to be
      funny. */
   if(cEntries < 1) {
-    WARN(accel, "Application sent invalid parameters (%p %d).\n",
+    WARN_(accel)("Application sent invalid parameters (%p %d).\n",
 	 lpaccel, cEntries);
     SetLastError(ERROR_INVALID_PARAMETER);
     return (HACCEL)NULL;
   }
-  FIXME(accel, "should check that the accelerator descriptions are valid,"
+  FIXME_(accel)("should check that the accelerator descriptions are valid,"
 	" return NULL and SetLastError() if not.\n");
 
 
   /* Allocate memory and copy the table. */
   hAccel = GlobalAlloc16(0,cEntries*sizeof(ACCEL16));
 
-  TRACE(accel, "handle %x\n", hAccel);
+  TRACE_(accel)("handle %x\n", hAccel);
   if(!hAccel) {
-    ERR(accel, "Out of memory.\n");
+    ERR_(accel)("Out of memory.\n");
     SetLastError(ERROR_NOT_ENOUGH_MEMORY);
     return (HACCEL)NULL;
   }
@@ -773,7 +773,7 @@
   /* Set the end-of-table terminator. */
   accel[cEntries-1].fVirt |= 0x80;
 
-  TRACE(accel, "Allocated accelerator handle %x\n", hAccel);
+  TRACE_(accel)("Allocated accelerator handle %x\n", hAccel);
   return hAccel;
 }
 
@@ -792,7 +792,7 @@
  */
 BOOL WINAPI DestroyAcceleratorTable( HACCEL handle )
 {
-    FIXME(accel, "(0x%x): stub\n", handle);
+    FIXME_(accel)("(0x%x): stub\n", handle);
     /* FIXME: GlobalFree16(handle); */
     return TRUE;
 }
@@ -809,7 +809,7 @@
     int string_num;
     int i;
 
-    TRACE(resource,"inst=%04x id=%04x buff=%08x len=%d\n",
+    TRACE_(resource)("inst=%04x id=%04x buff=%08x len=%d\n",
                      instance, resource_id, (int) buffer, buflen);
 
     hrsrc = FindResource16( instance, (SEGPTR)((resource_id>>4)+1), RT_STRING16 );
@@ -822,7 +822,7 @@
     for (i = 0; i < string_num; i++)
 	p += *p + 1;
     
-    TRACE(resource, "strlen = %d\n", (int)*p );
+    TRACE_(resource)("strlen = %d\n", (int)*p );
     
     i = MIN(buflen - 1, *p);
     if (buffer == NULL)
@@ -835,11 +835,11 @@
 	    buffer[0] = '\0';
 	    return 0;
 	}
-	WARN(resource,"Dont know why caller give buflen=%d *p=%d trying to obtain string '%s'\n", buflen, *p, p + 1);
+	WARN_(resource)("Dont know why caller give buflen=%d *p=%d trying to obtain string '%s'\n", buflen, *p, p + 1);
     }
     FreeResource16( hmem );
 
-    TRACE(resource,"'%s' loaded !\n", buffer);
+    TRACE_(resource)("'%s' loaded !\n", buffer);
     return i;
 }
 
@@ -857,7 +857,7 @@
 
     if (HIWORD(resource_id)==0xFFFF) /* netscape 3 passes this */
 	resource_id = (UINT)(-((INT)resource_id));
-    TRACE(resource, "instance = %04x, id = %04x, buffer = %08x, "
+    TRACE_(resource)("instance = %04x, id = %04x, buffer = %08x, "
 	   "length = %d\n", instance, (int)resource_id, (int) buffer, buflen);
 
     /* Use bits 4 - 19 (incremented by 1) as resourceid, mask out 
@@ -873,7 +873,7 @@
     for (i = 0; i < string_num; i++)
 	p += *p + 1;
     
-    TRACE(resource, "strlen = %d\n", (int)*p );
+    TRACE_(resource)("strlen = %d\n", (int)*p );
     
     i = MIN(buflen - 1, *p);
     if (buffer == NULL)
@@ -887,11 +887,11 @@
 	    return 0;
 	}
 #if 0
-	WARN(resource,"Dont know why caller give buflen=%d *p=%d trying to obtain string '%s'\n", buflen, *p, p + 1);
+	WARN_(resource)("Dont know why caller give buflen=%d *p=%d trying to obtain string '%s'\n", buflen, *p, p + 1);
 #endif
     }
 
-    TRACE(resource,"%s loaded !\n", debugstr_w(buffer));
+    TRACE_(resource)("%s loaded !\n", debugstr_w(buffer));
     return i;
 }
 
@@ -955,7 +955,7 @@
     PMESSAGE_RESOURCE_ENTRY	mre;
     int		i,slen;
 
-    TRACE(resource, "instance = %08lx, id = %08lx, buffer = %p, length = %ld\n", (DWORD)instance, (DWORD)id, buffer, (DWORD)buflen);
+    TRACE_(resource)("instance = %08lx, id = %08lx, buffer = %p, length = %ld\n", (DWORD)instance, (DWORD)id, buffer, (DWORD)buflen);
 
     /*FIXME: I am not sure about the '1' ... But I've only seen those entries*/
     hrsrc = FindResourceExW(instance,RT_MESSAGELISTW,(LPWSTR)1,lang);
@@ -982,7 +982,7 @@
     	mre = (PMESSAGE_RESOURCE_ENTRY)(((char*)mre)+(mre->Length));
     }
     slen=mre->Length;
-    TRACE(resource,"	- strlen=%d\n",slen);
+    TRACE_(resource)("	- strlen=%d\n",slen);
     i = MIN(buflen - 1, slen);
     if (buffer == NULL)
 	return slen; /* different to LoadString */
@@ -996,7 +996,7 @@
 	}
     }
     if (buffer)
-	    TRACE(resource,"'%s' copied !\n", buffer);
+	    TRACE_(resource)("'%s' copied !\n", buffer);
     return i;
 }