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.

146 lines
3.7 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 PFILE_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. // Character count (not including the null terminator)
  59. size_t Count() const
  60. {
  61. return _count;
  62. }
  63. private:
  64. CNtfsStreamName(); // default construction, not allowed.
  65. private:
  66. size_t _count;
  67. WCHAR _wsz[ NTFS_MAX_ATTR_NAME_LEN + 1]; // (Include room for terminator)
  68. };
  69. //+----------------------------------------------------------------------------
  70. //
  71. // Class: CDocfileStreamName
  72. //
  73. //+----------------------------------------------------------------------------
  74. #define CCH_DOCFILESTREAMPREFIX 5
  75. class CDocfileStreamName
  76. {
  77. public:
  78. CDocfileStreamName( const WCHAR *pwsz);
  79. public:
  80. operator const WCHAR*() const
  81. {
  82. return( _wszName );
  83. }
  84. private:
  85. CDocfileStreamName(); // default construction, not allowed.
  86. WCHAR _wszName[ CCH_DOCFILESTREAMPREFIX + CCH_MAX_PROPSTG_NAME + 1 ];
  87. }; // class CDocfileStreamName
  88. //+----------------------------------------------------------------------------
  89. //
  90. // Class: CNtfsUpdateStreamName
  91. //
  92. //+----------------------------------------------------------------------------
  93. #define CCH_UPDATESTREAMPREFIX 5
  94. class CNtfsUpdateStreamName
  95. {
  96. public:
  97. CNtfsUpdateStreamName( const WCHAR *pwsz);
  98. public:
  99. operator const WCHAR*() const
  100. {
  101. return( _wszName );
  102. }
  103. static BOOL IsUpdateStream( const WCHAR *pwsz );
  104. private:
  105. CNtfsUpdateStreamName(); // default construction, not allowed.
  106. WCHAR _wszName[ CCH_UPDATESTREAMPREFIX + CCH_MAX_PROPSTG_NAME + 1 ];
  107. }; // class CNtfsUpdateStreamName