訪問許可權和存取遮罩

存取權是一個位旗標,對應至線程可以在安全性實體對象上執行的特定作業集。 例如,登錄機碼具有 KEY_SET_VALUE 訪問許可權,其對應於線程在機碼下設定值的能力。 如果線程嘗試在對象上執行作業,但沒有物件的必要存取權,則系統不會執行作業。

存取掩碼是 32 位值,其位對應於 物件所支援的訪問許可權。 所有 Windows 安全性實體物件都會使用 存取遮罩格式 ,其中包含下列存取權限類型的位:

當線程嘗試開啟物件的句柄時,線程通常會指定存取掩碼來 要求一組訪問許可權。 例如,需要設定及查詢登錄機碼值的應用程式可以使用存取遮罩來要求 KEY_SET_VALUE 和 KEY_QUERY_VALUE 訪問許可權來開啟密鑰。

訪問許可權和可保護的物件

下表顯示操作每種安全性實體物件安全性資訊的函式。

物件類型 安全性描述元函式
NTFS 檔案系統上的檔案或目錄 GetNamedSecurityInfo、SetNamedSecurityInfo、GetSecurityInfo、SetSecurityInfo
命名管道匿名管道 GetSecurityInfo、 SetSecurityInfo
控制台畫面緩衝區 不支援。
處理線程 GetSecurityInfo、 SetSecurityInfo
檔案對應物件 GetNamedSecurityInfo、 SetNamedSecurityInfo、 GetSecurityInfo、 SetSecurityInfo
存取權杖 SetKernelObjectSecurity、 GetKernelObjectSecurity
視窗管理物件(視窗月 臺和 桌面電腦) GetSecurityInfo、 SetSecurityInfo
登錄機碼 GetNamedSecurityInfo、SetNamedSecurityInfo、GetSecurityInfo、SetSecurityInfo
Windows 服務 GetNamedSecurityInfo、 SetNamedSecurityInfo、 GetSecurityInfo、 SetSecurityInfo
本機或遠端印表機 GetNamedSecurityInfo、 SetNamedSecurityInfo、 GetSecurityInfo、 SetSecurityInfo
網路共用 GetNamedSecurityInfo、 SetNamedSecurityInfo、 GetSecurityInfo、 SetSecurityInfo
行程間同步處理物件 (事件、Mutex、號誌和可等候定時器) GetNamedSecurityInfo、 SetNamedSecurityInfo、 GetSecurityInfo、 SetSecurityInfo
作業物件 GetNamedSecurityInfo、SetNamedSecurityInfo、GetSecurityInfo、SetSecurityInfo

存取遮罩格式

目錄服務訪問許可權

要求一組訪問許可權