IADsSecurityUtility::GetSecurityDescriptor method (iads.h)

The GetSecurityDescriptor method retrieves a security descriptor for the specified file, fileshare, or registry key.

Syntax

HRESULT GetSecurityDescriptor(
  [in]  VARIANT varPath,
  [in]  long    lPathFormat,
  [in]  long    lFormat,
  [out] VARIANT *pVariant
);

Parameters

[in] varPath

A VARIANT string that contains the path of the object to retrieve the security descriptor for.

File

A valid file path syntax. For example: "c:\specs\public\adxml.doc" or "\adsi\public\dsclient.exe".

File share

A valid file path syntax for a file share. For example: "\adsi\public".

Registry key

A valid registry syntax. For example, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ADs".

[in] lPathFormat

Contains one of the ADS_PATHTYPE_ENUM values which specifies the format of the varPath parameter.

[in] lFormat

Contains one of the ADS_SD_FORMAT_ENUM values which specifies the format of the security descriptor returned in the pVariant parameter. The following list identifies the possible values for this parameter and the format that is supplied in the pVariant parameter.

ADS_SD_FORMAT_IID

pVariant receives a VT_DISPATCH that can be queried for the IADsSecurityDescriptor interface.

ADS_SD_FORMAT_RAW

pVariant receives a VT_I1 | VT_ARRAY that contains the security descriptor in raw data format. This is in the format of a SECURITY_DESCRIPTOR structure.

ADS_SD_FORMAT_HEXSTRING

pVariant receives a VT_BSTR that contains the raw security descriptor in hex encode string format.

[out] pVariant

Pointer to a VARIANT that receives the returned security descriptor. The format of the retrieved security descriptor is specified by the lFormat parameter.

Return value

Returns S_OK if successful or a COM or Win32 error code otherwise. Possible error codes include the following.

Requirements

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

See also

ADS_PATHTYPE_ENUM

ADS_SD_FORMAT_ENUM

IADsSecurityDescriptor

IADsSecurityUtility

SECURITY_DESCRIPTOR

SetSecurityDescriptor