Directory Services

BinarySDToSecurityDescriptor

The BinarySDToSecurityDescriptor function converts a binary security descriptor to an IADsSecurityDescriptor object.

HRESULT BinarySDToSecurityDescriptor(
  PSECURITY_DESCRIPTOR pSecurityDescriptor,
  VARIANT* pVarsec,
  LPCWSTR pszServerName,
  LPCWSTR userName,
  LPCWSTR passWord,
  DWORD dwFlags
);

Parameters

pSecurityDescriptor
[in] Address of a SECURITY_DESCRIPTOR structure to convert.
pVarsec
[out] Address of a VARIANT that receives the object. The VARIANT contains a VT_DISPATCH object that can be queried for the IADsSecurityDescriptor interface. The caller must release this VARIANT by passing the VARIANT to the VariantClear function.
pszServerName
[in] A null-terminated Unicode string that provides the name of the server that the security descriptor was retrieved from. This parameter is optional and can be NULL.
userName
[in] A null-terminated Unicode string that provides the user name to be associated with the security descriptor. This parameter is optional and can be NULL.
passWord
[in] A null-terminated Unicode string that provides the password to be associated with the security descriptor. This parameter is optional and can be NULL.
dwFlags
[in] Contains authentication flags for the conversion. This can be zero or a combination of one or more of the ADS_AUTHENTICATION_ENUM enumeration values.

Return Values

This method supports standard return values, as well as the following:
Return Code Description
S_OK Operation was successful.

If the operation fails, an ADSI error code is returned. For more information, see ADSI Error Codes.

Remarks

This function is used for legacy applications that must manually convert security descriptors to binary security descriptors. For new applications, use the IADsSecurityUtility interface, which does this conversion automatically.

Requirements

Client: Included in Windows XP.
Server: Included in Windows Server 2003.
Redistributable: Requires Active Directory Client Extension on Windows NT 4.0 SP6a and Windows 95/98/Me.
Header: Declared in Adshlp.h.
Library: Use ActiveDS.lib.

See Also

IADsSecurityDescriptor, SECURITY_DESCRIPTOR, VariantClear, ADS_AUTHENTICATION_ENUM, IADsSecurityUtility, SecurityDescriptorToBinarySD, ADSI Error Codes, ADSI Functions