1 /**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the mingw-w64 runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6 #ifndef __DSKQUOTA_H
7 #define __DSKQUOTA_H
8
9 #include <windows.h>
10 #include <ole2.h>
11 #include <olectl.h>
12
13 #ifdef INITGUIDS
14 #include <initguid.h>
15 #endif
16
17 DEFINE_GUID(CLSID_DiskQuotaControl,0x7988b571,0xec89,0x11cf,0x9c,0x0,0x0,0xaa,0x0,0xa1,0x4f,0x56);
18 DEFINE_GUID(IID_IDiskQuotaControl,0x7988b572,0xec89,0x11cf,0x9c,0x0,0x0,0xaa,0x0,0xa1,0x4f,0x56);
19 DEFINE_GUID(IID_IDiskQuotaUser,0x7988b574,0xec89,0x11cf,0x9c,0x0,0x0,0xaa,0x0,0xa1,0x4f,0x56);
20 DEFINE_GUID(IID_IDiskQuotaUserBatch,0x7988b576,0xec89,0x11cf,0x9c,0x0,0x0,0xaa,0x0,0xa1,0x4f,0x56);
21 DEFINE_GUID(IID_IEnumDiskQuotaUsers,0x7988b577,0xec89,0x11cf,0x9c,0x0,0x0,0xaa,0x0,0xa1,0x4f,0x56);
22 DEFINE_GUID(IID_IDiskQuotaEvents,0x7988b579,0xec89,0x11cf,0x9c,0x0,0x0,0xaa,0x0,0xa1,0x4f,0x56);
23
24 #define DISKQUOTA_STATE_DISABLED 0x00000000
25 #define DISKQUOTA_STATE_TRACK 0x00000001
26 #define DISKQUOTA_STATE_ENFORCE 0x00000002
27 #define DISKQUOTA_STATE_MASK 0x00000003
28 #define DISKQUOTA_FILESTATE_INCOMPLETE 0x00000100
29 #define DISKQUOTA_FILESTATE_REBUILDING 0x00000200
30 #define DISKQUOTA_FILESTATE_MASK 0x00000300
31
32 #define DISKQUOTA_SET_DISABLED(s) ((s) &= ~DISKQUOTA_STATE_MASK)
33 #define DISKQUOTA_SET_TRACKED(s) ((s) |= (DISKQUOTA_STATE_MASK & DISKQUOTA_STATE_TRACK))
34 #define DISKQUOTA_SET_ENFORCED(s) ((s) |= (DISKQUOTA_STATE_ENFORCE & DISKQUOTA_STATE_ENFORCE))
35 #define DISKQUOTA_IS_DISABLED(s) (DISKQUOTA_STATE_DISABLED==((s) & DISKQUOTA_STATE_MASK))
36 #define DISKQUOTA_IS_TRACKED(s) (DISKQUOTA_STATE_TRACK==((s) & DISKQUOTA_STATE_MASK))
37 #define DISKQUOTA_IS_ENFORCED(s) (DISKQUOTA_STATE_ENFORCE==((s) & DISKQUOTA_STATE_MASK))
38 #define DISKQUOTA_FILE_INCOMPLETE(s) (0!=((s) & DISKQUOTA_FILESTATE_INCOMPLETE))
39 #define DISKQUOTA_FILE_REBUILDING(s) (0!=((s) & DISKQUOTA_FILESTATE_REBUILDING))
40
41 #define DISKQUOTA_LOGFLAG_USER_THRESHOLD 0x00000001
42 #define DISKQUOTA_LOGFLAG_USER_LIMIT 0x00000002
43
44 #define DISKQUOTA_IS_LOGGED_USER_THRESHOLD(f) (0!=((f) & DISKQUOTA_LOGFLAG_USER_THRESHOLD))
45 #define DISKQUOTA_IS_LOGGED_USER_LIMIT(f) (0!=((f) & DISKQUOTA_LOGFLAG_USER_LIMIT))
46 #define DISKQUOTA_SET_LOG_USER_THRESHOLD(f,yn) ((f &= ~DISKQUOTA_LOGFLAG_USER_THRESHOLD) |= ((yn) ? DISKQUOTA_LOGFLAG_USER_THRESHOLD : 0))
47 #define DISKQUOTA_SET_LOG_USER_LIMIT(f,yn) ((f &= ~DISKQUOTA_LOGFLAG_USER_LIMIT) |= ((yn) ? DISKQUOTA_LOGFLAG_USER_LIMIT : 0))
48
49 typedef struct DiskQuotaUserInformation {
50 LONGLONG QuotaUsed;
51 LONGLONG QuotaThreshold;
52 LONGLONG QuotaLimit;
53 } DISKQUOTA_USER_INFORMATION,*PDISKQUOTA_USER_INFORMATION;
54
55 #define DISKQUOTA_USERNAME_RESOLVE_NONE 0
56 #define DISKQUOTA_USERNAME_RESOLVE_SYNC 1
57 #define DISKQUOTA_USERNAME_RESOLVE_ASYNC 2
58
59 #define DISKQUOTA_USER_ACCOUNT_RESOLVED 0
60 #define DISKQUOTA_USER_ACCOUNT_UNAVAILABLE 1
61 #define DISKQUOTA_USER_ACCOUNT_DELETED 2
62 #define DISKQUOTA_USER_ACCOUNT_INVALID 3
63 #define DISKQUOTA_USER_ACCOUNT_UNKNOWN 4
64 #define DISKQUOTA_USER_ACCOUNT_UNRESOLVED 5
65
66 #undef INTERFACE
67 #define INTERFACE IDiskQuotaUser
DECLARE_INTERFACE_(IDiskQuotaUser,IUnknown)68 DECLARE_INTERFACE_(IDiskQuotaUser,IUnknown) {
69 STDMETHOD(GetID)(THIS_ ULONG *pulID) PURE;
70 STDMETHOD(GetName)(THIS_ LPWSTR pszAccountContainer,DWORD cchAccountContainer,LPWSTR pszLogonName,DWORD cchLogonName,LPWSTR pszDisplayName,DWORD cchDisplayName) PURE;
71 STDMETHOD(GetSidLength)(THIS_ LPDWORD pdwLength) PURE;
72 STDMETHOD(GetSid)(THIS_ LPBYTE pbSidBuffer,DWORD cbSidBuffer) PURE;
73 STDMETHOD(GetQuotaThreshold)(THIS_ PLONGLONG pllThreshold) PURE;
74 STDMETHOD(GetQuotaThresholdText)(THIS_ LPWSTR pszText,DWORD cchText) PURE;
75 STDMETHOD(GetQuotaLimit)(THIS_ PLONGLONG pllLimit) PURE;
76 STDMETHOD(GetQuotaLimitText)(THIS_ LPWSTR pszText,DWORD cchText) PURE;
77 STDMETHOD(GetQuotaUsed)(THIS_ PLONGLONG pllUsed) PURE;
78 STDMETHOD(GetQuotaUsedText)(THIS_ LPWSTR pszText,DWORD cchText) PURE;
79 STDMETHOD(GetQuotaInformation)(THIS_ LPVOID pbQuotaInfo,DWORD cbQuotaInfo) PURE;
80 STDMETHOD(SetQuotaThreshold)(THIS_ LONGLONG llThreshold,WINBOOL fWriteThrough) PURE;
81 STDMETHOD(SetQuotaLimit)(THIS_ LONGLONG llLimit,WINBOOL fWriteThrough) PURE;
82 STDMETHOD(Invalidate)(THIS) PURE;
83 STDMETHOD(GetAccountStatus)(THIS_ LPDWORD pdwStatus) PURE;
84 };
85 typedef IDiskQuotaUser DISKQUOTA_USER,*PDISKQUOTA_USER;
86
87 #undef INTERFACE
88 #define INTERFACE IEnumDiskQuotaUsers
DECLARE_INTERFACE_(IEnumDiskQuotaUsers,IUnknown)89 DECLARE_INTERFACE_(IEnumDiskQuotaUsers,IUnknown) {
90 STDMETHOD(Next)(THIS_ DWORD cUsers,PDISKQUOTA_USER *rgUsers,LPDWORD pcUsersFetched) PURE;
91 STDMETHOD(Skip)(THIS_ DWORD cUsers) PURE;
92 STDMETHOD(Reset)(THIS) PURE;
93 STDMETHOD(Clone)(THIS_ IEnumDiskQuotaUsers **ppEnum) PURE;
94 };
95
96 typedef IEnumDiskQuotaUsers ENUM_DISKQUOTA_USERS,*PENUM_DISKQUOTA_USERS;
97
98 #undef INTERFACE
99 #define INTERFACE IDiskQuotaUserBatch
DECLARE_INTERFACE_(IDiskQuotaUserBatch,IUnknown)100 DECLARE_INTERFACE_(IDiskQuotaUserBatch,IUnknown) {
101 STDMETHOD(Add)(THIS_ PDISKQUOTA_USER pUser) PURE;
102 STDMETHOD(Remove)(THIS_ PDISKQUOTA_USER pUser) PURE;
103 STDMETHOD(RemoveAll)(THIS) PURE;
104 STDMETHOD(FlushToDisk)(THIS) PURE;
105 };
106
107 typedef IDiskQuotaUserBatch DISKQUOTA_USER_BATCH,*PDISKQUOTA_USER_BATCH;
108
109 #undef INTERFACE
110 #define INTERFACE IDiskQuotaControl
DECLARE_INTERFACE_(IDiskQuotaControl,IConnectionPointContainer)111 DECLARE_INTERFACE_(IDiskQuotaControl,IConnectionPointContainer) {
112 STDMETHOD(Initialize)(THIS_ LPCWSTR pszPath,WINBOOL bReadWrite) PURE;
113 STDMETHOD(SetQuotaState)(THIS_ DWORD dwState) PURE;
114 STDMETHOD(GetQuotaState)(THIS_ LPDWORD pdwState) PURE;
115 STDMETHOD(SetQuotaLogFlags)(THIS_ DWORD dwFlags) PURE;
116 STDMETHOD(GetQuotaLogFlags)(THIS_ LPDWORD pdwFlags) PURE;
117 STDMETHOD(SetDefaultQuotaThreshold)(THIS_ LONGLONG llThreshold) PURE;
118 STDMETHOD(GetDefaultQuotaThreshold)(THIS_ PLONGLONG pllThreshold) PURE;
119 STDMETHOD(GetDefaultQuotaThresholdText)(THIS_ LPWSTR pszText,DWORD cchText) PURE;
120 STDMETHOD(SetDefaultQuotaLimit)(THIS_ LONGLONG llLimit) PURE;
121 STDMETHOD(GetDefaultQuotaLimit)(THIS_ PLONGLONG pllLimit) PURE;
122 STDMETHOD(GetDefaultQuotaLimitText)(THIS_ LPWSTR pszText,DWORD cchText) PURE;
123 STDMETHOD(AddUserSid)(THIS_ PSID pUserSid,DWORD fNameResolution,PDISKQUOTA_USER *ppUser) PURE;
124 STDMETHOD(AddUserName)(THIS_ LPCWSTR pszLogonName,DWORD fNameResolution,PDISKQUOTA_USER *ppUser) PURE;
125 STDMETHOD(DeleteUser)(THIS_ PDISKQUOTA_USER pUser) PURE;
126 STDMETHOD(FindUserSid)(THIS_ PSID pUserSid,DWORD fNameResolution,PDISKQUOTA_USER *ppUser) PURE;
127 STDMETHOD(FindUserName)(THIS_ LPCWSTR pszLogonName,PDISKQUOTA_USER *ppUser) PURE;
128 STDMETHOD(CreateEnumUsers)(THIS_ PSID *rgpUserSids,DWORD cpSids,DWORD fNameResolution,PENUM_DISKQUOTA_USERS *ppEnum) PURE;
129 STDMETHOD(CreateUserBatch)(THIS_ PDISKQUOTA_USER_BATCH *ppBatch) PURE;
130 STDMETHOD(InvalidateSidNameCache)(THIS) PURE;
131 STDMETHOD(GiveUserNameResolutionPriority)(THIS_ PDISKQUOTA_USER pUser) PURE;
132 STDMETHOD(ShutdownNameResolution)(THIS) PURE;
133 };
134
135 typedef IDiskQuotaControl DISKQUOTA_CONTROL,*PDISKQUOTA_CONTROL;
136
137 #undef INTERFACE
138 #define INTERFACE IDiskQuotaEvents
DECLARE_INTERFACE_(IDiskQuotaEvents,IUnknown)139 DECLARE_INTERFACE_(IDiskQuotaEvents,IUnknown) {
140 STDMETHOD(OnUserNameChanged)(THIS_ PDISKQUOTA_USER pUser) PURE;
141 };
142
143 typedef IDiskQuotaEvents DISKQUOTA_EVENTS,*PDISKQUOTA_EVENTS;
144 #endif
145