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.

64 lines
1.5 KiB

  1. /*** error.c - Error Reporting
  2. *
  3. * Microsoft Confidential
  4. * Copyright (C) Microsoft Corporation 1993-1994
  5. * All Rights Reserved.
  6. *
  7. * History:
  8. * 10-Aug-1993 bens Initial version
  9. * 03-May-1994 bens Add err.code and err.pv fields
  10. */
  11. #include "types.h"
  12. #include "asrt.h"
  13. #include "error.h"
  14. #include "message.h"
  15. /*** ErrSet - Set error message
  16. *
  17. * NOTE: See error.h for entry/exit conditions.
  18. */
  19. void __cdecl ErrSet(PERROR perr, char *pszMsg, ...)
  20. {
  21. va_list marker;
  22. char *pszFmtList;
  23. Assert(perr!=NULL);
  24. Assert(pszMsg!=NULL);
  25. va_start(marker,pszMsg); // Initialize variable arguments
  26. pszFmtList = (char *)va_arg(marker,char *); // Assume format string
  27. //** Format the message
  28. MsgSetWorker(perr->ach,pszMsg,pszFmtList,marker);
  29. va_end(marker); // Done with variable arguments
  30. perr->fError = TRUE;
  31. }
  32. /*** ErrClear - Clear ERROR
  33. *
  34. * NOTE: See error.h for entry/exit conditions.
  35. */
  36. void ErrClear(PERROR perr)
  37. {
  38. Assert(perr != NULL);
  39. perr->fError = FALSE; // No error
  40. perr->ach[0] = '\0'; // No message
  41. perr->code = 0;
  42. perr->pv = NULL;
  43. }
  44. #ifdef ASSERT
  45. /*** ErrIsError - Check if error condition is set
  46. *
  47. * NOTE: See error.h for entry/exit conditions.
  48. */
  49. BOOL ErrIsError(PERROR perr)
  50. {
  51. Assert(perr != NULL);
  52. return perr->fError;
  53. }
  54. #endif