Esempio n. 1
0
        /// <summary>
        /// считываем Byte по одному оффсету
        /// </summary>
        /// <param name="handle"></param>
        /// <param name="address"></param>
        /// <returns></returns>
        public static byte CalcByteValue(IntPtr handle, Int32 address)
        {
            IntPtr read;

            byte[] buffer = new byte[1];
            WinApi.ReadProcessMemory(handle, (IntPtr)address, buffer, buffer.Length, out read);
            return(buffer[0]);
        }
Esempio n. 2
0
        /// <summary>
        /// считываем Float по одному оффсету
        /// </summary>
        /// <param name="handle"></param>
        /// <param name="address"></param>
        /// <returns></returns>
        public static float CalcFloatValue(IntPtr handle, Int32 address)
        {
            IntPtr read;

            byte[] buffer = new byte[50];
            WinApi.ReadProcessMemory(handle, (IntPtr)address, buffer, buffer.Length, out read);
            float x = BitConverter.ToSingle(buffer, 0);

            return(x);
        }
Esempio n. 3
0
        /// <summary>
        /// считываем String по одному оффсету с кодировкой ASCII
        /// </summary>
        /// <param name="handle"></param>
        /// <param name="address"></param>
        /// <returns></returns>
        public static string CalcStringValue_ASCII(IntPtr handle, Int32 address)
        {
            IntPtr read;

            byte[] buffer = new byte[300];
            WinApi.ReadProcessMemory(handle, (IntPtr)address, buffer, buffer.Length, out read);
            string x = Encoding.ASCII.GetString(buffer);

            return((x.IndexOf('\0') != -1) ? x.Substring(0, x.IndexOf('\0')) : x);
        }
Esempio n. 4
0
        /// <summary>
        /// считываем Int32 по одному оффсету
        /// </summary>
        /// <param name="handle"></param>
        /// <param name="address"></param>
        /// <returns></returns>
        public static Int32 CalcInt32Value(IntPtr handle, Int32 address)
        {
            IntPtr read;

            byte[] buffer = new byte[4];
            WinApi.ReadProcessMemory(handle, (IntPtr)address, buffer, buffer.Length, out read);
            Int32 x = BitConverter.ToInt32(buffer, 0);

            return(x);
        }