Platform SDK: Files and I/O |
Adds a new quota entry on the volume for the specified user. The user is identified by domain and account name.
HRESULT AddUserName( LPCWSTR pszLogonName, DWORD fNameResolution, PDISKQUOTA_USER *ppUser );
Value | Meaning |
---|---|
DISKQUOTA_USERNAME_RESOLVE_NONE | Do not resolve user account information. |
DISKQUOTA_USERNAME_RESOLVE_SYNC | Resolve user account information synchronously. AddUserName returns when the information is resolved. If the information exists in the disk quota SID cache, it is returned immediately. Otherwise, the method must locate the information. This can take several seconds. |
DISKQUOTA_USERNAME_RESOLVE_ASYNC | Resolve user account information asynchronously. AddUserName returns immediately. The caller must implement the IDiskQuotaEvents interface to receive notification when the information is available. If the information was cached during a previous request, notification occurs as soon as the object is serviced. Otherwise, the method obtains the information from the network domain controller, then notifies IDiskQuotaEvents. |
This method returns a file system error or one of the following values.
Value | Meaning |
---|---|
S_OK | Success. |
S_FALSE | User already exists. Not added. |
ERROR_NOT_READY | The DiskQuotaControl object is not initialized. |
ERROR_USER_UNKNOWN | The specified user name is unknown. |
E_INVALIDARG | A pointer parameter is NULL. |
E_OUTOFMEMORY | Insufficient memory. |
E_FAIL | An unexpected file system error occurred. |
E_UNEXPECTED | An unexpected exception occurred. |
The NTFS file system automatically creates a user quota entry when a user first writes to the volume. Entries that are created automatically are assigned the default warning threshold and hard quota limit values for the volume. This method allows you to create a user quota entry before a user has written information to the volume. Therefore, you can pre-assign a warning threshold or hard quota limit value different than the volume default settings.
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Unsupported.
Header: Declared in Dskquota.h.
File Systems Overview, File System Interfaces, IDiskQuotaControl