File: _generated\0\LibraryImports.g.cs
Web Access
Project: src\src\runtime\src\libraries\System.DirectoryServices\src\System.DirectoryServices.csproj (System.DirectoryServices)
// <auto-generated/>
internal static unsafe partial class Interop
{
    internal static unsafe partial class Activeds
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial int ADsEncodeBinaryData(byte[] data, int length, ref nint result)
        {
            int __retVal;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (nint* __result_native = &result)
            fixed (void* __data_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(data))
            {
                __retVal = __PInvoke((byte*)__data_native, length, __result_native);
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("activeds.dll", EntryPoint = "ADsEncodeBinaryData", ExactSpelling = true)]
            static extern unsafe int __PInvoke(byte* __data_native, int __length_native, nint* __result_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Activeds
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial int ADsGetLastError(out int error, char[] errorBuffer, int errorBufferLength, char[] nameBuffer, int nameBufferLength)
        {
            error = default;
            int __retVal;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (void* __nameBuffer_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<char, char>.ManagedToUnmanagedIn.GetPinnableReference(nameBuffer))
            fixed (void* __errorBuffer_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<char, char>.ManagedToUnmanagedIn.GetPinnableReference(errorBuffer))
            fixed (int* __error_native = &error)
            {
                __retVal = __PInvoke(__error_native, (char*)__errorBuffer_native, errorBufferLength, (char*)__nameBuffer_native, nameBufferLength);
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("activeds.dll", EntryPoint = "ADsGetLastError", ExactSpelling = true)]
            static extern unsafe int __PInvoke(int* __error_native, char* __errorBuffer_native, int __errorBufferLength_native, char* __nameBuffer_native, int __nameBufferLength_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Activeds
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial int ADsOpenObject(string path, string userName, string password, int flags, ref global::System.Guid iid, out nint ppObject)
        {
            ppObject = default;
            int __retVal;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (nint* __ppObject_native = &ppObject)
            fixed (global::System.Guid* __iid_native = &iid)
            fixed (void* __password_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(password))
            fixed (void* __userName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(userName))
            fixed (void* __path_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(path))
            {
                __retVal = __PInvoke((ushort*)__path_native, (ushort*)__userName_native, (ushort*)__password_native, flags, __iid_native, __ppObject_native);
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("activeds.dll", EntryPoint = "ADsOpenObject", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(ushort* __path_native, ushort* __userName_native, ushort* __password_native, int __flags_native, global::System.Guid* __iid_native, nint* __ppObject_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Activeds
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial int ADsSetLastError(int error, string errorString, string provider)
        {
            int __retVal;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (void* __provider_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(provider))
            fixed (void* __errorString_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(errorString))
            {
                __retVal = __PInvoke(error, (ushort*)__errorString_native, (ushort*)__provider_native);
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("activeds.dll", EntryPoint = "ADsSetLastError", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(int __error_native, ushort* __errorString_native, ushort* __provider_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Activeds
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool FreeADsMem(nint pVoid)
        {
            bool __retVal;
            int __retVal_native;
            {
                __retVal_native = __PInvoke(pVoid);
            }
 
            // Unmarshal - Convert native data to managed data.
            __retVal = __retVal_native != 0;
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("activeds.dll", EntryPoint = "FreeADsMem", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __pVoid_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial global::Interop.BOOL ConvertSidToStringSid(nint sid, out string stringSid)
        {
            int __lastError;
            bool __invokeSucceeded = default;
            stringSid = default;
            ushort* __stringSid_native = default;
            global::Interop.BOOL __retVal = default;
            try
            {
                {
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal = __PInvoke(sid, &__stringSid_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                __invokeSucceeded = true;
                // Unmarshal - Convert native data to managed data.
                stringSid = global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.ConvertToManaged(__stringSid_native);
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.Free(__stringSid_native);
                }
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "ConvertSidToStringSidW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe global::Interop.BOOL __PInvoke(nint __sid_native, ushort** __stringSid_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static unsafe partial global::Interop.BOOL ConvertStringSidToSid(string StringSid, out void* Sid)
        {
            int __lastError;
            Sid = default;
            global::Interop.BOOL __retVal;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (void** __Sid_native = &Sid)
            fixed (void* __StringSid_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(StringSid))
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal = __PInvoke((ushort*)__StringSid_native, __Sid_native);
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "ConvertStringSidToSidW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe global::Interop.BOOL __PInvoke(ushort* __StringSid_native, void** __Sid_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool CopySid(int destinationLength, nint pSidDestination, nint pSidSource)
        {
            int __lastError;
            bool __retVal;
            int __retVal_native;
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal_native = __PInvoke(destinationLength, pSidDestination, pSidSource);
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            // Unmarshal - Convert native data to managed data.
            __retVal = __retVal_native != 0;
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "CopySid", ExactSpelling = true)]
            static extern unsafe int __PInvoke(int __destinationLength_native, nint __pSidDestination_native, nint __pSidSource_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial bool EqualDomainSid(nint pSid1, nint pSid2, ref bool equal)
        {
            int __equal_native;
            bool __retVal;
            int __retVal_native;
            // Marshal - Convert managed data to native data.
            __equal_native = (int)(equal ? 1 : 0);
            {
                __retVal_native = __PInvoke(pSid1, pSid2, &__equal_native);
            }
 
            // Unmarshal - Convert native data to managed data.
            __retVal = __retVal_native != 0;
            equal = __equal_native != 0;
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "EqualDomainSid", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __pSid1_native, nint __pSid2_native, int* __equal_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "GetLengthSid", ExactSpelling = true)]
        internal static extern partial int GetLengthSid(nint sid);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "GetSidIdentifierAuthority", ExactSpelling = true)]
        internal static extern partial nint GetSidIdentifierAuthority(nint sid);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "GetSidSubAuthority", ExactSpelling = true)]
        internal static extern partial nint GetSidSubAuthority(nint sid, int index);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "GetSidSubAuthorityCount", ExactSpelling = true)]
        internal static extern partial nint GetSidSubAuthorityCount(nint sid);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool GetTokenInformation(nint TokenHandle, uint TokenInformationClass, nint TokenInformation, uint TokenInformationLength, out uint ReturnLength)
        {
            int __lastError;
            ReturnLength = default;
            bool __retVal;
            int __retVal_native;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (uint* __ReturnLength_native = &ReturnLength)
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal_native = __PInvoke(TokenHandle, TokenInformationClass, TokenInformation, TokenInformationLength, __ReturnLength_native);
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            // Unmarshal - Convert native data to managed data.
            __retVal = __retVal_native != 0;
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "GetTokenInformation", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __TokenHandle_native, uint __TokenInformationClass_native, nint __TokenInformation_native, uint __TokenInformationLength_native, uint* __ReturnLength_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool ImpersonateAnonymousToken(nint token)
        {
            int __lastError;
            bool __retVal;
            int __retVal_native;
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal_native = __PInvoke(token);
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            // Unmarshal - Convert native data to managed data.
            __retVal = __retVal_native != 0;
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "ImpersonateAnonymousToken", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __token_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial int ImpersonateLoggedOnUser(nint userToken)
        {
            int __lastError;
            int __retVal;
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal = __PInvoke(userToken);
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "ImpersonateLoggedOnUser", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __userToken_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool IsValidSid(nint sid)
        {
            int __lastError;
            bool __retVal;
            int __retVal_native;
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal_native = __PInvoke(sid);
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            // Unmarshal - Convert native data to managed data.
            __retVal = __retVal_native != 0;
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "IsValidSid", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __sid_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial int LogonUser(string username, string domain, string password, int logonType, int logonProvider, ref nint token)
        {
            int __lastError;
            int __retVal;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (nint* __token_native = &token)
            fixed (void* __password_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(password))
            fixed (void* __domain_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(domain))
            fixed (void* __username_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(username))
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal = __PInvoke((ushort*)__username_native, (ushort*)__domain_native, (ushort*)__password_native, logonType, logonProvider, __token_native);
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "LogonUserW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(ushort* __username_native, ushort* __domain_native, ushort* __password_native, int __logonType_native, int __logonProvider_native, nint* __token_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial int LsaClose(nint handle)
        {
            int __lastError;
            int __retVal;
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal = __PInvoke(handle);
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "LsaClose", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __handle_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial uint LsaCreateTrustedDomainEx(global::Microsoft.Win32.SafeHandles.SafeLsaPolicyHandle handle, in global::Interop.Advapi32.TRUSTED_DOMAIN_INFORMATION_EX domainEx, in global::Interop.Advapi32.TRUSTED_DOMAIN_AUTH_INFORMATION authInfo, int desiredAccess, out nint domainHandle)
        {
            domainHandle = default;
            nint __handle_native = default;
            uint __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeLsaPolicyHandle>.ManagedToUnmanagedIn __handle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __handle_native__marshaller.FromManaged(handle);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (nint* __domainHandle_native = &domainHandle)
                fixed (global::Interop.Advapi32.TRUSTED_DOMAIN_AUTH_INFORMATION* __authInfo_native = &authInfo)
                fixed (global::Interop.Advapi32.TRUSTED_DOMAIN_INFORMATION_EX* __domainEx_native = &domainEx)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __handle_native = __handle_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__handle_native, __domainEx_native, __authInfo_native, desiredAccess, __domainHandle_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __handle_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "LsaCreateTrustedDomainEx", ExactSpelling = true)]
            static extern unsafe uint __PInvoke(nint __handle_native, global::Interop.Advapi32.TRUSTED_DOMAIN_INFORMATION_EX* __domainEx_native, global::Interop.Advapi32.TRUSTED_DOMAIN_AUTH_INFORMATION* __authInfo_native, int __desiredAccess_native, nint* __domainHandle_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial uint LsaDeleteTrustedDomain(global::Microsoft.Win32.SafeHandles.SafeLsaPolicyHandle handle, nint pSid)
        {
            nint __handle_native = default;
            uint __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeLsaPolicyHandle>.ManagedToUnmanagedIn __handle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __handle_native__marshaller.FromManaged(handle);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __handle_native = __handle_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__handle_native, pSid);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __handle_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "LsaDeleteTrustedDomain", ExactSpelling = true)]
            static extern unsafe uint __PInvoke(nint __handle_native, nint __pSid_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial int LsaFreeMemory(nint handle)
        {
            int __lastError;
            int __retVal;
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal = __PInvoke(handle);
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "LsaFreeMemory", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __handle_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "LsaNtStatusToWinError", ExactSpelling = true, SetLastError = false)]
        internal static extern partial uint LsaNtStatusToWinError(uint status);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        private static partial uint LsaOpenPolicy(ref global::Interop.UNICODE_STRING SystemName, ref global::Interop.OBJECT_ATTRIBUTES ObjectAttributes, int AccessMask, out global::Microsoft.Win32.SafeHandles.SafeLsaPolicyHandle PolicyHandle)
        {
            int __lastError;
            bool __invokeSucceeded = default;
            PolicyHandle = default;
            nint __PolicyHandle_native = default;
            uint __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeLsaPolicyHandle>.ManagedToUnmanagedOut __PolicyHandle_native__marshaller = new();
            try
            {
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (global::Interop.OBJECT_ATTRIBUTES* __ObjectAttributes_native = &ObjectAttributes)
                fixed (global::Interop.UNICODE_STRING* __SystemName_native = &SystemName)
                {
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal = __PInvoke(__SystemName_native, __ObjectAttributes_native, AccessMask, &__PolicyHandle_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __PolicyHandle_native__marshaller.FromUnmanaged(__PolicyHandle_native);
                // Unmarshal - Convert native data to managed data.
                PolicyHandle = __PolicyHandle_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __PolicyHandle_native__marshaller.Free();
                }
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "LsaOpenPolicy", ExactSpelling = true)]
            static extern unsafe uint __PInvoke(global::Interop.UNICODE_STRING* __SystemName_native, global::Interop.OBJECT_ATTRIBUTES* __ObjectAttributes_native, int __AccessMask_native, nint* __PolicyHandle_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial uint LsaQueryInformationPolicy(nint policyHandle, int policyInformationClass, ref nint buffer)
        {
            uint __retVal;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (nint* __buffer_native = &buffer)
            {
                __retVal = __PInvoke(policyHandle, policyInformationClass, __buffer_native);
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "LsaQueryInformationPolicy", ExactSpelling = true)]
            static extern unsafe uint __PInvoke(nint __policyHandle_native, int __policyInformationClass_native, nint* __buffer_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial uint LsaQueryForestTrustInformation(global::Microsoft.Win32.SafeHandles.SafeLsaPolicyHandle handle, in global::Interop.UNICODE_STRING target, ref nint ForestTrustInfo)
        {
            nint __handle_native = default;
            uint __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeLsaPolicyHandle>.ManagedToUnmanagedIn __handle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __handle_native__marshaller.FromManaged(handle);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (nint* __ForestTrustInfo_native = &ForestTrustInfo)
                fixed (global::Interop.UNICODE_STRING* __target_native = &target)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __handle_native = __handle_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__handle_native, __target_native, __ForestTrustInfo_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __handle_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "LsaQueryForestTrustInformation", ExactSpelling = true)]
            static extern unsafe uint __PInvoke(nint __handle_native, global::Interop.UNICODE_STRING* __target_native, nint* __ForestTrustInfo_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial uint LsaQueryTrustedDomainInfoByName(global::Microsoft.Win32.SafeHandles.SafeLsaPolicyHandle handle, in global::Interop.UNICODE_STRING trustedDomain, global::Interop.Advapi32.TRUSTED_INFORMATION_CLASS infoClass, ref nint buffer)
        {
            nint __handle_native = default;
            uint __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeLsaPolicyHandle>.ManagedToUnmanagedIn __handle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __handle_native__marshaller.FromManaged(handle);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (nint* __buffer_native = &buffer)
                fixed (global::Interop.UNICODE_STRING* __trustedDomain_native = &trustedDomain)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __handle_native = __handle_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__handle_native, __trustedDomain_native, infoClass, __buffer_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __handle_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "LsaQueryTrustedDomainInfoByName", ExactSpelling = true)]
            static extern unsafe uint __PInvoke(nint __handle_native, global::Interop.UNICODE_STRING* __trustedDomain_native, global::Interop.Advapi32.TRUSTED_INFORMATION_CLASS __infoClass_native, nint* __buffer_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial uint LsaSetForestTrustInformation(global::Microsoft.Win32.SafeHandles.SafeLsaPolicyHandle handle, in global::Interop.UNICODE_STRING target, nint forestTrustInfo, bool checkOnly, out nint collisionInfo)
        {
            collisionInfo = default;
            nint __handle_native = default;
            byte __checkOnly_native = default;
            uint __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeLsaPolicyHandle>.ManagedToUnmanagedIn __handle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __checkOnly_native = (byte)(checkOnly ? 1 : 0);
                __handle_native__marshaller.FromManaged(handle);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (nint* __collisionInfo_native = &collisionInfo)
                fixed (global::Interop.UNICODE_STRING* __target_native = &target)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __handle_native = __handle_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__handle_native, __target_native, forestTrustInfo, __checkOnly_native, __collisionInfo_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __handle_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "LsaSetForestTrustInformation", ExactSpelling = true)]
            static extern unsafe uint __PInvoke(nint __handle_native, global::Interop.UNICODE_STRING* __target_native, nint __forestTrustInfo_native, byte __checkOnly_native, nint* __collisionInfo_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial uint LsaSetTrustedDomainInfoByName(global::Microsoft.Win32.SafeHandles.SafeLsaPolicyHandle handle, in global::Interop.UNICODE_STRING trustedDomain, global::Interop.Advapi32.TRUSTED_INFORMATION_CLASS infoClass, nint buffer)
        {
            nint __handle_native = default;
            uint __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeLsaPolicyHandle>.ManagedToUnmanagedIn __handle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __handle_native__marshaller.FromManaged(handle);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (global::Interop.UNICODE_STRING* __trustedDomain_native = &trustedDomain)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __handle_native = __handle_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__handle_native, __trustedDomain_native, infoClass, buffer);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __handle_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "LsaSetTrustedDomainInfoByName", ExactSpelling = true)]
            static extern unsafe uint __PInvoke(nint __handle_native, global::Interop.UNICODE_STRING* __trustedDomain_native, global::Interop.Advapi32.TRUSTED_INFORMATION_CLASS __infoClass_native, nint __buffer_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool OpenThreadToken(nint ThreadHandle, global::System.Security.Principal.TokenAccessLevels dwDesiredAccess, bool bOpenAsSelf, out global::Microsoft.Win32.SafeHandles.SafeTokenHandle phThreadToken)
        {
            int __lastError;
            bool __invokeSucceeded = default;
            phThreadToken = default;
            int __bOpenAsSelf_native = default;
            nint __phThreadToken_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeTokenHandle>.ManagedToUnmanagedOut __phThreadToken_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __bOpenAsSelf_native = (int)(bOpenAsSelf ? 1 : 0);
                {
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(ThreadHandle, dwDesiredAccess, __bOpenAsSelf_native, &__phThreadToken_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __phThreadToken_native__marshaller.FromUnmanaged(__phThreadToken_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
                phThreadToken = __phThreadToken_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __phThreadToken_native__marshaller.Free();
                }
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "OpenThreadToken", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __ThreadHandle_native, global::System.Security.Principal.TokenAccessLevels __dwDesiredAccess_native, int __bOpenAsSelf_native, nint* __phThreadToken_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool OpenProcessToken(nint ProcessHandle, int DesiredAccess, out global::Microsoft.Win32.SafeHandles.SafeTokenHandle TokenHandle)
        {
            int __lastError;
            bool __invokeSucceeded = default;
            TokenHandle = default;
            nint __TokenHandle_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeTokenHandle>.ManagedToUnmanagedOut __TokenHandle_native__marshaller = new();
            try
            {
                {
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(ProcessHandle, DesiredAccess, &__TokenHandle_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __TokenHandle_native__marshaller.FromUnmanaged(__TokenHandle_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
                TokenHandle = __TokenHandle_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __TokenHandle_native__marshaller.Free();
                }
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "OpenProcessToken", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(nint __ProcessHandle_native, int __DesiredAccess_native, nint* __TokenHandle_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool RevertToSelf()
        {
            int __lastError;
            bool __retVal;
            int __retVal_native;
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal_native = __PInvoke();
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            // Unmarshal - Convert native data to managed data.
            __retVal = __retVal_native != 0;
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "RevertToSelf", ExactSpelling = true)]
            static extern unsafe int __PInvoke();
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool CloseHandle(nint handle)
        {
            int __lastError;
            bool __retVal;
            int __retVal_native;
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal_native = __PInvoke(handle);
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            // Unmarshal - Convert native data to managed data.
            __retVal = __retVal_native != 0;
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "CloseHandle", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __handle_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial int CompareString(uint locale, uint dwCmpFlags, string lpString1, int cchCount1, string lpString2, int cchCount2)
        {
            int __lastError;
            int __retVal;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (void* __lpString2_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(lpString2))
            fixed (void* __lpString1_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(lpString1))
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal = __PInvoke(locale, dwCmpFlags, (ushort*)__lpString1_native, cchCount1, (ushort*)__lpString2_native, cchCount2);
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "CompareStringW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(uint __locale_native, uint __dwCmpFlags_native, ushort* __lpString1_native, int __cchCount1_native, ushort* __lpString2_native, int __cchCount2_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool FreeLibrary(nint hModule)
        {
            int __lastError;
            bool __retVal;
            int __retVal_native;
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal_native = __PInvoke(hModule);
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            // Unmarshal - Convert native data to managed data.
            __retVal = __retVal_native != 0;
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "FreeLibrary", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __hModule_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "GetCurrentProcess", ExactSpelling = true)]
        internal static extern partial nint GetCurrentProcess();
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "GetCurrentThread", ExactSpelling = true)]
        internal static extern partial nint GetCurrentThread();
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "GetCurrentThreadId", ExactSpelling = true)]
        public static extern partial int GetCurrentThreadId();
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial nint GetProcAddress(global::Microsoft.Win32.SafeHandles.SafeLibraryHandle hModule, string lpProcName)
        {
            nint __hModule_native = default;
            byte* __lpProcName_native = default;
            nint __retVal = default;
            // Setup - Perform required setup.
            scoped global::System.Runtime.InteropServices.Marshalling.AnsiStringMarshaller.ManagedToUnmanagedIn __lpProcName_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeLibraryHandle>.ManagedToUnmanagedIn __hModule_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __lpProcName_native__marshaller.FromManaged(lpProcName, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.AnsiStringMarshaller.ManagedToUnmanagedIn.BufferSize]);
                __hModule_native__marshaller.FromManaged(hModule);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __lpProcName_native = __lpProcName_native__marshaller.ToUnmanaged();
                    __hModule_native = __hModule_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__hModule_native, __lpProcName_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __lpProcName_native__marshaller.Free();
                __hModule_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "GetProcAddress", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __hModule_native, byte* __lpProcName_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial nint GetProcAddress(nint hModule, string lpProcName)
        {
            byte* __lpProcName_native = default;
            nint __retVal = default;
            // Setup - Perform required setup.
            scoped global::System.Runtime.InteropServices.Marshalling.AnsiStringMarshaller.ManagedToUnmanagedIn __lpProcName_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __lpProcName_native__marshaller.FromManaged(lpProcName, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.AnsiStringMarshaller.ManagedToUnmanagedIn.BufferSize]);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __lpProcName_native = __lpProcName_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(hModule, __lpProcName_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __lpProcName_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "GetProcAddress", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __hModule_native, byte* __lpProcName_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "GetSystemTimeAsFileTime", ExactSpelling = true)]
        internal static extern partial void GetSystemTimeAsFileTime(nint fileTime);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial nint LoadLibrary(string libFilename)
        {
            int __lastError;
            nint __retVal;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (void* __libFilename_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(libFilename))
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal = __PInvoke((ushort*)__libFilename_native);
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "LoadLibraryW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe nint __PInvoke(ushort* __libFilename_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "LocalFree", ExactSpelling = true)]
        private static extern partial nint LocalFree(nint hMem);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial nint OpenThread(uint desiredAccess, bool inherited, int threadID)
        {
            int __lastError;
            int __inherited_native;
            nint __retVal;
            // Marshal - Convert managed data to native data.
            __inherited_native = (int)(inherited ? 1 : 0);
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal = __PInvoke(desiredAccess, __inherited_native, threadID);
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "OpenThread", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(uint __desiredAccess_native, int __inherited_native, int __threadID_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Netapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial int DsEnumerateDomainTrustsW(string serverName, global::Interop.Netapi32.DS_DOMAINTRUST_FLAG flags, out nint domains, out int count)
        {
            domains = default;
            count = default;
            int __retVal;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (int* __count_native = &count)
            fixed (nint* __domains_native = &domains)
            fixed (void* __serverName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(serverName))
            {
                __retVal = __PInvoke((ushort*)__serverName_native, flags, __domains_native, __count_native);
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("netapi32.dll", EntryPoint = "DsEnumerateDomainTrustsW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(ushort* __serverName_native, global::Interop.Netapi32.DS_DOMAINTRUST_FLAG __flags_native, nint* __domains_native, int* __count_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Netapi32
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("netapi32.dll", EntryPoint = "DsGetDcCloseW", ExactSpelling = true)]
        internal static extern partial void DsGetDcClose(nint getDcContextHandle);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Netapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial int DsGetDcName(string computerName, string domainName, nint domainGuid, string siteName, int flags, out nint domainControllerInfo)
        {
            domainControllerInfo = default;
            int __retVal;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (nint* __domainControllerInfo_native = &domainControllerInfo)
            fixed (void* __siteName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(siteName))
            fixed (void* __domainName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(domainName))
            fixed (void* __computerName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(computerName))
            {
                __retVal = __PInvoke((ushort*)__computerName_native, (ushort*)__domainName_native, domainGuid, (ushort*)__siteName_native, flags, __domainControllerInfo_native);
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("netapi32.dll", EntryPoint = "DsGetDcNameW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(ushort* __computerName_native, ushort* __domainName_native, nint __domainGuid_native, ushort* __siteName_native, int __flags_native, nint* __domainControllerInfo_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Netapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial int DsGetDcNext(nint getDcContextHandle, out nint sockAddressCount, out nint sockAddresses, out nint dnsHostName)
        {
            sockAddressCount = default;
            sockAddresses = default;
            dnsHostName = default;
            int __retVal;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (nint* __dnsHostName_native = &dnsHostName)
            fixed (nint* __sockAddresses_native = &sockAddresses)
            fixed (nint* __sockAddressCount_native = &sockAddressCount)
            {
                __retVal = __PInvoke(getDcContextHandle, __sockAddressCount_native, __sockAddresses_native, __dnsHostName_native);
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("netapi32.dll", EntryPoint = "DsGetDcNextW", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __getDcContextHandle_native, nint* __sockAddressCount_native, nint* __sockAddresses_native, nint* __dnsHostName_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Netapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial int DsGetDcOpen(string dnsName, int optionFlags, string siteName, nint domainGuid, string dnsForestName, int dcFlags, out nint retGetDcContext)
        {
            retGetDcContext = default;
            int __retVal;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (nint* __retGetDcContext_native = &retGetDcContext)
            fixed (void* __dnsForestName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(dnsForestName))
            fixed (void* __siteName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(siteName))
            fixed (void* __dnsName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(dnsName))
            {
                __retVal = __PInvoke((ushort*)__dnsName_native, optionFlags, (ushort*)__siteName_native, domainGuid, (ushort*)__dnsForestName_native, dcFlags, __retGetDcContext_native);
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("netapi32.dll", EntryPoint = "DsGetDcOpenW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(ushort* __dnsName_native, int __optionFlags_native, ushort* __siteName_native, nint __domainGuid_native, ushort* __dnsForestName_native, int __dcFlags_native, nint* __retGetDcContext_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Netapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial int DsGetSiteName(string dcName, ref nint ptr)
        {
            int __retVal;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (nint* __ptr_native = &ptr)
            fixed (void* __dcName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(dcName))
            {
                __retVal = __PInvoke((ushort*)__dcName_native, __ptr_native);
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("netapi32.dll", EntryPoint = "DsGetSiteNameW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(ushort* __dcName_native, nint* __ptr_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Netapi32
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("netapi32.dll", EntryPoint = "DsRoleFreeMemory", ExactSpelling = true)]
        internal static extern partial void DsRoleFreeMemory(nint buffer);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Netapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial int I_NetLogonControl2(string serverName, int FunctionCode, int QueryLevel, nint data, out nint buffer)
        {
            buffer = default;
            int __retVal;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (nint* __buffer_native = &buffer)
            fixed (void* __serverName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(serverName))
            {
                __retVal = __PInvoke((ushort*)__serverName_native, FunctionCode, QueryLevel, data, __buffer_native);
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("netapi32.dll", EntryPoint = "I_NetLogonControl2", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(ushort* __serverName_native, int __FunctionCode_native, int __QueryLevel_native, nint __data_native, nint* __buffer_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Netapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial int DsRoleGetPrimaryDomainInformation(string lpServer, global::Interop.Netapi32.DSROLE_PRIMARY_DOMAIN_INFO_LEVEL InfoLevel, out nint Buffer)
        {
            Buffer = default;
            int __retVal;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (nint* __Buffer_native = &Buffer)
            fixed (void* __lpServer_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(lpServer))
            {
                __retVal = __PInvoke((ushort*)__lpServer_native, InfoLevel, __Buffer_native);
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("netapi32.dll", EntryPoint = "DsRoleGetPrimaryDomainInformation", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(ushort* __lpServer_native, global::Interop.Netapi32.DSROLE_PRIMARY_DOMAIN_INFO_LEVEL __InfoLevel_native, nint* __Buffer_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Netapi32
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("netapi32.dll", EntryPoint = "NetApiBufferFree", ExactSpelling = true)]
        internal static extern partial int NetApiBufferFree(nint buffer);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class NtDll
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial void RtlInitUnicodeString(out global::Interop.UNICODE_STRING result, nint s)
        {
            result = default;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (global::Interop.UNICODE_STRING* __result_native = &result)
            {
                __PInvoke(__result_native, s);
            }
 
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("ntdll.dll", EntryPoint = "RtlInitUnicodeString", ExactSpelling = true)]
            static extern unsafe void __PInvoke(global::Interop.UNICODE_STRING* __result_native, nint __s_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Secur32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial uint LsaCallAuthenticationPackage(global::Interop.Secur32.LsaLogonProcessSafeHandle lsaHandle, int authenticationPackage, in global::Interop.Secur32.NegotiateCallerNameRequest protocolSubmitBuffer, int submitBufferLength, out nint protocolReturnBuffer, out int returnBufferLength, out uint protocolStatus)
        {
            protocolReturnBuffer = default;
            returnBufferLength = default;
            protocolStatus = default;
            nint __lsaHandle_native = default;
            uint __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.Secur32.LsaLogonProcessSafeHandle>.ManagedToUnmanagedIn __lsaHandle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __lsaHandle_native__marshaller.FromManaged(lsaHandle);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (uint* __protocolStatus_native = &protocolStatus)
                fixed (int* __returnBufferLength_native = &returnBufferLength)
                fixed (nint* __protocolReturnBuffer_native = &protocolReturnBuffer)
                fixed (global::Interop.Secur32.NegotiateCallerNameRequest* __protocolSubmitBuffer_native = &protocolSubmitBuffer)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __lsaHandle_native = __lsaHandle_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__lsaHandle_native, authenticationPackage, __protocolSubmitBuffer_native, submitBufferLength, __protocolReturnBuffer_native, __returnBufferLength_native, __protocolStatus_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __lsaHandle_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("secur32.dll", EntryPoint = "LsaCallAuthenticationPackage", ExactSpelling = true)]
            static extern unsafe uint __PInvoke(nint __lsaHandle_native, int __authenticationPackage_native, global::Interop.Secur32.NegotiateCallerNameRequest* __protocolSubmitBuffer_native, int __submitBufferLength_native, nint* __protocolReturnBuffer_native, int* __returnBufferLength_native, uint* __protocolStatus_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Secur32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial uint LsaConnectUntrusted(out global::Interop.Secur32.LsaLogonProcessSafeHandle lsaHandle)
        {
            bool __invokeSucceeded = default;
            lsaHandle = default;
            nint __lsaHandle_native = default;
            uint __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.Secur32.LsaLogonProcessSafeHandle>.ManagedToUnmanagedOut __lsaHandle_native__marshaller = new();
            try
            {
                {
                    __retVal = __PInvoke(&__lsaHandle_native);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __lsaHandle_native__marshaller.FromUnmanaged(__lsaHandle_native);
                // Unmarshal - Convert native data to managed data.
                lsaHandle = __lsaHandle_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __lsaHandle_native__marshaller.Free();
                }
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("secur32.dll", EntryPoint = "LsaConnectUntrusted", ExactSpelling = true)]
            static extern unsafe uint __PInvoke(nint* __lsaHandle_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Secur32
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("secur32.dll", EntryPoint = "LsaDeregisterLogonProcess", ExactSpelling = true)]
        internal static extern partial int LsaDeregisterLogonProcess(nint lsaHandle);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Secur32
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("secur32.dll", EntryPoint = "LsaFreeReturnBuffer", ExactSpelling = true)]
        internal static extern partial uint LsaFreeReturnBuffer(nint buffer);
    }
}