SetSecurityDescriptorGroup 函式 (securitybaseapi.h)

SetSecurityDescriptorGroup 函式會設定絕對格式安全性描述元的主要群組資訊,取代安全性描述元中已存在的任何主要群組資訊。

語法

BOOL SetSecurityDescriptorGroup(
  [in, out]      PSECURITY_DESCRIPTOR pSecurityDescriptor,
  [in, optional] PSID                 pGroup,
  [in]           BOOL                 bGroupDefaulted
);

參數

[in, out] pSecurityDescriptor

此函式設定主要群組 之SECURITY_DESCRIPTOR 結構的指標。 函式會將任何現有的主要群組取代為新的主要群組。

[in, optional] pGroup

安全性描述項新主要群組之 SID 結構的指標。 SID 結構是由安全性描述元所參考,而不是複製到 中。 如果此參數為 NULL,函式會清除安全性描述項的主要群組資訊。 這會將安全性描述符標示為沒有主要群組。

[in] bGroupDefaulted

指出主要群組資訊是否衍生自默認機制。 如果此值為 TRUE,則為預設資訊,且函式會將此值儲存為SECURITY_DESCRIPTOR_CONTROL結構中的 SE_GROUP_DEFAULTED 旗標。 如果此參數為零,則會清除SE_GROUP_DEFAULTED旗標。

傳回值

如果函式成功,則傳回非零的值。

如果此函式失敗,則傳回值為零。 若要取得擴充的錯誤資訊,請呼叫 GetLastError

規格需求

需求
最低支援的用戶端 Windows XP [傳統型應用程式 |UWP 應用程式]
最低支援的伺服器 Windows Server 2003 [傳統型應用程式 |UWP 應用程式]
目標平台 Windows
標頭 securitybaseapi.h (包括 Windows.h)
程式庫 Advapi32.lib
Dll Advapi32.dll

另請參閱

GetSecurityDescriptorGroup

InitializeSecurityDescriptor

低階 存取控制

低階 存取控制 函式

SECURITY_DESCRIPTOR

SECURITY_DESCRIPTOR_CONTROL

SID

SetSecurityDescriptorDacl

SetSecurityDescriptorOwner

SetSecurityDescriptorSacl