Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ID"></param>
        /// <returns>未初始化或数据未定义返回-1</returns>
        public static int GetSign(string ID)
        {
            if (SignHead == 0)
            {
                return(-1);
            }
            byte[] content = new byte[1024 * 8];
            NativeFunctions.ReadProcessMemory(GameContext.HContext.Handle, SignHead, content, SignSize - 20, 0);            //去掉头部的20个位置,这20个位置最后四个是数量(int)
            byte[] h = AobscanHelper.GetHexCodeFromString(ID);
            int    j = AobscanHelper.Memmem(content, content.Length, h, h.Length);

            if (j == -1)
            {
                return(-1);
            }
            return(BitConverter.ToInt32(content, j + 16));
        }
Example #2
0
        public static void SetSign(string ID, int v)
        {
            if (SignHead == 0)
            {
                return;
            }
            byte[] content = new byte[1024 * 8];
            NativeFunctions.ReadProcessMemory(GameContext.HContext.Handle, SignHead, content, SignSize - 20, 0);            //去掉头部的20个位置,这20个位置最后四个是数量(int)
            byte[] h = AobscanHelper.GetHexCodeFromString(ID);
            int    j = AobscanHelper.Memmem(content, content.Length, h, h.Length);

            if (j != -1)            //-1说明没找到
            {
                NativeFunctions.WriteProcessMemory(GameContext.HContext.Handle, SignHead + j + 16, ref v, 4, 0);
            }
            else
            {
                int u = GetSignNumber();
                NativeFunctions.WriteProcessMemory(GameContext.HContext.Handle, SignHead + u * 20, h, 16, 0);              //写入标记
                NativeFunctions.WriteProcessMemory(GameContext.HContext.Handle, SignHead + u * 20 + 16, ref v, 4, 0);      //写入数据
                u++;
                NativeFunctions.WriteProcessMemory(GameContext.HContext.Handle, SignHead - 4, ref u, 4, 0);                //长度+1
            }
        }