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.

293 lines
8.2 KiB

  1. /**********************************************************************/
  2. /** Microsoft LAN Manager **/
  3. /** Copyright(c) Microsoft Corp., 1990, 1991 **/
  4. /**********************************************************************/
  5. /*
  6. lmoefile.hxx
  7. This file contains the class declarations for the FILE3_ENUM
  8. and FILE3_ENUM_ITER classes.
  9. FILE3_ENUM is an enumeration class used to enumerate the open
  10. resources on a particular server. FILE3_ENUM_ITER is an iterator
  11. used to iterate the open resources from the FILE3_ENUM class.
  12. FILE HISTORY:
  13. KeithMo 29-May-1991 Created for the Server Manager.
  14. KeithMo 13-Aug-1991 Cleanup.
  15. KeithMo 19-Aug-1991 Code review revisions (code review
  16. attended by ChuckC, Hui-LiCh, JimH,
  17. JonN, KevinL).
  18. KeithMo 07-Oct-1991 Win32 Conversion.
  19. terryk 17-Oct-1991 Change file's permission type
  20. JonN 30-Jan-1992 Split LOC_LM_RESUME_ENUM from LM_RESUME_ENUM
  21. */
  22. #ifndef _LMOEFILE_HXX
  23. #define _LMOEFILE_HXX
  24. /*************************************************************************
  25. NAME: FILE_ENUM
  26. SYNOPSIS: FILE_ENUM is a generic file enumerator. It will be
  27. subclassed for the specific infolevels as desired.
  28. INTERFACE: FILE_ENUM() - Class constructor.
  29. CallAPI() - Invokes the enumeration API.
  30. ResetResumeKey() - Resets the resume key to its
  31. initial state.
  32. PARENT: LOC_LM_RESUME_ENUM
  33. USES: None.
  34. CAVEATS:
  35. NOTES:
  36. HISTORY:
  37. KeithMo 29-May-1991 Created for the Server Manager.
  38. KeithMo 13-Aug-1991 Cleanup.
  39. KeithMo 15-Aug-1991 Made constructor protected.
  40. **************************************************************************/
  41. DLL_CLASS FILE_ENUM : public LOC_LM_RESUME_ENUM
  42. {
  43. private:
  44. //
  45. // The NetFileEnum2() resume key.
  46. //
  47. FRK _frk;
  48. //
  49. // The enumeration will start at _nlsBasePath,
  50. // enumerating the files opened by _nlsUserName.
  51. // If the FILE_ENUM is constructed with a NULL
  52. // pszBasePath, then the entire disk tree is
  53. // enumerated. If pszUserName is NULL, then all
  54. // files opened by all users are enumerated.
  55. //
  56. NLS_STR _nlsBasePath;
  57. NLS_STR _nlsUserName;
  58. //
  59. // This virtual callback invokes the NetFileEnum2() API.
  60. //
  61. virtual APIERR CallAPI( BOOL fRestartEnum,
  62. BYTE ** ppbBuffer,
  63. UINT * pcEntriesRead );
  64. //
  65. // This flag is set to TRUE when we are trying to use the
  66. // larger buffer size.
  67. //
  68. BOOL _fBigBuffer;
  69. protected:
  70. //
  71. // Usual constructor/destructor goodies.
  72. //
  73. FILE_ENUM( const TCHAR * pszServerName,
  74. const TCHAR * pszBasePath,
  75. const TCHAR * pszUserName,
  76. UINT uLevel );
  77. ~FILE_ENUM( VOID );
  78. //
  79. // This method is invoked to free an enumeration buffer.
  80. //
  81. virtual VOID FreeBuffer( BYTE ** ppbBuffer );
  82. }; // class FILE_ENUM
  83. DLL_CLASS FILE2_ENUM_ITER; // Forward reference.
  84. DLL_CLASS FILE3_ENUM_ITER; // Forward reference.
  85. /*************************************************************************
  86. NAME: FILE2_ENUM
  87. SYNOPSIS: FILE2_ENUM is an enumerator for enumerating the
  88. open resources on a particular server.
  89. INTERFACE: FILE2_ENUM() - Class constructor.
  90. PARENT: FILE_ENUM
  91. USES: None.
  92. CAVEATS:
  93. NOTES:
  94. HISTORY:
  95. KeithMo 29-May-1991 Created for the Server Manager.
  96. KeithMo 19-Aug-1991 Made constructor's pszBasePath and
  97. pszUserName default to NULL.
  98. **************************************************************************/
  99. DLL_CLASS FILE2_ENUM : public FILE_ENUM
  100. {
  101. public:
  102. FILE2_ENUM( const TCHAR * pszServerName,
  103. const TCHAR * pszBasePath = NULL,
  104. const TCHAR * pszUserName = NULL );
  105. }; // class FILE2_ENUM
  106. /*************************************************************************
  107. NAME: FILE2_ENUM_OBJ
  108. SYNOPSIS: This is basically the return type from the FILE2_ENUM_ITER
  109. iterator.
  110. INTERFACE: FILE2_ENUM_OBJ - Class constructor.
  111. ~FILE2_ENUM_OBJ - Class destructor.
  112. QueryBufferPtr - Replaces ENUM_OBJ_BASE method.
  113. QueryFileId - Returns the file ID.
  114. PARENT: ENUM_OBJ_BASE
  115. HISTORY:
  116. KeithMo 07-Oct-1991 Created.
  117. **************************************************************************/
  118. DLL_CLASS FILE2_ENUM_OBJ : public ENUM_OBJ_BASE
  119. {
  120. public:
  121. //
  122. // Provide properly-casted buffer Query/Set methods.
  123. //
  124. const struct file_info_2 * QueryBufferPtr( VOID ) const
  125. { return (const struct file_info_2 *)ENUM_OBJ_BASE::QueryBufferPtr(); }
  126. VOID SetBufferPtr( const struct file_info_2 * pBuffer );
  127. //
  128. // Accessors.
  129. //
  130. DECLARE_ENUM_ACCESSOR( QueryFileId, ULONG, fi2_id );
  131. }; // class FILE2_ENUM_OBJ
  132. DECLARE_LM_RESUME_ENUM_ITER_OF( FILE2, struct file_info_2 )
  133. /*************************************************************************
  134. NAME: FILE3_ENUM
  135. SYNOPSIS: FILE3_ENUM is an enumerator for enumerating the
  136. open resources on a particular server.
  137. INTERFACE: FILE3_ENUM() - Class constructor.
  138. PARENT: FILE_ENUM
  139. USES: None.
  140. CAVEATS:
  141. NOTES:
  142. HISTORY:
  143. KeithMo 29-May-1991 Created for the Server Manager.
  144. KeithMo 19-Aug-1991 Made constructor's pszBasePath and
  145. pszUserName default to NULL.
  146. **************************************************************************/
  147. DLL_CLASS FILE3_ENUM : public FILE_ENUM
  148. {
  149. public:
  150. FILE3_ENUM( const TCHAR * pszServerName,
  151. const TCHAR * pszBasePath = NULL,
  152. const TCHAR * pszUserName = NULL );
  153. }; // class FILE3_ENUM
  154. /*************************************************************************
  155. NAME: FILE3_ENUM_OBJ
  156. SYNOPSIS: This is basically the return type from the FILE3_ENUM_ITER
  157. iterator.
  158. INTERFACE: FILE3_ENUM_OBJ - Class constructor.
  159. ~FILE3_ENUM_OBJ - Class destructor.
  160. QueryBufferPtr - Replaces ENUM_OBJ_BASE method.
  161. QueryFileId - Returns the file ID.
  162. QueryPermissions - Returns the file permissions.
  163. QueryNumLocks - Returns the number of file locks.
  164. QueryPathName - Returns the pathname.
  165. QueryUserName - Returns the name of the user that
  166. opened this file.
  167. PARENT: ENUM_OBJ_BASE
  168. HISTORY:
  169. KeithMo 07-Oct-1991 Created.
  170. **************************************************************************/
  171. DLL_CLASS FILE3_ENUM_OBJ : public ENUM_OBJ_BASE
  172. {
  173. public:
  174. //
  175. // Provide properly-casted buffer Query/Set methods.
  176. //
  177. const struct file_info_3 * QueryBufferPtr( VOID ) const
  178. { return (const struct file_info_3 *)ENUM_OBJ_BASE::QueryBufferPtr(); }
  179. VOID SetBufferPtr( const struct file_info_3 * pBuffer );
  180. //
  181. // Accessors.
  182. //
  183. DECLARE_ENUM_ACCESSOR( QueryFileId, ULONG, fi3_id );
  184. DECLARE_ENUM_ACCESSOR( QueryPermissions,ULONG, fi3_permissions );
  185. DECLARE_ENUM_ACCESSOR( QueryNumLocks, ULONG, fi3_num_locks );
  186. DECLARE_ENUM_ACCESSOR( QueryPathName, const TCHAR *, fi3_pathname );
  187. DECLARE_ENUM_ACCESSOR( QueryUserName, const TCHAR *, fi3_username );
  188. }; // class FILE3_ENUM_OBJ
  189. DECLARE_LM_RESUME_ENUM_ITER_OF( FILE3, struct file_info_3 )
  190. #endif // _LMOEFILE_HXX