internal void LoadAndCallMethod(string Library, string MethodName) { PerformValidationCheck(Library); var LoadedLibraryPTR = Load(Library); var LibraryToLoadCurrentProcPTR = NativeImport.LoadLibrary(Library); var PTRToMethod = NativeImport.GetProcAddress(LibraryToLoadCurrentProcPTR, MethodName); CallMethod(PTRToMethod, IntPtr.Zero); }
internal Loader(string ProcessName) { try { LoadedProcess = Process.GetProcessesByName(ProcessName).First(); } catch (Exception) { Console.WriteLine($"Could Not Find Process: {ProcessName}"); Console.Read(); Environment.Exit(0); } Kernel32PTR = NativeImport.LoadLibrary("kernel32"); LoadLibraryPTR = NativeImport.GetProcAddress(Kernel32PTR, "LoadLibraryA"); }
internal static IntPtr GetFunctionAddress(string LibraryName, string FunctionName) { IntPtr HModule = NativeImport.LoadLibrary(LibraryName); return(NativeImport.GetProcAddress(HModule, FunctionName)); }
public static nint GetFunctionAddress(string libName, string funcName) => NativeImport.GetProcAddress(NativeImport.LoadLibrary(libName), funcName);