File: _generated\0\LibraryImports.g.cs
Web Access
Project: src\src\runtime\src\libraries\Microsoft.Win32.Registry\src\Microsoft.Win32.Registry.csproj (Microsoft.Win32.Registry)
// <auto-generated/>
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        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 Advapi32
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "RegCloseKey", ExactSpelling = true)]
        internal static extern partial int RegCloseKey(nint hKey);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        internal static partial int RegConnectRegistry(string machineName, nint key, out global::Microsoft.Win32.SafeHandles.SafeRegistryHandle result)
        {
            bool __invokeSucceeded = default;
            result = default;
            nint __result_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeRegistryHandle>.ManagedToUnmanagedOut __result_native__marshaller = new();
            try
            {
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __machineName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(machineName))
                {
                    __retVal = __PInvoke((ushort*)__machineName_native, key, &__result_native);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __result_native__marshaller.FromUnmanaged(__result_native);
                // Unmarshal - Convert native data to managed data.
                result = __result_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __result_native__marshaller.Free();
                }
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "RegConnectRegistryW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(ushort* __machineName_native, nint __key_native, nint* __result_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")]
        internal static partial int RegCreateKeyEx(global::Microsoft.Win32.SafeHandles.SafeRegistryHandle hKey, string lpSubKey, int Reserved, string lpClass, int dwOptions, int samDesired, ref global::Interop.Kernel32.SECURITY_ATTRIBUTES secAttrs, out global::Microsoft.Win32.SafeHandles.SafeRegistryHandle hkResult, out int lpdwDisposition)
        {
            bool __invokeSucceeded = default;
            hkResult = default;
            lpdwDisposition = default;
            nint __hKey_native = default;
            nint __hkResult_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeRegistryHandle>.ManagedToUnmanagedOut __hkResult_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeRegistryHandle>.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 (int* __lpdwDisposition_native = &lpdwDisposition)
                fixed (global::Interop.Kernel32.SECURITY_ATTRIBUTES* __secAttrs_native = &secAttrs)
                fixed (void* __lpClass_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(lpClass))
                fixed (void* __lpSubKey_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(lpSubKey))
                {
                    // 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, (ushort*)__lpSubKey_native, Reserved, (ushort*)__lpClass_native, dwOptions, samDesired, __secAttrs_native, &__hkResult_native, __lpdwDisposition_native);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __hkResult_native__marshaller.FromUnmanaged(__hkResult_native);
                // Unmarshal - Convert native data to managed data.
                hkResult = __hkResult_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __hkResult_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hKey_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "RegCreateKeyExW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(nint __hKey_native, ushort* __lpSubKey_native, int __Reserved_native, ushort* __lpClass_native, int __dwOptions_native, int __samDesired_native, global::Interop.Kernel32.SECURITY_ATTRIBUTES* __secAttrs_native, nint* __hkResult_native, int* __lpdwDisposition_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")]
        internal static partial int RegDeleteKeyEx(global::Microsoft.Win32.SafeHandles.SafeRegistryHandle hKey, string lpSubKey, int samDesired, int Reserved)
        {
            nint __hKey_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeRegistryHandle>.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 (void* __lpSubKey_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(lpSubKey))
                {
                    // 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, (ushort*)__lpSubKey_native, samDesired, Reserved);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hKey_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "RegDeleteKeyExW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(nint __hKey_native, ushort* __lpSubKey_native, int __samDesired_native, int __Reserved_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")]
        internal static partial int RegDeleteTree(global::Microsoft.Win32.SafeHandles.SafeRegistryHandle hKey, string lpSubKey)
        {
            nint __hKey_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeRegistryHandle>.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 (void* __lpSubKey_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(lpSubKey))
                {
                    // 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, (ushort*)__lpSubKey_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hKey_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "RegDeleteTreeW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(nint __hKey_native, ushort* __lpSubKey_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")]
        internal static partial int RegDeleteValue(global::Microsoft.Win32.SafeHandles.SafeRegistryHandle hKey, string lpValueName)
        {
            nint __hKey_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeRegistryHandle>.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 (void* __lpValueName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(lpValueName))
                {
                    // 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, (ushort*)__lpValueName_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hKey_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "RegDeleteValueW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(nint __hKey_native, ushort* __lpValueName_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")]
        internal static unsafe partial int RegEnumKeyEx(global::Microsoft.Win32.SafeHandles.SafeRegistryHandle hKey, int dwIndex, ref char lpName, ref int lpcbName, int[] lpReserved, char[] lpClass, int[] lpcbClass, long[] lpftLastWriteTime)
        {
            nint __hKey_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeRegistryHandle>.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 (void* __lpftLastWriteTime_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<long, long>.ManagedToUnmanagedIn.GetPinnableReference(lpftLastWriteTime))
                fixed (void* __lpcbClass_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.ManagedToUnmanagedIn.GetPinnableReference(lpcbClass))
                fixed (void* __lpClass_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<char, char>.ManagedToUnmanagedIn.GetPinnableReference(lpClass))
                fixed (void* __lpReserved_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.ManagedToUnmanagedIn.GetPinnableReference(lpReserved))
                fixed (int* __lpcbName_native = &lpcbName)
                fixed (char* __lpName_native = &lpName)
                {
                    // 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, dwIndex, __lpName_native, __lpcbName_native, (int*)__lpReserved_native, (char*)__lpClass_native, (int*)__lpcbClass_native, (long*)__lpftLastWriteTime_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hKey_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "RegEnumKeyExW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(nint __hKey_native, int __dwIndex_native, char* __lpName_native, int* __lpcbName_native, int* __lpReserved_native, char* __lpClass_native, int* __lpcbClass_native, long* __lpftLastWriteTime_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")]
        internal static partial int RegEnumValue(global::Microsoft.Win32.SafeHandles.SafeRegistryHandle hKey, int dwIndex, char[] lpValueName, ref int lpcbValueName, nint lpReserved_MustBeZero, int[] lpType, byte[] lpData, int[] lpcbData)
        {
            nint __hKey_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeRegistryHandle>.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 (void* __lpcbData_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.ManagedToUnmanagedIn.GetPinnableReference(lpcbData))
                fixed (void* __lpData_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(lpData))
                fixed (void* __lpType_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.ManagedToUnmanagedIn.GetPinnableReference(lpType))
                fixed (int* __lpcbValueName_native = &lpcbValueName)
                fixed (void* __lpValueName_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<char, char>.ManagedToUnmanagedIn.GetPinnableReference(lpValueName))
                {
                    // 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, dwIndex, (char*)__lpValueName_native, __lpcbValueName_native, lpReserved_MustBeZero, (int*)__lpType_native, (byte*)__lpData_native, (int*)__lpcbData_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hKey_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "RegEnumValueW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(nint __hKey_native, int __dwIndex_native, char* __lpValueName_native, int* __lpcbValueName_native, nint __lpReserved_MustBeZero_native, int* __lpType_native, byte* __lpData_native, int* __lpcbData_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")]
        internal static partial int RegFlushKey(global::Microsoft.Win32.SafeHandles.SafeRegistryHandle hKey)
        {
            nint __hKey_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeRegistryHandle>.ManagedToUnmanagedIn __hKey_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __hKey_native__marshaller.FromManaged(hKey);
                {
                    // 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);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hKey_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "RegFlushKey", 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")]
        internal static partial int RegOpenKeyEx(global::Microsoft.Win32.SafeHandles.SafeRegistryHandle hKey, string lpSubKey, int ulOptions, int samDesired, out global::Microsoft.Win32.SafeHandles.SafeRegistryHandle hkResult)
        {
            bool __invokeSucceeded = default;
            hkResult = default;
            nint __hKey_native = default;
            nint __hkResult_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeRegistryHandle>.ManagedToUnmanagedOut __hkResult_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeRegistryHandle>.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 (void* __lpSubKey_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(lpSubKey))
                {
                    // 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, (ushort*)__lpSubKey_native, ulOptions, samDesired, &__hkResult_native);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __hkResult_native__marshaller.FromUnmanaged(__hkResult_native);
                // Unmarshal - Convert native data to managed data.
                hkResult = __hkResult_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __hkResult_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hKey_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "RegOpenKeyExW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(nint __hKey_native, ushort* __lpSubKey_native, int __ulOptions_native, int __samDesired_native, nint* __hkResult_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")]
        internal static partial int RegOpenKeyEx(nint hKey, string lpSubKey, int ulOptions, int samDesired, out global::Microsoft.Win32.SafeHandles.SafeRegistryHandle hkResult)
        {
            bool __invokeSucceeded = default;
            hkResult = default;
            nint __hkResult_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeRegistryHandle>.ManagedToUnmanagedOut __hkResult_native__marshaller = new();
            try
            {
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __lpSubKey_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(lpSubKey))
                {
                    __retVal = __PInvoke(hKey, (ushort*)__lpSubKey_native, ulOptions, samDesired, &__hkResult_native);
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __hkResult_native__marshaller.FromUnmanaged(__hkResult_native);
                // Unmarshal - Convert native data to managed data.
                hkResult = __hkResult_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __hkResult_native__marshaller.Free();
                }
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "RegOpenKeyExW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(nint __hKey_native, ushort* __lpSubKey_native, int __ulOptions_native, int __samDesired_native, nint* __hkResult_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")]
        internal static partial int RegQueryInfoKey(global::Microsoft.Win32.SafeHandles.SafeRegistryHandle hKey, char[] lpClass, int[] lpcbClass, nint lpReserved_MustBeZero, ref int lpcSubKeys, int[] lpcbMaxSubKeyLen, int[] lpcbMaxClassLen, ref int lpcValues, int[] lpcbMaxValueNameLen, int[] lpcbMaxValueLen, int[] lpcbSecurityDescriptor, int[] lpftLastWriteTime)
        {
            nint __hKey_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeRegistryHandle>.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 (void* __lpftLastWriteTime_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.ManagedToUnmanagedIn.GetPinnableReference(lpftLastWriteTime))
                fixed (void* __lpcbSecurityDescriptor_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.ManagedToUnmanagedIn.GetPinnableReference(lpcbSecurityDescriptor))
                fixed (void* __lpcbMaxValueLen_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.ManagedToUnmanagedIn.GetPinnableReference(lpcbMaxValueLen))
                fixed (void* __lpcbMaxValueNameLen_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.ManagedToUnmanagedIn.GetPinnableReference(lpcbMaxValueNameLen))
                fixed (int* __lpcValues_native = &lpcValues)
                fixed (void* __lpcbMaxClassLen_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.ManagedToUnmanagedIn.GetPinnableReference(lpcbMaxClassLen))
                fixed (void* __lpcbMaxSubKeyLen_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.ManagedToUnmanagedIn.GetPinnableReference(lpcbMaxSubKeyLen))
                fixed (int* __lpcSubKeys_native = &lpcSubKeys)
                fixed (void* __lpcbClass_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.ManagedToUnmanagedIn.GetPinnableReference(lpcbClass))
                fixed (void* __lpClass_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<char, char>.ManagedToUnmanagedIn.GetPinnableReference(lpClass))
                {
                    // 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, (char*)__lpClass_native, (int*)__lpcbClass_native, lpReserved_MustBeZero, __lpcSubKeys_native, (int*)__lpcbMaxSubKeyLen_native, (int*)__lpcbMaxClassLen_native, __lpcValues_native, (int*)__lpcbMaxValueNameLen_native, (int*)__lpcbMaxValueLen_native, (int*)__lpcbSecurityDescriptor_native, (int*)__lpftLastWriteTime_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hKey_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "RegQueryInfoKeyW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(nint __hKey_native, char* __lpClass_native, int* __lpcbClass_native, nint __lpReserved_MustBeZero_native, int* __lpcSubKeys_native, int* __lpcbMaxSubKeyLen_native, int* __lpcbMaxClassLen_native, int* __lpcValues_native, int* __lpcbMaxValueNameLen_native, int* __lpcbMaxValueLen_native, int* __lpcbSecurityDescriptor_native, int* __lpftLastWriteTime_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")]
        internal static partial int RegQueryValueEx(global::Microsoft.Win32.SafeHandles.SafeRegistryHandle hKey, string lpValueName, int[] lpReserved, ref int lpType, byte[] lpData, ref int lpcbData)
        {
            nint __hKey_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeRegistryHandle>.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 (int* __lpcbData_native = &lpcbData)
                fixed (void* __lpData_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(lpData))
                fixed (int* __lpType_native = &lpType)
                fixed (void* __lpReserved_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<int, int>.ManagedToUnmanagedIn.GetPinnableReference(lpReserved))
                fixed (void* __lpValueName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(lpValueName))
                {
                    // 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, (ushort*)__lpValueName_native, (int*)__lpReserved_native, __lpType_native, (byte*)__lpData_native, __lpcbData_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hKey_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "RegQueryValueExW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(nint __hKey_native, ushort* __lpValueName_native, int* __lpReserved_native, int* __lpType_native, byte* __lpData_native, int* __lpcbData_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")]
        internal static unsafe partial int RegQueryValueEx(global::Microsoft.Win32.SafeHandles.SafeRegistryHandle hKey, string lpValueName, int* lpReserved, int* lpType, byte* lpData, uint* lpcbData)
        {
            nint __hKey_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeRegistryHandle>.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 (void* __lpValueName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(lpValueName))
                {
                    // 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, (ushort*)__lpValueName_native, lpReserved, lpType, lpData, lpcbData);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hKey_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "RegQueryValueExW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(nint __hKey_native, ushort* __lpValueName_native, int* __lpReserved_native, int* __lpType_native, byte* __lpData_native, uint* __lpcbData_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")]
        internal static partial int RegSetValueEx(global::Microsoft.Win32.SafeHandles.SafeRegistryHandle hKey, string lpValueName, int Reserved, int dwType, byte[] lpData, int cbData)
        {
            nint __hKey_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeRegistryHandle>.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 (void* __lpData_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(lpData))
                fixed (void* __lpValueName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(lpValueName))
                {
                    // 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, (ushort*)__lpValueName_native, Reserved, dwType, (byte*)__lpData_native, cbData);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hKey_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "RegSetValueExW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(nint __hKey_native, ushort* __lpValueName_native, int __Reserved_native, int __dwType_native, byte* __lpData_native, int __cbData_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")]
        internal static partial int RegSetValueEx(global::Microsoft.Win32.SafeHandles.SafeRegistryHandle hKey, string lpValueName, int Reserved, int dwType, char[] lpData, int cbData)
        {
            nint __hKey_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeRegistryHandle>.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 (void* __lpData_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<char, char>.ManagedToUnmanagedIn.GetPinnableReference(lpData))
                fixed (void* __lpValueName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(lpValueName))
                {
                    // 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, (ushort*)__lpValueName_native, Reserved, dwType, (char*)__lpData_native, cbData);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hKey_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "RegSetValueExW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(nint __hKey_native, ushort* __lpValueName_native, int __Reserved_native, int __dwType_native, char* __lpData_native, int __cbData_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")]
        internal static partial int RegSetValueEx(global::Microsoft.Win32.SafeHandles.SafeRegistryHandle hKey, string lpValueName, int Reserved, int dwType, ref int lpData, int cbData)
        {
            nint __hKey_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeRegistryHandle>.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 (int* __lpData_native = &lpData)
                fixed (void* __lpValueName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(lpValueName))
                {
                    // 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, (ushort*)__lpValueName_native, Reserved, dwType, __lpData_native, cbData);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hKey_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "RegSetValueExW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(nint __hKey_native, ushort* __lpValueName_native, int __Reserved_native, int __dwType_native, int* __lpData_native, int __cbData_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")]
        internal static partial int RegSetValueEx(global::Microsoft.Win32.SafeHandles.SafeRegistryHandle hKey, string lpValueName, int Reserved, int dwType, ref long lpData, int cbData)
        {
            nint __hKey_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeRegistryHandle>.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 (long* __lpData_native = &lpData)
                fixed (void* __lpValueName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(lpValueName))
                {
                    // 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, (ushort*)__lpValueName_native, Reserved, dwType, __lpData_native, cbData);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hKey_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "RegSetValueExW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(nint __hKey_native, ushort* __lpValueName_native, int __Reserved_native, int __dwType_native, long* __lpData_native, int __cbData_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")]
        internal static partial int RegSetValueEx(global::Microsoft.Win32.SafeHandles.SafeRegistryHandle hKey, string lpValueName, int Reserved, int dwType, string lpData, int cbData)
        {
            nint __hKey_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeRegistryHandle>.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 (void* __lpData_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(lpData))
                fixed (void* __lpValueName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(lpValueName))
                {
                    // 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, (ushort*)__lpValueName_native, Reserved, dwType, (ushort*)__lpData_native, cbData);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hKey_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "RegSetValueExW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(nint __hKey_native, ushort* __lpValueName_native, int __Reserved_native, int __dwType_native, ushort* __lpData_native, int __cbData_native);
        }
    }
}