03 - 12 - 2024

CSharp Security-Editor - Structs

Bewertung:  / 2
SchwachSuper 
Zurück zum Hauptartikel
Implementation von Struct-Elementen für den CSharp - Security-Editor:
	
	[StructLayout(LayoutKind.Sequential)]
    public struct GENERIC_MAPPING 
    {
        public int GenericRead;
        public int GenericWrite;
        public int GenericExecute;
        public int GenericAll;
    }
	
	/// <summary>
    /// The SI_OBJECT_INFO structure is used by the ISecurityInformation::GetObjectInformation method to specify information used to initialize the access control editor.
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct SI_OBJECT_INFO
    {
        /// <summary>
        /// A set of bit flags that determine the editing options available to the user. This member can be a combination of the following values. 
        /// </summary>
        public SI_OBJECT_FLAGS dwFlags;
        
        /// <summary>
        /// Identifies a module that contains string resources to be used in the property sheet. The ISecurityInformation::GetAccessRights and ISecurityInformation::GetInheritTypes methods can specify string resource identifiers for display names.
        /// </summary>
        private IntPtr hInstance;
		
        /// <summary>
        /// A pointer to a null-terminated, Unicode string that names the computer on which to look up account names and SIDs. This value can be NULL to specify the local computer. The access control editor does not free this pointer.
        /// </summary>
        [MarshalAs(UnmanagedType.LPWStr)]
        public string szServerName;
		
        /// <summary>
        /// A pointer to a null-terminated, Unicode string that names the object being edited. This name appears in the title of the advanced security property sheet and any error message boxes displayed by the access control editor. The access control editor does not free this pointer.
        /// </summary>
        [MarshalAs(UnmanagedType.LPWStr)]
        public string szObjectName;
		
        /// <summary>
        /// A pointer to a null-terminated, Unicode string used as the title of the basic security property page. This member is ignored unless the SI_PAGE_TITLE flag is set in dwFlags. If the page title is not provided, a default title is used. The access control editor does not free this pointer.
        /// </summary>
        [MarshalAs(UnmanagedType.LPWStr)]
        public string szPageTitle;
        
		/// <summary>
        /// A GUID for the object. This member is ignored unless the SI_OBJECT_GUID flag is set in dwFlags.
        /// </summary>
        private IntPtr guidObjectType;
		
        public SI_OBJECT_INFO(SI_OBJECT_FLAGS flags, IntPtr hInstance, string servername, string objectname, string pagetitle)
        {
            dwFlags = flags;
            this.hInstance = hInstance;
            szServerName = servername;
            szObjectName = objectname;
            szPageTitle = pagetitle;
            guidObjectType = IntPtr.Zero;
        }
    }
    
	/// <summary>
    /// The SI_ACCESS structure contains information about an access right or default access mask for a securable object. The ISecurityInformation::GetAccessRights method uses this structure to specify information that the access control editor uses to initialize its property pages.
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct SI_ACCESS
    {
        /// <summary>
        /// A pointer to a GUID structure that identifies the type of object to which the access right or default access mask applies. The GUID can identify a property set or property on the object, or a type of child object that can be contained by the object. If this member points to GUID_NULL, the access right applies to the object itself.
        /// </summary>
        private IntPtr pguid;
		
        /// <summary>
        /// A bitmask that specifies the access right described by this structure. The mask can contain any combination of standard and specific rights, but should not contain generic rights such as GENERIC_ALL.
        /// </summary>
        public SI_ACCESS_MASK mask;
		
        /// <summary>
        /// A pointer to a null-terminated Unicode string containing a display string that describes the access right. Alternatively, pszName can be a string resource identifier returned by the MAKEINTRESOURCE macro. Use the ISecurityInformation::GetObjectInformation method to identify the module that contains the string resource.
        /// </summary>
        [MarshalAs(UnmanagedType.LPWStr)]
        public string szName;
        
        /// <summary>
        /// A set of bit flags that indicate where the access right is displayed. This member can be a combination of the following. 
        /// </summary>
        public SI_ACCESS_FLAG dwFlags;
        
        public static readonly int SizeOf = Marshal.SizeOf(typeof(SI_ACCESS));
		
        public SI_ACCESS(SI_ACCESS_MASK mask, string name, SI_ACCESS_FLAG flags)
        {
            pguid = IntPtr.Zero;
            this.mask = mask;
            szName = name;
            dwFlags = flags;
        }
    }
	
	/// <summary>
    /// The SI_INHERIT_TYPE structure contains information about how access control entries (ACEs) can be inherited by child objects. The ISecurityInformation::GetInheritTypes method uses this structure to specify display strings that the access control editor uses to initialize its property pages.
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct SI_INHERIT_TYPE
    {
        /// <summary>
        /// A pointer to a GUID structure that identifies the type of child object. This member can be a pointer to GUID_NULL. The GUID corresponds to the InheritedObjectType member of an object-specific ACE.
        /// </summary>
        private IntPtr pguid;
        
        /// <summary>
        /// A set of inheritance flags that indicate the types of ACEs that can be inherited by the pguid object type. These flags correspond to the AceFlags member of an ACE_HEADER structure. This member can be a combination of the following values. 
        /// </summary>
        public SI_INHERIT_FLAGS dwFlags;

		/// <summary>
        /// A pointer to a null-terminated Unicode string containing a display string that describes the child object.
        /// Alternatively, pszName can be a string resource identifier returned by the MAKEINTRESOURCE macro. Use the ISecurityInformation::GetObjectInformation method to identify the module that contains the string resource.
        /// </summary>
        [MarshalAs(UnmanagedType.LPWStr)]
        public string pszName;
    }
Zurück zum Hauptartikel