File: _generated\0\LibraryImports.g.cs
Web Access
Project: src\src\runtime\src\libraries\System.Management\src\System.Management.csproj (System.Management)
// <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]
        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.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial nint GetProcAddress(global::Microsoft.Win32.SafeHandles.SafeLibraryHandle hModule, string lpProcName)
        {
            nint __hModule_native = default;
            byte* __lpProcName_native = default;
            nint __retVal = default;
            // Setup - Perform required setup.
            scoped global::System.Runtime.InteropServices.Marshalling.AnsiStringMarshaller.ManagedToUnmanagedIn __lpProcName_native__marshaller = new();
            global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeLibraryHandle>.ManagedToUnmanagedIn __hModule_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __lpProcName_native__marshaller.FromManaged(lpProcName, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.AnsiStringMarshaller.ManagedToUnmanagedIn.BufferSize]);
                __hModule_native__marshaller.FromManaged(hModule);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __lpProcName_native = __lpProcName_native__marshaller.ToUnmanaged();
                    __hModule_native = __hModule_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(__hModule_native, __lpProcName_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __lpProcName_native__marshaller.Free();
                __hModule_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "GetProcAddress", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __hModule_native, byte* __lpProcName_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
        [global::System.Runtime.CompilerServices.SkipLocalsInitAttribute]
        public static partial nint GetProcAddress(nint hModule, string lpProcName)
        {
            byte* __lpProcName_native = default;
            nint __retVal = default;
            // Setup - Perform required setup.
            scoped global::System.Runtime.InteropServices.Marshalling.AnsiStringMarshaller.ManagedToUnmanagedIn __lpProcName_native__marshaller = new();
            try
            {
                // Marshal - Convert managed data to native data.
                __lpProcName_native__marshaller.FromManaged(lpProcName, stackalloc byte[global::System.Runtime.InteropServices.Marshalling.AnsiStringMarshaller.ManagedToUnmanagedIn.BufferSize]);
                {
                    // PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
                    __lpProcName_native = __lpProcName_native__marshaller.ToUnmanaged();
                    __retVal = __PInvoke(hModule, __lpProcName_native);
                }
            }
            finally
            {
                // CleanupCallerAllocated - Perform cleanup of caller allocated resources.
                __lpProcName_native__marshaller.Free();
            }
 
            return __retVal;
            // Local P/Invoke
            [global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "GetProcAddress", ExactSpelling = true)]
            static extern unsafe nint __PInvoke(nint __hModule_native, byte* __lpProcName_native);
        }
    }
}
internal static unsafe partial class Interop
{
    internal static unsafe partial class Kernel32
    {
        [global::System.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 Ole32
    {
        [global::System.Runtime.InteropServices.DllImportAttribute("ole32.dll", EntryPoint = "CoGetObjectContext", ExactSpelling = true)]
        internal static unsafe extern partial int CoGetObjectContext(global::System.Guid* riid, nint* ppv);
    }
}