BinarySDToSecurityDescriptor function (adshlp.h)

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

Syntax

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

Parameters

[in] pSecurityDescriptor

Type: PSECURITY_DESCRIPTOR

Address of a SECURITY_DESCRIPTOR structure to convert.

[out] pVarsec

Type: VARIANT*

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.

[in] pszServerName

Type: LPCWSTR

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.

[in] userName

Type: LPCWSTR

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.

[in] passWord

Type: LPCWSTR

A null-terminated Unicode string that provides the password to be associated with the security descriptor. This parameter is optional and can be NULL.

[in] dwFlags

Type: DWORD

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 value

Type: HRESULT

This method supports standard return values, as well as the following:

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

Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header adshlp.h
Library Activeds.lib
DLL Activeds.dll

See also

ADSI Error Codes

ADSI Functions

ADS_AUTHENTICATION_ENUM

IADsSecurityDescriptor

IADsSecurityUtility

SECURITY_DESCRIPTOR

SecurityDescriptorToBinarySD

VariantClear