private int registerHotKey(string hotKey, int hotKeyid) { char[] separator = new char[] { '+' }; Keys none = Keys.None; SysApi.KeyModifiers fsModifiers = SysApi.KeyModifiers.None; foreach (string str in hotKey.Replace(" ", "").Split(separator)) { try { fsModifiers |= (SysApi.KeyModifiers)Enum.Parse(typeof(SysApi.KeyModifiers), str); } catch { try { none = (Keys)Enum.Parse(typeof(Keys), str); break; } catch { return(0); } } } fsModifiers |= SysApi.KeyModifiers.Norepeat; if (SysApi.RegisterHotKey(this.formIntPtr, hotKeyid, fsModifiers, (int)none)) { return(hotKeyid); } return(0); }
public static Module GetModule(Process process, string ModuleName) { SysApi.MODULEENTRY32 lppe = new SysApi.MODULEENTRY32(); if ((ModuleName == "") || (ModuleName == null)) { throw new Exception("Can't find module"); } IntPtr hSnapShot = SysApi.CreateToolhelp32Snapshot(8, process.Id); if (hSnapShot != IntPtr.Zero) { lppe.dwSize = Marshal.SizeOf(typeof(SysApi.MODULEENTRY32)); if (SysApi.Module32First(hSnapShot, ref lppe) != 0) { do { if (lppe.szModule.ToLower() == ModuleName.ToLower()) { Module module1 = new Module { ProcessID = lppe.th32ProcessID, BaseAddr = lppe.modBaseAddr, BaseSize = lppe.modBaseSize, hModule = lppe.hModule, szModule = lppe.szModule, szExePath = lppe.szExePath }; SysApi.CloseHandle(hSnapShot); return(module1); } }while (SysApi.Module32Next(hSnapShot, ref lppe) != 0); } SysApi.CloseHandle(hSnapShot); } throw new Exception("Can't find module. code = " + SysApi.GetLastError()); }
public static uint ReadMemory(Process Process, uint Address, int size) { uint num; SysApi.ReadProcessMemory(Process.Handle, Address, out num, size, 0); return(num); }
public static int GetSystemBits() { SysApi.SYSTEM_INFO system_info; SysApi.GetNativeSystemInfo(out system_info); if ((system_info.wProcessorArchitecture != 9) && (system_info.wProcessorArchitecture != 6)) { return(0x20); } return(0x40); }
public static int getProcessBits() { bool flag; SysApi.IsWow64Process(SysApi.GetCurrentProcess(), out flag); if ((GetSystemBits() == 0x40) && !flag) { return(0x40); } return(0x20); }
public static int WriteMemory(Process Process, uint[] Offset, uint Value, int size) { uint lpBuffer = 0; uint lpBaseAddress = Offset[0]; for (int i = 1; i < Offset.GetLength(0); i++) { SysApi.ReadProcessMemory(Process.Handle, lpBaseAddress, out lpBuffer, 4, 0); lpBaseAddress = Offset[i] + lpBuffer; } return(SysApi.WriteProcessMemory(Process.Handle, lpBaseAddress, ref Value, size, 0)); }
public void reload() { this.lockedMemory.Clear(); this.memories.Clear(); this.baseAddress.Clear(); this.pluginMemory.Clear(); this.plugins.Clear(); for (int i = 0; i < this.shortcut.Count <string>(); i++) { SysApi.UnregisterHotKey(this.formIntPtr, i + 0x3e8); } this.PluginInit(this.profilePath, this.formIntPtr); }
public static int getProcessBits(Process process) { bool flag; IntPtr hProcess = SysApi.OpenProcess(0x400, 0, process.Id); SysApi.IsWow64Process(hProcess, out flag); SysApi.CloseHandle(hProcess); if ((GetSystemBits() == 0x40) && !flag) { return(0x40); } return(0x20); }
public static uint ReadMemory(Process Process, uint[] Offset, int size) { uint lpBuffer = 0; uint num2 = 0; uint lpBaseAddress = Offset[0]; for (int i = 1; i < Offset.GetLength(0); i++) { SysApi.ReadProcessMemory(Process.Handle, lpBaseAddress, out num2, 4, 0); lpBaseAddress = Offset[i] + num2; } SysApi.ReadProcessMemory(Process.Handle, lpBaseAddress, out lpBuffer, size, 0); return(lpBuffer); }
protected virtual void Dispose(bool disposing) { if (disposing && this.isInit) { this.lockedMemory.Clear(); this.memories.Clear(); this.baseAddress.Clear(); this.pluginMemory.Clear(); this.plugins.Clear(); this.lockedMemory = null; this.memories = null; this.baseAddress = null; this.pluginMemory = null; for (int i = 0; i < this.shortcut.Count <string>(); i++) { SysApi.UnregisterHotKey(this.formIntPtr, i + 0x3e8); } this.isInit = false; } else { GC.SuppressFinalize(this); } }
private void lockedMem() { do { try { foreach (PluginMemory memory in this.lockedMemory.Values) { string baseAddress = this.memories[memory.memory].baseAddress; string module = this.baseAddress[baseAddress].module; uint num = sting2uint(this.baseAddress[baseAddress].address); if (module != "") { num += this.gameMemory.GetModuleAddress(module); } this.memories[memory.memory].offsets.Insert(0, num.ToString()); uint[] offset = this.memories[memory.memory].offsets.ToUIntArray(); this.memories[memory.memory].offsets.RemoveAt(0); this.gameMemory.WriteMemory(offset, sting2uint(memory.free), memory.size); } SysApi.Sleep(100); } catch { } }while (this.isInit); }
public static int WriteMemory(Process Process, uint Address, uint Value, int size) { return(SysApi.WriteProcessMemory(Process.Handle, Address, ref Value, size, 0)); }