⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dskquota.h

📁 vc6.0完整版
💻 H
📖 第 1 页 / 共 5 页
字号:
/************************************************************************
*                                                                       *
*   dskquota.h --  public header for Windows NT disk quota interfaces.  *
*                                                                       *
*   Copyright 1991-1998, Microsoft Corp. All rights reserved.       *
*                                                                       *
************************************************************************/
#ifndef __DSKQUOTA_H
#define __DSKQUOTA_H

//
// This is the public header for the Windows NT disk quota control 
// COM library.  The interfaces are implemented in DSKQUOTA.DLL.
//
// Define the INITGUIDS macros in one source module (and only one source
// module) before including this header.  This will generate a single 
// definition for the GUIDs used by the library.
//
// DSKQUOTA.DLL is self-registering using REGSVR32.
//
//
// Interfaces -----------------------------------------------------------------
//
//      IDiskQuotaControl
//
//          Represents an NTFS volume for purposes of managing disk quota.
//          Instantiate this interface for each volume to be controlled.
//          Through it you can:
//              * Enable/Disable disk quotas.
//              * Obtain status of quota system on the volume.
//              * Deny disk space to users exceding their quota limit.
//              * Assign default warning threshold and quota limit values
//                to be used for new volume users.
//              * Locate a single user quota entry.
//              * Mark a user quota entry for deletion.
//              * Create an enumeration object for enumerating user quota
//                entries.
//              * Create a batch object for updating multiple user quota
//                entries efficiently.
//
//      IDiskQuotaUser
//
//          Represents a user quota entry on the volume.
//          Instantiated through IEnumDiskQuotaUsers, 
//              IDiskQuotaControl::FindUserSid or 
//              IDiskQuotaControl::FindUserName or
//              IDiskQuotaControl::AddUser
//
//          Through it you can:
//              * Set/Retrieve the user's quota warning threshold and quota
//                limit.
//              * Retrieve the user's quota amount "used" value.
//              * Retrieve the user's domain, account and friendly name.
//              * Retrieve the user's security ID (SID).
//
//      IEnumDiskQuotaUsers
//
//          Enumerates user quota entries on the volume.  Implements the
//          standard OLE IEnumXXXX interface.
//          Instantiated through IDiskQuotaControl::CreateEnumUsers.
//
//      IDiskQuotaUserBatch
//
//          Coordinates the update of multiple user quota entries into
//          a single call to NTFS.  Improves update efficiency when 
//          multiple entries must be updated.
//          Instantiated through IDiskQuotaControl::CreateUserBatch.
//
//      IDiskQuotaEvents
//
//          The DiskQuotaControl object services this interface as
//          an OLE connection point.  The connection point is used to
//          notify client code when a significant event has occured in
//          the quota system.  Currently, the only event supported is
//          the asynchronous update of a quota user object's name 
//          information.
//
// Interfaces [end] -----------------------------------------------------------
//          
//
#ifndef _WINDOWS_
#include <windows.h>
#endif

#ifndef _OLE2_H_
#include <ole2.h>
#endif

#ifndef _OLECTL_H_
#include <olectl.h>
#endif

#ifdef INITGUIDS
#include <initguid.h>
#endif


//
// Class IDs
//
// {7988B571-EC89-11cf-9C00-00AA00A14F56}
DEFINE_GUID(CLSID_DiskQuotaControl, 
0x7988b571, 0xec89, 0x11cf, 0x9c, 0x0, 0x0, 0xaa, 0x0, 0xa1, 0x4f, 0x56);

//
// Interface IDs
//
// {7988B572-EC89-11cf-9C00-00AA00A14F56}
DEFINE_GUID(IID_IDiskQuotaControl, 
0x7988b572, 0xec89, 0x11cf, 0x9c, 0x0, 0x0, 0xaa, 0x0, 0xa1, 0x4f, 0x56);

// {7988B574-EC89-11cf-9C00-00AA00A14F56}
DEFINE_GUID(IID_IDiskQuotaUser, 
0x7988b574, 0xec89, 0x11cf, 0x9c, 0x0, 0x0, 0xaa, 0x0, 0xa1, 0x4f, 0x56);

// {7988B576-EC89-11cf-9C00-00AA00A14F56}
DEFINE_GUID(IID_IDiskQuotaUserBatch, 
0x7988b576, 0xec89, 0x11cf, 0x9c, 0x0, 0x0, 0xaa, 0x0, 0xa1, 0x4f, 0x56);

