AdvApi32GetKernelObjectSecurity Method

Retrieves a copy of the security descriptor that protects a kernel object.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("AdvApi32.dll", SetLastError = true)]
public static bool GetKernelObjectSecurity(
	IntPtr handle,
	SecurityInformation securityInformation,
	byte[] securityDescriptor,
	uint length,
	ref uint refLengthNeeded
)

Parameters

handle  IntPtr
A handle to a kernel object.
securityInformation  SecurityInformation
Specifies a SecurityInformation value that identifies the security information being requested.
securityDescriptor  Byte
A pointer to a buffer the function fills with a copy of the security descriptor of the specified object.

The calling process must have the right to view the specified aspects of the object's security status.

The SECURITY_DESCRIPTOR structure is returned in self-relative format.

length  UInt32
Specifies the size, in bytes, of the buffer pointed to by the securityDescriptor parameter.
refLengthNeeded  UInt32
A pointer to a variable that receives the number of bytes required for the buffer pointed to by the securityDescriptor parameter.

If this variable's value is greater than the value of the nLength parameter when the function returns, none of the security descriptor is copied to the buffer.

Return Value

Boolean
If the function succeeds, the return value is .

If the function fails, the return value is

To get extended error information, call GetLastWin32Error.

Remarks

See Also