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.

50 lines
1.3 KiB

  1. #include "rgb_pch.h"
  2. #pragma hdrstop
  3. namespace RGB_RAST_LIB_NAMESPACE
  4. {
  5. #if DBG
  6. bool Assert(LPCSTR szFile, int nLine, LPCSTR szCondition)
  7. {
  8. typedef BOOL (*PFNBV)(VOID);
  9. static bool bInit( false);
  10. static PFNBV pIsDebuggerPresent= NULL;
  11. LONG err;
  12. char str[256];
  13. // Initialize stuff
  14. if(!bInit)
  15. {
  16. HINSTANCE hinst;
  17. bInit= true;
  18. // Get IsDebuggerPresent entry point
  19. if((hinst = (HINSTANCE) GetModuleHandle("kernel32.dll")) ||
  20. (hinst = (HINSTANCE) LoadLibrary("kernel32.dll")))
  21. {
  22. pIsDebuggerPresent = (PFNBV) GetProcAddress(hinst, "IsDebuggerPresent");
  23. }
  24. }
  25. // Display a message box if no debugger is present
  26. if(pIsDebuggerPresent && !pIsDebuggerPresent())
  27. {
  28. _snprintf(str, sizeof(str), "File:\t %s\nLine:\t %d\nAssertion:\t%s\n\nDo you want to invoke the debugger?", szFile, nLine, szCondition);
  29. err = MessageBox(NULL, str, "RGBRast Assertion Failure", MB_SYSTEMMODAL | MB_YESNOCANCEL);
  30. switch(err)
  31. {
  32. case IDYES: return true;
  33. case IDNO: return false;
  34. case IDCANCEL: FatalAppExit(0, "RGBRast Assertion Failure.. Application terminated"); return true;
  35. }
  36. }
  37. return true;
  38. }
  39. #endif // DBG
  40. }