/// <summary> /// Set security using a named object. /// </summary> /// <param name="name">The name of the object.</param> /// <param name="type">The type of named object.</param> /// <param name="security_information">The security information to set.</param> /// <param name="security_descriptor">The security descriptor to set.</param> /// <param name="invoke_setting">Specify to indicate when to execute progress function.</param> /// <param name="action">The security operation to perform on the tree.</param> /// <param name="progress_function">Progress function.</param> public static void SetSecurityInfo(string name, SeObjectType type, SecurityInformation security_information, SecurityDescriptor security_descriptor, TreeSecInfo action, TreeProgressFunction progress_function, ProgressInvokeSetting invoke_setting ) { SetSecurityInfo(name, type, security_information, security_descriptor, action, progress_function, invoke_setting, true); }
internal static extern Win32Error TreeSetNamedSecurityInfo( string pObjectName, SeObjectType ObjectType, SecurityInformation SecurityInfo, byte[] psidOwner, byte[] psidGroup, byte[] pDacl, byte[] pSacl, TreeSecInfo dwAction, TreeSetNamedSecurityProgress fnProgress, ProgressInvokeSetting ProgressInvokeSetting, IntPtr Args );
/// <summary> /// Set security using a named object. /// </summary> /// <param name="name">The name of the object.</param> /// <param name="type">The type of named object.</param> /// <param name="security_information">The security information to set.</param> /// <param name="security_descriptor">The security descriptor to set.</param> /// <param name="invoke_setting">Specify to indicate when to execute progress function.</param> /// <param name="action">The security operation to perform on the tree.</param> /// <param name="progress_function">Progress function.</param> /// <param name="throw_on_error">True to throw on error.</param> /// <returns>The NT status code.</returns> public static NtStatus SetSecurityInfo(string name, SeObjectType type, SecurityInformation security_information, SecurityDescriptor security_descriptor, TreeSecInfo action, TreeProgressFunction progress_function, ProgressInvokeSetting invoke_setting, bool throw_on_error) { return(Win32NativeMethods.TreeSetNamedSecurityInfo( name, type, security_information, security_descriptor.Owner?.Sid.ToArray(), security_descriptor.Group?.Sid.ToArray(), security_descriptor.Dacl?.ToByteArray(), security_descriptor.Sacl?.ToByteArray(), action, CreateCallback(progress_function), invoke_setting, IntPtr.Zero ).ToNtException(throw_on_error)); }