Directory Services

SecurityDescriptorToBinarySD

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

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

Parameters

vVarSecDes
[in] Contains a VARIANT that contains the security descriptor to convert. The VARIANT must contain a VT_DISPATCH that contains an IADsSecurityDescriptor object.
ppSecurityDescriptor
[out] 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.
pdwSDLength
[out] Address of a DWORD value that receives the length, in bytes of the binary security descriptor data.
pszServerName
[in] 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.
userName
[in] 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.
passWord
[in] A null-terminated Unicode string that contains the password that the security descriptor is associated. 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 the standard return values, as well as the following.
Return Code Description
S_OK Operation succeeded.

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

Client: Included in Windows XP.
Server: Included in Windows Server 2003.
Header: Declared in Adshlp.h.
Library: Use ActiveDS.lib.

See Also

IADsSecurityDescriptor, VARIANT, SECURITY_DESCRIPTOR, FreeADsMem, ADS_AUTHENTICATION_ENUM, BinarySDToSecurityDescriptor, ADSI Error Codes, ADSI Functions