예제 #1
0
        /// <summary>
        /// Reads the string from CodePointer with length specified as number of bytes.
        /// </summary>
        /// <param name="codePointer">The code pointer.</param>
        /// <param name="length">The length in bytes. If length is -1, string is null terminated</param>
        /// <returns>Read string from CodePointer.</returns>
        public static string ReadStringByteLength(this CodePointer <char> codePointer, int length = -1)
        {
            int charSize = (int)codePointer.GetCodeType().ElementType.Size;

            if (length % charSize != 0)
            {
                throw new ArgumentOutOfRangeException(nameof(length));
            }

            return(UserType.ReadString(codePointer.GetCodeType().Module.Process, codePointer.GetPointerAddress(), charSize, length / charSize));
        }
예제 #2
0
 /// <summary>
 /// Reads the string from CodePointer.
 /// </summary>
 /// <param name="codePointer">The code pointer.</param>
 /// <param name="length">The length in characters. If length is -1, string is null terminated</param>
 /// <returns>Read string from CodePointer.</returns>
 public static string ReadString(this CodePointer <char> codePointer, int length = -1)
 {
     return(UserType.ReadString(codePointer.GetCodeType().Module.Process, codePointer.GetPointerAddress(), (int)codePointer.GetCodeType().ElementType.Size, length));
 }