File: _generated\0\LibraryImports.g.cs
Web Access
Project: src\src\runtime\src\libraries\System.Security.Cryptography.Pkcs\src\System.Security.Cryptography.Pkcs.csproj (System.Security.Cryptography.Pkcs)
// <auto-generated/>
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 CryptAcquireContext(out global::System.Security.Cryptography.SafeProvHandle phProv, string szContainer, string szProvider, int dwProvType, uint dwFlags)
        {
            int __lastError;
            bool __invokeSucceeded = default;
            phProv = default;
            nint __phProv_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Security.Cryptography.SafeProvHandle>.ManagedToUnmanagedOut __phProv_native__marshaller = new();
            try
            {
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __szProvider_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(szProvider))
                fixed (void* __szContainer_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(szContainer))
                {
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(&__phProv_native, (ushort*)__szContainer_native, (ushort*)__szProvider_native, dwProvType, dwFlags);
                    __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.
                __phProv_native__marshaller.FromUnmanaged(__phProv_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
                phProv = __phProv_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __phProv_native__marshaller.Free();
                }
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "CryptAcquireContextW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(nint* __phProv_native, ushort* __szContainer_native, ushort* __szProvider_native, int __dwProvType_native, uint __dwFlags_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 CryptDestroyHash(nint hHash)
        {
            int __lastError;
            bool __retVal;
            int __retVal_native;
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal_native = __PInvoke(hHash);
                __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 = "CryptDestroyHash", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __hHash_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 CryptDestroyKey(nint hKey)
        {
            int __lastError;
            bool __retVal;
            int __retVal_native;
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal_native = __PInvoke(hKey);
                __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 = "CryptDestroyKey", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __hKey_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 CryptSetProvParam(global::System.Runtime.InteropServices.SafeHandle safeProvHandle, global::Interop.Advapi32.CryptProvParam dwParam, nint pbData, int dwFlags)
        {
            int __lastError;
            nint __safeProvHandle_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Runtime.InteropServices.SafeHandle>.ManagedToUnmanagedIn __safeProvHandle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __safeProvHandle_native__marshaller.FromManaged(safeProvHandle);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __safeProvHandle_native = __safeProvHandle_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__safeProvHandle_native, dwParam, pbData, dwFlags);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __safeProvHandle_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "CryptSetProvParam", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __safeProvHandle_native, global::Interop.Advapi32.CryptProvParam __dwParam_native, nint __pbData_native, int __dwFlags_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 CryptSetProvParam(global::System.Security.Cryptography.SafeProvHandle hProv, global::Interop.Advapi32.CryptProvParam dwParam, ref nint pbData, int dwFlags)
        {
            int __lastError;
            nint __hProv_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Security.Cryptography.SafeProvHandle>.ManagedToUnmanagedIn __hProv_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __hProv_native__marshaller.FromManaged(hProv);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (nint* __pbData_native = &pbData)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __hProv_native = __hProv_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__hProv_native, dwParam, __pbData_native, dwFlags);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hProv_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "CryptSetProvParam", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __hProv_native, global::Interop.Advapi32.CryptProvParam __dwParam_native, nint* __pbData_native, int __dwFlags_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 CryptGetProvParam(global::System.Runtime.InteropServices.SafeHandle safeProvHandle, global::Interop.Advapi32.CryptProvParam dwParam, nint pbData, ref int dwDataLen, int dwFlags)
        {
            int __lastError;
            nint __safeProvHandle_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Runtime.InteropServices.SafeHandle>.ManagedToUnmanagedIn __safeProvHandle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __safeProvHandle_native__marshaller.FromManaged(safeProvHandle);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __dwDataLen_native = &dwDataLen)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __safeProvHandle_native = __safeProvHandle_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__safeProvHandle_native, dwParam, pbData, __dwDataLen_native, dwFlags);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __safeProvHandle_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "CryptGetProvParam", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __safeProvHandle_native, global::Interop.Advapi32.CryptProvParam __dwParam_native, nint __pbData_native, int* __dwDataLen_native, int __dwFlags_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 CryptReleaseContext(nint hProv, int dwFlags)
        {
            int __lastError;
            bool __retVal;
            int __retVal_native;
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal_native = __PInvoke(hProv, dwFlags);
                __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 = "CryptReleaseContext", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __hProv_native, int __dwFlags_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypt32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial nint CertDuplicateCertificateContext(nint pCertContext)
        {
            int __lastError;
            nint __retVal;
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal = __PInvoke(pCertContext);
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("crypt32.dll", EntryPoint = "CertDuplicateCertificateContext", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __pCertContext_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypt32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool CertFreeCertificateContext(nint pCertContext)
        {
            int __lastError;
            bool __retVal;
            int __retVal_native;
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal_native = __PInvoke(pCertContext);
                __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("crypt32.dll", EntryPoint = "CertFreeCertificateContext", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __pCertContext_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypt32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool CertGetCertificateContextProperty(global::Microsoft.Win32.SafeHandles.SafeCertContextHandle pCertContext, global::Interop.Crypt32.CertContextPropId dwPropId, byte[] pvData, ref int pcbData)
        {
            int __lastError;
            nint __pCertContext_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeCertContextHandle>.ManagedToUnmanagedIn __pCertContext_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __pCertContext_native__marshaller.FromManaged(pCertContext);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __pcbData_native = &pcbData)
                fixed (void* __pvData_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(pvData))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __pCertContext_native = __pCertContext_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__pCertContext_native, dwPropId, (byte*)__pvData_native, __pcbData_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __pCertContext_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("crypt32.dll", EntryPoint = "CertGetCertificateContextProperty", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __pCertContext_native, global::Interop.Crypt32.CertContextPropId __dwPropId_native, byte* __pvData_native, int* __pcbData_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypt32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static unsafe partial bool CertGetCertificateContextPropertyPtr(global::Microsoft.Win32.SafeHandles.SafeCertContextHandle pCertContext, global::Interop.Crypt32.CertContextPropId dwPropId, byte* pvData, ref int pcbData)
        {
            int __lastError;
            nint __pCertContext_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeCertContextHandle>.ManagedToUnmanagedIn __pCertContext_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __pCertContext_native__marshaller.FromManaged(pCertContext);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __pcbData_native = &pcbData)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __pCertContext_native = __pCertContext_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__pCertContext_native, dwPropId, pvData, __pcbData_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __pCertContext_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("crypt32.dll", EntryPoint = "CertGetCertificateContextProperty", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __pCertContext_native, global::Interop.Crypt32.CertContextPropId __dwPropId_native, byte* __pvData_native, int* __pcbData_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypt32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool CertGetCertificateContextProperty(global::Microsoft.Win32.SafeHandles.SafeCertContextHandle pCertContext, global::Interop.Crypt32.CertContextPropId dwPropId, out nint pvData, ref int pcbData)
        {
            int __lastError;
            pvData = default;
            nint __pCertContext_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeCertContextHandle>.ManagedToUnmanagedIn __pCertContext_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __pCertContext_native__marshaller.FromManaged(pCertContext);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __pcbData_native = &pcbData)
                fixed (nint* __pvData_native = &pvData)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __pCertContext_native = __pCertContext_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__pCertContext_native, dwPropId, __pvData_native, __pcbData_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __pCertContext_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("crypt32.dll", EntryPoint = "CertGetCertificateContextProperty", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __pCertContext_native, global::Interop.Crypt32.CertContextPropId __dwPropId_native, nint* __pvData_native, int* __pcbData_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypt32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool CertGetCertificateContextProperty(global::Microsoft.Win32.SafeHandles.SafeCertContextHandle pCertContext, global::Interop.Crypt32.CertContextPropId dwPropId, out global::Interop.Crypt32.DATA_BLOB pvData, ref int pcbData)
        {
            int __lastError;
            pvData = default;
            nint __pCertContext_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeCertContextHandle>.ManagedToUnmanagedIn __pCertContext_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __pCertContext_native__marshaller.FromManaged(pCertContext);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __pcbData_native = &pcbData)
                fixed (global::Interop.Crypt32.DATA_BLOB* __pvData_native = &pvData)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __pCertContext_native = __pCertContext_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__pCertContext_native, dwPropId, __pvData_native, __pcbData_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __pCertContext_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("crypt32.dll", EntryPoint = "CertGetCertificateContextProperty", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __pCertContext_native, global::Interop.Crypt32.CertContextPropId __dwPropId_native, global::Interop.Crypt32.DATA_BLOB* __pvData_native, int* __pcbData_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypt32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial int CertGetPublicKeyLength(global::Interop.Crypt32.MsgEncodingType dwCertEncodingType, ref global::Interop.Crypt32.CERT_PUBLIC_KEY_INFO pPublicKey)
        {
            int __lastError;
            int __retVal;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (global::Interop.Crypt32.CERT_PUBLIC_KEY_INFO* __pPublicKey_native = &pPublicKey)
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal = __PInvoke(dwCertEncodingType, __pPublicKey_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("crypt32.dll", EntryPoint = "CertGetPublicKeyLength", ExactSpelling = true)]
            static extern unsafe int __PInvoke(global::Interop.Crypt32.MsgEncodingType __dwCertEncodingType_native, global::Interop.Crypt32.CERT_PUBLIC_KEY_INFO* __pPublicKey_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypt32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static unsafe partial int CertNameToStr(int dwCertEncodingType, void* pName, int dwStrType, char* psz, int csz)
        {
            int __lastError;
            int __retVal;
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal = __PInvoke(dwCertEncodingType, pName, dwStrType, psz, csz);
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("crypt32.dll", EntryPoint = "CertNameToStrW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(int __dwCertEncodingType_native, void* __pName_native, int __dwStrType_native, char* __psz_native, int __csz_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypt32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool CryptAcquireCertificatePrivateKey(global::Microsoft.Win32.SafeHandles.SafeCertContextHandle pCert, global::Interop.Crypt32.CryptAcquireCertificatePrivateKeyFlags dwFlags, nint pvParameters, out nint phCryptProvOrNCryptKey, out global::Interop.Crypt32.CryptKeySpec pdwKeySpec, out bool pfCallerFreeProvOrNCryptKey)
        {
            int __lastError;
            phCryptProvOrNCryptKey = default;
            pdwKeySpec = default;
            pfCallerFreeProvOrNCryptKey = default;
            nint __pCert_native = default;
            int __pfCallerFreeProvOrNCryptKey_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeCertContextHandle>.ManagedToUnmanagedIn __pCert_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __pCert_native__marshaller.FromManaged(pCert);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (global::Interop.Crypt32.CryptKeySpec* __pdwKeySpec_native = &pdwKeySpec)
                fixed (nint* __phCryptProvOrNCryptKey_native = &phCryptProvOrNCryptKey)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __pCert_native = __pCert_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__pCert_native, dwFlags, pvParameters, __phCryptProvOrNCryptKey_native, __pdwKeySpec_native, &__pfCallerFreeProvOrNCryptKey_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
                pfCallerFreeProvOrNCryptKey = __pfCallerFreeProvOrNCryptKey_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __pCert_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("crypt32.dll", EntryPoint = "CryptAcquireCertificatePrivateKey", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __pCert_native, global::Interop.Crypt32.CryptAcquireCertificatePrivateKeyFlags __dwFlags_native, nint __pvParameters_native, nint* __phCryptProvOrNCryptKey_native, global::Interop.Crypt32.CryptKeySpec* __pdwKeySpec_native, int* __pfCallerFreeProvOrNCryptKey_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypt32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        private static unsafe partial bool CryptDecodeObject(global::Interop.Crypt32.MsgEncodingType dwCertEncodingType, nint lpszStructType, nint pbEncoded, int cbEncoded, int dwFlags, void* pvStructInfo, ref int pcbStructInfo)
        {
            int __lastError;
            bool __retVal;
            int __retVal_native;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (int* __pcbStructInfo_native = &pcbStructInfo)
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal_native = __PInvoke(dwCertEncodingType, lpszStructType, pbEncoded, cbEncoded, dwFlags, pvStructInfo, __pcbStructInfo_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("crypt32.dll", EntryPoint = "CryptDecodeObject", ExactSpelling = true)]
            static extern unsafe int __PInvoke(global::Interop.Crypt32.MsgEncodingType __dwCertEncodingType_native, nint __lpszStructType_native, nint __pbEncoded_native, int __cbEncoded_native, int __dwFlags_native, void* __pvStructInfo_native, int* __pcbStructInfo_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypt32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        private static unsafe partial bool CryptEncodeObject(global::Interop.Crypt32.MsgEncodingType dwCertEncodingType, nint lpszStructType, void* pvStructInfo, byte[] pbEncoded, ref int pcbEncoded)
        {
            int __lastError;
            bool __retVal;
            int __retVal_native;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (int* __pcbEncoded_native = &pcbEncoded)
            fixed (void* __pbEncoded_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(pbEncoded))
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal_native = __PInvoke(dwCertEncodingType, lpszStructType, pvStructInfo, (byte*)__pbEncoded_native, __pcbEncoded_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("crypt32.dll", EntryPoint = "CryptEncodeObject", ExactSpelling = true)]
            static extern unsafe int __PInvoke(global::Interop.Crypt32.MsgEncodingType __dwCertEncodingType_native, nint __lpszStructType_native, void* __pvStructInfo_native, byte* __pbEncoded_native, int* __pcbEncoded_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypt32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool CryptMsgClose(nint hCryptMsg)
        {
            int __lastError;
            bool __retVal;
            int __retVal_native;
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal_native = __PInvoke(hCryptMsg);
                __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("crypt32.dll", EntryPoint = "CryptMsgClose", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __hCryptMsg_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypt32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool CryptMsgControl(global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle hCryptMsg, int dwFlags, global::Interop.Crypt32.MsgControlType dwCtrlType, ref global::Interop.Crypt32.CMSG_CTRL_DECRYPT_PARA pvCtrlPara)
        {
            int __lastError;
            nint __hCryptMsg_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle>.ManagedToUnmanagedIn __hCryptMsg_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __hCryptMsg_native__marshaller.FromManaged(hCryptMsg);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (global::Interop.Crypt32.CMSG_CTRL_DECRYPT_PARA* __pvCtrlPara_native = &pvCtrlPara)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __hCryptMsg_native = __hCryptMsg_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__hCryptMsg_native, dwFlags, dwCtrlType, __pvCtrlPara_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hCryptMsg_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("crypt32.dll", EntryPoint = "CryptMsgControl", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __hCryptMsg_native, int __dwFlags_native, global::Interop.Crypt32.MsgControlType __dwCtrlType_native, global::Interop.Crypt32.CMSG_CTRL_DECRYPT_PARA* __pvCtrlPara_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypt32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool CryptMsgControl(global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle hCryptMsg, int dwFlags, global::Interop.Crypt32.MsgControlType dwCtrlType, ref global::Interop.Crypt32.CMSG_CTRL_KEY_AGREE_DECRYPT_PARA pvCtrlPara)
        {
            int __lastError;
            nint __hCryptMsg_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle>.ManagedToUnmanagedIn __hCryptMsg_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __hCryptMsg_native__marshaller.FromManaged(hCryptMsg);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (global::Interop.Crypt32.CMSG_CTRL_KEY_AGREE_DECRYPT_PARA* __pvCtrlPara_native = &pvCtrlPara)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __hCryptMsg_native = __hCryptMsg_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__hCryptMsg_native, dwFlags, dwCtrlType, __pvCtrlPara_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hCryptMsg_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("crypt32.dll", EntryPoint = "CryptMsgControl", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __hCryptMsg_native, int __dwFlags_native, global::Interop.Crypt32.MsgControlType __dwCtrlType_native, global::Interop.Crypt32.CMSG_CTRL_KEY_AGREE_DECRYPT_PARA* __pvCtrlPara_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypt32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool CryptMsgGetParam(global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle hCryptMsg, global::Interop.Crypt32.CryptMsgParamType dwParamType, int dwIndex, out int pvData, ref int pcbData)
        {
            int __lastError;
            pvData = default;
            nint __hCryptMsg_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle>.ManagedToUnmanagedIn __hCryptMsg_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __hCryptMsg_native__marshaller.FromManaged(hCryptMsg);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __pcbData_native = &pcbData)
                fixed (int* __pvData_native = &pvData)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __hCryptMsg_native = __hCryptMsg_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__hCryptMsg_native, dwParamType, dwIndex, __pvData_native, __pcbData_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hCryptMsg_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("crypt32.dll", EntryPoint = "CryptMsgGetParam", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __hCryptMsg_native, global::Interop.Crypt32.CryptMsgParamType __dwParamType_native, int __dwIndex_native, int* __pvData_native, int* __pcbData_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypt32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static unsafe partial bool CryptMsgGetParam(global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle hCryptMsg, global::Interop.Crypt32.CryptMsgParamType dwParamType, int dwIndex, byte* pvData, ref int pcbData)
        {
            int __lastError;
            nint __hCryptMsg_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle>.ManagedToUnmanagedIn __hCryptMsg_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __hCryptMsg_native__marshaller.FromManaged(hCryptMsg);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __pcbData_native = &pcbData)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __hCryptMsg_native = __hCryptMsg_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__hCryptMsg_native, dwParamType, dwIndex, pvData, __pcbData_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hCryptMsg_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("crypt32.dll", EntryPoint = "CryptMsgGetParam", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __hCryptMsg_native, global::Interop.Crypt32.CryptMsgParamType __dwParamType_native, int __dwIndex_native, byte* __pvData_native, int* __pcbData_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypt32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool CryptMsgGetParam(global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle hCryptMsg, global::Interop.Crypt32.CryptMsgParamType dwParamType, int dwIndex, out global::Interop.Crypt32.CryptMsgType pvData, ref int pcbData)
        {
            int __lastError;
            pvData = default;
            nint __hCryptMsg_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle>.ManagedToUnmanagedIn __hCryptMsg_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __hCryptMsg_native__marshaller.FromManaged(hCryptMsg);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __pcbData_native = &pcbData)
                fixed (global::Interop.Crypt32.CryptMsgType* __pvData_native = &pvData)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __hCryptMsg_native = __hCryptMsg_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__hCryptMsg_native, dwParamType, dwIndex, __pvData_native, __pcbData_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hCryptMsg_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("crypt32.dll", EntryPoint = "CryptMsgGetParam", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __hCryptMsg_native, global::Interop.Crypt32.CryptMsgParamType __dwParamType_native, int __dwIndex_native, global::Interop.Crypt32.CryptMsgType* __pvData_native, int* __pcbData_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypt32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool CryptMsgGetParam(global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle hCryptMsg, global::Interop.Crypt32.CryptMsgParamType dwParamType, int dwIndex, nint pvData, ref int pcbData)
        {
            int __lastError;
            nint __hCryptMsg_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle>.ManagedToUnmanagedIn __hCryptMsg_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __hCryptMsg_native__marshaller.FromManaged(hCryptMsg);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __pcbData_native = &pcbData)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __hCryptMsg_native = __hCryptMsg_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__hCryptMsg_native, dwParamType, dwIndex, pvData, __pcbData_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hCryptMsg_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("crypt32.dll", EntryPoint = "CryptMsgGetParam", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __hCryptMsg_native, global::Interop.Crypt32.CryptMsgParamType __dwParamType_native, int __dwIndex_native, nint __pvData_native, int* __pcbData_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypt32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle CryptMsgOpenToDecode(global::Interop.Crypt32.MsgEncodingType dwMsgEncodingType, int dwFlags, int dwMsgType, nint hCryptProv, nint pRecipientInfo, nint pStreamInfo)
        {
            int __lastError;
            bool __invokeSucceeded = default;
            global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            try
            {
                {
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(dwMsgEncodingType, dwFlags, dwMsgType, hCryptProv, pRecipientInfo, pStreamInfo);
                    __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.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("crypt32.dll", EntryPoint = "CryptMsgOpenToDecode", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(global::Interop.Crypt32.MsgEncodingType __dwMsgEncodingType_native, int __dwFlags_native, int __dwMsgType_native, nint __hCryptProv_native, nint __pRecipientInfo_native, nint __pStreamInfo_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypt32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static unsafe partial global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle CryptMsgOpenToEncode(global::Interop.Crypt32.MsgEncodingType dwMsgEncodingType, int dwFlags, global::Interop.Crypt32.CryptMsgType dwMsgType, global::Interop.Crypt32.CMSG_ENVELOPED_ENCODE_INFO* pvMsgEncodeInfo, string pszInnerContentObjID, nint pStreamInfo)
        {
            int __lastError;
            bool __invokeSucceeded = default;
            byte* __pszInnerContentObjID_native = default;
            global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            scoped global::System.Runtime.InteropServices.Marshalling.AnsiStringMarshaller.ManagedToUnmanagedIn __pszInnerContentObjID_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __pszInnerContentObjID_native__marshaller.FromManaged(pszInnerContentObjID, 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.
                    __pszInnerContentObjID_native = __pszInnerContentObjID_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(dwMsgEncodingType, dwFlags, dwMsgType, pvMsgEncodeInfo, __pszInnerContentObjID_native, pStreamInfo);
                    __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.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __pszInnerContentObjID_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("crypt32.dll", EntryPoint = "CryptMsgOpenToEncode", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(global::Interop.Crypt32.MsgEncodingType __dwMsgEncodingType_native, int __dwFlags_native, global::Interop.Crypt32.CryptMsgType __dwMsgType_native, global::Interop.Crypt32.CMSG_ENVELOPED_ENCODE_INFO* __pvMsgEncodeInfo_native, byte* __pszInnerContentObjID_native, nint __pStreamInfo_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypt32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool CryptMsgUpdate(global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle hCryptMsg, byte[] pbData, int cbData, bool fFinal)
        {
            int __lastError;
            nint __hCryptMsg_native = default;
            int __fFinal_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle>.ManagedToUnmanagedIn __hCryptMsg_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __fFinal_native = (int)(fFinal ? 1 : 0);
                __hCryptMsg_native__marshaller.FromManaged(hCryptMsg);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __pbData_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(pbData))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __hCryptMsg_native = __hCryptMsg_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__hCryptMsg_native, (byte*)__pbData_native, cbData, __fFinal_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hCryptMsg_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("crypt32.dll", EntryPoint = "CryptMsgUpdate", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __hCryptMsg_native, byte* __pbData_native, int __cbData_native, int __fFinal_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypt32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool CryptMsgUpdate(global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle hCryptMsg, nint pbData, int cbData, bool fFinal)
        {
            int __lastError;
            nint __hCryptMsg_native = default;
            int __fFinal_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle>.ManagedToUnmanagedIn __hCryptMsg_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __fFinal_native = (int)(fFinal ? 1 : 0);
                __hCryptMsg_native__marshaller.FromManaged(hCryptMsg);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __hCryptMsg_native = __hCryptMsg_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__hCryptMsg_native, pbData, cbData, __fFinal_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hCryptMsg_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("crypt32.dll", EntryPoint = "CryptMsgUpdate", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __hCryptMsg_native, nint __pbData_native, int __cbData_native, int __fFinal_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypt32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool CryptMsgUpdate(global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle hCryptMsg, ref byte pbData, int cbData, bool fFinal)
        {
            int __lastError;
            nint __hCryptMsg_native = default;
            int __fFinal_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeCryptMsgHandle>.ManagedToUnmanagedIn __hCryptMsg_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __fFinal_native = (int)(fFinal ? 1 : 0);
                __hCryptMsg_native__marshaller.FromManaged(hCryptMsg);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (byte* __pbData_native = &pbData)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __hCryptMsg_native = __hCryptMsg_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__hCryptMsg_native, __pbData_native, cbData, __fFinal_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hCryptMsg_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("crypt32.dll", EntryPoint = "CryptMsgUpdate", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __hCryptMsg_native, byte* __pbData_native, int __cbData_native, int __fFinal_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Crypt32
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("crypt32.dll", EntryPoint = "CryptFindOIDInfo", ExactSpelling = true)]
        private static unsafe extern partial global::Interop.Crypt32.CRYPT_OID_INFO* CryptFindOIDInfo(global::Interop.Crypt32.CryptOidInfoKeyType dwKeyType, nint pvKey, global::System.Security.Cryptography.OidGroup group);
    }
}
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]
        private static unsafe partial int FormatMessage(int dwFlags, nint lpSource, uint dwMessageId, int dwLanguageId, void* lpBuffer, int nSize, nint arguments)
        {
            int __lastError;
            int __retVal;
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal = __PInvoke(dwFlags, lpSource, dwMessageId, dwLanguageId, lpBuffer, nSize, arguments);
                __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 = "FormatMessageW", ExactSpelling = true)]
            static extern unsafe int __PInvoke(int __dwFlags_native, nint __lpSource_native, uint __dwMessageId_native, int __dwLanguageId_native, void* __lpBuffer_native, int __nSize_native, nint __arguments_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "GetProcessHeap", ExactSpelling = true)]
        internal static extern partial nint GetProcessHeap();
    }
}
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 global::Microsoft.Win32.SafeHandles.SafeHeapAllocHandle HeapAlloc(nint hHeap, global::Interop.Kernel32.HeapAllocFlags dwFlags, nint dwBytes)
        {
            bool __invokeSucceeded = default;
            global::Microsoft.Win32.SafeHandles.SafeHeapAllocHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeHeapAllocHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            try
            {
                {
                    __retVal_native = __PInvoke(hHeap, dwFlags, dwBytes);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "HeapAlloc", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __hHeap_native, global::Interop.Kernel32.HeapAllocFlags __dwFlags_native, nint __dwBytes_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 HeapFree(nint hHeap, global::Interop.Kernel32.HeapAllocFlags dwFlags, nint lpMem)
        {
            bool __retVal;
            int __retVal_native;
            {
                __retVal_native = __PInvoke(hHeap, dwFlags, lpMem);
            }
 
            // Unmarshal - Convert native data to managed data.
            __retVal = __retVal_native != 0;
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "HeapFree", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __hHeap_native, global::Interop.Kernel32.HeapAllocFlags __dwFlags_native, nint __lpMem_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class NCrypt
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static unsafe partial global::Interop.NCrypt.ErrorCode NCryptGetProperty(global::Microsoft.Win32.SafeHandles.SafeNCryptHandle hObject, string pszProperty, void* pbOutput, int cbOutput, out int pcbResult, global::System.Security.Cryptography.CngPropertyOptions dwFlags)
        {
            pcbResult = default;
            nint __hObject_native = default;
            global::Interop.NCrypt.ErrorCode __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeNCryptHandle>.ManagedToUnmanagedIn __hObject_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __hObject_native__marshaller.FromManaged(hObject);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (int* __pcbResult_native = &pcbResult)
                fixed (void* __pszProperty_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(pszProperty))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __hObject_native = __hObject_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__hObject_native, (ushort*)__pszProperty_native, pbOutput, cbOutput, __pcbResult_native, dwFlags);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hObject_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("ncrypt.dll", EntryPoint = "NCryptGetProperty", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe global::Interop.NCrypt.ErrorCode __PInvoke(nint __hObject_native, ushort* __pszProperty_native, void* __pbOutput_native, int __cbOutput_native, int* __pcbResult_native, global::System.Security.Cryptography.CngPropertyOptions __dwFlags_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class NCrypt
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static unsafe partial global::Interop.NCrypt.ErrorCode NCryptSetProperty(global::Microsoft.Win32.SafeHandles.SafeNCryptHandle hObject, string pszProperty, void* pbInput, int cbInput, global::System.Security.Cryptography.CngPropertyOptions dwFlags)
        {
            nint __hObject_native = default;
            global::Interop.NCrypt.ErrorCode __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeNCryptHandle>.ManagedToUnmanagedIn __hObject_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __hObject_native__marshaller.FromManaged(hObject);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __pszProperty_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(pszProperty))
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __hObject_native = __hObject_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__hObject_native, (ushort*)__pszProperty_native, pbInput, cbInput, dwFlags);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hObject_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("ncrypt.dll", EntryPoint = "NCryptSetProperty", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe global::Interop.NCrypt.ErrorCode __PInvoke(nint __hObject_native, ushort* __pszProperty_native, void* __pbInput_native, int __cbInput_native, global::System.Security.Cryptography.CngPropertyOptions __dwFlags_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class NCrypt
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("ncrypt.dll", EntryPoint = "NCryptFreeObject", ExactSpelling = true)]
        internal static extern partial global::Interop.NCrypt.ErrorCode NCryptFreeObject(nint hObject);
    }
}