public ReflectMeBro() { try { MapMe = AppDomain.CurrentDomain.Load(Properties.Resources.ManualMapper); WinAPI = MapMe.GetType("ManualMapper.WinAPI"); ReadRemoteMemory = WinAPI.GetMethod("ReadRemoteMemory"); WriteProcessMemory = WinAPI.GetMethod("WriteProcessMemory"); GetProcAddressEx = WinAPI.GetMethod("GetProcAddressEx"); NtCreateThreadEx = WinAPI.GetMethod("NtCreateThreadEx"); WaitForSingleObject = WinAPI.GetMethod("WaitForSingleObject"); VirtualAllocEx = WinAPI.GetMethod("VirtualAllocEx"); VirtualFreeEx = WinAPI.GetMethod("VirtualFreeEx"); CloseHandle = WinAPI.GetMethod("CloseHandle"); OpenHandle = WinAPI.GetMethod("OpenProcess"); Injector = MapMe.GetType("ManualMapper.InjectionMethod").GetMethod("Create"); InjectionEnum = MapMe.GetType("ManualMapper.InjectionMethodType"); PortableExecutable = MapMe.GetType("ManualMapper.PortableExecutable").GetConstructor(new[] { typeof(byte[]) }); MapMe.GetType("ManualMapper.ReflectionHelper").GetMethod("AddHandler").Invoke(null, null); } catch (Exception ex) { MessageBox.Show("Encountered an unrecoverable error, Now closing. Error: " + ex.Message); Process.GetCurrentProcess().Close(); } }
private IntPtr Inject(object instance, object img, IntPtr hProc) { var methodSig = new[] { img.GetType(), typeof(IntPtr) }; return ((IntPtr) MapMe.GetType("ManualMapper.ManualMap") .GetMethod("Inject", methodSig) .Invoke(instance, new[] { img, hProc })); }