CopySid 函式 (securitybaseapi.h)

CopySid 函式會將安全性標識碼 (SID) 複製到緩衝區。

語法

BOOL CopySid(
  [in]  DWORD nDestinationSidLength,
  [out] PSID  pDestinationSid,
  [in]  PSID  pSourceSid
);

參數

[in] nDestinationSidLength

指定接收 SID 複本之緩衝區的長度,以位元組為單位。

[out] pDestinationSid

接收來源 SID 結構複本之緩衝區的指標。

[in] pSourceSid

函式複製到 pDestinationSid 參數所指向之緩衝區的 SID 結構的指標。

傳回值

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

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

備註

應用程式可以使用 CopySid 函式,在 存取令牌 (中建立 SID 的複本,例如,在 TOKEN_GROUPS結構中 ,) 用於存取控制專案 (ACE) 。

範例

如需使用此函式的範例,請參閱 取得登入SID

規格需求

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

另請參閱

存取控制 概觀

AllocateAndInitializeSid

基本 存取控制 函式

EqualSid

GetLengthSid

GetSidIdentifierAuthority

GetSidLengthRequired

GetSidSubAuthority

GetSidSubAuthorityCount

InitializeSid

IsValidSid

SID