Directory Services |
The ConvertSecurityDescriptor method converts a security descriptor from one format to another.
HRESULT ConvertSecurityDescriptor( VARIANT varSD, LONG lDataFormat, LONG lOutFormat, VARIANT* pvResult );
This method returns the standard return values, as well as the following.
For more information about other return values, see ADSI Error Codes.
Return Code | Description |
---|---|
S_OK | The conversion succeeded. |
The following code example shows how to convert a security descriptor from IADsSecurityDescriptor interface format to hexadecimal format.
Dim sdUtil as New ADsSecurityUtility Dim obj as IADs Dim sd as IADsSecurityDescriptor Dim sdInHex as VARIANT On Error GoTo Cleanup Set obj = GetObject("LDAP://DC=MyDivision,DC=Fabrikam,DC=com") Set sd = obj.Get("ntSecurityDescriptor") sdInHex = sdUtil.ConvertSecurityDescriptor(sd, ADS_SD_FORMAT_IID, ADS_SD_FORMAT_HEXSTRING ) Cleanup: If (Err.Number<>0) Then MsgBox("An error has occurred. " & Err.Number) End If Set sdUtil = Nothing Set obj = Nothing Set sd = Nothing
Client: Included in Windows XP.
Server: Included in Windows Server 2003.
Header: Declared in Iads.h.
ADS_PATHTYPE_ENUM, ADS_SD_FORMAT_ENUM, IADsSecurityDescriptor, IADsSecurityUtility, GetSecurityDescriptor, SetSecurityDescriptor