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.

145 lines
3.5 KiB

  1. #pragma once
  2. //+---------------------------------------------------------------------------
  3. //
  4. // Microsoft Windows
  5. // Copyright (C) Microsoft Corporation, 1994 - 1998.
  6. //
  7. // File: names.hxx
  8. //
  9. //+---------------------------------------------------------------------------
  10. #ifndef NTFS_MAX_ATTR_NAME_LEN
  11. #define NTFS_MAX_ATTR_NAME_LEN 255
  12. #endif
  13. BOOL IsContentStream( const WCHAR* pwszName );
  14. const WCHAR* GetContentStreamName();
  15. BOOL IsDataStream( const PFILE_STREAM_INFORMATION pFileStreamInformation );
  16. BOOL IsDocfileStream( const WCHAR *pwsz );
  17. BOOL IsSpecifiedStream(const FILE_STREAM_INFORMATION *pFSI,
  18. const WCHAR *pwszStream // Without the :*:$data adornments
  19. );
  20. BOOL HasVisibleNamedStreams( const FILE_STREAM_INFORMATION *pfsi );
  21. const WCHAR *UnmangleDocfileStreamName( const WCHAR *pwszName );
  22. void GetNtfsUnmangledNameInfo(const FILE_STREAM_INFORMATION *pFSI,
  23. const WCHAR** ppwsz,
  24. ULONG* pcch);
  25. const WCHAR* GetControlStreamName();
  26. #define CCH_NTFS_DOLLAR_DATA 6 // ":$DATA"
  27. inline BOOL
  28. IsHiddenStream( const FILE_STREAM_INFORMATION *pfsi )
  29. {
  30. return( IsSpecifiedStream( pfsi, GetControlStreamName() ));
  31. }
  32. inline BOOL
  33. IsContentsStream( const FILE_STREAM_INFORMATION *pfsi )
  34. {
  35. return( IsSpecifiedStream( pfsi, L"" ));
  36. }
  37. //+============================================================================
  38. //
  39. // Class: CNtfsStreamName
  40. //
  41. // This class holds the name of an NTFS stream. It is initialized by
  42. // passing in a un-decorated stream name (that is, without the leading
  43. // ":" and trailing ":$DATA"). It can be cast to a WCHAR* which is the
  44. // decorated name. This class also handles the mapping from the
  45. // "Contents" stream name (used for the IStorage interface) to the
  46. // unnamed data stream (used for the NT open call).
  47. //
  48. //+============================================================================
  49. class CNtfsStreamName
  50. {
  51. public:
  52. CNtfsStreamName( const WCHAR *pwsz);
  53. public:
  54. operator const WCHAR*() const
  55. {
  56. return _wsz;
  57. }
  58. size_t Count() const
  59. {
  60. return _count;
  61. }
  62. private:
  63. CNtfsStreamName(); // default construction, not allowed.
  64. private:
  65. size_t _count;
  66. WCHAR _wsz[ NTFS_MAX_ATTR_NAME_LEN ];
  67. };
  68. //+----------------------------------------------------------------------------
  69. //
  70. // Class: CDocfileStreamName
  71. //
  72. //+----------------------------------------------------------------------------
  73. #define CCH_DOCFILESTREAMPREFIX 5
  74. class CDocfileStreamName
  75. {
  76. public:
  77. CDocfileStreamName( const WCHAR *pwsz);
  78. public:
  79. operator const WCHAR*() const
  80. {
  81. return( _wszName );
  82. }
  83. private:
  84. CDocfileStreamName(); // default construction, not allowed.
  85. WCHAR _wszName[ CCH_DOCFILESTREAMPREFIX + CCH_MAX_PROPSTG_NAME + 1 ];
  86. }; // class CDocfileStreamName
  87. //+----------------------------------------------------------------------------
  88. //
  89. // Class: CNtfsUpdateStreamName
  90. //
  91. //+----------------------------------------------------------------------------
  92. #define CCH_UPDATESTREAMPREFIX 5
  93. class CNtfsUpdateStreamName
  94. {
  95. public:
  96. CNtfsUpdateStreamName( const WCHAR *pwsz);
  97. public:
  98. operator const WCHAR*() const
  99. {
  100. return( _wszName );
  101. }
  102. static BOOL IsUpdateStream( const WCHAR *pwsz );
  103. private:
  104. CNtfsUpdateStreamName(); // default construction, not allowed.
  105. WCHAR _wszName[ CCH_UPDATESTREAMPREFIX + CCH_MAX_PROPSTG_NAME + 1 ];
  106. }; // class CNtfsUpdateStreamName