Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than advapi32, prefix the name with the module name and a period.
GetSecurityInfo (advapi32)
.
Local or remote files or directories on an NTFS file system
Named pipes
Local or remote printers
Local or remote Windows services
Network shares
Registry keys
Semaphores, events, mutexes, and waitable timers
Processes, threads, jobs, and file-mapping objects
Interactive service window stations and desktops
Directory service objects
C# Signature:
[DllImport("advapi32.dll", SetLastError=true)]
static extern uint GetSecurityInfo(
HANDLE handle,
SE_OBJECT_TYPE ObjectType,
SECURITY_INFORMATION SecurityInfo,
out IntPtr pSidOwner,
out IntPtr pSidGroup,
out IntPtr pDacl,
out IntPtr pSacl,
out IntPtr pSecurityDescriptor);
VB Signature:
Declare Function GetSecurityInfo Lib "advapi32.dll" (TODO) As TODO
User-Defined Types:
The following is a static class that can be placed in your .NET wrapper for your GetSecurityInfo and other related functions. While it is a class, it has only readonly, static members so it acts more like a C++ Typedef with the Namespace.Object.Member syntax of C#. Oh, and yeah, it's got all the valudes for the SECURITY_INFORMATION bit values which are not exactly spelled out in MSDN.
public class SecurityInfo
{
/// <summary>
/// Indicates the owner identifier of the object is being referenced.
/// </summary>
public static readonly int OWNER=0x00000001 ;
/// <summary>
/// Indicates the primary group identifier of the object is being referenced.
/// </summary>
public static readonly int GROUP=0x00000002 ;
/// <summary>
/// Indicates the DACL of the object is being referenced.
/// </summary>
public static readonly int DACL=0x00000004 ;
/// <summary>
/// Indicates the SACL of the object is being referenced.
/// </summary>
/// <remarks>
/// Windows NT: This value is not supported.
/// </remarks>
public static readonly int SACL=0x00000008 ;
/// <summary>
/// Indicates the SACL inherits ACEs from the parent object.
/// </summary>
/// <remarks>
/// Windows NT: This value is not supported.
/// </remarks>
public static readonly int UNPROTECTED_SACL=0x10000000L;
/// <summary>
/// Indicates the DACL inherits ACEs from the parent object.
/// </summary>
/// <remarks>
/// Windows NT: This value is not supported.
/// </remarks>
public static readonly int UNPROTECTED_DACL=0x20000000L;
/// <summary>
/// Indicates the SACL cannot inherit ACEs.
/// </summary>
/// <remarks>
/// Windows NT: This value is not supported.
/// </remarks>
public static readonly int PROTECTED_SACL=0x40000000L;
/// <summary>
/// Indicates the DACL cannot inherit access control entries (ACEs).
/// </summary>
/// <remarks>
/// Windows NT: This value is not supported.
/// </remarks>
public static readonly int PROTECTED_DACL=0x80000000L;
}
Alternative Managed API:
Do you know one? Please contribute it!
Notes:
I am currently trying to implement this function to get the security attributes for Network Shares.
Tips & Tricks:
Please add some!
Sample Code:
Please add some!
You can use the GetSecurityInfo function with the following types of objects
12/1/2012 10:58:24 AM - -76.120.237.99
You can use the GetSecurityInfo function with the following types of objects
12/1/2012 10:58:24 AM - -76.120.237.99
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).