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.

203 lines
5.2 KiB

  1. #ifndef _INC_DSKQUOTA_USERENUM_H
  2. #define _INC_DSKQUOTA_USERENUM_H
  3. ///////////////////////////////////////////////////////////////////////////////
  4. /* File: userenum.h
  5. Description: Contains declaration for class DiskQuotaUserEnum.
  6. Revision History:
  7. Date Description Programmer
  8. -------- --------------------------------------------------- ----------
  9. 05/22/96 Initial creation. BrianAu
  10. */
  11. ///////////////////////////////////////////////////////////////////////////////
  12. #ifndef _INC_DSKQUOTA_H
  13. # include "dskquota.h"
  14. #endif
  15. #ifndef _INC_DSKQUOTA_FSOBJECT_H
  16. # include "fsobject.h"
  17. #endif
  18. #ifndef _INC_DSKQUOTA_SIDNAME_H
  19. # include "sidname.h"
  20. #endif
  21. #ifndef _INC_DSKQUOTA_DISPATCH_H
  22. # include "dispatch.h" // MIDL-generated header.
  23. #endif
  24. #ifndef _INC_DSKQUOTA_OADISP_H
  25. # include "oadisp.h" // OleAutoDispatch class.
  26. #endif
  27. class DiskQuotaUserEnum : public IEnumDiskQuotaUsers {
  28. private:
  29. LONG m_cRef; // Object Ref counter.
  30. LPBYTE m_pbBuffer; // For reading disk info.
  31. LPBYTE m_pbCurrent; // Pointer to "current" rec in cache.
  32. DWORD m_cbBuffer; // Size of buffer in bytes.
  33. PSIDLIST m_pSidList; // Optional SidList filter.
  34. BOOL m_bEOF; // End of quota info file reached?
  35. DWORD m_cbSidList; // Sid list length in bytes.
  36. BOOL m_bSingleUser; // Single-user enumeration?
  37. BOOL m_bInitialized; // Initialize() already called?
  38. BOOL m_bRestartScan; // Restart NTFS quota file scan?
  39. DWORD m_fNameResolution; // None, sync, async
  40. FSObject *m_pFSObject; // Pointer to file system object.
  41. PDISKQUOTA_CONTROL m_pQuotaController; // Ptr to quota controller.
  42. PSID_NAME_RESOLVER m_pSidNameResolver; // For getting SID account names.
  43. HRESULT
  44. QueryQuotaInformation(
  45. BOOL bReturnSingleEntry = FALSE,
  46. PVOID pSidList = NULL,
  47. ULONG cbSidList = 0,
  48. PSID pStartSid = NULL,
  49. BOOL bRestartScan = FALSE);
  50. HRESULT
  51. CreateUserObject(
  52. PFILE_QUOTA_INFORMATION pfqi,
  53. PDISKQUOTA_USER *ppOut);
  54. HRESULT
  55. GetNextUser(
  56. PDISKQUOTA_USER *ppOut);
  57. HRESULT
  58. InitializeSidList(
  59. PSIDLIST pSidList,
  60. DWORD cbSidList);
  61. HRESULT
  62. InitializeSidList(
  63. PSID *rgpSids,
  64. DWORD cpSids);
  65. //
  66. // Prevent copy construction.
  67. //
  68. DiskQuotaUserEnum(const DiskQuotaUserEnum& UserEnum);
  69. void operator = (const DiskQuotaUserEnum& UserEnum);
  70. public:
  71. DiskQuotaUserEnum(
  72. PDISKQUOTA_CONTROL pQuotaController,
  73. PSID_NAME_RESOLVER pSidNameResolver,
  74. FSObject *pFSObject);
  75. ~DiskQuotaUserEnum(VOID);
  76. HRESULT
  77. Initialize(
  78. DWORD fNameResolution,
  79. DWORD cbBuffer = 2048,
  80. PSID *rgpSids = NULL,
  81. DWORD cpSids = 0);
  82. HRESULT
  83. Initialize(
  84. const DiskQuotaUserEnum& UserEnum);
  85. STDMETHODIMP
  86. SetNameResolution(
  87. DWORD fNameResolution);
  88. //
  89. // IUnknown methods.
  90. //
  91. STDMETHODIMP
  92. QueryInterface(
  93. REFIID,
  94. LPVOID *);
  95. STDMETHODIMP_(ULONG)
  96. AddRef(
  97. VOID);
  98. STDMETHODIMP_(ULONG)
  99. Release(
  100. VOID);
  101. //
  102. // IEnumDiskQuotaUsers methods.
  103. //
  104. STDMETHODIMP
  105. Next(
  106. DWORD,
  107. PDISKQUOTA_USER *,
  108. LPDWORD);
  109. STDMETHODIMP
  110. Skip(
  111. DWORD);
  112. STDMETHODIMP
  113. Reset(
  114. VOID);
  115. STDMETHODIMP
  116. Clone(
  117. PENUM_DISKQUOTA_USERS *);
  118. };
  119. //
  120. // Enumerator for VB's "for each" construct.
  121. //
  122. class DiskQuotaUserCollection : public IEnumVARIANT
  123. {
  124. public:
  125. DiskQuotaUserCollection(PDISKQUOTA_CONTROL pController,
  126. DWORD fNameResolution);
  127. ~DiskQuotaUserCollection(VOID);
  128. HRESULT Initialize(VOID);
  129. //
  130. // IUnknown methods.
  131. //
  132. STDMETHODIMP
  133. QueryInterface(
  134. REFIID,
  135. LPVOID *);
  136. STDMETHODIMP_(ULONG)
  137. AddRef(
  138. VOID);
  139. STDMETHODIMP_(ULONG)
  140. Release(
  141. VOID);
  142. //
  143. // IEnumVARIANT Methods.
  144. //
  145. STDMETHODIMP
  146. Next(
  147. DWORD cUsers,
  148. VARIANT *rgvar,
  149. DWORD *pcUsersFetched);
  150. STDMETHODIMP
  151. Skip(
  152. DWORD cUsers);
  153. STDMETHODIMP
  154. Reset(
  155. void);
  156. STDMETHODIMP
  157. Clone(
  158. IEnumVARIANT **ppEnum);
  159. private:
  160. LONG m_cRef;
  161. PDISKQUOTA_CONTROL m_pController;
  162. PENUM_DISKQUOTA_USERS m_pEnum;
  163. DWORD m_fNameResolution;
  164. };
  165. #endif // _INC_DSKQUOTA_USERENUM_H