SecurityDescriptorToBinarySD function (adshlp.h)

The SecurityDescriptorToBinarySD function converts an IADsSecurityDescriptor object to the binary security descriptor format.

Syntax

HRESULT SecurityDescriptorToBinarySD(
  [in]  VARIANT              vVarSecDes,
  [out] PSECURITY_DESCRIPTOR *ppSecurityDescriptor,
  [out] PDWORD               pdwSDLength,
  [in]  LPCWSTR              pszServerName,
  [in]  LPCWSTR              userName,
  [in]  LPCWSTR              passWord,
  [in]  DWORD                dwFlags
);

Parameters

[in] vVarSecDes

Type: VARIANT

Contains a VARIANT that contains the security descriptor to convert. The VARIANT must contain a VT_DISPATCH that contains an IADsSecurityDescriptor object.

[out] ppSecurityDescriptor

Type: PSECURITY_DESCRIPTOR*

Address of a SECURITY_DESCRIPTOR pointer that receives the binary security descriptor data. The caller must free this memory by passing this pointer to the FreeADsMem function.

[out] pdwSDLength

Type: PDWORD

Address of a DWORD value that receives the length, in bytes of the binary security descriptor data.

[in] pszServerName

Type: LPCWSTR

A null-terminated Unicode string that specifies the name of the server where the security descriptor is placed. This parameter is optional and can be NULL.

[in] userName

Type: LPCWSTR

A null-terminated Unicode string that contains the user name that the security descriptor is associated to. This parameter is optional and can be NULL.

[in] passWord

Type: LPCWSTR

A null-terminated Unicode string that contains the password that the security descriptor is associated. 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 the standard return values, as well as the following.

Remarks

This function is used for legacy applications to manually convert security descriptors to binary security descriptors. For new applications, use IADsSecurityUtility, which performs 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

BinarySDToSecurityDescriptor

FreeADsMem

IADsSecurityDescriptor

SECURITY_DESCRIPTOR

VARIANT