File: Windows.Win32.PInvoke.ADVAPI32.dll.g.cs
Project: src\src\Servers\HttpSys\src\Microsoft.AspNetCore.Server.HttpSys.csproj (Microsoft.AspNetCore.Server.HttpSys)
// ------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------

#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
using global::System;
using global::System.Diagnostics;
using global::System.Diagnostics.CodeAnalysis;
using global::System.Runtime.CompilerServices;
using global::System.Runtime.InteropServices;
using global::System.Runtime.Versioning;
using winmdroot = global::Windows.Win32;
namespace Windows.Win32
{

	/// <content>
	/// Contains extern methods from "ADVAPI32.dll".
	/// </content>
	internal static partial class PInvoke
	{
		/// <inheritdoc cref="GetSecurityInfo(winmdroot.Foundation.HANDLE, winmdroot.Security.Authorization.SE_OBJECT_TYPE, uint, winmdroot.Foundation.PSID*, winmdroot.Foundation.PSID*, winmdroot.Security.ACL**, winmdroot.Security.ACL**, winmdroot.Security.PSECURITY_DESCRIPTOR*)"/>
		[SupportedOSPlatform("windows5.1.2600")]
		internal static unsafe winmdroot.Foundation.WIN32_ERROR GetSecurityInfo(SafeHandle handle, winmdroot.Security.Authorization.SE_OBJECT_TYPE ObjectType, uint SecurityInfo, winmdroot.Foundation.PSID* ppsidOwner, winmdroot.Foundation.PSID* ppsidGroup, winmdroot.Security.ACL** ppDacl, winmdroot.Security.ACL** ppSacl, winmdroot.Security.PSECURITY_DESCRIPTOR* ppSecurityDescriptor)
		{
			bool handleAddRef = false;
			try
			{
				winmdroot.Foundation.HANDLE handleLocal;
				if (handle is object)
				{
					handle.DangerousAddRef(ref handleAddRef);
					handleLocal = (winmdroot.Foundation.HANDLE)handle.DangerousGetHandle();
				}
				else
					throw new ArgumentNullException(nameof(handle));
				winmdroot.Foundation.WIN32_ERROR __result = PInvoke.GetSecurityInfo(handleLocal, ObjectType, SecurityInfo, ppsidOwner, ppsidGroup, ppDacl, ppSacl, ppSecurityDescriptor);
				return __result;
			}
			finally
			{
				if (handleAddRef)
					handle.DangerousRelease();
			}
		}

