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.

160 lines
4.5 KiB

  1. /*++
  2. Copyright (c) 2000-2001 Microsoft Corporation
  3. Module Name:
  4. params.h
  5. Abstract:
  6. Header of class that manages the dump parameters.
  7. Author:
  8. Stefan R. Steiner [ssteiner] 02-18-2000
  9. Revision History:
  10. --*/
  11. #ifndef __H_PARAMS_
  12. #define __H_PARAMS_
  13. #define FSD_MAX_PATH ( 8 * 1024 )
  14. enum EFsDumpType
  15. {
  16. eFsDumpVolume = 1,
  17. eFsDumpDirTraverse,
  18. eFsDumpDirNoTraverse,
  19. eFsDumpFile,
  20. eFsDump_Last
  21. };
  22. #define FSDMP_DEFAULT_MASKED_ATTRIBS ( FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_NORMAL )
  23. //
  24. // The dump parameters and methods to write to the dump file and error log
  25. // file.
  26. //
  27. class CDumpParameters
  28. {
  29. public:
  30. // Set up defaults for the parameters
  31. CDumpParameters(
  32. IN DWORD dwReserved
  33. ) : m_eFsDumpType( eFsDumpVolume ),
  34. m_fpErrLog( stderr ),
  35. m_fpDump( stdout ),
  36. m_fpExtraInfoDump( stdout ),
  37. m_bNoChecksums( FALSE ),
  38. m_bHex( FALSE ),
  39. m_bDontTraverseMountpoints( FALSE ),
  40. m_bDontChecksumHighLatencyData( TRUE ),
  41. m_bNoSpecialReparsePointProcessing( FALSE ),
  42. m_bAddMillisecsToTimestamps( FALSE ),
  43. m_bDontShowDirectoryTimestamps( TRUE ),
  44. m_bUnicode( FALSE),
  45. m_bNoHeaderFooter( TRUE ),
  46. m_bDumpCommaDelimited( TRUE ),
  47. m_bUseExcludeProcessor( FALSE ),
  48. m_bDontUseRegistryExcludes( FALSE ),
  49. m_bPrintDebugInfo( FALSE ),
  50. m_bHaveSecurityPrivilege( TRUE ),
  51. m_dwFileAttributesMask( FSDMP_DEFAULT_MASKED_ATTRIBS ),
  52. m_bDisableLongPaths( FALSE ),
  53. m_bEnableSDCtrlWordDump( TRUE ),
  54. m_bEnableObjectIdExtendedDataChecksums( FALSE ),
  55. m_bShowSymbolicSIDNames( FALSE ) { ; }
  56. virtual ~CDumpParameters();
  57. WCHAR m_pwszULongHexFmt[16]; // Checksum printf style format
  58. EFsDumpType m_eFsDumpType;
  59. CBsString m_cwsErrLogFileName;
  60. CBsString m_cwsDumpFileName;
  61. CBsString m_cwsArgv0;
  62. CBsString m_cwsFullPathToEXE;
  63. BOOL m_bNoChecksums;
  64. BOOL m_bUnicode;
  65. BOOL m_bHex;
  66. BOOL m_bDontTraverseMountpoints;
  67. BOOL m_bDontChecksumHighLatencyData;
  68. BOOL m_bNoSpecialReparsePointProcessing;
  69. BOOL m_bAddMillisecsToTimestamps;
  70. BOOL m_bDontShowDirectoryTimestamps;
  71. BOOL m_bShowSymbolicSIDNames;
  72. BOOL m_bNoHeaderFooter;
  73. BOOL m_bDumpCommaDelimited;
  74. BOOL m_bUseExcludeProcessor;
  75. BOOL m_bDontUseRegistryExcludes;
  76. BOOL m_bPrintDebugInfo;
  77. BOOL m_bDisableLongPaths;
  78. BOOL m_bHaveSecurityPrivilege;
  79. BOOL m_bEnableObjectIdExtendedDataChecksums;
  80. BOOL m_bEnableSDCtrlWordDump; // This is a temporary flag
  81. DWORD m_dwFileAttributesMask;
  82. INT
  83. Initialize(
  84. IN INT argc,
  85. IN WCHAR *argv[]
  86. );
  87. // Adds a wprintf style string to the error log file, automatically puts
  88. // a CR-LF at the end of each line
  89. inline VOID ErrPrint(
  90. IN LPCWSTR pwszMsgFormat,
  91. IN ...
  92. )
  93. {
  94. ::fwprintf( m_fpErrLog, L" *** ERROR: " );
  95. va_list marker;
  96. va_start( marker, pwszMsgFormat );
  97. ::vfwprintf( m_fpErrLog, pwszMsgFormat, marker );
  98. va_end( marker );
  99. ::fwprintf( m_fpErrLog, m_bUnicode ? L"\r\n" : L"\n" );
  100. }
  101. // Adds a wprintf style string to the dump file, automatically puts
  102. // a CR-LF at the end of each line
  103. inline VOID DumpPrintAlways(
  104. IN LPCWSTR pwszMsgFormat,
  105. IN ...
  106. )
  107. {
  108. va_list marker;
  109. va_start( marker, pwszMsgFormat );
  110. ::vfwprintf( m_fpDump, pwszMsgFormat, marker );
  111. va_end( marker );
  112. ::fwprintf( m_fpDump, m_bUnicode ? L"\r\n" : L"\n" );
  113. }
  114. inline VOID DumpPrint(
  115. IN LPCWSTR pwszMsgFormat,
  116. IN ...
  117. )
  118. {
  119. if ( m_fpExtraInfoDump != NULL )
  120. {
  121. va_list marker;
  122. va_start( marker, pwszMsgFormat );
  123. ::vfwprintf( m_fpExtraInfoDump, pwszMsgFormat, marker );
  124. va_end( marker );
  125. ::fwprintf( m_fpExtraInfoDump, m_bUnicode ? L"\r\n" : L"\n" );
  126. }
  127. }
  128. inline FILE *GetDumpFile() { return m_fpExtraInfoDump; }
  129. inline FILE *GetDumpAlwaysFile() { return m_fpDump; }
  130. inline FILE *GEtErrLogFile() { return m_fpErrLog; }
  131. private:
  132. CDumpParameters() {} // Disallow copying
  133. FILE *m_fpErrLog;
  134. FILE *m_fpDump;
  135. FILE *m_fpExtraInfoDump;
  136. };
  137. #endif // __H_PARAMS_