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.

382 lines
10 KiB

  1. /**************************************************************************
  2. * *
  3. * dskquota.h -- public header for Windows 2000 disk quota interfaces. *
  4. * *
  5. * Copyright (c) 1991-1999, Microsoft Corp. All rights reserved. *
  6. * *
  7. **************************************************************************/
  8. #ifndef __DSKQUOTA_H
  9. #define __DSKQUOTA_H
  10. #if _MSC_VER > 1000
  11. #pragma once
  12. #endif
  13. #ifndef _WINDOWS_
  14. #include <windows.h>
  15. #endif
  16. #ifndef _OLE2_H_
  17. #include <ole2.h>
  18. #endif
  19. #ifndef _OLECTL_H_
  20. #include <olectl.h>
  21. #endif
  22. #ifdef INITGUIDS
  23. #include <initguid.h>
  24. #endif
  25. //
  26. // Class IDs
  27. //
  28. // {7988B571-EC89-11cf-9C00-00AA00A14F56}
  29. DEFINE_GUID(CLSID_DiskQuotaControl,
  30. 0x7988b571, 0xec89, 0x11cf, 0x9c, 0x0, 0x0, 0xaa, 0x0, 0xa1, 0x4f, 0x56);
  31. //
  32. // Interface IDs
  33. //
  34. // {7988B572-EC89-11cf-9C00-00AA00A14F56}
  35. DEFINE_GUID(IID_IDiskQuotaControl,
  36. 0x7988b572, 0xec89, 0x11cf, 0x9c, 0x0, 0x0, 0xaa, 0x0, 0xa1, 0x4f, 0x56);
  37. // {7988B574-EC89-11cf-9C00-00AA00A14F56}
  38. DEFINE_GUID(IID_IDiskQuotaUser,
  39. 0x7988b574, 0xec89, 0x11cf, 0x9c, 0x0, 0x0, 0xaa, 0x0, 0xa1, 0x4f, 0x56);
  40. // {7988B576-EC89-11cf-9C00-00AA00A14F56}
  41. DEFINE_GUID(IID_IDiskQuotaUserBatch,
  42. 0x7988b576, 0xec89, 0x11cf, 0x9c, 0x0, 0x0, 0xaa, 0x0, 0xa1, 0x4f, 0x56);
  43. // {7988B577-EC89-11cf-9C00-00AA00A14F56}
  44. DEFINE_GUID(IID_IEnumDiskQuotaUsers,
  45. 0x7988b577, 0xec89, 0x11cf, 0x9c, 0x0, 0x0, 0xaa, 0x0, 0xa1, 0x4f, 0x56);
  46. // {7988B579-EC89-11cf-9C00-00AA00A14F56}
  47. DEFINE_GUID(IID_IDiskQuotaEvents,
  48. 0x7988b579, 0xec89, 0x11cf, 0x9c, 0x0, 0x0, 0xaa, 0x0, 0xa1, 0x4f, 0x56);
  49. //
  50. // Definitions for value and bits in DWORD returned by
  51. // IDiskQuotaControl::GetQuotaState.
  52. //
  53. #define DISKQUOTA_STATE_DISABLED 0x00000000
  54. #define DISKQUOTA_STATE_TRACK 0x00000001
  55. #define DISKQUOTA_STATE_ENFORCE 0x00000002
  56. #define DISKQUOTA_STATE_MASK 0x00000003
  57. #define DISKQUOTA_FILESTATE_INCOMPLETE 0x00000100
  58. #define DISKQUOTA_FILESTATE_REBUILDING 0x00000200
  59. #define DISKQUOTA_FILESTATE_MASK 0x00000300
  60. //
  61. // Helper macros for setting and testing state value.
  62. //
  63. #define DISKQUOTA_SET_DISABLED(s) \
  64. ((s) &= ~DISKQUOTA_STATE_MASK)
  65. #define DISKQUOTA_SET_TRACKED(s) \
  66. ((s) |= (DISKQUOTA_STATE_MASK & DISKQUOTA_STATE_TRACK))
  67. #define DISKQUOTA_SET_ENFORCED(s) \
  68. ((s) |= (DISKQUOTA_STATE_ENFORCE & DISKQUOTA_STATE_ENFORCE))
  69. #define DISKQUOTA_IS_DISABLED(s) \
  70. (DISKQUOTA_STATE_DISABLED == ((s) & DISKQUOTA_STATE_MASK))
  71. #define DISKQUOTA_IS_TRACKED(s) \
  72. (DISKQUOTA_STATE_TRACK == ((s) & DISKQUOTA_STATE_MASK))
  73. #define DISKQUOTA_IS_ENFORCED(s) \
  74. (DISKQUOTA_STATE_ENFORCE == ((s) & DISKQUOTA_STATE_MASK))
  75. //
  76. // These file state flags are read-only.
  77. //
  78. #define DISKQUOTA_FILE_INCOMPLETE(s) \
  79. (0 != ((s) & DISKQUOTA_FILESTATE_INCOMPLETE))
  80. #define DISKQUOTA_FILE_REBUILDING(s) \
  81. (0 != ((s) & DISKQUOTA_FILESTATE_REBUILDING))
  82. //
  83. // Definitions for bits in DWORD returned by
  84. // IDiskQuotaControl::GetQuotaLogFlags.
  85. //
  86. #define DISKQUOTA_LOGFLAG_USER_THRESHOLD 0x00000001
  87. #define DISKQUOTA_LOGFLAG_USER_LIMIT 0x00000002
  88. //
  89. // Helper macros to interrogate a log flags DWORD.
  90. //
  91. #define DISKQUOTA_IS_LOGGED_USER_THRESHOLD(f) \
  92. (0 != ((f) & DISKQUOTA_LOGFLAG_USER_THRESHOLD))
  93. #define DISKQUOTA_IS_LOGGED_USER_LIMIT(f) \
  94. (0 != ((f) & DISKQUOTA_LOGFLAG_USER_LIMIT))
  95. //
  96. // Helper macros to set/clear bits in a log flags DWORD.
  97. //
  98. #define DISKQUOTA_SET_LOG_USER_THRESHOLD(f,yn) \
  99. ((f &= ~DISKQUOTA_LOGFLAG_USER_THRESHOLD) |= ((yn) ? DISKQUOTA_LOGFLAG_USER_THRESHOLD : 0))
  100. #define DISKQUOTA_SET_LOG_USER_LIMIT(f,yn) \
  101. ((f &= ~DISKQUOTA_LOGFLAG_USER_LIMIT) |= ((yn) ? DISKQUOTA_LOGFLAG_USER_LIMIT : 0))
  102. //
  103. // Per-user quota information.
  104. //
  105. typedef struct DiskQuotaUserInformation {
  106. LONGLONG QuotaUsed;
  107. LONGLONG QuotaThreshold;
  108. LONGLONG QuotaLimit;
  109. } DISKQUOTA_USER_INFORMATION, *PDISKQUOTA_USER_INFORMATION;
  110. //
  111. // Values for fNameResolution argument to:
  112. //
  113. // IDiskQuotaControl::AddUserSid
  114. // IDiskQuotaControl::AddUserName
  115. // IDiskQuotaControl::FindUserSid
  116. // IDiskQuotaControl::CreateEnumUsers
  117. //
  118. #define DISKQUOTA_USERNAME_RESOLVE_NONE 0
  119. #define DISKQUOTA_USERNAME_RESOLVE_SYNC 1
  120. #define DISKQUOTA_USERNAME_RESOLVE_ASYNC 2
  121. //
  122. // Values for status returned by IDiskQuotaUser::GetAccountStatus.
  123. //
  124. #define DISKQUOTA_USER_ACCOUNT_RESOLVED 0
  125. #define DISKQUOTA_USER_ACCOUNT_UNAVAILABLE 1
  126. #define DISKQUOTA_USER_ACCOUNT_DELETED 2
  127. #define DISKQUOTA_USER_ACCOUNT_INVALID 3
  128. #define DISKQUOTA_USER_ACCOUNT_UNKNOWN 4
  129. #define DISKQUOTA_USER_ACCOUNT_UNRESOLVED 5
  130. //
  131. // IDiskQuotaUser represents a single user quota record on a particular
  132. // NTFS volume. Objects using this interface are instantiated
  133. // through several IDiskQuotaControl methods.
  134. //
  135. #undef INTERFACE
  136. #define INTERFACE IDiskQuotaUser
  137. DECLARE_INTERFACE_(IDiskQuotaUser, IUnknown)
  138. {
  139. STDMETHOD(GetID)(THIS_
  140. ULONG *pulID) PURE;
  141. STDMETHOD(GetName)(THIS_
  142. LPWSTR pszAccountContainer,
  143. DWORD cchAccountContainer,
  144. LPWSTR pszLogonName,
  145. DWORD cchLogonName,
  146. LPWSTR pszDisplayName,
  147. DWORD cchDisplayName) PURE;
  148. STDMETHOD(GetSidLength)(THIS_
  149. LPDWORD pdwLength) PURE;
  150. STDMETHOD(GetSid)(THIS_
  151. LPBYTE pbSidBuffer,
  152. DWORD cbSidBuffer) PURE;
  153. STDMETHOD(GetQuotaThreshold)(THIS_
  154. PLONGLONG pllThreshold) PURE;
  155. STDMETHOD(GetQuotaThresholdText)(THIS_
  156. LPWSTR pszText,
  157. DWORD cchText) PURE;
  158. STDMETHOD(GetQuotaLimit)(THIS_
  159. PLONGLONG pllLimit) PURE;
  160. STDMETHOD(GetQuotaLimitText)(THIS_
  161. LPWSTR pszText,
  162. DWORD cchText) PURE;
  163. STDMETHOD(GetQuotaUsed)(THIS_
  164. PLONGLONG pllUsed) PURE;
  165. STDMETHOD(GetQuotaUsedText)(THIS_
  166. LPWSTR pszText,
  167. DWORD cchText) PURE;
  168. STDMETHOD(GetQuotaInformation)(THIS_
  169. LPVOID pbQuotaInfo,
  170. DWORD cbQuotaInfo) PURE;
  171. STDMETHOD(SetQuotaThreshold)(THIS_
  172. LONGLONG llThreshold,
  173. BOOL fWriteThrough) PURE;
  174. STDMETHOD(SetQuotaLimit)(THIS_
  175. LONGLONG llLimit,
  176. BOOL fWriteThrough) PURE;
  177. STDMETHOD(Invalidate)(THIS) PURE;
  178. STDMETHOD(GetAccountStatus)(THIS_
  179. LPDWORD pdwStatus) PURE;
  180. };
  181. typedef IDiskQuotaUser DISKQUOTA_USER, *PDISKQUOTA_USER;
  182. //
  183. // IEnumDiskQuotaUsers represents an enumerator created by
  184. // IDiskQuotaControl for the purpose of enumerating individual user quota
  185. // records on a particular volume. Each record is represented through
  186. // the IDiskQuotaUser interface.
  187. //
  188. #undef INTERFACE
  189. #define INTERFACE IEnumDiskQuotaUsers
  190. DECLARE_INTERFACE_(IEnumDiskQuotaUsers, IUnknown)
  191. {
  192. STDMETHOD(Next)(THIS_
  193. DWORD cUsers,
  194. PDISKQUOTA_USER *rgUsers,
  195. LPDWORD pcUsersFetched) PURE;
  196. STDMETHOD(Skip)(THIS_
  197. DWORD cUsers) PURE;
  198. STDMETHOD(Reset)(THIS) PURE;
  199. STDMETHOD(Clone)(THIS_
  200. IEnumDiskQuotaUsers **ppEnum) PURE;
  201. };
  202. typedef IEnumDiskQuotaUsers ENUM_DISKQUOTA_USERS, *PENUM_DISKQUOTA_USERS;
  203. //
  204. // IDiskQuotaUserBatch represents a collection of IDiskQuotaUser
  205. // pointers for the purpose of grouping updates to quota information.
  206. //
  207. #undef INTERFACE
  208. #define INTERFACE IDiskQuotaUserBatch
  209. DECLARE_INTERFACE_(IDiskQuotaUserBatch, IUnknown)
  210. {
  211. STDMETHOD(Add)(THIS_
  212. PDISKQUOTA_USER pUser) PURE;
  213. STDMETHOD(Remove)(THIS_
  214. PDISKQUOTA_USER pUser) PURE;
  215. STDMETHOD(RemoveAll)(THIS) PURE;
  216. STDMETHOD(FlushToDisk)(THIS) PURE;
  217. };
  218. typedef IDiskQuotaUserBatch DISKQUOTA_USER_BATCH, *PDISKQUOTA_USER_BATCH;
  219. //
  220. // IDiskQuotaControl represents a disk volume, providing query and
  221. // control of that volume's quota information.
  222. //
  223. #undef INTERFACE
  224. #define INTERFACE IDiskQuotaControl
  225. DECLARE_INTERFACE_(IDiskQuotaControl, IConnectionPointContainer)
  226. {
  227. STDMETHOD(Initialize)(THIS_
  228. LPCWSTR pszPath,
  229. BOOL bReadWrite) PURE;
  230. STDMETHOD(SetQuotaState)(THIS_
  231. DWORD dwState) PURE;
  232. STDMETHOD(GetQuotaState)(THIS_
  233. LPDWORD pdwState) PURE;
  234. STDMETHOD(SetQuotaLogFlags)(THIS_
  235. DWORD dwFlags) PURE;
  236. STDMETHOD(GetQuotaLogFlags)(THIS_
  237. LPDWORD pdwFlags) PURE;
  238. STDMETHOD(SetDefaultQuotaThreshold)(THIS_
  239. LONGLONG llThreshold) PURE;
  240. STDMETHOD(GetDefaultQuotaThreshold)(THIS_
  241. PLONGLONG pllThreshold) PURE;
  242. STDMETHOD(GetDefaultQuotaThresholdText)(THIS_
  243. LPWSTR pszText,
  244. DWORD cchText) PURE;
  245. STDMETHOD(SetDefaultQuotaLimit)(THIS_
  246. LONGLONG llLimit) PURE;
  247. STDMETHOD(GetDefaultQuotaLimit)(THIS_
  248. PLONGLONG pllLimit) PURE;
  249. STDMETHOD(GetDefaultQuotaLimitText)(THIS_
  250. LPWSTR pszText,
  251. DWORD cchText) PURE;
  252. STDMETHOD(AddUserSid)(THIS_
  253. PSID pUserSid,
  254. DWORD fNameResolution,
  255. PDISKQUOTA_USER *ppUser) PURE;
  256. STDMETHOD(AddUserName)(THIS_
  257. LPCWSTR pszLogonName,
  258. DWORD fNameResolution,
  259. PDISKQUOTA_USER *ppUser) PURE;
  260. STDMETHOD(DeleteUser)(THIS_
  261. PDISKQUOTA_USER pUser) PURE;
  262. STDMETHOD(FindUserSid)(THIS_
  263. PSID pUserSid,
  264. DWORD fNameResolution,
  265. PDISKQUOTA_USER *ppUser) PURE;
  266. STDMETHOD(FindUserName)(THIS_
  267. LPCWSTR pszLogonName,
  268. PDISKQUOTA_USER *ppUser) PURE;
  269. STDMETHOD(CreateEnumUsers)(THIS_
  270. PSID *rgpUserSids,
  271. DWORD cpSids,
  272. DWORD fNameResolution,
  273. PENUM_DISKQUOTA_USERS *ppEnum) PURE;
  274. STDMETHOD(CreateUserBatch)(THIS_
  275. PDISKQUOTA_USER_BATCH *ppBatch) PURE;
  276. STDMETHOD(InvalidateSidNameCache)(THIS) PURE;
  277. STDMETHOD(GiveUserNameResolutionPriority)(THIS_
  278. PDISKQUOTA_USER pUser) PURE;
  279. STDMETHOD(ShutdownNameResolution)(THIS_
  280. VOID) PURE;
  281. };
  282. typedef IDiskQuotaControl DISKQUOTA_CONTROL, *PDISKQUOTA_CONTROL;
  283. #undef INTERFACE
  284. #define INTERFACE IDiskQuotaEvents
  285. DECLARE_INTERFACE_(IDiskQuotaEvents, IUnknown)
  286. {
  287. STDMETHOD(OnUserNameChanged)(THIS_
  288. PDISKQUOTA_USER pUser) PURE;
  289. };
  290. typedef IDiskQuotaEvents DISKQUOTA_EVENTS, *PDISKQUOTA_EVENTS;
  291. #endif // __DSKQUOTA_H