Exemplo n.º 1
0
        public ulong GetTailAddress(PointerResult pointerResult, MappedSectionList mappedSectionList)
        {
            ulong tailAddress = pointerResult.GetBaseAddress(mappedSectionList);

            if (pointerResult.Offsets.Length > 0)
            {
                int     j       = 0;
                Pointer pointer = new Pointer();
                int     index   = GetPointerByAddress(tailAddress, ref pointer);
                if (index < 0)
                {
                    return(0);
                }
                tailAddress = pointer.PointerValue;
                for (j = 0; j < pointerResult.Offsets.Length - 1; ++j)
                {
                    index = GetPointerByAddress((ulong)((long)tailAddress + pointerResult.Offsets[j]), ref pointer);
                    if (index < 0)
                    {
                        return(0);
                    }
                    tailAddress = pointer.PointerValue;
                }

                tailAddress = (ulong)((long)tailAddress + pointerResult.Offsets[j]);
            }

            return(tailAddress);
        }
Exemplo n.º 2
0
        public ulong GetBaseAddress(MappedSectionList mappedSectionList)
        {
            if (BaseSectionID >= mappedSectionList.Count)
            {
                return(0);
            }

            MappedSection section = mappedSectionList[BaseSectionID];

            return(section.Start + BaseOffset);
        }
Exemplo n.º 3
0
        public GameInfo()
        {
            string process_name   = "";
            string section_name   = "";
            ulong  id_offset      = 0;
            ulong  version_offset = 0;
            int    section_prot   = 0;

            switch (Util.Version)
            {
            case 405:
                process_name   = GAME_INFO_4_05_PROCESS_NAME;
                section_name   = GAME_INFO_4_05_SECTION_NAME;
                id_offset      = GAME_INFO_4_05_ID_OFFSET;
                version_offset = GAME_INFO_4_05_VERSION_OFFSET;
                section_prot   = GAME_INFO_4_05_SECTION_PROT;
                break;

            case 455:
                process_name   = GAME_INFO_4_55_PROCESS_NAME;
                section_name   = GAME_INFO_4_55_SECTION_NAME;
                id_offset      = GAME_INFO_4_55_ID_OFFSET;
                version_offset = GAME_INFO_4_55_VERSION_OFFSET;
                section_prot   = GAME_INFO_4_55_SECTION_PROT;
                break;

            default:
                break;
            }

            try
            {
                ProcessManager processManager = new ProcessManager();
                ProcessInfo    processInfo    = processManager.GetProcessInfo(process_name);

                MemoryHelper      memoryHelper      = new MemoryHelper(false, processInfo.pid);
                MappedSectionList mappedSectionList = processManager.MappedSectionList;
                mappedSectionList.InitMemorySectionList(processInfo);
                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
            {
            }
        }
Exemplo n.º 4
0
        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
            {
            }
        }
Exemplo n.º 5
0
 public ProcessManager()
 {
     MappedSectionList = new MappedSectionList();
 }