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

Windows Kernel

Development Platform:

Visual C++

  1. #ifndef __debug_h__
  2. #define __debug_h__
  3. // For compatibility with WINNT build environment:
  4. #if DBG
  5. #define DEBUG 1
  6. #endif
  7. #ifdef DEBUG
  8. #define DBOUT(str)      OutputDebugString(str)
  9. #define DebugTrap  DebugBreak();
  10. #ifdef LOTS_O_DEBUG
  11. #include "nocrt.h"
  12. #include <objbase.h>
  13. #include <objerror.h>
  14. //#include <stdio.h>              // Prevent sprintf warnings in client code....
  15.   // Simple debug statements
  16. #define DebugSzdw(sz,dw) 
  17. {                                                                              
  18.   TCHAR szT[100];                                                               
  19.   wsprintf (szT, sz, dw);                                                       
  20.   MessageBox (GetFocus(), szT, NULL, MB_OK);                                   
  21. }
  22. #define DebugSz(sz) MessageBox (GetFocus(), sz, NULL, MB_OK)
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. void _DebugHr (HRESULT hr, LPTSTR lpszFile, DWORD dwLine);
  27. void _DebugGUID (GUID g);
  28. #ifdef __cplusplus
  29. }; // extern C
  30. #endif
  31. #define DebugHr(hr) _DebugHr (hr, __FILE__, __LINE__)
  32. #define DebugGUID(guid) _DebugGUID (guid)
  33. #else //LOTS_O_DEBUG
  34. #define DebugSzdw(sz,dw)
  35. #define DebugSz(sz)
  36. #define DebugHr(hr)
  37. #define DebugGUID(guid)
  38. #endif // LOTS_O_DEBUG
  39. #ifdef __cplusplus
  40. extern TEXT("C") {
  41. #endif
  42. void _Assert (DWORD dw, LPSTR lpszExp, LPSTR lpszFile, DWORD dwLine);
  43. void _AssertSz (DWORD dw, LPSTR lpszExp, LPTSTR lpsz, LPSTR lpszFile, DWORD dwLine);
  44. #ifdef __cplusplus
  45. }; // extern C
  46. #endif
  47. #define Assert(dw) if (!(dw)) _Assert((dw), (#dw), __FILE__, __LINE__)
  48. #define AssertSz(dw,sz) if (!(dw)) _AssertSz ((dw), (#dw), (sz), __FILE__, __LINE__)
  49. #else // DEBUG
  50. #define Assert(dw)
  51. #define AssertSz(dw,sz)
  52. #define DebugSzdw(sz,dw)
  53. #define DebugSz(sz)
  54. #define DebugHr(hr)
  55. #define DebugGUID(guid)
  56. #define DBOUT(str)
  57. #endif // DEBUG
  58. #endif // __debug_h__