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.

91 lines
2.3 KiB

  1. #ifndef _LOGUTILS_H_
  2. #define _LOGUTILS_H_
  3. #include <windows.h>
  4. #include <ntlog.h>
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <tchar.h>
  8. //
  9. // Definitions
  10. //
  11. #define LOG_STRING_LEN 256
  12. #define LOG_SPACE_LEN 6
  13. #define NTLOG_LINE_LEN 42
  14. #define NO_NTLOG_LINE_LEN 65
  15. #define MAX_FUNC_NUM 100
  16. #define INFO TLS_INFO
  17. #define PASS TLS_PASS
  18. #define SEV1 TLS_SEV1
  19. #define SEV2 TLS_SEV2
  20. #define SEV3 TLS_SEV3
  21. #define GREY 0x7
  22. #define GREEN 0xa
  23. #define RED 0xc
  24. //
  25. // Globals
  26. //
  27. static HANDLE gPnPTestLog; // Handle to NTLog - "pnptest.log"
  28. static FILE *gPnPTestLogFile; // Handle if ntlog.dll couldn't load
  29. static BOOL gNtLogLoaded; // Tells whether ntlog.dll was loaded
  30. static USHORT g_LogLineLen;
  31. HANDLE g_hConsole;
  32. //
  33. // Function definitions
  34. //
  35. void LoadDLLs(IN PTCHAR DLLName);
  36. HANDLE InitLog(IN PTCHAR tszLogName,
  37. IN PTCHAR tszTitle,
  38. IN BOOL bConsole);
  39. void ExitLog();
  40. void WriteLog(IN DWORD dwLogLevel,
  41. IN PTCHAR tszBuffer);
  42. void Log(IN double dFunctionNumber,
  43. IN DWORD dwLogLevel,
  44. IN PTCHAR tszLogString,
  45. IN ...);
  46. VOID LogBlankLine();
  47. VOID CreateConsoleWindow(IN BOOL bConsole,
  48. IN PTCHAR tszTitle);
  49. VOID AddLogParticipant(IN HANDLE hLog);
  50. VOID RemoveLogParticipant(IN HANDLE hLog);
  51. //
  52. // NtLog definitions
  53. //
  54. typedef HANDLE (*Dll_tlCreateLog) (LPCWSTR, DWORD);
  55. typedef BOOL (*Dll_tlAddParticipant) (HANDLE, DWORD, int);
  56. typedef BOOL (*Dll_tlStartVariation) (HANDLE);
  57. typedef BOOL (*Dll_tlLog) (HANDLE, DWORD, PTCHAR, int, PTCHAR, ...);
  58. typedef DWORD (*Dll_tlEndVariation) (HANDLE);
  59. typedef BOOL (*Dll_tlRemoveParticipant) (HANDLE);
  60. typedef BOOL (*Dll_tlDestroyLog) (HANDLE);
  61. typedef VOID (*Dll_tlReportStats) (HANDLE);
  62. Dll_tlCreateLog _tlCreateLog;
  63. Dll_tlAddParticipant _tlAddParticipant;
  64. Dll_tlDestroyLog _tlDestroyLog;
  65. Dll_tlEndVariation _tlEndVariation;
  66. Dll_tlLog _tlLog;
  67. Dll_tlRemoveParticipant _tlRemoveParticipant;
  68. Dll_tlStartVariation _tlStartVariation;
  69. Dll_tlReportStats _tlReportStats;
  70. #define LOG_OPTIONS (TLS_REFRESH | TLS_SEV2 | TLS_WARN | TLS_PASS | \
  71. TLS_MONITOR | TLS_VARIATION | \
  72. TLS_SYSTEM | TLS_INFO )
  73. #endif // _LOGUTILS_H_