DSCreateSecurityPage function (dssec.h)

The DSCreateSecurityPage function creates a security property page for an Active Directory object. The resulting property page can be added to a property sheet.

Syntax

HRESULT DSCreateSecurityPage(
  [in]           LPCWSTR                pwszObjectPath,
  [in, optional] LPCWSTR                pwszObjectClass,
  [in]           DWORD                  dwFlags,
  [out]          HPROPSHEETPAGE         *phPage,
  [in, optional] PFNREADOBJECTSECURITY  pfnReadSD,
  [in, optional] PFNWRITEOBJECTSECURITY pfnWriteSD,
  [in]           LPARAM                 lpContext
);

Parameters

[in] pwszObjectPath

A pointer to a null-terminated wide character string that represents the full Active Directory path for the object.

[in, optional] pwszObjectClass

A pointer to a null-terminated wide character string that represents the object class. This value can be NULL.

[in] dwFlags

Flags used for the security property page. This parameter can be none or any combination of the following flags.

Value Meaning
DSSI_READ_ONLY
0x00000001
The security properties are read-only.
DSSI_NO_ACCESS_CHECK
0x00000002
No access check is performed.
DSSI_NO_EDIT_SACL
0x00000004
The system access control list (SACL) property is read-only.
DSSI_NO_EDIT_OWNER
0x00000008
The object owner property is read-only.
DSSI_IS_ROOT
0x00000010
The object is a root object.
DSSI_NO_FILTER
0x00000020
Do not apply any filters.
DSSI_NO_READONLY_MESSAGE
0x00000040
Suppress read-only popup messages.

[out] phPage

A pointer to a HPROPSHEETPAGE that returns the created security property page.

[in, optional] pfnReadSD

A pointer to a function used to read the security descriptor of the object. This value can be NULL. If pfnReadSD is not NULL, DSCreateSecurityPage calls the function referenced by pfnReadSD to retrieve the security descriptor of the object.

[in, optional] pfnWriteSD

A pointer to a function used to write the security descriptor of the object. This value can be NULL. If pfnWriteSD is not NULL, DSCreateSecurityPage calls the function referenced by pfnWriteSD to write the security descriptor of the object.

[in] lpContext

Context to pass to the functions identified by pfnReadSD or pfnWriteSD.

Return value

If the function succeeds, the function returns S_OK.

If the function fails, it returns an HRESULT value that indicates the error. For a list of common error codes, see Common HRESULT Values.

Remarks

The function pointed to by pfnReadSD is defined as follows.

#include <windows.h>

typedef HRESULT (WINAPI *PFNREADOBJECTSECURITY)(
    LPCWSTR,               // Active Directory path of object
    SECURITY_INFORMATION,  // the security information to read
    PSECURITY_DESCRIPTOR*, // the returned security descriptor 
    LPARAM                 // context parameter
);

The DSCreateSecurityPage function will free the security descriptor returned in the third parameter above by a call to the LocalFree function.

The function pointed to by pfnWriteSD is defined as follows.

#include <windows.h>

typedef HRESULT (WINAPI *PFNWRITEOBJECTSECURITY)(
    LPCWSTR,              // Active Directory path of object
    SECURITY_INFORMATION, // the security information to write
    PSECURITY_DESCRIPTOR, // the security descriptor to write
    LPARAM                // context parameter
);

Requirements

Requirement Value
Minimum supported client None supported
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header dssec.h
Library DSSec.lib
DLL DSSec.dll

See also

Basic Security Property Page

ISecurityInformation