using System; using System.Runtime.InteropServices; using System.Security; namespace TurnoffMonitorOnLock.IconExtract { internal static class NativeMethods { [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] public static extern IntPtr LoadLibraryEx(string lpFileName, IntPtr hFile, uint dwFlags); [DllImport("kernel32.dll", SetLastError = true)] [SuppressUnmanagedCodeSecurity] public static extern bool FreeLibrary(IntPtr hModule); [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] public static extern bool EnumResourceNames(IntPtr hModule, IntPtr lpszType, Enumresnameproc lpEnumFunc, IntPtr lParam); [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] public static extern IntPtr FindResource(IntPtr hModule, IntPtr lpName, IntPtr lpType); [DllImport("kernel32.dll", SetLastError = true)] [SuppressUnmanagedCodeSecurity] public static extern IntPtr LoadResource(IntPtr hModule, IntPtr hResInfo); [DllImport("kernel32.dll", SetLastError = true)] [SuppressUnmanagedCodeSecurity] public static extern IntPtr LockResource(IntPtr hResData); [DllImport("kernel32.dll", SetLastError = true)] [SuppressUnmanagedCodeSecurity] public static extern uint SizeofResource(IntPtr hModule, IntPtr hResInfo); } [UnmanagedFunctionPointer(CallingConvention.Winapi, SetLastError = true, CharSet = CharSet.Unicode)] [SuppressUnmanagedCodeSecurity] internal delegate bool Enumresnameproc(IntPtr hModule, IntPtr lpszType, IntPtr lpszName, IntPtr lParam); }