private void processes_comboBox_SelectedIndexChanged(object sender, EventArgs e) { try { section_list_box.Items.Clear(); result_list_view.Items.Clear(); new_scan_btn.Enabled = true; valueTypeList.Enabled = true; compareTypeList.Enabled = true; section_list_box.Enabled = true; ProcessInfo?maybeProcessInfo = processManager.GetProcessInfo(processes_comboBox.Text); if (maybeProcessInfo is null) { msg.Text = "No process information found."; return; } ProcessInfo processInfo = (ProcessInfo)maybeProcessInfo; Util.DefaultProcessID = processInfo.pid; ProcessMap processMap = MemoryHelper.GetProcessMaps(processInfo.pid); if (processMap is null) { msg.Text = "No process maps found."; return; } processManager.MappedSectionList.InitMemorySectionList(processMap); section_list_box.BeginUpdate(); for (int i = 0; i < processManager.MappedSectionList.Count; ++i) { section_list_box.Items.Add(processManager.MappedSectionList.GetSectionName(i), false); } section_list_box.EndUpdate(); } catch (Exception exception) { MessageBox.Show(exception.Message); } }
public GameInfo() { Dictionary <string, object> gameInfo = gameInfos[0]; if (gameInfos.ContainsKey(Util.Version)) { gameInfo = gameInfos[Util.Version]; } string process_name = (string)gameInfo["process_name"]; string section_name = (string)gameInfo["section_name"]; ulong id_offset = Convert.ToUInt64(gameInfo["id_offset"]); ulong version_offset = Convert.ToUInt64(gameInfo["version_offset"]); int section_prot = Convert.ToInt32(gameInfo["section_prot"]); try { ProcessManager processManager = new ProcessManager(); ProcessInfo processInfo = processManager.GetProcessInfo(process_name); MemoryHelper memoryHelper = new MemoryHelper(false, processInfo.pid); MappedSectionList mappedSectionList = processManager.MappedSectionList; mappedSectionList.InitMemorySectionList(MemoryHelper.GetProcessMaps(processInfo.pid)); List <MappedSection> sectionList = mappedSectionList.GetMappedSectionList(section_name, section_prot); if (sectionList.Count != 1) { return; } GameID = System.Text.Encoding.Default.GetString(memoryHelper.ReadMemory(sectionList[0].Start + id_offset, 16)); GameID = GameID.Trim(new char[] { '\0' }); Version = System.Text.Encoding.Default.GetString(memoryHelper.ReadMemory(sectionList[0].Start + version_offset, 16)); Version = Version.Trim(new char[] { '\0' }); } catch { } }
public GameInfo() { string process_name = ""; string section_name = ""; ulong id_offset = 0; ulong version_offset = 0; int section_prot = 0; switch (Util.Version) { case 702: process_name = GAME_INFO_7_02_PROCESS_NAME; section_name = GAME_INFO_7_02_SECTION_NAME; id_offset = GAME_INFO_7_02_ID_OFFSET; version_offset = GAME_INFO_7_02_VERSION_OFFSET; section_prot = GAME_INFO_7_02_SECTION_PROT; break; case 672: process_name = GAME_INFO_6_72_PROCESS_NAME; section_name = GAME_INFO_6_72_SECTION_NAME; id_offset = GAME_INFO_6_72_ID_OFFSET; version_offset = GAME_INFO_6_72_VERSION_OFFSET; section_prot = GAME_INFO_6_72_SECTION_PROT; break; case 505: process_name = GAME_INFO_5_05_PROCESS_NAME; section_name = GAME_INFO_5_05_SECTION_NAME; id_offset = GAME_INFO_5_05_ID_OFFSET; version_offset = GAME_INFO_5_05_VERSION_OFFSET; section_prot = GAME_INFO_5_05_SECTION_PROT; break; default: break; } try { ProcessManager processManager = new ProcessManager(); ProcessInfo? maybeProcessInfo = processManager.GetProcessInfo(process_name); if (maybeProcessInfo is null) { return; } ProcessInfo processInfo = (ProcessInfo)maybeProcessInfo; MemoryHelper memoryHelper = new MemoryHelper(false, processInfo.pid); MappedSectionList mappedSectionList = processManager.MappedSectionList; ProcessMap processMap = MemoryHelper.GetProcessMaps(processInfo.pid); if (processMap is null) { return; } mappedSectionList.InitMemorySectionList(processMap); List <MappedSection> sectionList = mappedSectionList.GetMappedSectionList(section_name, section_prot); if (sectionList.Count != 1) { return; } GameID = System.Text.Encoding.Default.GetString(memoryHelper.ReadMemory(sectionList[0].Start + id_offset, 16)); GameID = GameID.Trim(new char[] { '\0' }); Version = System.Text.Encoding.Default.GetString(memoryHelper.ReadMemory(sectionList[0].Start + version_offset, 16)); Version = Version.Trim(new char[] { '\0' }); } catch { } }
public ProcessMap GetProcessMaps(int pid) { ProcessMap processMap = MemoryHelper.GetProcessMaps(pid); return(processMap); }