private MIntPtr GetRemoteProcAddress(string Module, string Function) { Target.Refresh(); var Handle = LoadLibraryA(Module); MIntPtr func = Imports.GetProcAddress(Handle, Function); if (!func) { return(IntPtr.Zero); } ulong offset = func.ToUInt64() - Handle.ToUInt64(); return(Target.GetModuleByName(Module).Sum(offset)); }
/// <summary> /// Parse a MIntPtr to your generic type /// </summary> /// <typeparam name="T">The MIntPtr Type</typeparam> /// <param name="Pointer">The Pointer to Parse</param> /// <returns>The Converted Type</returns> public static T Parse <T>(this MIntPtr <T> Pointer) => Pointer;
public static MIntPtr Sum(this MIntPtr Pointer, long Value) => (Pointer.ToUInt64() + (ulong)Value).ToIntPtr();
public static uint HighToUInt32(this MIntPtr Ptr) => unchecked ((uint)((IntPtr)Ptr) >> 32);
public static uint ToUInt32(this MIntPtr Ptr) => unchecked ((uint)(((IntPtr)Ptr).ToInt64() & 0xFFFFFFFF));
public static ulong ToUInt64(this MIntPtr Ptr) => unchecked ((ulong)((IntPtr)Ptr).ToInt64());