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.

37 lines
740 B

  1. #pragma once
  2. #ifndef _MYDEBUG_H_
  3. #define _MYDEBUG_H_
  4. #include <malloc.h>
  5. class _com_error;
  6. #define THROW_IF_NULL(x) if ( x ) {} else throw _com_error(E_OUTOFMEMORY)
  7. #ifdef DBG
  8. #include <crtdbg.h>
  9. #define THIS_FILE __FILE__
  10. #define DEBUG_NEW new(THIS_FILE, __LINE__)
  11. #define DEBUG_START DebugStart()
  12. #define DEBUG_STOP DebugStop()
  13. void* __cdecl operator new( size_t s, const char* file, long line ) _THROW1(_com_error);
  14. #if _MSC_VER >= 1200
  15. void __cdecl operator delete(void *p, const char* file, long line) _THROW0();
  16. #endif
  17. void DebugStart();
  18. void DebugStop();
  19. #else // !DBG
  20. #define DEBUG_NEW new
  21. #define DEBUG_START
  22. #define DEBUG_STOP
  23. #endif // #ifdef DBG
  24. #endif // #ifndef _MYDEBUG_H_