// {7988B577-EC89-11cf-9C00-00AA00A14F56}
DEFINE_GUID(IID_IEnumDiskQuotaUsers, 
0x7988b577, 0xec89, 0x11cf, 0x9c, 0x0, 0x0, 0xaa, 0x0, 0xa1, 0x4f, 0x56);

// {7988B579-EC89-11cf-9C00-00AA00A14F56}
DEFINE_GUID(IID_IDiskQuotaEvents, 
0x7988b579, 0xec89, 0x11cf, 0x9c, 0x0, 0x0, 0xaa, 0x0, 0xa1, 0x4f, 0x56);


//
// Definitions for value and bits in DWORD returned by GetQuotaState().
//
#define DISKQUOTA_STATE_DISABLED            0x00000000
#define DISKQUOTA_STATE_TRACK               0x00000001
#define DISKQUOTA_STATE_ENFORCE             0x00000002
#define DISKQUOTA_STATE_MASK                0x00000003
#define DISKQUOTA_FILESTATE_INCOMPLETE      0x00000100
#define DISKQUOTA_FILESTATE_REBUILDING      0x00000200
#define DISKQUOTA_FILESTATE_MASK            0x00000300

//
// Helper macros for setting and testing state value.
//
#define DISKQUOTA_SET_DISABLED(s) \
            ((s) &= ~DISKQUOTA_STATE_MASK)

#define DISKQUOTA_SET_TRACKED(s) \
            ((s) |= (DISKQUOTA_STATE_MASK & DISKQUOTA_STATE_TRACK))

#define DISKQUOTA_SET_ENFORCED(s) \
            ((s) |= (DISKQUOTA_STATE_ENFORCE & DISKQUOTA_STATE_ENFORCE))

#define DISKQUOTA_IS_DISABLED(s) \
            (DISKQUOTA_STATE_DISABLED == ((s) & DISKQUOTA_STATE_MASK))

#define DISKQUOTA_IS_TRACKED(s) \
            (DISKQUOTA_STATE_TRACK == ((s) & DISKQUOTA_STATE_MASK))

#define DISKQUOTA_IS_ENFORCED(s) \
            (DISKQUOTA_STATE_ENFORCE == ((s) & DISKQUOTA_STATE_MASK))
//
// These file state flags are read-only.
//
#define DISKQUOTA_FILE_INCOMPLETE(s) \
            (0 != ((s) & DISKQUOTA_FILESTATE_INCOMPLETE))

#define DISKQUOTA_FILE_REBUILDING(s) \
            (0 != ((s) & DISKQUOTA_FILESTATE_REBUILDING))


//
// Definitions for bits in DWORD returned by GetQuotaLogFlags().
//
#define DISKQUOTA_LOGFLAG_USER_THRESHOLD    0x00000001
#define DISKQUOTA_LOGFLAG_USER_LIMIT        0x00000002

//
// Helper macros to interrogate a log flags DWORD.
//
#define DISKQUOTA_IS_LOGGED_USER_THRESHOLD(f) \
            (0 != ((f) & DISKQUOTA_LOGFLAG_USER_THRESHOLD))

#define DISKQUOTA_IS_LOGGED_USER_LIMIT(f) \
            (0 != ((f) & DISKQUOTA_LOGFLAG_USER_LIMIT))

//
// Helper macros to set/clear bits in a log flags DWORD.
//
#define DISKQUOTA_SET_LOG_USER_THRESHOLD(f,yn) \
              ((f &= ~DISKQUOTA_LOGFLAG_USER_THRESHOLD) |= ((yn) ? DISKQUOTA_LOGFLAG_USER_THRESHOLD : 0))

#define DISKQUOTA_SET_LOG_USER_LIMIT(f,yn) \
              ((f &= ~DISKQUOTA_LOGFLAG_USER_LIMIT) |= ((yn) ? DISKQUOTA_LOGFLAG_USER_LIMIT : 0))

//
// Per-user quota information.
//
typedef struct DiskQuotaUserInformation {    
    LONGLONG QuotaUsed;
    LONGLONG QuotaThreshold;
    LONGLONG QuotaLimit;
} DISKQUOTA_USER_INFORMATION, *PDISKQUOTA_USER_INFORMATION;


//
// Values for fNameResolution argument to:
//
//      IDiskQuotaControl::AddUser
//      IDiskQuotaControl::FindUserSid
//      IDiskQuotaControl::CreateEnumUsers
//
#define DISKQUOTA_USERNAME_RESOLVE_NONE     0
#define DISKQUOTA_USERNAME_RESOLVE_SYNC     1
#define DISKQUOTA_USERNAME_RESOLVE_ASYNC    2

