CPF/CPF.Skia/GlContexts/Wgl/Kernel32.cs
2023-11-21 23:05:03 +08:00

26 lines
668 B
C#

using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace CPF.Skia
{
public class Kernel32
{
private const string kernel32 = "kernel32.dll";
static Kernel32()
{
CurrentModuleHandle = Kernel32.GetModuleHandle(null);
if (CurrentModuleHandle == IntPtr.Zero)
{
throw new Exception("Could not get module handle.");
}
}
public static IntPtr CurrentModuleHandle { get; }
[DllImport(kernel32, CallingConvention = CallingConvention.Winapi, BestFitMapping = false, ThrowOnUnmappableChar = true)]
public static extern IntPtr GetModuleHandle([MarshalAs(UnmanagedType.LPTStr)] string lpModuleName);
}
}