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.

85 lines
2.5 KiB

  1. /*** error.h - Definitions for 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. * 09-Feb-1994 bens Add pszLine to ERROR structure
  10. * 03-May-1994 bens Add err.code and err.pv fields
  11. */
  12. #ifndef INCLUDED_ERROR
  13. #define INCLUDED_ERROR 1
  14. #include "message.h"
  15. typedef struct {
  16. char ach[cbMSG_MAX]; // Error message
  17. BOOL fError; // TRUE => error present
  18. char *pszFile; // Name of directives file being processed
  19. int iLine; // Line number in directives file, if >0
  20. char *pszLine; // Text of current line being processed
  21. int code; // Detailed error code
  22. void *pv; // Additional error information
  23. } ERROR; /* err */
  24. typedef ERROR *PERROR; /* perr */
  25. /*** ErrSet - Set error message
  26. *
  27. * Entry
  28. * perr - ERROR structure to receive formatted message
  29. * pszMsg - Message string, possibly including %1, %2, ... replaceable
  30. * parameters.
  31. * Remaining arguments are optional, and depend upon presence of %N
  32. * replaceable parameters in pszMsg:
  33. * pszFmt - If at least one %N string in pszMsg, then this contains
  34. * sprintf() formatting strings.
  35. * Arg1 - Present only if %1 is present.
  36. * Arg2 - Present only if %2 is present.
  37. * ...
  38. *
  39. * Exit-Success
  40. * perr filled in with formatted message.
  41. * Arg1 is formatted according to the first sprintf format in
  42. * pszFmt, and replaces the %1 in pszMsg. Similar treatment for
  43. * any other arguments.
  44. *
  45. * Exit-Failure
  46. * perr filled in with message describing bad arguments.
  47. */
  48. void __cdecl ErrSet(PERROR perr, char *pszMsg, ...);
  49. /*** ErrClear - Clear ERROR
  50. *
  51. * Entry
  52. * perr - ERROR structure to clear
  53. *
  54. * Exit-Success
  55. * perr is cleared
  56. */
  57. void ErrClear(PERROR perr);
  58. /*** ErrIsError - Check if error condition is set
  59. *
  60. * Entry
  61. * perr - ERROR structure to check
  62. *
  63. * Exit-Success
  64. * Returns TRUE if an error message is set.
  65. *
  66. * Exit-Failure
  67. * Returns FALSE if no error message set.
  68. */
  69. #ifdef ASSERT
  70. BOOL ErrIsError(PERROR perr);
  71. #else // !ASSERT
  72. #define ErrIsError(perr) (perr->fError) // Fast dereference
  73. #endif // !ASSERT
  74. #endif // !INCLUDED_ERROR