Erm..
Copy+Pasta from my Lib; This would return a utf-8/unicode string.
Code:
public string ReadUnicode(Process Proc, int Address) //>> Returns a Unicode string <<
{
try
{
ReadProcessMemory(Proc.Handle, Address, bytes, bytes.Length, 0);
return UnicodeDecoder(bytes);
}
catch { return null; }
}
string UnicodeDecoder(byte[] bytes) //>> The function that returns a string from bytes in a Unicode format <<
{
UnicodeEncoding unicode = new UnicodeEncoding();
string _s = unicode.GetString(bytes, 0, bytes.Length);
if (_s.IndexOf("\0") != -1)
_s = _s.Remove(_s.IndexOf("\0"), _s.Length - _s.IndexOf("\0")); //>> Remove any of our invalid positions <<
return _s;
}