		/// <summary>Retrieves a copy of the security descriptor for an object specified by a handle.</summary>
		/// <param name="handle">A handle to the object from which to retrieve security information.</param>
		/// <param name="ObjectType"><a href="https://docs.microsoft.com/windows/desktop/api/accctrl/ne-accctrl-se_object_type">SE_OBJECT_TYPE</a> enumeration value that indicates the type of object.</param>
		/// <param name="SecurityInfo">
		/// <para>A set of bit flags that indicate the type of security information to retrieve. This parameter can be a combination of the <a href="https://docs.microsoft.com/windows/desktop/SecAuthZ/security-information">SECURITY_INFORMATION</a> bit flags.</para>
		/// <para><see href="https://learn.microsoft.com/windows/win32/api/aclapi/nf-aclapi-getsecurityinfo#parameters">Read more on docs.microsoft.com</see>.</para>
		/// </param>
		/// <param name="ppsidOwner">A pointer to a variable that receives a pointer to the owner SID in the security descriptor returned in <i>ppSecurityDescriptor</i>. The returned pointer is valid only if you set the OWNER_SECURITY_INFORMATION flag. This parameter can be <b>NULL</b> if you do not need the owner SID.</param>
		/// <param name="ppsidGroup">A pointer to a variable that receives a pointer to the primary group SID in the returned <a href="https://docs.microsoft.com/windows/desktop/SecGloss/s-gly">security descriptor</a>. The returned pointer is valid only if you set the GROUP_SECURITY_INFORMATION flag. This parameter can be <b>NULL</b> if you do not need the group SID.</param>
		/// <param name="ppDacl">A pointer to a variable that receives a pointer to the DACL in the returned security descriptor. The returned pointer is valid only if you set the DACL_SECURITY_INFORMATION flag. This parameter can be <b>NULL</b> if you do not need the DACL.</param>
		/// <param name="ppSacl">A pointer to a variable that receives a pointer to the SACL in the returned security descriptor. The returned pointer is valid only if you set the SACL_SECURITY_INFORMATION flag. This parameter can be <b>NULL</b> if you do not need the SACL.</param>
		/// <param name="ppSecurityDescriptor">
		/// <para>A pointer to a variable that receives a pointer to the security descriptor of the object. When you have finished using the pointer,  free the returned buffer by calling the <a href="https://docs.microsoft.com/windows/desktop/api/winbase/nf-winbase-localfree">LocalFree</a> function. This parameter is required if any one of the <i>ppsidOwner</i>, <i>ppsidGroup</i>, <i>ppDacl</i>, or <i>ppSacl</i> parameters is not <b>NULL</b>.</para>
		/// <para><see href="https://learn.microsoft.com/windows/win32/api/aclapi/nf-aclapi-getsecurityinfo#parameters">Read more on docs.microsoft.com</see>.</para>
		/// </param>
		/// <returns>
		/// <para>If the function succeeds, the return value is ERROR_SUCCESS. If the function fails, the return value is a nonzero error code defined in WinError.h.</para>
		/// </returns>
		/// <remarks>
		/// <para>If the <i>ppsidOwner</i>, <i>ppsidGroup</i>, <i>ppDacl</i>, and <i>ppSacl</i> parameters are non-<b>NULL</b>, and the <i>SecurityInfo</i> parameter specifies that they be retrieved from the object, those parameters will point to the corresponding parameters in the security descriptor returned in <i>ppSecurityDescriptor</i>. To read the owner, group, or DACL from the object's security descriptor, the calling process must have been granted READ_CONTROL access when the handle was opened. To get READ_CONTROL access, the caller must be the owner of the object or the object's DACL must grant the access. To read the SACL from the security descriptor, the calling process must have been granted ACCESS_SYSTEM_SECURITY access when the handle was opened. The proper way to get this access is to enable the SE_SECURITY_NAME privilege in the caller's current token, open the handle for ACCESS_SYSTEM_SECURITY access, and then disable the privilege. For information about the security implications of enabling  privileges, see <a href="https://docs.microsoft.com/windows/desktop/SecBP/running-with-special-privileges">Running with Special Privileges</a>. You can use the <b>GetSecurityInfo</b> function with the following types of objects: </para>
		/// <para>This doc was truncated.</para>
		/// <para><see href="https://learn.microsoft.com/windows/win32/api/aclapi/nf-aclapi-getsecurityinfo#">Read more on docs.microsoft.com</see>.</para>
		/// </remarks>
		[DllImport("ADVAPI32.dll", ExactSpelling = true)]
		[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
		[SupportedOSPlatform("windows5.1.2600")]
		internal static extern unsafe winmdroot.Foundation.WIN32_ERROR GetSecurityInfo(winmdroot.Foundation.HANDLE handle, winmdroot.Security.Authorization.SE_OBJECT_TYPE ObjectType, uint SecurityInfo, [Optional] winmdroot.Foundation.PSID* ppsidOwner, [Optional] winmdroot.Foundation.PSID* ppsidGroup, [Optional] winmdroot.Security.ACL** ppDacl, [Optional] winmdroot.Security.ACL** ppSacl, [Optional] winmdroot.Security.PSECURITY_DESCRIPTOR* ppSecurityDescriptor);

		/// <summary>Returns the length, in bytes, of a structurally valid security descriptor. The length includes the length of all associated structures.</summary>
		/// <param name="pSecurityDescriptor">
		/// <para>A pointer to the <a href="https://docs.microsoft.com/windows/desktop/api/winnt/ns-winnt-security_descriptor">SECURITY_DESCRIPTOR</a> structure whose length the function returns. The pointer is assumed to be valid.</para>
		/// <para><see href="https://learn.microsoft.com/windows/win32/api/securitybaseapi/nf-securitybaseapi-getsecuritydescriptorlength#parameters">Read more on docs.microsoft.com</see>.</para>
		/// </param>
		/// <returns>
		/// <para>If the function succeeds, the function returns the length, in bytes, of the <a href="https://docs.microsoft.com/windows/desktop/api/winnt/ns-winnt-security_descriptor">SECURITY_DESCRIPTOR</a> structure. If the <a href="https://docs.microsoft.com/windows/desktop/api/winnt/ns-winnt-security_descriptor">SECURITY_DESCRIPTOR</a> structure is not valid, the return value is undefined.</para>
		/// </returns>
		/// <remarks>
		/// <para>The minimum length of a security descriptor is SECURITY_DESCRIPTOR_MIN_LENGTH. A security descriptor of this length has no associated <a href="https://docs.microsoft.com/windows/desktop/SecGloss/s-gly">security identifiers</a> (SIDs) or <a href="https://docs.microsoft.com/windows/desktop/SecGloss/a-gly">access control lists</a> (ACLs).</para>
		/// <para><see href="https://learn.microsoft.com/windows/win32/api/securitybaseapi/nf-securitybaseapi-getsecuritydescriptorlength#">Read more on docs.microsoft.com</see>.</para>
		/// </remarks>
		[DllImport("ADVAPI32.dll", ExactSpelling = true)]
		[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
		[SupportedOSPlatform("windows5.1.2600")]
		internal static extern uint GetSecurityDescriptorLength(winmdroot.Security.PSECURITY_DESCRIPTOR pSecurityDescriptor);
	}
}