Source code of Windows XP (NT5)
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.

93 lines
2.7 KiB

  1. #include "precomp.h"
  2. #pragma hdrstop
  3. /***************************************************************************/
  4. /***** Common Library Component - Debug Assert - 1 *************************/
  5. /***************************************************************************/
  6. #if DBG
  7. /*
  8. ** Purpose:
  9. ** Generate a message box with the file name and line number for an
  10. ** Assert() that failed.
  11. ** Arguments:
  12. ** szFile: non-NULL pointer to string containing the name of the source
  13. ** file where the Assert occurred.
  14. ** usLine: the line number where the Assert occurred.
  15. ** Returns:
  16. ** fTrue for success, fFalse otherwise.
  17. **
  18. ***************************************************************************/
  19. BOOL APIENTRY AssertSzUs(SZ szFile,USHORT usLine)
  20. {
  21. CHP szText[129];
  22. AssertDataSeg();
  23. ChkArg(szFile != (SZ)NULL, 1, fFalse);
  24. wsprintf((LPSTR)szText, (LPSTR)"Assert Failed: File: %.60s, Line: %u",
  25. (LPSTR)szFile, (INT)usLine);
  26. MessBoxSzSz("Assertion Failure", szText);
  27. return(fTrue);
  28. }
  29. /*
  30. ** Purpose:
  31. ** Generate a message box with the file name and line number for a
  32. ** PreCondition() that failed.
  33. ** Arguments:
  34. ** szFile: non-NULL pointer to string containing the name of the source
  35. ** file where the PreCondition occurred.
  36. ** usLine: the line number where the PreCondition occurred.
  37. ** Returns:
  38. ** fTrue if successful, fFalse otherwise.
  39. **
  40. ***************************************************************************/
  41. BOOL APIENTRY PreCondSzUs(SZ szFile,USHORT usLine)
  42. {
  43. CHP szText[129];
  44. AssertDataSeg();
  45. ChkArg(szFile != (SZ)NULL, 1, fFalse);
  46. wsprintf((LPSTR)szText, (LPSTR)"PreCondition Failed: File: %.60s, Line: %u",
  47. (LPSTR)szFile, (INT)usLine);
  48. MessBoxSzSz("PreCondition Failure", szText);
  49. return(fTrue);
  50. }
  51. /*
  52. ** Purpose:
  53. ** Generate a message box with the argument number that was bad.
  54. ** Arguments:
  55. ** iArg: the index of the bad argument.
  56. ** szFile: non-NULL string containing name of source file where error
  57. ** occurred.
  58. ** usLine: line number in source file where error occurred.
  59. ** Returns:
  60. ** fTrue if successful, fFalse otherwise.
  61. **
  62. ***************************************************************************/
  63. BOOL APIENTRY BadParamUs(USHORT iArg,SZ szFile,USHORT usLine)
  64. {
  65. CHP szText[129];
  66. AssertDataSeg();
  67. ChkArg(szFile != (SZ)NULL, 2, fFalse);
  68. wsprintf((LPSTR)szText, (LPSTR)"Bad Argument Value:\nNumber %u\n"
  69. "File: %.60s, Line: %u", (unsigned int)iArg, (LPSTR)szFile,
  70. (unsigned int)usLine);
  71. MessBoxSzSz("Bad Argument Value", szText);
  72. return(fTrue);
  73. }
  74. #endif