//
// Values for status returned by IDiskQuotaUser::GetAccountStatus.
//
#define DISKQUOTA_USER_ACCOUNT_RESOLVED     0
#define DISKQUOTA_USER_ACCOUNT_UNAVAILABLE  1
#define DISKQUOTA_USER_ACCOUNT_DELETED      2
#define DISKQUOTA_USER_ACCOUNT_INVALID      3
#define DISKQUOTA_USER_ACCOUNT_UNKNOWN      4
#define DISKQUOTA_USER_ACCOUNT_UNRESOLVED   5


///////////////////////////////////////////////////////////////////////////////
// IDiskQuotaUser interface
//
// This interface represents a single user entry in the volume's quota
// information file.  Through this interface, you can query and modify
// user-specific quota information on an NTFS volume.  An IDiskQuotaUser 
// interface is instantiated through IEnumDiskQuotaUsers, 
// IDiskQuotaControl::FindUserSid, IDiskQuotaControl::FindUserName or
// IDiskQuotaControl::AddUser.
//
// IDiskQuotaUser::GetName ----------------------------------------------------
//
//      Retrieves the various name strings associated with a disk quota user.
//
//      Arguments:
//
//          pszDomain - Address of buffer to receive the name of the user's 
//              network domain.  May be NULL.
//
//          cchDomain - Size of domain name buffer in characters.  Ignored if
//              pszDomain is NULL.
//
//          pszName - Address of buffer to receive the name of the user's
//              account in the network domain.  May be NULL.
//
//          cchName - Size of the name buffer in characters.  Ignored if pszName
//              is NULL.
//
//          pszFullName - Address of buffer to receive the "full" name for
//              the quota user.  The "full" name is the friendly name 
//              associated with the user's account.  For example, user 
//              John Doe might have an account name of "jdoe" while his
//              "full" name is the string "John Doe".  May be NULL.
//
//          cchFullName - Size of the "full name" buffer in characters.  Ignored
//              if pszFullName is NULL.
//
//      Returns:
//          NOERROR           - Success.
//          DQC_E_LOCK_FAILED - Could not gain exclusive lock on user object.
//
//
// IDiskQuotaUser::GetSidLength -----------------------------------------------
//
//      Retrieves the length of the user's security ID (SID) in bytes.  The
//      return value is used to size the destination buffer passed to
//      IDiskQuotaUser::GetSid.
//
//      Arguments:
//
//          pdwLength - Address of DWORD variable to receive SID length.
//
//      Returns:
//
//          NOERROR           - Success.
//          E_POINTER         - pdwLength argument is NULL.
//          DQC_E_INVALID_SID - User's SID is invalid.
//          DQC_E_LOCK_FAILED - Could not gain exclusive lock on user object.
//          
//
// IDiskQuotaUser::GetSid -----------------------------------------------------
//
//      Retrieves the user's security ID (SID).
//
//      Arguments:
//
//          pbSidBuffer - Address of destination buffer to receive SID.
//
//          cbSidBuffer - Size of destination buffer in bytes.
//
//      Returns:
//
//          NOERROR                   - Success.
//          E_POINTER                 - pbSidBuffer is NULL.
//          DQC_E_INVALID_SID         - Quota entry SID is invalid.
//          DQC_E_INSUFFICIENT_BUFFER - Insufficient destination buffer size.
//          DQC_E_LOCK_FAILED         - Couldn't lock user object.
//          
//
// IDiskQuotaUser::GetQuotaThreshold ------------------------------------------
//
//      Retrieves the user's quota "threshold" value on the volume.  The
//      threshold is an arbitrary value set by the volume's quota 
//      administrator.  It may be used to identify users who are approaching
//      their quota limit.
//
//      Arguments:
//
//          pllThreshold - Address of LONGLONG variable to receive the 
//              threshold value.
//
//      Returns:
//
//          NOERROR             - Success.
//          DQC_E_ACCESS_DENIED - No READ access to quota information.
//          DQC_E_LOCK_FAILED   - Couldn't lock user object.
//          E_POINTER           - pllThreshold is NULL.
//          E_OUTOFMEMORY       - Insufficient memory.
//          E_FAIL              - Failed reading quota information.
//          
//
// IDiskQuotaUser::GetQuotaThresholdText --------------------------------------
//
//      Retrieves the user's quota "threshold" value expressed as a text
//      string (i.e. "10.5 MB").  If the user's threshold is unlimited,
//      the string "No Limit" is returned (localized).
//
//      Arguments:
//
//          pszText - Address of character buffer to receive text.
//
//          cchText - Size of destination buffer in bytes.
//
//      Returns:
//

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -