Beispiel #1
0
 /// <summary>
 /// Reads the string from CodeArray.
 /// </summary>
 /// <param name="codeArray">The code array.</param>
 /// <returns>Read string from CodeArray.</returns>
 public static string ReadString(this CodeArray <char> codeArray)
 {
     if (codeArray.variable != null)
     {
         return(UserType.ReadString(codeArray.variable.GetCodeType().Module.Process, codeArray.variable.GetPointerAddress(), (int)codeArray.variable.GetCodeType().ElementType.Size, codeArray.Length));
     }
     else
     {
         return(new string(codeArray.ToArray()));
     }
 }
Beispiel #2
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));
        }
Beispiel #3
0
 /// <summary>
 /// Reads the Unicode string from CodePointer.
 /// </summary>
 /// <param name="length">The number of characters. If length is -1, string is null terminated.</param>
 /// <returns>Read Unicode string from CodePointer.</returns>
 public string ReadUnicodeString(int length = -1)
 {
     return(UserType.ReadString(GetCodeType().Module.Process, GetPointerAddress(), 2, length));
 }
Beispiel #4
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));
 }