debug.h
Upload User: xhy777
Upload Date: 2007-02-14
Package Size: 24088k
Code Size: 4k
Category:

Windows Kernel

Development Platform:

Visual C++

  1. //*******************************************************************************************
  2. //
  3. // Filename : Debug.h
  4. //
  5. // Definitions of Debug routines
  6. //
  7. // Copyright (c) 1994 - 1996 Microsoft Corporation. All rights reserved
  8. //
  9. //*******************************************************************************************
  10. #define NOSHELLDEBUG // don't take shell versions of this
  11. // NOTE: You can #define your own DM_* values using bits in the HI BYTE
  12.                                                                
  13. #define DM_TRACE    0x0001      // Trace messages              
  14. #define DM_WARNING  0x0002      // Warning                     
  15. #define DM_ERROR    0x0004      // Error                       
  16. #define DM_ASSERT   0x0008      // Assertions                  
  17.                                                                
  18. // NOTE: Default debug mask is 0x00ff (show everything)        
  19. //                                                             
  20. // Inside debugger, you can modify wDebugMask variable.        
  21. //                                                             
  22. // Set debug mask; returning previous.                         
  23. //                                                             
  24. UINT WINAPI SetDebugMask(UINT mask);                           
  25.                                                                
  26. // Get debug mask.                                             
  27. //                                                             
  28. UINT WINAPI GetDebugMask();                                    
  29.                                                                
  30. // Use this macro to declare message text that will be placed  
  31. // in the CODE segment (useful if DS is getting full)          
  32. //                                                             
  33. // Ex: DBGTEXT(szMsg, "Invalid whatever: %d");               
  34. //                                                             
  35. #define DBGTEXT(sz, msg)      static const CHAR sz[] = msg;                    
  36.                                                                
  37. #ifdef DEBUG
  38. // Assert(f)  -- Generate "assertion failed in line x of file.c"
  39. //               message if f is NOT true.
  40. //
  41. // AssertMsg(f, msg, args...)  -- Generate wsprintf-formatted msg w/params
  42. //                          if f is NOT true.                  
  43. //                                                             
  44. // DebugMsg(mask, msg, args...) -                              
  45. //         Generate wsprintf-formatted msg using               
  46. //         specified debug mask.  System debug mask
  47. //         governs whether message is output.
  48. //                                                             
  49. void WINAPI AssertFailed(LPCSTR szFile, int line);
  50. #define Assert(f)                           
  51.     {                                       
  52.         DBGTEXT(szFile, __FILE__);          
  53.         if (!(f))                           
  54.             AssertFailed(szFile, __LINE__); 
  55.     }                                       
  56. #define AssertE(f) Assert(f)                
  57.                                                                
  58. void __cdecl _AssertMsg(BOOL f, LPCSTR pszMsg, ...);        
  59. #define AssertMsg   _AssertMsg                                 
  60.                                                                
  61. void __cdecl _DebugMsg(UINT mask, LPCSTR psz, ...);        
  62. #define DebugMsg    _DebugMsg                                  
  63.                                                                
  64. #else
  65. // retail versions to produce no code, no data
  66.                                                                
  67. #define Assert(f)                                              
  68. #define AssertE(f)      (f)                                    
  69. #define AssertMsg   1 ? (void)0 : (void)                       
  70. #define DebugMsg    1 ? (void)0 : (void)                       
  71.                                                                
  72. #endif