File: _generated\0\LibraryImports.g.cs
Web Access
Project: src\src\runtime\src\libraries\System.Diagnostics.PerformanceCounter\src\System.Diagnostics.PerformanceCounter.csproj (System.Diagnostics.PerformanceCounter)
// <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")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        private static unsafe partial int FormatMessage(int dwFlags, nint lpSource, uint dwMessageId, int dwLanguageId, void* lpBuffer, int nSize, nint arguments)
        {
            int __lastError;
            int __retVal;
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal = __PInvoke(dwFlags, lpSource, dwMessageId, dwLanguageId, lpBuffer, nSize, arguments);
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "FormatMessageW", ExactSpelling = true)]
            static extern unsafe int __PInvoke(int __dwFlags_native, nint __lpSource_native, uint __dwMessageId_native, int __dwLanguageId_native, void* __lpBuffer_native, int __nSize_native, nint __arguments_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class 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")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial int RegQueryValueEx(global::Internal.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::Internal.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")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static unsafe partial int RegQueryValueEx(global::Internal.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::Internal.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")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static unsafe partial bool ConvertStringSecurityDescriptorToSecurityDescriptor(string StringSecurityDescriptor, int StringSDRevision, out void* pSecurityDescriptor, uint* SecurityDescriptorSize)
        {
            int __lastError;
            pSecurityDescriptor = default;
            bool __retVal;
            int __retVal_native;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (void** __pSecurityDescriptor_native = &pSecurityDescriptor)
            fixed (void* __StringSecurityDescriptor_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(StringSecurityDescriptor))
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal_native = __PInvoke((ushort*)__StringSecurityDescriptor_native, StringSDRevision, __pSecurityDescriptor_native, SecurityDescriptorSize);
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            // Unmarshal - Convert native data to managed data.
            __retVal = __retVal_native != 0;
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "ConvertStringSecurityDescriptorToSecurityDescriptorW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(ushort* __StringSecurityDescriptor_native, int __StringSDRevision_native, void** __pSecurityDescriptor_native, uint* __SecurityDescriptorSize_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool GetTokenInformation(nint TokenHandle, uint TokenInformationClass, nint TokenInformation, uint TokenInformationLength, out uint ReturnLength)
        {
            int __lastError;
            ReturnLength = default;
            bool __retVal;
            int __retVal_native;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (uint* __ReturnLength_native = &ReturnLength)
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal_native = __PInvoke(TokenHandle, TokenInformationClass, TokenInformation, TokenInformationLength, __ReturnLength_native);
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            // Unmarshal - Convert native data to managed data.
            __retVal = __retVal_native != 0;
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "GetTokenInformation", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __TokenHandle_native, uint __TokenInformationClass_native, nint __TokenInformation_native, uint __TokenInformationLength_native, uint* __ReturnLength_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Advapi32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial int RegConnectRegistry(string machineName, nint key, out global::Internal.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::Internal.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 Kernel32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial global::Microsoft.Win32.SafeHandles.SafeMemoryMappedFileHandle CreateFileMapping(global::Microsoft.Win32.SafeHandles.SafeFileHandle hFile, ref global::Interop.Kernel32.SECURITY_ATTRIBUTES lpFileMappingAttributes, int flProtect, int dwMaximumSizeHigh, int dwMaximumSizeLow, string lpName)
        {
            int __lastError;
            bool __invokeSucceeded = default;
            nint __hFile_native = default;
            global::Microsoft.Win32.SafeHandles.SafeMemoryMappedFileHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeMemoryMappedFileHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeFileHandle>.ManagedToUnmanagedIn __hFile_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __hFile_native__marshaller.FromManaged(hFile);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __lpName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(lpName))
                fixed (global::Interop.Kernel32.SECURITY_ATTRIBUTES* __lpFileMappingAttributes_native = &lpFileMappingAttributes)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __hFile_native = __hFile_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__hFile_native, __lpFileMappingAttributes_native, flProtect, dwMaximumSizeHigh, dwMaximumSizeLow, (ushort*)__lpName_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hFile_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "CreateFileMappingW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe nint __PInvoke(nint __hFile_native, global::Interop.Kernel32.SECURITY_ATTRIBUTES* __lpFileMappingAttributes_native, int __flProtect_native, int __dwMaximumSizeHigh_native, int __dwMaximumSizeLow_native, ushort* __lpName_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial global::Microsoft.Win32.SafeHandles.SafeMemoryMappedFileHandle CreateFileMapping(nint hFile, ref global::Interop.Kernel32.SECURITY_ATTRIBUTES lpFileMappingAttributes, int flProtect, int dwMaximumSizeHigh, int dwMaximumSizeLow, string lpName)
        {
            int __lastError;
            bool __invokeSucceeded = default;
            global::Microsoft.Win32.SafeHandles.SafeMemoryMappedFileHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeMemoryMappedFileHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            try
            {
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __lpName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(lpName))
                fixed (global::Interop.Kernel32.SECURITY_ATTRIBUTES* __lpFileMappingAttributes_native = &lpFileMappingAttributes)
                {
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(hFile, __lpFileMappingAttributes_native, flProtect, dwMaximumSizeHigh, dwMaximumSizeLow, (ushort*)__lpName_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __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 = "CreateFileMappingW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe nint __PInvoke(nint __hFile_native, global::Interop.Kernel32.SECURITY_ATTRIBUTES* __lpFileMappingAttributes_native, int __flProtect_native, int __dwMaximumSizeHigh_native, int __dwMaximumSizeLow_native, ushort* __lpName_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool DuplicateHandle(nint hSourceProcessHandle, global::System.Runtime.InteropServices.SafeHandle hSourceHandle, nint hTargetProcess, out global::Microsoft.Win32.SafeHandles.SafeWaitHandle targetHandle, int dwDesiredAccess, bool bInheritHandle, int dwOptions)
        {
            int __lastError;
            bool __invokeSucceeded = default;
            targetHandle = default;
            nint __hSourceHandle_native = default;
            nint __targetHandle_native = default;
            int __bInheritHandle_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeWaitHandle>.ManagedToUnmanagedOut __targetHandle_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Runtime.InteropServices.SafeHandle>.ManagedToUnmanagedIn __hSourceHandle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __bInheritHandle_native = (int)(bInheritHandle ? 1 : 0);
                __hSourceHandle_native__marshaller.FromManaged(hSourceHandle);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __hSourceHandle_native = __hSourceHandle_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(hSourceProcessHandle, __hSourceHandle_native, hTargetProcess, &__targetHandle_native, dwDesiredAccess, __bInheritHandle_native, dwOptions);
                    __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.
                __targetHandle_native__marshaller.FromUnmanaged(__targetHandle_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native != 0;
                targetHandle = __targetHandle_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __targetHandle_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hSourceHandle_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "DuplicateHandle", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __hSourceProcessHandle_native, nint __hSourceHandle_native, nint __hTargetProcess_native, nint* __targetHandle_native, int __dwDesiredAccess_native, int __bInheritHandle_native, int __dwOptions_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool FreeLibrary(nint hModule)
        {
            int __lastError;
            bool __retVal;
            int __retVal_native;
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal_native = __PInvoke(hModule);
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            // Unmarshal - Convert native data to managed data.
            __retVal = __retVal_native != 0;
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "FreeLibrary", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __hModule_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "GetComputerNameW", ExactSpelling = true)]
        private static unsafe extern partial int GetComputerName(char* lpBuffer, uint* nSize);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "GetCurrentProcess", ExactSpelling = true)]
        internal static extern partial nint GetCurrentProcess();
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "GetCurrentProcessId", ExactSpelling = true)]
        internal static extern partial uint GetCurrentProcessId();
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool GetProcessTimes(global::Microsoft.Win32.SafeHandles.SafeProcessHandle handle, out long creation, out long exit, out long kernel, out long user)
        {
            int __lastError;
            creation = default;
            exit = default;
            kernel = default;
            user = default;
            nint __handle_native = default;
            bool __retVal = default;
            int __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeProcessHandle>.ManagedToUnmanagedIn __handle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __handle_native__marshaller.FromManaged(handle);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (long* __user_native = &user)
                fixed (long* __kernel_native = &kernel)
                fixed (long* __exit_native = &exit)
                fixed (long* __creation_native = &creation)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __handle_native = __handle_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__handle_native, __creation_native, __exit_native, __kernel_native, __user_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.
                __handle_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "GetProcessTimes", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe int __PInvoke(nint __handle_native, long* __creation_native, long* __exit_native, long* __kernel_native, long* __user_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial nint LoadLibrary(string libFilename)
        {
            int __lastError;
            nint __retVal;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (void* __libFilename_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(libFilename))
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal = __PInvoke((ushort*)__libFilename_native);
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "LoadLibraryW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe nint __PInvoke(ushort* __libFilename_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial global::Microsoft.Win32.SafeHandles.SafeMemoryMappedViewHandle MapViewOfFile(global::Microsoft.Win32.SafeHandles.SafeMemoryMappedFileHandle hFileMappingObject, int dwDesiredAccess, int dwFileOffsetHigh, int dwFileOffsetLow, nuint dwNumberOfBytesToMap)
        {
            int __lastError;
            bool __invokeSucceeded = default;
            nint __hFileMappingObject_native = default;
            global::Microsoft.Win32.SafeHandles.SafeMemoryMappedViewHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeMemoryMappedViewHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeMemoryMappedFileHandle>.ManagedToUnmanagedIn __hFileMappingObject_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __hFileMappingObject_native__marshaller.FromManaged(hFileMappingObject);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __hFileMappingObject_native = __hFileMappingObject_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(__hFileMappingObject_native, dwDesiredAccess, dwFileOffsetHigh, dwFileOffsetLow, dwNumberOfBytesToMap);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __retVal_native__marshaller.FromUnmanaged(__retVal_native);
                // Unmarshal - Convert native data to managed data.
                __retVal = __retVal_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __retVal_native__marshaller.Free();
                }
 
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hFileMappingObject_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "MapViewOfFile", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe nint __PInvoke(nint __hFileMappingObject_native, int __dwDesiredAccess_native, int __dwFileOffsetHigh_native, int __dwFileOffsetLow_native, nuint __dwNumberOfBytesToMap_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial global::Microsoft.Win32.SafeHandles.SafeMemoryMappedFileHandle OpenFileMapping(int dwDesiredAccess, bool bInheritHandle, string lpName)
        {
            int __lastError;
            bool __invokeSucceeded = default;
            int __bInheritHandle_native = default;
            global::Microsoft.Win32.SafeHandles.SafeMemoryMappedFileHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeMemoryMappedFileHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __bInheritHandle_native = (int)(bInheritHandle ? 1 : 0);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __lpName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(lpName))
                {
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(dwDesiredAccess, __bInheritHandle_native, (ushort*)__lpName_native);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
 
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __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 = "OpenFileMappingW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe nint __PInvoke(int __dwDesiredAccess_native, int __bInheritHandle_native, ushort* __lpName_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial global::Microsoft.Win32.SafeHandles.SafeProcessHandle OpenProcess(int access, bool inherit, int processId)
        {
            int __lastError;
            bool __invokeSucceeded = default;
            int __inherit_native = default;
            global::Microsoft.Win32.SafeHandles.SafeProcessHandle __retVal = default;
            nint __retVal_native = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeProcessHandle>.ManagedToUnmanagedOut __retVal_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __inherit_native = (int)(inherit ? 1 : 0);
                {
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal_native = __PInvoke(access, __inherit_native, processId);
                    __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 = "OpenProcess", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(int __access_native, int __inherit_native, int __processId_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial bool UnmapViewOfFile(nint lpBaseAddress)
        {
            int __lastError;
            bool __retVal;
            int __retVal_native;
            {
                global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                __retVal_native = __PInvoke(lpBaseAddress);
                __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
            }
 
            // Unmarshal - Convert native data to managed data.
            __retVal = __retVal_native != 0;
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "UnmapViewOfFile", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __lpBaseAddress_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial nuint VirtualQuery(global::System.Runtime.InteropServices.SafeHandle lpAddress, ref global::Interop.Kernel32.MEMORY_BASIC_INFORMATION lpBuffer, nuint dwLength)
        {
            int __lastError;
            nint __lpAddress_native = default;
            nuint __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::System.Runtime.InteropServices.SafeHandle>.ManagedToUnmanagedIn __lpAddress_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __lpAddress_native__marshaller.FromManaged(lpAddress);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (global::Interop.Kernel32.MEMORY_BASIC_INFORMATION* __lpBuffer_native = &lpBuffer)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __lpAddress_native = __lpAddress_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal = __PInvoke(__lpAddress_native, __lpBuffer_native, dwLength);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __lpAddress_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "VirtualQuery", ExactSpelling = true)]
            static extern unsafe nuint __PInvoke(nint __lpAddress_native, global::Interop.Kernel32.MEMORY_BASIC_INFORMATION* __lpBuffer_native, nuint __dwLength_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial int WaitForSingleObject(global::Microsoft.Win32.SafeHandles.SafeWaitHandle handle, int timeout)
        {
            int __lastError;
            nint __handle_native = default;
            int __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeWaitHandle>.ManagedToUnmanagedIn __handle_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __handle_native__marshaller.FromManaged(handle);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __handle_native = __handle_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal = __PInvoke(__handle_native, timeout);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __handle_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "WaitForSingleObject", ExactSpelling = true)]
            static extern unsafe int __PInvoke(nint __handle_native, int __timeout_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Pdh
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial int PdhFormatFromRawValue(uint dwCounterType, uint dwFormat, ref long pTimeBase, ref global::Interop.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER pRawValue1, ref global::Interop.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER pRawValue2, ref global::Interop.Kernel32.PerformanceCounterOptions.PDH_FMT_COUNTERVALUE pFmtValue)
        {
            int __retVal;
            // Pin - Pin data in preparation for calling the P/Invoke.
            fixed (global::Interop.Kernel32.PerformanceCounterOptions.PDH_FMT_COUNTERVALUE* __pFmtValue_native = &pFmtValue)
            fixed (global::Interop.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER* __pRawValue2_native = &pRawValue2)
            fixed (global::Interop.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER* __pRawValue1_native = &pRawValue1)
            fixed (long* __pTimeBase_native = &pTimeBase)
            {
                __retVal = __PInvoke(dwCounterType, dwFormat, __pTimeBase_native, __pRawValue1_native, __pRawValue2_native, __pFmtValue_native);
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("pdh.dll", EntryPoint = "PdhFormatFromRawValue", ExactSpelling = true)]
            static extern unsafe int __PInvoke(uint __dwCounterType_native, uint __dwFormat_native, long* __pTimeBase_native, global::Interop.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER* __pRawValue1_native, global::Interop.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER* __pRawValue2_native, global::Interop.Kernel32.PerformanceCounterOptions.PDH_FMT_COUNTERVALUE* __pFmtValue_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class PerfCounter
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "PerfStopProvider", ExactSpelling = true)]
        internal static extern partial uint PerfStopProvider(nint hProvider);
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class PerfCounter
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static partial uint PerfStartProvider(ref global::System.Guid ProviderGuid, global::Interop.PerfCounter.PERFLIBREQUEST ControlCallback, out global::Microsoft.Win32.SafeHandles.SafePerfProviderHandle phProvider)
        {
            bool __invokeSucceeded = default;
            phProvider = default;
            nint __ControlCallback_native = default;
            nint __phProvider_native = default;
            uint __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafePerfProviderHandle>.ManagedToUnmanagedOut __phProvider_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __ControlCallback_native = ControlCallback != null ? global::System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(ControlCallback) : default;
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (global::System.Guid* __ProviderGuid_native = &ProviderGuid)
                {
                    __retVal = __PInvoke(__ProviderGuid_native, __ControlCallback_native, &__phProvider_native);
                }
 
                // NotifyForSuccessfulInvoke - Keep alive any managed objects that need to stay alive across the call.
                global::System.GC.KeepAlive(ControlCallback);
                __invokeSucceeded = true;
                // UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
                __phProvider_native__marshaller.FromUnmanaged(__phProvider_native);
                // Unmarshal - Convert native data to managed data.
                phProvider = __phProvider_native__marshaller.ToManaged();
            }
            finally
            {
                if (__invokeSucceeded)
                {
                    // CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
                    __phProvider_native__marshaller.Free();
                }
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "PerfStartProvider", ExactSpelling = true)]
            static extern unsafe uint __PInvoke(global::System.Guid* __ProviderGuid_native, nint __ControlCallback_native, nint* __phProvider_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class PerfCounter
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static unsafe partial global::Interop.PerfCounter.PerfCounterSetInstanceStruct* PerfCreateInstance(global::Microsoft.Win32.SafeHandles.SafePerfProviderHandle hProvider, ref global::System.Guid CounterSetGuid, string szInstanceName, uint dwInstance)
        {
            int __lastError;
            nint __hProvider_native = default;
            global::Interop.PerfCounter.PerfCounterSetInstanceStruct* __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafePerfProviderHandle>.ManagedToUnmanagedIn __hProvider_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __hProvider_native__marshaller.FromManaged(hProvider);
                // Pin - Pin data in preparation for calling the P/Invoke.
                fixed (void* __szInstanceName_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(szInstanceName))
                fixed (global::System.Guid* __CounterSetGuid_native = &CounterSetGuid)
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __hProvider_native = __hProvider_native__marshaller.ToUnmanaged();
                    global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
                    __retVal = __PInvoke(__hProvider_native, __CounterSetGuid_native, (ushort*)__szInstanceName_native, dwInstance);
                    __lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hProvider_native__marshaller.Free();
            }
 
            global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "PerfCreateInstance", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
            static extern unsafe global::Interop.PerfCounter.PerfCounterSetInstanceStruct* __PInvoke(nint __hProvider_native, global::System.Guid* __CounterSetGuid_native, ushort* __szInstanceName_native, uint __dwInstance_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class PerfCounter
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static unsafe partial uint PerfSetCounterSetInfo(global::Microsoft.Win32.SafeHandles.SafePerfProviderHandle hProvider, global::Interop.PerfCounter.PerfCounterSetInfoStruct* pTemplate, uint dwTemplateSize)
        {
            nint __hProvider_native = default;
            uint __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafePerfProviderHandle>.ManagedToUnmanagedIn __hProvider_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __hProvider_native__marshaller.FromManaged(hProvider);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __hProvider_native = __hProvider_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__hProvider_native, pTemplate, dwTemplateSize);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hProvider_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "PerfSetCounterSetInfo", ExactSpelling = true)]
            static extern unsafe uint __PInvoke(nint __hProvider_native, global::Interop.PerfCounter.PerfCounterSetInfoStruct* __pTemplate_native, uint __dwTemplateSize_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class PerfCounter
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static unsafe partial uint PerfDeleteInstance(global::Microsoft.Win32.SafeHandles.SafePerfProviderHandle hProvider, global::Interop.PerfCounter.PerfCounterSetInstanceStruct* InstanceBlock)
        {
            nint __hProvider_native = default;
            uint __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafePerfProviderHandle>.ManagedToUnmanagedIn __hProvider_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __hProvider_native__marshaller.FromManaged(hProvider);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __hProvider_native = __hProvider_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__hProvider_native, InstanceBlock);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hProvider_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "PerfDeleteInstance", ExactSpelling = true)]
            static extern unsafe uint __PInvoke(nint __hProvider_native, global::Interop.PerfCounter.PerfCounterSetInstanceStruct* __InstanceBlock_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class PerfCounter
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        internal static unsafe partial uint PerfSetCounterRefValue(global::Microsoft.Win32.SafeHandles.SafePerfProviderHandle hProvider, global::Interop.PerfCounter.PerfCounterSetInstanceStruct* pInstance, uint CounterId, void* lpAddr)
        {
            nint __hProvider_native = default;
            uint __retVal = default;
            // Setup - Perform required setup.
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafePerfProviderHandle>.ManagedToUnmanagedIn __hProvider_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __hProvider_native__marshaller.FromManaged(hProvider);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __hProvider_native = __hProvider_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__hProvider_native, pInstance, CounterId, lpAddr);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __hProvider_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "PerfSetCounterRefValue", ExactSpelling = true)]
            static extern unsafe uint __PInvoke(nint __hProvider_native, global::Interop.PerfCounter.PerfCounterSetInstanceStruct* __pInstance_native, uint __CounterId_native, void* __lpAddr_native);
        }
    }
}