Beispiel #1
0
        /// <summary>
        /// Reads a value from memory.
        /// </summary>
        /// <param name="dwAddress">Address at which value will be read.</param>
        /// <param name="bReverse">Determines whether bytes read will be reversed or not (Little endian or big endian).  Usually 'false'.</param>
        /// <exception cref="Exception">Throws general exception on failure.</exception>
        /// <returns>Returns the value that was read from memory.</returns>
        /// <remarks>Sometimes one needs to read a value where the most significant bytes is not first (i.e. when reading a network packet from memory).  In this case, one would specify 'true' for the bReverse parameter to get the value in a readable format.</remarks>
        public ushort ReadUShort(uint dwAddress, bool bReverse)
        {
            if (!this.m_bProcessOpen || this.m_hProcess == IntPtr.Zero)
            {
                throw new Exception("Process is not open for read/write.");
            }

            return(SMemory.ReadUShort(this.m_hProcess, dwAddress, bReverse));
        }