public static void FakeManagedString(this RemoteMemoryStream stream, string str) { stream.Write <nuint>(0); //sync block stream.Write(stream.Context.Runtime.Heap.StringType.ClrHandle); //handle stream.Write((nuint)str.Length); //length WriteWCHARArray(stream, str); }
/// <summary> /// For ASCII string /// </summary> /// <param name="str"></param> public static void WriteCHARArray(this RemoteMemoryStream stream, string str) { byte[] data = Encoding.ASCII.GetBytes(str); stream.Write(data, (uint)data.Length); stream.Write <byte>(0); }
/// <summary> /// For unicode string /// </summary> /// <param name="str"></param> public static void WriteWCHARArray(this RemoteMemoryStream stream, string str) { byte[] data = Encoding.Unicode.GetBytes(str); stream.Write(data, (uint)data.Length); stream.Write <short>(0); }