using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using NtApiDotNet.Win32;
namespace RPCMon.Control
{
public static class Win32NativeMethods
{
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
internal static extern SafeLoadLibraryHandle LoadLibraryEx(string name, IntPtr reserved, LoadLibraryFlags flags);
public static bool isSucceedLoadLibrary(string i_Name, LoadLibraryFlags flags)
{
bool isSuceed = false;
SafeLoadLibraryHandle ret = LoadLibraryEx(i_Name, IntPtr.Zero, flags);
if (!ret.IsInvalid)
{
isSuceed = true;
}
return isSuceed;
}
}
public enum LoadLibraryFlags
{
///
/// None.
///
None = 0,
///
/// Don't resolve DLL references
///
DontResolveDllReferences = 0x00000001,
///
/// Load library as a data file.
///
LoadLibraryAsDataFile = 0x00000002,
///
/// Load with an altered search path.
///
LoadWithAlteredSearchPath = 0x00000008,
///
/// Ignore code authz level.
///
LoadIgnoreCodeAuthzLevel = 0x00000010,
///
/// Load library as an image resource.
///
LoadLibraryAsImageResource = 0x00000020,
///
/// Load library as a data file exclusively.
///
LoadLibraryAsDataFileExclusive = 0x00000040,
///
/// Add the DLL's directory temporarily to the search list.
///
LoadLibrarySearchDllLoadDir = 0x00000100,
///
/// Search application directory for the DLL.
///
LoadLibrarySearchApplicationDir = 0x00000200,
///
/// Search the user's directories for the DLL.
///
LoadLibrarySearchUserDirs = 0x00000400,
///
/// Search system32 for the DLL.
///
LoadLibrarySearchSystem32 = 0x00000800,
///
/// Search the default directories for the DLL.
///
LoadLibrarySearchDefaultDirs = 0x00001000,
}
}