25 - 07 - 2024

Beiträge

CSharp Security-Editor - Interface ISecurityInformation

Bewertung:  / 2
SchwachSuper 
Zurück zum Hauptartikel
Implementation des Interface ISecurityInformation für den CSharp - Security-Editor:
	
	using System;
	using System.Runtime.InteropServices;
	using System.Windows;
	using System.Windows.Interop;
	
	/// <summary>
    /// The ISecurityInformation interface enables the access control editor to communicate with the caller of the CreateSecurityPage and EditSecurity functions. The editor calls the interface methods to retrieve information that is used to initialize its pages and to determine the editing options available to the user. The editor also calls the interface methods to pass the user's input back to the application.
    /// </summary>
    [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("965FC360-16FF-11d0-91CB-00AA00BBB723")]
    internal interface ISecurityInformation
    {
        /// <summary>
        /// Requests information that is used to initialize the access control editor and to determine the editing options available to the user.
        /// </summary>
        ///<param name="pObjectInfo" />A pointer to an SI_OBJECT_INFO structure. Your implementation must fill this structure to pass information back to the access control editor.</param>
        void GetObjectInformation(ref SI_OBJECT_INFO pObjectInfo);
        
		/// <summary>
        /// Requests the security descriptor of the object being edited.
        /// </summary>
        /// <param name="RequestedInformation" />A set of SECURITY_INFORMATION bit flags that indicate the parts of the security descriptor being requested. This parameter can be a combination of the following values.</param>
        /// <param name="ppSecurityDescriptor" />A pointer to a variable that your implementation must set to a pointer to the object's security descriptor. The security descriptor must include the components requested by the RequestedInformation parameter. The system calls the LocalFree function to free the returned pointer.</param>
        /// <param name="fDefault" />If this parameter is TRUE, ppSecurityDescriptor should return an application-defined default security descriptor for the object. The access control editor uses this default security descriptor to reinitialize the property page. The access control editor sets this parameter to TRUE only if the user clicks the Default button. The Default button is displayed only if you set the SI_RESET flag in the ISecurityInformation::GetObjectInformation method. If no default security descriptor is available, do not set the SI_RESET flag. If this flag is FALSE, ppSecurityDescriptor should return the object's current security descriptor.</param>
        void GetSecurity(SI_SECURITY_INFORMATION RequestedInformation, IntPtr ppSecurityDescriptor, bool fDefault);
        
		/// <summary>
        /// Provides a security descriptor containing the security information specified by the user.
        /// </summary>
        /// <param name="SecurityInformation" />A set of SECURITY_INFORMATION bit flags that indicate the parts of the security descriptor to set. This parameter can be a combination of the following values.</param>
        /// <param name="pSecurityDescriptor" />A pointer to a security descriptor containing the new security information. Do not assume the security descriptor is in self-relative form; it can be either absolute or self-relative.</param>
        void SetSecurity(SI_SECURITY_INFORMATION SecurityInformation, IntPtr pSecurityDescriptor);
        
		/// <summary>
        /// Requests information about the access rights supported by the object being edited.
        /// </summary>
        /// <param name="pguidObjectType" />A pointer to a GUID structure that identifies the type of object for which access rights are being requested. If this parameter is NULL or a pointer to GUID_NULL, return the access rights for the object being edited. Otherwise, the GUID identifies a child object type returned by the ISecurityInformation::GetInheritTypes method. The GUID corresponds to the InheritedObjectType member of an object-specific ACE.</param>
        /// <param name="dwFlags" />A set of bit flags that indicate the property page being initialized. This value is zero if the basic security page is being initialized. Otherwise, it is a combination of the following values.</param>
        /// <param name="ppAccess" />A pointer to an array of SI_ACCESS structures. The array must include one entry for each access right. You can specify access rights that apply to the object itself, as well as object-specific access rights that apply only to a property set or property on the object.</param>
        /// <param name="pcAccesses" />A pointer to ULONG that indicates the number of entries in the ppAccess array.</param>
        /// <param name="piDefaultAccess" />A pointer to ULONG that indicates the zero-based index of the array entry that contains the default access rights. The access control editor uses this entry as the initial access rights in a new ACE.</param>
        void GetAccessRight(IntPtr pguidObjectType, SI_ACCESS_RIGHT_FLAG dwFlags, [MarshalAs(UnmanagedType.LPArray)]out SI_ACCESS[] ppAccess, ref uint pcAccesses, ref uint piDefaultAccess);
        
		/// <summary>
        /// Requests that the generic access rights in an access mask be mapped to their corresponding standard and specific access rights.
        /// </summary>
        /// <param name="pguidObjectType" />A pointer to a GUID structure that identifies the type of object to which the access mask applies. If this member is NULL or a pointer to GUID_NULL, the access mask applies to the object itself.</param>
        /// <param name="pAceFlags" />A pointer to the AceFlags member of the ACE_HEADER structure from the ACE whose access mask is being mapped.</param>
        /// <param name="pMask" />A pointer to an access mask that contains the generic access rights to map. Your implementation must map the generic access rights to the corresponding standard and specific access rights for the specified object type.</param>
        void MapGeneric(IntPtr pguidObjectType, IntPtr pAceFlags, IntPtr pMask);
        
		/// <summary>
        /// Requests information about how the object's ACEs can be inherited by child objects.
        /// </summary>
        /// <param name="ppInheritTypes" />A pointer to a variable you should set to a pointer to an array of SI_INHERIT_TYPE structures. The array should include one entry for each combination of inheritance flags and child object type that you support.</param>
        /// <param name="pcInheritTypes " />A pointer to a variable that you should set to indicate the number of entries in the ppInheritTypes array.</param>
        void GetInheritTypes(ref SI_INHERIT_TYPE ppInheritTypes, IntPtr pcInheritTypes);
        
		/// <summary>
        /// Notifies the application that an access control editor property page is being created or destroyed.
        /// </summary>
        /// <param name="hwnd" />If uMsg is PSPCB_SI_INITDIALOG, hwnd is a handle to the property page dialog box. Otherwise, hwnd is NULL.</param>
        /// <param name="uMsg" />Identifies the message being received. This parameter is one of the following values.</param>
        /// <param name="uPage" />A value from the SI_PAGE_TYPE enumeration type that indicates the type of access control editor property page being created or destroyed.</param>
        void PropertySheetPageCallback(IntPtr hwnd, int uMsg, SI_PAGE_TYPE uPage);
    }
	

Weitere Enumerationen und Struct-Elemente

Sowohl das Interface als auch die Klasse SecurityEditor verwenden weitere Enumerationen und Struct-Elemente, welche ebenfalls noch implementiert werden müssen:

 
 
Zurück zum Hauptartikel