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.

104 lines
2.9 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. log.h
  5. Abstract:
  6. Definitions and globals for internal only debug and support routines
  7. Author:
  8. Mac McLain (MacM) Aug 11, 1997
  9. Environment:
  10. Revision History:
  11. --*/
  12. #ifndef __LOG_H__
  13. #define __LOG_H__
  14. #define DSROLEP_VERBOSE_LOGGING
  15. #ifdef DSROLEP_VERBOSE_LOGGING
  16. #define DEB_TRACE_DS 0x00000008
  17. #define DEB_TRACE_UPDATE 0x00000010
  18. #define DEB_TRACE_LOCK 0x00000020
  19. #define DEB_TRACE_SERVICES 0x00000040
  20. #define DEB_TRACE_NET 0x00000080
  21. //
  22. // exported so it can be init'ed in DsRolepInitialize
  23. //
  24. extern CRITICAL_SECTION LogFileCriticalSection;
  25. DWORD
  26. DsRolepInitializeLog(
  27. VOID
  28. );
  29. DWORD
  30. DsRolepSetAndClearLog(
  31. VOID
  32. );
  33. DWORD
  34. DsRolepCloseLog(
  35. VOID
  36. );
  37. VOID
  38. DsRolepLogPrintRoutine(
  39. IN DWORD DebugFlag,
  40. IN LPSTR Format,
  41. ...
  42. );
  43. #define DsRolepLogPrint( x ) DsRolepLogPrintRoutine x
  44. #define DsRolepDisplayOptional( y ) y ? y : L"(NULL)"
  45. #define DsRolepLogOnFailure( z, a ) if ( z != ERROR_SUCCESS ) a
  46. #define DsRolepLogGuid( l, t, g ) g == NULL ? DsRolepLogPrint(( l, "%S (NULL)\n", t )) : \
  47. DsRolepLogPrint(( l, "%S %08x-%04x-%04x-%02x%02x%02x%02x%02x%02x%02x%02x\n", \
  48. t,(g)->Data1,(g)->Data2,(g)->Data3,(g)->Data4[0], \
  49. (g)->Data4[1],(g)->Data4[2],(g)->Data4[3],(g)->Data4[4], \
  50. (g)->Data4[5],(g)->Data4[6],(g)->Data4[7]))
  51. #define DsRolepLogSid( l, t, s ) \
  52. { LPWSTR sidstring; \
  53. ConvertSidToStringSidW( s, &sidstring ); \
  54. DsRolepLogPrint(( l, "%S %ws\n", t, sidstring )); \
  55. LocalFree(sidstring); \
  56. }
  57. #define DsRolepUnicodestringtowstr( s, u ) \
  58. { s = (WCHAR*)malloc(u.Length+sizeof(WCHAR)); \
  59. if (s){ \
  60. CopyMemory(s,u.Buffer,u.Length); \
  61. s[u.Length/sizeof(WCHAR)] = L'\0'; \
  62. } \
  63. }
  64. #else
  65. #define DsRolepInitializeLog()
  66. #define DsRolepCloseLog()
  67. #define DsRolepLogPrint( x )
  68. #define DsRolepDisplayOptional( y )
  69. #define DsRolepLogOnFailure( z, a )
  70. #define DsRolepLogGuid( t, g )
  71. #define DsRolepLogSid( t, s )
  72. #define DsRolepSetAndClearLog()
  73. #define DsRolepUnicodestringtowstr( s, u )
  74. #endif
  75. #endif // __LOG_H__