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.

290 lines
7.7 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1991 - 1996.
  5. //
  6. // File: msffunc.hxx
  7. //
  8. // Contents: Multistream inline functions
  9. //
  10. // Classes: None.
  11. //
  12. //--------------------------------------------------------------------------
  13. #ifndef __MSFFUNC_HXX__
  14. #define __MSFFUNC_HXX__
  15. #include "msf.hxx"
  16. #include "dir.hxx"
  17. #include "dirfunc.hxx"
  18. //+-------------------------------------------------------------------------
  19. //
  20. // Member: CMStream::RenameEntry, public
  21. //
  22. // Synposis: Rename an entry.
  23. //
  24. // Arguments: [sidParent] - Parent SID
  25. // [pdfn] - Old name
  26. // [pdfnNew] -- New name
  27. //
  28. // Returns: S_OK otherwise
  29. //
  30. // Algorithm: Call through to CDirectory::RenameEntry
  31. //
  32. // Notes:
  33. //
  34. //---------------------------------------------------------------------------
  35. inline SCODE CMStream::RenameEntry(
  36. SID const sidParent,
  37. CDfName const *pdfn,
  38. CDfName const *pdfnNew)
  39. {
  40. return _dir.RenameEntry(sidParent, pdfn, pdfnNew);
  41. }
  42. //+-------------------------------------------------------------------------
  43. //
  44. // Member: CMStream::IsEntry, public
  45. //
  46. // Synposis: Determine if a given entry is present in a multistream
  47. //
  48. // Arguments: [sidParent] - Parent SID
  49. // [pdfn] -- Name of entry to be located
  50. // [peb] - Entry block to fill in
  51. //
  52. // Returns: S_OK if entry exists.
  53. // STG_E_FILENOTFOUND if it doesn't.
  54. //
  55. //---------------------------------------------------------------------------
  56. inline SCODE CMStream::IsEntry(
  57. SID const sidParent,
  58. CDfName const *pdfn,
  59. SEntryBuffer *peb)
  60. {
  61. return _dir.IsEntry(sidParent, pdfn, peb);
  62. }
  63. //+-------------------------------------------------------------------------
  64. //
  65. // Member: CMStream::CreateEntry, public
  66. //
  67. // Synposis: Allows creation of new entries
  68. //
  69. // Arguments: [sidParent] -- SID of parent entry
  70. // [pdfn] -- Name of new entry
  71. // [mefFlags] -- Flags to be set on new entry
  72. // [psid] -- Location for return SID
  73. //
  74. // Returns: S_OK if call completed OK.
  75. // STG_E_FILEALREADYEXISTS if stream already exists
  76. //
  77. //---------------------------------------------------------------------------
  78. inline SCODE CMStream::CreateEntry(
  79. SID const sidParent,
  80. CDfName const *pdfn,
  81. MSENTRYFLAGS const mefFlags,
  82. SID *psid)
  83. {
  84. return _dir.CreateEntry(sidParent, pdfn, mefFlags, psid);
  85. }
  86. //+-------------------------------------------------------------------------
  87. //
  88. // Method: CMStream::GetTime, public
  89. //
  90. // Synopsis: Get the time for a given handle
  91. //
  92. // Arguments: [sid] -- SID to retrieve time for
  93. // [tt] -- Timestamp requested (WT_CREATION, WT_MODIFICATION,
  94. // WT_ACCESS)
  95. // [pnt] -- Pointer to return location
  96. //
  97. // Returns: S_OK if call completed OK.
  98. //
  99. //--------------------------------------------------------------------------
  100. inline SCODE CMStream::GetTime(SID const sid,
  101. WHICHTIME const tt,
  102. TIME_T *pnt)
  103. {
  104. return _dir.GetTime(sid, tt, pnt);
  105. }
  106. //+-------------------------------------------------------------------------
  107. //
  108. // Method: CMStream::SetTime, public
  109. //
  110. // Synopsis: Set the time for a given handle
  111. //
  112. // Arguments: [sid] -- SID to retrieve time for
  113. // [tt] -- Timestamp requested (WT_CREATION, WT_MODIFICATION,
  114. // WT_ACCESS)
  115. // [nt] -- New timestamp
  116. //
  117. // Returns: S_OK if call completed OK.
  118. //
  119. // Algorithm: Call through to directory
  120. //
  121. //--------------------------------------------------------------------------
  122. inline SCODE CMStream::SetTime(SID const sid,
  123. WHICHTIME const tt,
  124. TIME_T nt)
  125. {
  126. return _dir.SetTime(sid, tt, nt);
  127. }
  128. //+---------------------------------------------------------------------------
  129. //
  130. // Member: CMStream::GetClass, public
  131. //
  132. // Synopsis: Gets the class ID
  133. //
  134. // Arguments: [pclsid] - Class ID return
  135. //
  136. // Returns: Appropriate status code
  137. //
  138. // Modifies: [pclsid]
  139. //
  140. //----------------------------------------------------------------------------
  141. inline SCODE CMStream::GetClass(SID const sid,
  142. CLSID *pclsid)
  143. {
  144. return _dir.GetClassId(sid, pclsid);
  145. }
  146. //+---------------------------------------------------------------------------
  147. //
  148. // Member: CMStream::SetClass, public
  149. //
  150. // Synopsis: Sets the class ID
  151. //
  152. // Arguments: [clsid] - Class ID
  153. //
  154. // Returns: Appropriate status code
  155. //
  156. //----------------------------------------------------------------------------
  157. inline SCODE CMStream::SetClass(SID const sid,
  158. REFCLSID clsid)
  159. {
  160. return _dir.SetClassId(sid, clsid);
  161. }
  162. //+---------------------------------------------------------------------------
  163. //
  164. // Member: CMStream::GetStateBits, public
  165. //
  166. // Synopsis: Gets state bits
  167. //
  168. // Arguments: [pgrfStateBits] - State bits return
  169. //
  170. // Returns: Appropriate status code
  171. //
  172. // Modifies: [pgrfStateBits]
  173. //
  174. //----------------------------------------------------------------------------
  175. inline SCODE CMStream::GetStateBits(SID const sid,
  176. DWORD *pgrfStateBits)
  177. {
  178. return _dir.GetUserFlags(sid, pgrfStateBits);
  179. }
  180. //+---------------------------------------------------------------------------
  181. //
  182. // Member: CMStream::SetStateBits, public
  183. //
  184. // Synopsis: Sets state bits
  185. //
  186. // Arguments: [grfStateBits] - State bits
  187. //
  188. // Returns: Appropriate status code
  189. //
  190. //----------------------------------------------------------------------------
  191. inline SCODE CMStream::SetStateBits(SID const sid,
  192. DWORD grfStateBits,
  193. DWORD grfMask)
  194. {
  195. return _dir.SetUserFlags(sid, grfStateBits, grfMask);
  196. }
  197. //+-------------------------------------------------------------------------
  198. //
  199. // Method: CMStream::GetEntrySize, public
  200. //
  201. // Synopsis: Return the size of an entry
  202. //
  203. // Arguments: [sid] - SID of entry
  204. // [pcbSize] -- Location for return of size
  205. //
  206. // Returns: S_OK if call completed OK.
  207. //
  208. // Algorithm: Ask directory for size
  209. //
  210. //--------------------------------------------------------------------------
  211. inline SCODE CMStream::GetEntrySize(SID const sid,
  212. ULONGLONG *pcbSize)
  213. {
  214. return _dir.GetSize(sid, pcbSize);
  215. }
  216. //+-------------------------------------------------------------------------
  217. //
  218. // Member: CMStream::DestroyEntry
  219. //
  220. // Synposis: Delete a directory entry from a multi-stream.
  221. //
  222. // Effects: Modifies directory.
  223. //
  224. // Arguments: [sidParent] - Parent SID
  225. // [pdfn] - Name of entry
  226. //
  227. // Returns: S_OK if operation completed successfully.
  228. //
  229. // Algorithm: Set information on entry to default "free" case.
  230. // Return S_OK
  231. //
  232. // Notes:
  233. //
  234. //---------------------------------------------------------------------------
  235. inline SCODE CMStream::DestroyEntry(SID const sidParent,
  236. CDfName const *pdfn)
  237. {
  238. SCODE sc;
  239. msfDebugOut((DEB_TRACE,"In CMStream::DestroyEntry()\n"));
  240. // Two cases:
  241. // pdfn == NULL - destroy all children of sidParent
  242. // pdfn != NULL - destroy the named child of sidParent
  243. if (pdfn == NULL)
  244. sc = _dir.DestroyAllChildren(sidParent);
  245. else
  246. sc = _dir.DestroyChild(sidParent, pdfn);
  247. msfDebugOut((DEB_TRACE,"Leaving CMStream::DestroyEntry()\n"));
  248. return sc;
  249. }
  250. #endif //__MSFFUNC_HXX__