Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

98 lines
1.9 KiB

  1. /*++
  2. Copyright (c) 1998-1999 Microsoft Corporation
  3. Module Name:
  4. drdbg
  5. Abstract:
  6. Contains Debug Routines for TS Device Redirector Component,
  7. RDPDR.DLL.
  8. Author:
  9. Tad Brockway 8/25/99
  10. Revision History:
  11. --*/
  12. #ifndef __DRDBG_H__
  13. #define __DRDBG_H__
  14. // Disable conditional expression as constant warnings
  15. #pragma warning (disable: 4127)
  16. //
  17. // Route ASSERT to TRC_ERR and then abort. Don't like
  18. // the DCL assert because it pops up its own dialog and
  19. // allows other threads to spin, thereby possibly losing state
  20. // of the process.
  21. //
  22. #undef ASSERT
  23. #if DBG
  24. #define ASSERT(expr) \
  25. if (!(expr)) { \
  26. TRC_ERR((TB,_T("Failed: %s\nLine %d, %s"), \
  27. _T(#expr), \
  28. __LINE__, \
  29. _T(__FILE__) )); \
  30. DebugBreak(); \
  31. }
  32. #else
  33. #define ASSERT(expr)
  34. #endif
  35. //
  36. // Object and Memory Tracking Defines
  37. //
  38. #define GOODMEMMAGICNUMBER 0x07052530
  39. #define DRBADMEM 0xDA
  40. #define UNITIALIZEDMEM 0xCC
  41. #define FREEDMEMMAGICNUMBER 0x09362229
  42. //
  43. // Memory Allocation Tags
  44. //
  45. #define DROBJECT_TAG ('BORD')
  46. #define DRGLOBAL_TAG ('BGRD')
  47. ////////////////////////////////////////////////////////////
  48. //
  49. // Memory Allocation Routines
  50. //
  51. //#if DBG
  52. // remove this ... i mean, restore this.
  53. #ifdef NOTUSED
  54. //
  55. // The Functions
  56. //
  57. void *DrAllocateMem(size_t size, DWORD tag);
  58. void DrFreeMem(void *ptr);
  59. //
  60. // The C++ Operators
  61. //
  62. inline void *__cdecl operator new(size_t sz)
  63. {
  64. void *ptr = DrAllocateMem(sz, DRGLOBAL_TAG);
  65. return ptr;
  66. }
  67. inline void *__cdecl operator new(size_t sz, DWORD tag)
  68. {
  69. void *ptr = DrAllocateMem(sz, tag);
  70. return ptr;
  71. }
  72. inline void __cdecl operator delete(void *ptr)
  73. {
  74. DrFreeMem(ptr);
  75. }
  76. #endif
  77. #endif