// <auto-generated/> namespace Microsoft.AspNetCore.Cryptography.SafeHandles { internal sealed unsafe partial class SafeLibraryHandle { private static partial class UnsafeNativeMethods { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "12.0.14.46214")] [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute] public static partial int FormatMessage(uint dwFlags, global::Microsoft.AspNetCore.Cryptography.SafeHandles.SafeLibraryHandle lpSource, uint dwMessageId, uint dwLanguageId, out global::Microsoft.AspNetCore.Cryptography.SafeHandles.LocalAllocHandle lpBuffer, uint nSize, nint Arguments) { unsafe { int __lastError; bool __invokeSucceeded = default; lpBuffer = default; nint __lpSource_native = default; nint __lpBuffer_native = default; int __retVal = default; // Setup - Perform required setup. global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.AspNetCore.Cryptography.SafeHandles.LocalAllocHandle>.ManagedToUnmanagedOut __lpBuffer_native__marshaller = new(); global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.AspNetCore.Cryptography.SafeHandles.SafeLibraryHandle>.ManagedToUnmanagedIn __lpSource_native__marshaller = new(); try { // Marshal - Convert managed data to native data. __lpSource_native__marshaller.FromManaged(lpSource); { // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned. __lpSource_native = __lpSource_native__marshaller.ToUnmanaged(); global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); __retVal = __PInvoke(dwFlags, __lpSource_native, dwMessageId, dwLanguageId, &__lpBuffer_native, nSize, Arguments); __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. __lpBuffer_native__marshaller.FromUnmanaged(__lpBuffer_native); // Unmarshal - Convert native data to managed data. lpBuffer = __lpBuffer_native__marshaller.ToManaged(); } finally { if (__invokeSucceeded) { // CleanupCalleeAllocated - Perform cleanup of callee allocated resources. __lpBuffer_native__marshaller.Free(); } // CleanupCallerAllocated - Perform cleanup of caller allocated resources. __lpSource_native__marshaller.Free(); } 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(uint __dwFlags_native, nint __lpSource_native, uint __dwMessageId_native, uint __dwLanguageId_native, nint* __lpBuffer_native, uint __nSize_native, nint __Arguments_native); } } } } } namespace Microsoft.AspNetCore.Cryptography.SafeHandles { internal sealed unsafe partial class SafeLibraryHandle { private static partial class UnsafeNativeMethods { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "12.0.14.46214")] [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute] internal static partial bool FreeLibrary(nint hModule) { unsafe { bool __retVal; int __retVal_native; { __retVal_native = __PInvoke(hModule); } // Unmarshal - Convert native data to managed data. __retVal = __retVal_native != 0; return __retVal; // Local P/Invoke [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "FreeLibrary", ExactSpelling = true)] static extern unsafe int __PInvoke(nint __hModule_native); } } } } } namespace Microsoft.AspNetCore.Cryptography.SafeHandles { internal sealed unsafe partial class SafeLibraryHandle { private static partial class UnsafeNativeMethods { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "12.0.14.46214")] [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute] internal static partial bool GetModuleHandleEx(uint dwFlags, global::Microsoft.AspNetCore.Cryptography.SafeHandles.SafeLibraryHandle lpModuleName, out nint phModule) { unsafe { int __lastError; phModule = default; nint __lpModuleName_native = default; bool __retVal = default; int __retVal_native = default; // Setup - Perform required setup. global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.AspNetCore.Cryptography.SafeHandles.SafeLibraryHandle>.ManagedToUnmanagedIn __lpModuleName_native__marshaller = new(); try { // Marshal - Convert managed data to native data. __lpModuleName_native__marshaller.FromManaged(lpModuleName); // Pin - Pin data in preparation for calling the P/Invoke. fixed (nint* __phModule_native = &phModule) { // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned. __lpModuleName_native = __lpModuleName_native__marshaller.ToUnmanaged(); global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); __retVal_native = __PInvoke(dwFlags, __lpModuleName_native, __phModule_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. __lpModuleName_native__marshaller.Free(); } global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); return __retVal; // Local P/Invoke [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "GetModuleHandleExW", ExactSpelling = true)] static extern unsafe int __PInvoke(uint __dwFlags_native, nint __lpModuleName_native, nint* __phModule_native); } } } } } namespace Microsoft.AspNetCore.Cryptography.SafeHandles { internal sealed unsafe partial class SafeLibraryHandle { private static partial class UnsafeNativeMethods { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "12.0.14.46214")] [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute] internal static partial nint GetProcAddress(global::Microsoft.AspNetCore.Cryptography.SafeHandles.SafeLibraryHandle hModule, string lpProcName) { unsafe { int __lastError; 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.AspNetCore.Cryptography.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(); global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); __retVal = __PInvoke(__hModule_native, __lpProcName_native); __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); } } finally { // CleanupCallerAllocated - Perform cleanup of caller allocated resources. __lpProcName_native__marshaller.Free(); __hModule_native__marshaller.Free(); } global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 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); } } } } } namespace Microsoft.AspNetCore.Cryptography.SafeHandles { internal sealed unsafe partial class SafeLibraryHandle { private static partial class UnsafeNativeMethods { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "12.0.14.46214")] [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute] internal static partial global::Microsoft.AspNetCore.Cryptography.SafeHandles.SafeLibraryHandle LoadLibraryEx(string lpFileName, nint hFile, uint dwFlags) { unsafe { int __lastError; bool __invokeSucceeded = default; global::Microsoft.AspNetCore.Cryptography.SafeHandles.SafeLibraryHandle __retVal = default; nint __retVal_native = default; // Setup - Perform required setup. global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.AspNetCore.Cryptography.SafeHandles.SafeLibraryHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new(); try { // Pin - Pin data in preparation for calling the P/Invoke. fixed (void* __lpFileName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(lpFileName)) { global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); __retVal_native = __PInvoke((ushort*)__lpFileName_native, hFile, 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. __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("kernel32.dll", EntryPoint = "LoadLibraryExW", ExactSpelling = true)] static extern unsafe nint __PInvoke(ushort* __lpFileName_native, nint __hFile_native, uint __dwFlags_native); } } } } } namespace Microsoft.AspNetCore.Cryptography { internal static unsafe partial class UnsafeNativeMethods { [global::System.Runtime.InteropServices.DllImportAttribute("bcrypt.dll", EntryPoint = "BCryptCloseAlgorithmProvider", ExactSpelling = true)] internal static extern partial int BCryptCloseAlgorithmProvider(nint hAlgorithm, uint dwFlags); } } namespace Microsoft.AspNetCore.Cryptography { internal static unsafe partial class UnsafeNativeMethods { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "12.0.14.46214")] [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute] internal static partial int BCryptCreateHash(global::Microsoft.AspNetCore.Cryptography.SafeHandles.BCryptAlgorithmHandle hAlgorithm, out global::Microsoft.AspNetCore.Cryptography.SafeHandles.BCryptHashHandle phHash, nint pbHashObject, uint cbHashObject, byte* pbSecret, uint cbSecret, uint dwFlags) { unsafe { bool __invokeSucceeded = default; phHash = default; nint __hAlgorithm_native = default; nint __phHash_native = default; int __retVal = default; // Setup - Perform required setup. global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.AspNetCore.Cryptography.SafeHandles.BCryptHashHandle>.ManagedToUnmanagedOut __phHash_native__marshaller = new(); global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.AspNetCore.Cryptography.SafeHandles.BCryptAlgorithmHandle>.ManagedToUnmanagedIn __hAlgorithm_native__marshaller = new(); try { // Marshal - Convert managed data to native data. __hAlgorithm_native__marshaller.FromManaged(hAlgorithm); { // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned. __hAlgorithm_native = __hAlgorithm_native__marshaller.ToUnmanaged(); __retVal = __PInvoke(__hAlgorithm_native, &__phHash_native, pbHashObject, cbHashObject, pbSecret, cbSecret, dwFlags); } __invokeSucceeded = true; // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception. __phHash_native__marshaller.FromUnmanaged(__phHash_native); // Unmarshal - Convert native data to managed data. phHash = __phHash_native__marshaller.ToManaged(); } finally { if (__invokeSucceeded) { // CleanupCalleeAllocated - Perform cleanup of callee allocated resources. __phHash_native__marshaller.Free(); } // CleanupCallerAllocated - Perform cleanup of caller allocated resources. __hAlgorithm_native__marshaller.Free(); } return __retVal; // Local P/Invoke [global::System.Runtime.InteropServices.DllImportAttribute("bcrypt.dll", EntryPoint = "BCryptCreateHash", ExactSpelling = true)] static extern unsafe int __PInvoke(nint __hAlgorithm_native, nint* __phHash_native, nint __pbHashObject_native, uint __cbHashObject_native, byte* __pbSecret_native, uint __cbSecret_native, uint __dwFlags_native); } } } } namespace Microsoft.AspNetCore.Cryptography { internal static unsafe partial class UnsafeNativeMethods { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "12.0.14.46214")] [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute] internal static partial int BCryptDecrypt(global::Microsoft.AspNetCore.Cryptography.SafeHandles.BCryptKeyHandle hKey, byte* pbInput, uint cbInput, void* pPaddingInfo, byte* pbIV, uint cbIV, byte* pbOutput, uint cbOutput, out uint pcbResult, global::Microsoft.AspNetCore.Cryptography.Cng.BCryptEncryptFlags dwFlags) { unsafe { pcbResult = default; nint __hKey_native = default; int __retVal = default; // Setup - Perform required setup. global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.AspNetCore.Cryptography.SafeHandles.BCryptKeyHandle>.ManagedToUnmanagedIn __hKey_native__marshaller = new(); try { // Marshal - Convert managed data to native data. __hKey_native__marshaller.FromManaged(hKey); // Pin - Pin data in preparation for calling the P/Invoke. fixed (uint* __pcbResult_native = &pcbResult) { // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned. __hKey_native = __hKey_native__marshaller.ToUnmanaged(); __retVal = __PInvoke(__hKey_native, pbInput, cbInput, pPaddingInfo, pbIV, cbIV, pbOutput, cbOutput, __pcbResult_native, dwFlags); } } finally { // CleanupCallerAllocated - Perform cleanup of caller allocated resources. __hKey_native__marshaller.Free(); } return __retVal; // Local P/Invoke [global::System.Runtime.InteropServices.DllImportAttribute("bcrypt.dll", EntryPoint = "BCryptDecrypt", ExactSpelling = true)] static extern unsafe int __PInvoke(nint __hKey_native, byte* __pbInput_native, uint __cbInput_native, void* __pPaddingInfo_native, byte* __pbIV_native, uint __cbIV_native, byte* __pbOutput_native, uint __cbOutput_native, uint* __pcbResult_native, global::Microsoft.AspNetCore.Cryptography.Cng.BCryptEncryptFlags __dwFlags_native); } } } } namespace Microsoft.AspNetCore.Cryptography { internal static unsafe partial class UnsafeNativeMethods { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "12.0.14.46214")] [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute] internal static partial int BCryptDeriveKeyPBKDF2(global::Microsoft.AspNetCore.Cryptography.SafeHandles.BCryptAlgorithmHandle hPrf, byte* pbPassword, uint cbPassword, byte* pbSalt, uint cbSalt, ulong cIterations, byte* pbDerivedKey, uint cbDerivedKey, uint dwFlags) { unsafe { nint __hPrf_native = default; int __retVal = default; // Setup - Perform required setup. global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.AspNetCore.Cryptography.SafeHandles.BCryptAlgorithmHandle>.ManagedToUnmanagedIn __hPrf_native__marshaller = new(); try { // Marshal - Convert managed data to native data. __hPrf_native__marshaller.FromManaged(hPrf); { // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned. __hPrf_native = __hPrf_native__marshaller.ToUnmanaged(); __retVal = __PInvoke(__hPrf_native, pbPassword, cbPassword, pbSalt, cbSalt, cIterations, pbDerivedKey, cbDerivedKey, dwFlags); } } finally { // CleanupCallerAllocated - Perform cleanup of caller allocated resources. __hPrf_native__marshaller.Free(); } return __retVal; // Local P/Invoke [global::System.Runtime.InteropServices.DllImportAttribute("bcrypt.dll", EntryPoint = "BCryptDeriveKeyPBKDF2", ExactSpelling = true)] static extern unsafe int __PInvoke(nint __hPrf_native, byte* __pbPassword_native, uint __cbPassword_native, byte* __pbSalt_native, uint __cbSalt_native, ulong __cIterations_native, byte* __pbDerivedKey_native, uint __cbDerivedKey_native, uint __dwFlags_native); } } } } namespace Microsoft.AspNetCore.Cryptography { internal static unsafe partial class UnsafeNativeMethods { [global::System.Runtime.InteropServices.DllImportAttribute("bcrypt.dll", EntryPoint = "BCryptDestroyHash", ExactSpelling = true)] internal static extern partial int BCryptDestroyHash(nint hHash); } } namespace Microsoft.AspNetCore.Cryptography { internal static unsafe partial class UnsafeNativeMethods { [global::System.Runtime.InteropServices.DllImportAttribute("bcrypt.dll", EntryPoint = "BCryptDestroyKey", ExactSpelling = true)] internal static extern partial int BCryptDestroyKey(nint hKey); } } namespace Microsoft.AspNetCore.Cryptography { internal static unsafe partial class UnsafeNativeMethods { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "12.0.14.46214")] [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute] internal static partial int BCryptDuplicateHash(global::Microsoft.AspNetCore.Cryptography.SafeHandles.BCryptHashHandle hHash, out global::Microsoft.AspNetCore.Cryptography.SafeHandles.BCryptHashHandle phNewHash, nint pbHashObject, uint cbHashObject, uint dwFlags) { unsafe { bool __invokeSucceeded = default; phNewHash = default; nint __hHash_native = default; nint __phNewHash_native = default; int __retVal = default; // Setup - Perform required setup. global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.AspNetCore.Cryptography.SafeHandles.BCryptHashHandle>.ManagedToUnmanagedOut __phNewHash_native__marshaller = new(); global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.AspNetCore.Cryptography.SafeHandles.BCryptHashHandle>.ManagedToUnmanagedIn __hHash_native__marshaller = new(); try { // Marshal - Convert managed data to native data. __hHash_native__marshaller.FromManaged(hHash); { // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned. __hHash_native = __hHash_native__marshaller.ToUnmanaged(); __retVal = __PInvoke(__hHash_native, &__phNewHash_native, pbHashObject, cbHashObject, dwFlags); } __invokeSucceeded = true; // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception. __phNewHash_native__marshaller.FromUnmanaged(__phNewHash_native); // Unmarshal - Convert native data to managed data. phNewHash = __phNewHash_native__marshaller.ToManaged(); } finally { if (__invokeSucceeded) { // CleanupCalleeAllocated - Perform cleanup of callee allocated resources. __phNewHash_native__marshaller.Free(); } // CleanupCallerAllocated - Perform cleanup of caller allocated resources. __hHash_native__marshaller.Free(); } return __retVal; // Local P/Invoke [global::System.Runtime.InteropServices.DllImportAttribute("bcrypt.dll", EntryPoint = "BCryptDuplicateHash", ExactSpelling = true)] static extern unsafe int __PInvoke(nint __hHash_native, nint* __phNewHash_native, nint __pbHashObject_native, uint __cbHashObject_native, uint __dwFlags_native); } } } } namespace Microsoft.AspNetCore.Cryptography { internal static unsafe partial class UnsafeNativeMethods { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "12.0.14.46214")] [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute] internal static partial int BCryptEncrypt(global::Microsoft.AspNetCore.Cryptography.SafeHandles.BCryptKeyHandle hKey, byte* pbInput, uint cbInput, void* pPaddingInfo, byte* pbIV, uint cbIV, byte* pbOutput, uint cbOutput, out uint pcbResult, global::Microsoft.AspNetCore.Cryptography.Cng.BCryptEncryptFlags dwFlags) { unsafe { pcbResult = default; nint __hKey_native = default; int __retVal = default; // Setup - Perform required setup. global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.AspNetCore.Cryptography.SafeHandles.BCryptKeyHandle>.ManagedToUnmanagedIn __hKey_native__marshaller = new(); try { // Marshal - Convert managed data to native data. __hKey_native__marshaller.FromManaged(hKey); // Pin - Pin data in preparation for calling the P/Invoke. fixed (uint* __pcbResult_native = &pcbResult) { // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned. __hKey_native = __hKey_native__marshaller.ToUnmanaged(); __retVal = __PInvoke(__hKey_native, pbInput, cbInput, pPaddingInfo, pbIV, cbIV, pbOutput, cbOutput, __pcbResult_native, dwFlags); } } finally { // CleanupCallerAllocated - Perform cleanup of caller allocated resources. __hKey_native__marshaller.Free(); } return __retVal; // Local P/Invoke [global::System.Runtime.InteropServices.DllImportAttribute("bcrypt.dll", EntryPoint = "BCryptEncrypt", ExactSpelling = true)] static extern unsafe int __PInvoke(nint __hKey_native, byte* __pbInput_native, uint __cbInput_native, void* __pPaddingInfo_native, byte* __pbIV_native, uint __cbIV_native, byte* __pbOutput_native, uint __cbOutput_native, uint* __pcbResult_native, global::Microsoft.AspNetCore.Cryptography.Cng.BCryptEncryptFlags __dwFlags_native); } } } } namespace Microsoft.AspNetCore.Cryptography { internal static unsafe partial class UnsafeNativeMethods { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "12.0.14.46214")] [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute] internal static partial int BCryptFinishHash(global::Microsoft.AspNetCore.Cryptography.SafeHandles.BCryptHashHandle hHash, byte* pbOutput, uint cbOutput, uint dwFlags) { unsafe { nint __hHash_native = default; int __retVal = default; // Setup - Perform required setup. global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.AspNetCore.Cryptography.SafeHandles.BCryptHashHandle>.ManagedToUnmanagedIn __hHash_native__marshaller = new(); try { // Marshal - Convert managed data to native data. __hHash_native__marshaller.FromManaged(hHash); { // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned. __hHash_native = __hHash_native__marshaller.ToUnmanaged(); __retVal = __PInvoke(__hHash_native, pbOutput, cbOutput, dwFlags); } } finally { // CleanupCallerAllocated - Perform cleanup of caller allocated resources. __hHash_native__marshaller.Free(); } return __retVal; // Local P/Invoke [global::System.Runtime.InteropServices.DllImportAttribute("bcrypt.dll", EntryPoint = "BCryptFinishHash", ExactSpelling = true)] static extern unsafe int __PInvoke(nint __hHash_native, byte* __pbOutput_native, uint __cbOutput_native, uint __dwFlags_native); } } } } namespace Microsoft.AspNetCore.Cryptography { internal static unsafe partial class UnsafeNativeMethods { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "12.0.14.46214")] [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute] internal static partial int BCryptGenerateSymmetricKey(global::Microsoft.AspNetCore.Cryptography.SafeHandles.BCryptAlgorithmHandle hAlgorithm, out global::Microsoft.AspNetCore.Cryptography.SafeHandles.BCryptKeyHandle phKey, nint pbKeyObject, uint cbKeyObject, byte* pbSecret, uint cbSecret, uint dwFlags) { unsafe { bool __invokeSucceeded = default; phKey = default; nint __hAlgorithm_native = default; nint __phKey_native = default; int __retVal = default; // Setup - Perform required setup. global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.AspNetCore.Cryptography.SafeHandles.BCryptKeyHandle>.ManagedToUnmanagedOut __phKey_native__marshaller = new(); global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.AspNetCore.Cryptography.SafeHandles.BCryptAlgorithmHandle>.ManagedToUnmanagedIn __hAlgorithm_native__marshaller = new(); try { // Marshal - Convert managed data to native data. __hAlgorithm_native__marshaller.FromManaged(hAlgorithm); { // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned. __hAlgorithm_native = __hAlgorithm_native__marshaller.ToUnmanaged(); __retVal = __PInvoke(__hAlgorithm_native, &__phKey_native, pbKeyObject, cbKeyObject, pbSecret, cbSecret, dwFlags); } __invokeSucceeded = true; // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception. __phKey_native__marshaller.FromUnmanaged(__phKey_native); // Unmarshal - Convert native data to managed data. phKey = __phKey_native__marshaller.ToManaged(); } finally { if (__invokeSucceeded) { // CleanupCalleeAllocated - Perform cleanup of callee allocated resources. __phKey_native__marshaller.Free(); } // CleanupCallerAllocated - Perform cleanup of caller allocated resources. __hAlgorithm_native__marshaller.Free(); } return __retVal; // Local P/Invoke [global::System.Runtime.InteropServices.DllImportAttribute("bcrypt.dll", EntryPoint = "BCryptGenerateSymmetricKey", ExactSpelling = true)] static extern unsafe int __PInvoke(nint __hAlgorithm_native, nint* __phKey_native, nint __pbKeyObject_native, uint __cbKeyObject_native, byte* __pbSecret_native, uint __cbSecret_native, uint __dwFlags_native); } } } } namespace Microsoft.AspNetCore.Cryptography { internal static unsafe partial class UnsafeNativeMethods { [global::System.Runtime.InteropServices.DllImportAttribute("bcrypt.dll", EntryPoint = "BCryptGenRandom", ExactSpelling = true)] internal static extern partial int BCryptGenRandom(nint hAlgorithm, byte* pbBuffer, uint cbBuffer, global::Microsoft.AspNetCore.Cryptography.Cng.BCryptGenRandomFlags dwFlags); } } namespace Microsoft.AspNetCore.Cryptography { internal static unsafe partial class UnsafeNativeMethods { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "12.0.14.46214")] [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute] internal static partial int BCryptGetProperty(global::Microsoft.AspNetCore.Cryptography.SafeHandles.BCryptHandle hObject, string pszProperty, void* pbOutput, uint cbOutput, out uint pcbResult, uint dwFlags) { unsafe { pcbResult = default; nint __hObject_native = default; int __retVal = default; // Setup - Perform required setup. global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.AspNetCore.Cryptography.SafeHandles.BCryptHandle>.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 (uint* __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("bcrypt.dll", EntryPoint = "BCryptGetProperty", ExactSpelling = true)] static extern unsafe int __PInvoke(nint __hObject_native, ushort* __pszProperty_native, void* __pbOutput_native, uint __cbOutput_native, uint* __pcbResult_native, uint __dwFlags_native); } } } } namespace Microsoft.AspNetCore.Cryptography { internal static unsafe partial class UnsafeNativeMethods { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "12.0.14.46214")] [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute] internal static partial int BCryptHashData(global::Microsoft.AspNetCore.Cryptography.SafeHandles.BCryptHashHandle hHash, byte* pbInput, uint cbInput, uint dwFlags) { unsafe { nint __hHash_native = default; int __retVal = default; // Setup - Perform required setup. global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.AspNetCore.Cryptography.SafeHandles.BCryptHashHandle>.ManagedToUnmanagedIn __hHash_native__marshaller = new(); try { // Marshal - Convert managed data to native data. __hHash_native__marshaller.FromManaged(hHash); { // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned. __hHash_native = __hHash_native__marshaller.ToUnmanaged(); __retVal = __PInvoke(__hHash_native, pbInput, cbInput, dwFlags); } } finally { // CleanupCallerAllocated - Perform cleanup of caller allocated resources. __hHash_native__marshaller.Free(); } return __retVal; // Local P/Invoke [global::System.Runtime.InteropServices.DllImportAttribute("bcrypt.dll", EntryPoint = "BCryptHashData", ExactSpelling = true)] static extern unsafe int __PInvoke(nint __hHash_native, byte* __pbInput_native, uint __cbInput_native, uint __dwFlags_native); } } } } namespace Microsoft.AspNetCore.Cryptography { internal static unsafe partial class UnsafeNativeMethods { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "12.0.14.46214")] [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute] internal static partial int BCryptKeyDerivation(global::Microsoft.AspNetCore.Cryptography.SafeHandles.BCryptKeyHandle hKey, global::Microsoft.AspNetCore.Cryptography.Cng.BCryptBufferDesc* pParameterList, byte* pbDerivedKey, uint cbDerivedKey, out uint pcbResult, uint dwFlags) { unsafe { pcbResult = default; nint __hKey_native = default; int __retVal = default; // Setup - Perform required setup. global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.AspNetCore.Cryptography.SafeHandles.BCryptKeyHandle>.ManagedToUnmanagedIn __hKey_native__marshaller = new(); try { // Marshal - Convert managed data to native data. __hKey_native__marshaller.FromManaged(hKey); // Pin - Pin data in preparation for calling the P/Invoke. fixed (uint* __pcbResult_native = &pcbResult) { // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned. __hKey_native = __hKey_native__marshaller.ToUnmanaged(); __retVal = __PInvoke(__hKey_native, pParameterList, pbDerivedKey, cbDerivedKey, __pcbResult_native, dwFlags); } } finally { // CleanupCallerAllocated - Perform cleanup of caller allocated resources. __hKey_native__marshaller.Free(); } return __retVal; // Local P/Invoke [global::System.Runtime.InteropServices.DllImportAttribute("bcrypt.dll", EntryPoint = "BCryptKeyDerivation", ExactSpelling = true)] static extern unsafe int __PInvoke(nint __hKey_native, global::Microsoft.AspNetCore.Cryptography.Cng.BCryptBufferDesc* __pParameterList_native, byte* __pbDerivedKey_native, uint __cbDerivedKey_native, uint* __pcbResult_native, uint __dwFlags_native); } } } } namespace Microsoft.AspNetCore.Cryptography { internal static unsafe partial class UnsafeNativeMethods { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "12.0.14.46214")] [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute] internal static partial int BCryptOpenAlgorithmProvider(out global::Microsoft.AspNetCore.Cryptography.SafeHandles.BCryptAlgorithmHandle phAlgorithm, string pszAlgId, string pszImplementation, uint dwFlags) { unsafe { bool __invokeSucceeded = default; phAlgorithm = default; nint __phAlgorithm_native = default; int __retVal = default; // Setup - Perform required setup. global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.AspNetCore.Cryptography.SafeHandles.BCryptAlgorithmHandle>.ManagedToUnmanagedOut __phAlgorithm_native__marshaller = new(); try { // Pin - Pin data in preparation for calling the P/Invoke. fixed (void* __pszImplementation_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(pszImplementation)) fixed (void* __pszAlgId_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(pszAlgId)) { __retVal = __PInvoke(&__phAlgorithm_native, (ushort*)__pszAlgId_native, (ushort*)__pszImplementation_native, dwFlags); } __invokeSucceeded = true; // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception. __phAlgorithm_native__marshaller.FromUnmanaged(__phAlgorithm_native); // Unmarshal - Convert native data to managed data. phAlgorithm = __phAlgorithm_native__marshaller.ToManaged(); } finally { if (__invokeSucceeded) { // CleanupCalleeAllocated - Perform cleanup of callee allocated resources. __phAlgorithm_native__marshaller.Free(); } } return __retVal; // Local P/Invoke [global::System.Runtime.InteropServices.DllImportAttribute("bcrypt.dll", EntryPoint = "BCryptOpenAlgorithmProvider", ExactSpelling = true)] static extern unsafe int __PInvoke(nint* __phAlgorithm_native, ushort* __pszAlgId_native, ushort* __pszImplementation_native, uint __dwFlags_native); } } } } namespace Microsoft.AspNetCore.Cryptography { internal static unsafe partial class UnsafeNativeMethods { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "12.0.14.46214")] [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute] internal static partial int BCryptSetProperty(global::Microsoft.AspNetCore.Cryptography.SafeHandles.BCryptHandle hObject, string pszProperty, void* pbInput, uint cbInput, uint dwFlags) { unsafe { nint __hObject_native = default; int __retVal = default; // Setup - Perform required setup. global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.AspNetCore.Cryptography.SafeHandles.BCryptHandle>.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("bcrypt.dll", EntryPoint = "BCryptSetProperty", ExactSpelling = true)] static extern unsafe int __PInvoke(nint __hObject_native, ushort* __pszProperty_native, void* __pbInput_native, uint __cbInput_native, uint __dwFlags_native); } } } } namespace Microsoft.AspNetCore.Cryptography { internal static unsafe partial class UnsafeNativeMethods { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "12.0.14.46214")] [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute] internal static partial bool CryptProtectData(global::Microsoft.AspNetCore.Cryptography.DATA_BLOB* pDataIn, nint szDataDescr, global::Microsoft.AspNetCore.Cryptography.DATA_BLOB* pOptionalEntropy, nint pvReserved, nint pPromptStruct, uint dwFlags, global::Microsoft.AspNetCore.Cryptography.DATA_BLOB* pDataOut) { unsafe { int __lastError; bool __retVal; int __retVal_native; { global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); __retVal_native = __PInvoke(pDataIn, szDataDescr, pOptionalEntropy, pvReserved, pPromptStruct, dwFlags, pDataOut); __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 = "CryptProtectData", ExactSpelling = true)] static extern unsafe int __PInvoke(global::Microsoft.AspNetCore.Cryptography.DATA_BLOB* __pDataIn_native, nint __szDataDescr_native, global::Microsoft.AspNetCore.Cryptography.DATA_BLOB* __pOptionalEntropy_native, nint __pvReserved_native, nint __pPromptStruct_native, uint __dwFlags_native, global::Microsoft.AspNetCore.Cryptography.DATA_BLOB* __pDataOut_native); } } } } namespace Microsoft.AspNetCore.Cryptography { internal static unsafe partial class UnsafeNativeMethods { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "12.0.14.46214")] [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute] public static partial bool CryptProtectMemory(global::System.Runtime.InteropServices.SafeHandle pData, uint cbData, uint dwFlags) { unsafe { int __lastError; nint __pData_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 __pData_native__marshaller = new(); try { // Marshal - Convert managed data to native data. __pData_native__marshaller.FromManaged(pData); { // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned. __pData_native = __pData_native__marshaller.ToUnmanaged(); global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); __retVal_native = __PInvoke(__pData_native, cbData, 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. __pData_native__marshaller.Free(); } global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); return __retVal; // Local P/Invoke [global::System.Runtime.InteropServices.DllImportAttribute("crypt32.dll", EntryPoint = "CryptProtectMemory", ExactSpelling = true)] static extern unsafe int __PInvoke(nint __pData_native, uint __cbData_native, uint __dwFlags_native); } } } } namespace Microsoft.AspNetCore.Cryptography { internal static unsafe partial class UnsafeNativeMethods { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "12.0.14.46214")] [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute] internal static partial bool CryptUnprotectData(global::Microsoft.AspNetCore.Cryptography.DATA_BLOB* pDataIn, nint ppszDataDescr, global::Microsoft.AspNetCore.Cryptography.DATA_BLOB* pOptionalEntropy, nint pvReserved, nint pPromptStruct, uint dwFlags, global::Microsoft.AspNetCore.Cryptography.DATA_BLOB* pDataOut) { unsafe { int __lastError; bool __retVal; int __retVal_native; { global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); __retVal_native = __PInvoke(pDataIn, ppszDataDescr, pOptionalEntropy, pvReserved, pPromptStruct, dwFlags, pDataOut); __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 = "CryptUnprotectData", ExactSpelling = true)] static extern unsafe int __PInvoke(global::Microsoft.AspNetCore.Cryptography.DATA_BLOB* __pDataIn_native, nint __ppszDataDescr_native, global::Microsoft.AspNetCore.Cryptography.DATA_BLOB* __pOptionalEntropy_native, nint __pvReserved_native, nint __pPromptStruct_native, uint __dwFlags_native, global::Microsoft.AspNetCore.Cryptography.DATA_BLOB* __pDataOut_native); } } } } namespace Microsoft.AspNetCore.Cryptography { internal static unsafe partial class UnsafeNativeMethods { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "12.0.14.46214")] [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute] public static partial bool CryptUnprotectMemory(byte* pData, uint cbData, uint dwFlags) { unsafe { int __lastError; bool __retVal; int __retVal_native; { global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); __retVal_native = __PInvoke(pData, cbData, 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("crypt32.dll", EntryPoint = "CryptUnprotectMemory", ExactSpelling = true)] static extern unsafe int __PInvoke(byte* __pData_native, uint __cbData_native, uint __dwFlags_native); } } } } namespace Microsoft.AspNetCore.Cryptography { internal static unsafe partial class UnsafeNativeMethods { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "12.0.14.46214")] [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute] public static partial bool CryptUnprotectMemory(global::System.Runtime.InteropServices.SafeHandle pData, uint cbData, uint dwFlags) { unsafe { int __lastError; nint __pData_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 __pData_native__marshaller = new(); try { // Marshal - Convert managed data to native data. __pData_native__marshaller.FromManaged(pData); { // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned. __pData_native = __pData_native__marshaller.ToUnmanaged(); global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); __retVal_native = __PInvoke(__pData_native, cbData, 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. __pData_native__marshaller.Free(); } global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); return __retVal; // Local P/Invoke [global::System.Runtime.InteropServices.DllImportAttribute("crypt32.dll", EntryPoint = "CryptUnprotectMemory", ExactSpelling = true)] static extern unsafe int __PInvoke(nint __pData_native, uint __cbData_native, uint __dwFlags_native); } } } } namespace Microsoft.AspNetCore.Cryptography { internal static unsafe partial class UnsafeNativeMethods { [global::System.Runtime.InteropServices.DllImportAttribute("ncrypt.dll", EntryPoint = "NCryptCloseProtectionDescriptor", ExactSpelling = true)] internal static extern partial int NCryptCloseProtectionDescriptor(nint hDescriptor); } } namespace Microsoft.AspNetCore.Cryptography { internal static unsafe partial class UnsafeNativeMethods { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "12.0.14.46214")] [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute] internal static partial int NCryptCreateProtectionDescriptor(string pwszDescriptorString, uint dwFlags, out global::Microsoft.AspNetCore.Cryptography.SafeHandles.NCryptDescriptorHandle phDescriptor) { unsafe { bool __invokeSucceeded = default; phDescriptor = default; nint __phDescriptor_native = default; int __retVal = default; // Setup - Perform required setup. global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.AspNetCore.Cryptography.SafeHandles.NCryptDescriptorHandle>.ManagedToUnmanagedOut __phDescriptor_native__marshaller = new(); try { // Pin - Pin data in preparation for calling the P/Invoke. fixed (void* __pwszDescriptorString_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(pwszDescriptorString)) { __retVal = __PInvoke((ushort*)__pwszDescriptorString_native, dwFlags, &__phDescriptor_native); } __invokeSucceeded = true; // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception. __phDescriptor_native__marshaller.FromUnmanaged(__phDescriptor_native); // Unmarshal - Convert native data to managed data. phDescriptor = __phDescriptor_native__marshaller.ToManaged(); } finally { if (__invokeSucceeded) { // CleanupCalleeAllocated - Perform cleanup of callee allocated resources. __phDescriptor_native__marshaller.Free(); } } return __retVal; // Local P/Invoke [global::System.Runtime.InteropServices.DllImportAttribute("ncrypt.dll", EntryPoint = "NCryptCreateProtectionDescriptor", ExactSpelling = true)] static extern unsafe int __PInvoke(ushort* __pwszDescriptorString_native, uint __dwFlags_native, nint* __phDescriptor_native); } } } } namespace Microsoft.AspNetCore.Cryptography { internal static unsafe partial class UnsafeNativeMethods { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "12.0.14.46214")] [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute] internal static partial int NCryptGetProtectionDescriptorInfo(global::Microsoft.AspNetCore.Cryptography.SafeHandles.NCryptDescriptorHandle hDescriptor, nint pMemPara, uint dwInfoType, out global::Microsoft.AspNetCore.Cryptography.SafeHandles.LocalAllocHandle ppvInfo) { unsafe { bool __invokeSucceeded = default; ppvInfo = default; nint __hDescriptor_native = default; nint __ppvInfo_native = default; int __retVal = default; // Setup - Perform required setup. global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.AspNetCore.Cryptography.SafeHandles.LocalAllocHandle>.ManagedToUnmanagedOut __ppvInfo_native__marshaller = new(); global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.AspNetCore.Cryptography.SafeHandles.NCryptDescriptorHandle>.ManagedToUnmanagedIn __hDescriptor_native__marshaller = new(); try { // Marshal - Convert managed data to native data. __hDescriptor_native__marshaller.FromManaged(hDescriptor); { // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned. __hDescriptor_native = __hDescriptor_native__marshaller.ToUnmanaged(); __retVal = __PInvoke(__hDescriptor_native, pMemPara, dwInfoType, &__ppvInfo_native); } __invokeSucceeded = true; // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception. __ppvInfo_native__marshaller.FromUnmanaged(__ppvInfo_native); // Unmarshal - Convert native data to managed data. ppvInfo = __ppvInfo_native__marshaller.ToManaged(); } finally { if (__invokeSucceeded) { // CleanupCalleeAllocated - Perform cleanup of callee allocated resources. __ppvInfo_native__marshaller.Free(); } // CleanupCallerAllocated - Perform cleanup of caller allocated resources. __hDescriptor_native__marshaller.Free(); } return __retVal; // Local P/Invoke [global::System.Runtime.InteropServices.DllImportAttribute("ncrypt.dll", EntryPoint = "NCryptGetProtectionDescriptorInfo", ExactSpelling = true)] static extern unsafe int __PInvoke(nint __hDescriptor_native, nint __pMemPara_native, uint __dwInfoType_native, nint* __ppvInfo_native); } } } } namespace Microsoft.AspNetCore.Cryptography { internal static unsafe partial class UnsafeNativeMethods { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "12.0.14.46214")] [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute] internal static partial int NCryptProtectSecret(global::Microsoft.AspNetCore.Cryptography.SafeHandles.NCryptDescriptorHandle hDescriptor, uint dwFlags, byte* pbData, uint cbData, nint pMemPara, nint hWnd, out global::Microsoft.AspNetCore.Cryptography.SafeHandles.LocalAllocHandle ppbProtectedBlob, out uint pcbProtectedBlob) { unsafe { bool __invokeSucceeded = default; ppbProtectedBlob = default; pcbProtectedBlob = default; nint __hDescriptor_native = default; nint __ppbProtectedBlob_native = default; int __retVal = default; // Setup - Perform required setup. global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.AspNetCore.Cryptography.SafeHandles.LocalAllocHandle>.ManagedToUnmanagedOut __ppbProtectedBlob_native__marshaller = new(); global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.AspNetCore.Cryptography.SafeHandles.NCryptDescriptorHandle>.ManagedToUnmanagedIn __hDescriptor_native__marshaller = new(); try { // Marshal - Convert managed data to native data. __hDescriptor_native__marshaller.FromManaged(hDescriptor); // Pin - Pin data in preparation for calling the P/Invoke. fixed (uint* __pcbProtectedBlob_native = &pcbProtectedBlob) { // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned. __hDescriptor_native = __hDescriptor_native__marshaller.ToUnmanaged(); __retVal = __PInvoke(__hDescriptor_native, dwFlags, pbData, cbData, pMemPara, hWnd, &__ppbProtectedBlob_native, __pcbProtectedBlob_native); } __invokeSucceeded = true; // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception. __ppbProtectedBlob_native__marshaller.FromUnmanaged(__ppbProtectedBlob_native); // Unmarshal - Convert native data to managed data. ppbProtectedBlob = __ppbProtectedBlob_native__marshaller.ToManaged(); } finally { if (__invokeSucceeded) { // CleanupCalleeAllocated - Perform cleanup of callee allocated resources. __ppbProtectedBlob_native__marshaller.Free(); } // CleanupCallerAllocated - Perform cleanup of caller allocated resources. __hDescriptor_native__marshaller.Free(); } return __retVal; // Local P/Invoke [global::System.Runtime.InteropServices.DllImportAttribute("ncrypt.dll", EntryPoint = "NCryptProtectSecret", ExactSpelling = true)] static extern unsafe int __PInvoke(nint __hDescriptor_native, uint __dwFlags_native, byte* __pbData_native, uint __cbData_native, nint __pMemPara_native, nint __hWnd_native, nint* __ppbProtectedBlob_native, uint* __pcbProtectedBlob_native); } } } } namespace Microsoft.AspNetCore.Cryptography { internal static unsafe partial class UnsafeNativeMethods { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "12.0.14.46214")] [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute] internal static partial int NCryptUnprotectSecret(nint phDescriptor, uint dwFlags, byte* pbProtectedBlob, uint cbProtectedBlob, nint pMemPara, nint hWnd, out global::Microsoft.AspNetCore.Cryptography.SafeHandles.LocalAllocHandle ppbData, out uint pcbData) { unsafe { bool __invokeSucceeded = default; ppbData = default; pcbData = default; nint __ppbData_native = default; int __retVal = default; // Setup - Perform required setup. global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.AspNetCore.Cryptography.SafeHandles.LocalAllocHandle>.ManagedToUnmanagedOut __ppbData_native__marshaller = new(); try { // Pin - Pin data in preparation for calling the P/Invoke. fixed (uint* __pcbData_native = &pcbData) { __retVal = __PInvoke(phDescriptor, dwFlags, pbProtectedBlob, cbProtectedBlob, pMemPara, hWnd, &__ppbData_native, __pcbData_native); } __invokeSucceeded = true; // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception. __ppbData_native__marshaller.FromUnmanaged(__ppbData_native); // Unmarshal - Convert native data to managed data. ppbData = __ppbData_native__marshaller.ToManaged(); } finally { if (__invokeSucceeded) { // CleanupCalleeAllocated - Perform cleanup of callee allocated resources. __ppbData_native__marshaller.Free(); } } return __retVal; // Local P/Invoke [global::System.Runtime.InteropServices.DllImportAttribute("ncrypt.dll", EntryPoint = "NCryptUnprotectSecret", ExactSpelling = true)] static extern unsafe int __PInvoke(nint __phDescriptor_native, uint __dwFlags_native, byte* __pbProtectedBlob_native, uint __cbProtectedBlob_native, nint __pMemPara_native, nint __hWnd_native, nint* __ppbData_native, uint* __pcbData_native); } } } } namespace Microsoft.AspNetCore.Cryptography { internal static unsafe partial class UnsafeNativeMethods { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "12.0.14.46214")] [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute] internal static partial int NCryptUnprotectSecret(out global::Microsoft.AspNetCore.Cryptography.SafeHandles.NCryptDescriptorHandle phDescriptor, uint dwFlags, byte* pbProtectedBlob, uint cbProtectedBlob, nint pMemPara, nint hWnd, out global::Microsoft.AspNetCore.Cryptography.SafeHandles.LocalAllocHandle ppbData, out uint pcbData) { unsafe { bool __invokeSucceeded = default; phDescriptor = default; ppbData = default; pcbData = default; nint __phDescriptor_native = default; nint __ppbData_native = default; int __retVal = default; // Setup - Perform required setup. global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.AspNetCore.Cryptography.SafeHandles.LocalAllocHandle>.ManagedToUnmanagedOut __ppbData_native__marshaller = new(); global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.AspNetCore.Cryptography.SafeHandles.NCryptDescriptorHandle>.ManagedToUnmanagedOut __phDescriptor_native__marshaller = new(); try { // Pin - Pin data in preparation for calling the P/Invoke. fixed (uint* __pcbData_native = &pcbData) { __retVal = __PInvoke(&__phDescriptor_native, dwFlags, pbProtectedBlob, cbProtectedBlob, pMemPara, hWnd, &__ppbData_native, __pcbData_native); } __invokeSucceeded = true; // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception. __ppbData_native__marshaller.FromUnmanaged(__ppbData_native); __phDescriptor_native__marshaller.FromUnmanaged(__phDescriptor_native); // Unmarshal - Convert native data to managed data. ppbData = __ppbData_native__marshaller.ToManaged(); phDescriptor = __phDescriptor_native__marshaller.ToManaged(); } finally { if (__invokeSucceeded) { // CleanupCalleeAllocated - Perform cleanup of callee allocated resources. __ppbData_native__marshaller.Free(); __phDescriptor_native__marshaller.Free(); } } return __retVal; // Local P/Invoke [global::System.Runtime.InteropServices.DllImportAttribute("ncrypt.dll", EntryPoint = "NCryptUnprotectSecret", ExactSpelling = true)] static extern unsafe int __PInvoke(nint* __phDescriptor_native, uint __dwFlags_native, byte* __pbProtectedBlob_native, uint __cbProtectedBlob_native, nint __pMemPara_native, nint __hWnd_native, nint* __ppbData_native, uint* __pcbData_native); } } } }