コード例 #1
0
 public static void RefreshData()
 {
     using (ModuleSnapshot snapshot = new ModuleSnapshot(Process.GetCurrentProcess().MainModule))
     {
         _clientVersion1 = GetVersion(snapshot, "8B 55 EC 8B 35 ? ? ? ?", 5);
         _clientVersion2 = GetVersion(snapshot, "66 83 02 0C 8B 3D ? ? ? ?", 6);
         _tables         = new MessageTables(GetGameMessages(snapshot, "55 8B EC 8B 45 08 0F B7 C0 3D 88 13 00 00"), GetSystemMessages(snapshot, "55 8B EC 8B 45 08 85 C0 78 10 3D ? ? ? ?", 11));
         //Analog to GetGameMessages: 55 8B EC 0F B7 45 08 3D 88 13 00 00
     }
 }
コード例 #2
0
        private static Dictionary <ushort, string> GetSystemMessages(ModuleSnapshot snapshot, string pattern, int patternOffset)
        {
            Dictionary <ushort, string> result = new Dictionary <ushort, string>();
            IntPtr             funcAddress     = new IntPtr(snapshot.FindPattern(pattern, 0, 0, false, false));
            GetMessageNameFunc func            = funcAddress.ToDelegate <GetMessageNameFunc>();
            uint count = LocalMemory.Read <uint>(funcAddress + patternOffset);

            for (ushort i = 0; i < count; i++)
            {
                result.Add(i, Marshal.PtrToStringUni(func(i)));
            }
            return(result);
        }
コード例 #3
0
        private static Dictionary <ushort, string> GetGameMessages(ModuleSnapshot snapshot, string pattern)
        {
            Dictionary <ushort, string> result = new Dictionary <ushort, string>();
            GetMessageNameFunc          func   = new IntPtr(snapshot.FindPattern(pattern, 0, 0, false, false)).ToDelegate <GetMessageNameFunc>();

            for (ushort i = 0; i < ushort.MaxValue; i++)
            {
                string opCodeName;
                if ((opCodeName = Marshal.PtrToStringAnsi(func(i))) != string.Empty)
                {
                    result.Add(i, opCodeName);
                }
            }
            return(result);
        }
コード例 #4
0
 private static uint GetVersion(ModuleSnapshot snapshot, string pattern, int patternOffset) => LocalMemory.Read <uint>((IntPtr)snapshot.FindPattern(pattern, patternOffset, 0, true, false));