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.

90 lines
2.5 KiB

  1. /*++
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. log.h
  5. Abstract:
  6. Header file for routines to log errors, warnings and info in the asr
  7. log file at %systemroot%\repair\asr.log
  8. Author:
  9. Guhan Suriyanarayanan (guhans) 10-Jul-2000
  10. Environment:
  11. User-mode only.
  12. Revision History:
  13. 10-Jul-2000 guhans
  14. Initial creation
  15. --*/
  16. #ifndef _INC_ASR_SF_GEN__LOG_H_
  17. #define _INC_ASR_SF_GEN__LOG_H_
  18. typedef enum __MesgLevel {
  19. s_Info = 0,
  20. s_Warning,
  21. s_Error
  22. } _MesgLevel;
  23. //
  24. // Functions for logging error messages
  25. //
  26. VOID
  27. AsrpInitialiseLogFiles(
  28. VOID
  29. );
  30. VOID
  31. AsrpCloseLogFiles(
  32. VOID
  33. );
  34. VOID
  35. AsrpPrintDbgMsg(
  36. IN CONST _MesgLevel Level,
  37. IN CONST PCSTR FormatString,
  38. ...
  39. );
  40. //
  41. // Macro Description:
  42. // This macro wraps calls that are expected to return SUCCESS (retcode).
  43. // If ErrorCondition occurs, it sets the LocalStatus to the ErrorCode
  44. // passed in, calls SetLastError() to set the Last Error to ErrorCode,
  45. // and jumps to the EXIT label in the calling function
  46. //
  47. // Arguments:
  48. // ErrorCondition // Result of some function call or conditional expression.
  49. // LocalStatus // Status variable in the calling function
  50. // LONG ErrorCode // An ErrorCode specific to the error and calling function
  51. //
  52. #define ErrExitCode(ErrorCondition, LocalStatus, ErrorCode) { \
  53. \
  54. if ((BOOL) ErrorCondition) { \
  55. \
  56. if ((BOOL) ErrorCode) { \
  57. AsrpPrintDbgMsg(s_Error, "%S(%lu): ErrorCode: %lu, GetLastError:%lu\n", \
  58. __FILE__, __LINE__, ErrorCode, GetLastError()); \
  59. } \
  60. \
  61. LocalStatus = (DWORD) ErrorCode; \
  62. \
  63. SetLastError((DWORD) ErrorCode); \
  64. \
  65. goto EXIT; \
  66. } \
  67. }
  68. #endif // _INC_ASR_SF_GEN__LOG_H_