mirror of
https://github.com/Devolutions/IronRDP.git
synced 2025-07-07 17:45:01 +00:00
chore: update Rust toolchain to 1.88.0 (#852)
MSRV is also bumped to 1.84.
This commit is contained in:
parent
eca256ae10
commit
48e02441d2
53 changed files with 122 additions and 140 deletions
|
@ -41,7 +41,7 @@ async fn main() -> Result<(), anyhow::Error> {
|
||||||
let filename: String = args.free_from_str().context("missing RGBX input filename")?;
|
let filename: String = args.free_from_str().context("missing RGBX input filename")?;
|
||||||
let file = File::open(&filename)
|
let file = File::open(&filename)
|
||||||
.await
|
.await
|
||||||
.with_context(|| format!("Failed to open file: {}", filename))?;
|
.with_context(|| format!("Failed to open file: {filename}"))?;
|
||||||
|
|
||||||
let mut flags = CmdFlags::all();
|
let mut flags = CmdFlags::all();
|
||||||
let mut update_codecs = UpdateEncoderCodecs::new();
|
let mut update_codecs = UpdateEncoderCodecs::new();
|
||||||
|
@ -83,8 +83,8 @@ async fn main() -> Result<(), anyhow::Error> {
|
||||||
|
|
||||||
let ratio = total_enc as f64 / total_raw as f64;
|
let ratio = total_enc as f64 / total_raw as f64;
|
||||||
let percent = 100.0 - ratio * 100.0;
|
let percent = 100.0 - ratio * 100.0;
|
||||||
println!("Encoder: {:?}", encoder);
|
println!("Encoder: {encoder:?}");
|
||||||
println!("Nb updates: {:?}", n_updates);
|
println!("Nb updates: {n_updates:?}");
|
||||||
println!(
|
println!(
|
||||||
"Sum of bytes: {}/{} ({:.2}%)",
|
"Sum of bytes: {}/{} ({:.2}%)",
|
||||||
bytesize::ByteSize(total_enc),
|
bytesize::ByteSize(total_enc),
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
msrv = "1.75"
|
msrv = "1.84"
|
||||||
semicolon-outside-block-ignore-multiline = true
|
semicolon-outside-block-ignore-multiline = true
|
||||||
accept-comment-above-statement = true
|
accept-comment-above-statement = true
|
||||||
accept-comment-above-attributes = true
|
accept-comment-above-attributes = true
|
||||||
|
|
|
@ -152,7 +152,7 @@ where
|
||||||
return Err(io::Error::new(io::ErrorKind::UnexpectedEof, "not enough bytes"));
|
return Err(io::Error::new(io::ErrorKind::UnexpectedEof, "not enough bytes"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(e) => return Err(io::Error::new(io::ErrorKind::Other, e)),
|
Err(e) => return Err(io::Error::other(e)),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -167,10 +167,7 @@ where
|
||||||
/// Data may have been read, but it will be stored in the internal buffer.
|
/// Data may have been read, but it will be stored in the internal buffer.
|
||||||
pub async fn read_by_hint(&mut self, hint: &dyn PduHint) -> io::Result<Bytes> {
|
pub async fn read_by_hint(&mut self, hint: &dyn PduHint) -> io::Result<Bytes> {
|
||||||
loop {
|
loop {
|
||||||
match hint
|
match hint.find_size(self.peek()).map_err(io::Error::other)? {
|
||||||
.find_size(self.peek())
|
|
||||||
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))?
|
|
||||||
{
|
|
||||||
Some((matched, length)) => {
|
Some((matched, length)) => {
|
||||||
let bytes = self.read_exact(length).await?.freeze();
|
let bytes = self.read_exact(length).await?.freeze();
|
||||||
if matched {
|
if matched {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use std::num::NonZero;
|
use core::num::NonZero;
|
||||||
|
|
||||||
use criterion::{criterion_group, criterion_main, Criterion};
|
use criterion::{criterion_group, criterion_main, Criterion};
|
||||||
use ironrdp_graphics::color_conversion::to_64x64_ycbcr_tile;
|
use ironrdp_graphics::color_conversion::to_64x64_ycbcr_tile;
|
||||||
|
|
|
@ -81,7 +81,7 @@ where
|
||||||
return Err(io::Error::new(io::ErrorKind::UnexpectedEof, "not enough bytes"));
|
return Err(io::Error::new(io::ErrorKind::UnexpectedEof, "not enough bytes"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(e) => return Err(io::Error::new(io::ErrorKind::Other, e)),
|
Err(e) => return Err(io::Error::other(e)),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,10 +89,7 @@ where
|
||||||
/// Reads a frame using the provided PduHint.
|
/// Reads a frame using the provided PduHint.
|
||||||
pub fn read_by_hint(&mut self, hint: &dyn PduHint) -> io::Result<Bytes> {
|
pub fn read_by_hint(&mut self, hint: &dyn PduHint) -> io::Result<Bytes> {
|
||||||
loop {
|
loop {
|
||||||
match hint
|
match hint.find_size(self.peek()).map_err(io::Error::other)? {
|
||||||
.find_size(self.peek())
|
|
||||||
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))?
|
|
||||||
{
|
|
||||||
Some((matched, length)) => {
|
Some((matched, length)) => {
|
||||||
let bytes = self.read_exact(length)?.freeze();
|
let bytes = self.read_exact(length)?.freeze();
|
||||||
if matched {
|
if matched {
|
||||||
|
|
|
@ -85,12 +85,12 @@ impl Destination {
|
||||||
let addr = addr.into();
|
let addr = addr.into();
|
||||||
|
|
||||||
if let Some(idx) = addr.rfind(':') {
|
if let Some(idx) = addr.rfind(':') {
|
||||||
if let Ok(sock_addr) = addr.parse::<std::net::SocketAddr>() {
|
if let Ok(sock_addr) = addr.parse::<core::net::SocketAddr>() {
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
name: sock_addr.ip().to_string(),
|
name: sock_addr.ip().to_string(),
|
||||||
port: sock_addr.port(),
|
port: sock_addr.port(),
|
||||||
})
|
})
|
||||||
} else if addr.parse::<std::net::Ipv6Addr>().is_ok() {
|
} else if addr.parse::<core::net::Ipv6Addr>().is_ok() {
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
name: addr,
|
name: addr,
|
||||||
port: RDP_DEFAULT_PORT,
|
port: RDP_DEFAULT_PORT,
|
||||||
|
@ -314,7 +314,7 @@ impl Config {
|
||||||
let codecs = match client_codecs_capabilities(&codecs) {
|
let codecs = match client_codecs_capabilities(&codecs) {
|
||||||
Ok(codecs) => codecs,
|
Ok(codecs) => codecs,
|
||||||
Err(help) => {
|
Err(help) => {
|
||||||
print!("{}", help);
|
print!("{help}");
|
||||||
std::process::exit(0);
|
std::process::exit(0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -128,10 +128,10 @@ pub fn plain_html_to_cf_html(fragment: &str) -> String {
|
||||||
|
|
||||||
let end_html_pos = buffer.len();
|
let end_html_pos = buffer.len();
|
||||||
|
|
||||||
let start_html_pos_value = format!("{:0>10}", start_html_pos);
|
let start_html_pos_value = format!("{start_html_pos:0>10}");
|
||||||
let end_html_pos_value = format!("{:0>10}", end_html_pos);
|
let end_html_pos_value = format!("{end_html_pos:0>10}");
|
||||||
let start_fragment_pos_value = format!("{:0>10}", start_fragment_pos);
|
let start_fragment_pos_value = format!("{start_fragment_pos:0>10}");
|
||||||
let end_fragment_pos_value = format!("{:0>10}", end_fragment_pos);
|
let end_fragment_pos_value = format!("{end_fragment_pos:0>10}");
|
||||||
|
|
||||||
let mut replace_placeholder = |value_begin_idx: usize, header_value: &str| {
|
let mut replace_placeholder = |value_begin_idx: usize, header_value: &str| {
|
||||||
// We know that: value_begin_idx + POS_PLACEHOLDER.len() < usize::MAX
|
// We know that: value_begin_idx + POS_PLACEHOLDER.len() < usize::MAX
|
||||||
|
|
|
@ -7,9 +7,9 @@ use crate::pdu::{
|
||||||
FormatDataRequest, FormatDataResponse, LockDataId, OwnedFormatDataResponse,
|
FormatDataRequest, FormatDataResponse, LockDataId, OwnedFormatDataResponse,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub trait ClipboardError: std::error::Error + Send + Sync + 'static {}
|
pub trait ClipboardError: core::error::Error + Send + Sync + 'static {}
|
||||||
|
|
||||||
impl<T> ClipboardError for T where T: std::error::Error + Send + Sync + 'static {}
|
impl<T> ClipboardError for T where T: core::error::Error + Send + Sync + 'static {}
|
||||||
|
|
||||||
/// Message sent by the OS clipboard backend event loop.
|
/// Message sent by the OS clipboard backend event loop.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use core::mem;
|
use core::mem;
|
||||||
|
use core::net::SocketAddr;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::net::SocketAddr;
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use ironrdp_core::{decode, encode_vec, Encode, WriteBuf};
|
use ironrdp_core::{decode, encode_vec, Encode, WriteBuf};
|
||||||
|
@ -615,7 +615,7 @@ fn create_gcc_blocks<'a>(
|
||||||
16 => SupportedColorDepths::BPP16,
|
16 => SupportedColorDepths::BPP16,
|
||||||
24 => SupportedColorDepths::BPP24,
|
24 => SupportedColorDepths::BPP24,
|
||||||
32 => SupportedColorDepths::BPP32 | SupportedColorDepths::BPP16,
|
32 => SupportedColorDepths::BPP32 | SupportedColorDepths::BPP16,
|
||||||
_ => panic!("Unsupported color depth: {}", max_color_depth),
|
_ => panic!("Unsupported color depth: {max_color_depth}"),
|
||||||
};
|
};
|
||||||
|
|
||||||
let channels = static_channels
|
let channels = static_channels
|
||||||
|
|
|
@ -292,8 +292,8 @@ impl fmt::Display for ConnectorErrorKind {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::error::Error for ConnectorErrorKind {
|
impl core::error::Error for ConnectorErrorKind {
|
||||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
|
||||||
match &self {
|
match &self {
|
||||||
ConnectorErrorKind::Encode(e) => Some(e),
|
ConnectorErrorKind::Encode(e) => Some(e),
|
||||||
ConnectorErrorKind::Decode(e) => Some(e),
|
ConnectorErrorKind::Decode(e) => Some(e),
|
||||||
|
@ -315,7 +315,7 @@ pub trait ConnectorErrorExt {
|
||||||
fn reason(context: &'static str, reason: impl Into<String>) -> Self;
|
fn reason(context: &'static str, reason: impl Into<String>) -> Self;
|
||||||
fn custom<E>(context: &'static str, e: E) -> Self
|
fn custom<E>(context: &'static str, e: E) -> Self
|
||||||
where
|
where
|
||||||
E: std::error::Error + Sync + Send + 'static;
|
E: core::error::Error + Sync + Send + 'static;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ConnectorErrorExt for ConnectorError {
|
impl ConnectorErrorExt for ConnectorError {
|
||||||
|
@ -337,7 +337,7 @@ impl ConnectorErrorExt for ConnectorError {
|
||||||
|
|
||||||
fn custom<E>(context: &'static str, e: E) -> Self
|
fn custom<E>(context: &'static str, e: E) -> Self
|
||||||
where
|
where
|
||||||
E: std::error::Error + Sync + Send + 'static,
|
E: core::error::Error + Sync + Send + 'static,
|
||||||
{
|
{
|
||||||
Self::new(context, ConnectorErrorKind::Custom).with_source(e)
|
Self::new(context, ConnectorErrorKind::Custom).with_source(e)
|
||||||
}
|
}
|
||||||
|
@ -349,7 +349,7 @@ pub trait ConnectorResultExt {
|
||||||
#[must_use]
|
#[must_use]
|
||||||
fn with_source<E>(self, source: E) -> Self
|
fn with_source<E>(self, source: E) -> Self
|
||||||
where
|
where
|
||||||
E: std::error::Error + Sync + Send + 'static;
|
E: core::error::Error + Sync + Send + 'static;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> ConnectorResultExt for ConnectorResult<T> {
|
impl<T> ConnectorResultExt for ConnectorResult<T> {
|
||||||
|
@ -362,7 +362,7 @@ impl<T> ConnectorResultExt for ConnectorResult<T> {
|
||||||
|
|
||||||
fn with_source<E>(self, source: E) -> Self
|
fn with_source<E>(self, source: E) -> Self
|
||||||
where
|
where
|
||||||
E: std::error::Error + Sync + Send + 'static,
|
E: core::error::Error + Sync + Send + 'static,
|
||||||
{
|
{
|
||||||
self.map_err(|e| e.with_source(source))
|
self.map_err(|e| e.with_source(source))
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,10 +35,10 @@ impl From<&str> for ServerName {
|
||||||
|
|
||||||
fn sanitize_server_name(name: String) -> String {
|
fn sanitize_server_name(name: String) -> String {
|
||||||
if let Some(idx) = name.rfind(':') {
|
if let Some(idx) = name.rfind(':') {
|
||||||
if let Ok(sock_addr) = name.parse::<std::net::SocketAddr>() {
|
if let Ok(sock_addr) = name.parse::<core::net::SocketAddr>() {
|
||||||
// A socket address, including a port
|
// A socket address, including a port
|
||||||
sock_addr.ip().to_string()
|
sock_addr.ip().to_string()
|
||||||
} else if name.parse::<std::net::Ipv6Addr>().is_ok() {
|
} else if name.parse::<core::net::Ipv6Addr>().is_ok() {
|
||||||
// An IPv6 address with no port, do not include a port, already sane
|
// An IPv6 address with no port, do not include a port, already sane
|
||||||
name
|
name
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -34,7 +34,7 @@ impl fmt::Display for NotEnoughBytesError {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
impl std::error::Error for NotEnoughBytesError {}
|
impl core::error::Error for NotEnoughBytesError {}
|
||||||
|
|
||||||
macro_rules! ensure_enough_bytes {
|
macro_rules! ensure_enough_bytes {
|
||||||
(in: $buf:ident, size: $expected:expr) => {{
|
(in: $buf:ident, size: $expected:expr) => {{
|
||||||
|
|
|
@ -64,7 +64,7 @@ pub enum DecodeErrorKind {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
impl std::error::Error for DecodeErrorKind {}
|
impl core::error::Error for DecodeErrorKind {}
|
||||||
|
|
||||||
impl fmt::Display for DecodeErrorKind {
|
impl fmt::Display for DecodeErrorKind {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
|
|
@ -68,7 +68,7 @@ pub enum EncodeErrorKind {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
impl std::error::Error for EncodeErrorKind {}
|
impl core::error::Error for EncodeErrorKind {}
|
||||||
|
|
||||||
impl fmt::Display for EncodeErrorKind {
|
impl fmt::Display for EncodeErrorKind {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
|
|
@ -21,7 +21,7 @@ impl core::fmt::Display for WindowsError {
|
||||||
WindowsError::CreateNamedPipe(_) => write!(f, "failed to create named pipe"),
|
WindowsError::CreateNamedPipe(_) => write!(f, "failed to create named pipe"),
|
||||||
WindowsError::CreateEvent(_) => write!(f, "failed to create event object"),
|
WindowsError::CreateEvent(_) => write!(f, "failed to create event object"),
|
||||||
WindowsError::SetEvent(_) => write!(f, "failed to set event to signaled state"),
|
WindowsError::SetEvent(_) => write!(f, "failed to set event to signaled state"),
|
||||||
WindowsError::InvalidSemaphoreParams(cause) => write!(f, "invalid semaphore parameters: {}", cause),
|
WindowsError::InvalidSemaphoreParams(cause) => write!(f, "invalid semaphore parameters: {cause}"),
|
||||||
WindowsError::ReleaseSemaphore(_) => write!(f, "failed to release semaphore"),
|
WindowsError::ReleaseSemaphore(_) => write!(f, "failed to release semaphore"),
|
||||||
WindowsError::WaitForMultipleObjectsFailed(_) => write!(f, "failed to wait for multiple objects"),
|
WindowsError::WaitForMultipleObjectsFailed(_) => write!(f, "failed to wait for multiple objects"),
|
||||||
WindowsError::WaitForMultipleObjectsTimeout => write!(f, "timed out waiting for multiple objects"),
|
WindowsError::WaitForMultipleObjectsTimeout => write!(f, "timed out waiting for multiple objects"),
|
||||||
|
@ -32,7 +32,7 @@ impl core::fmt::Display for WindowsError {
|
||||||
WindowsError::OverlappedRead(_) => write!(f, "overlapped read failed"),
|
WindowsError::OverlappedRead(_) => write!(f, "overlapped read failed"),
|
||||||
WindowsError::OverlappedWrite(_) => write!(f, "overlapped write failed"),
|
WindowsError::OverlappedWrite(_) => write!(f, "overlapped write failed"),
|
||||||
WindowsError::CreateSemaphore(_) => write!(f, "failed to create semaphore object"),
|
WindowsError::CreateSemaphore(_) => write!(f, "failed to create semaphore object"),
|
||||||
WindowsError::InvalidPipeName(cause) => write!(f, "invalid pipe name: `{}`", cause),
|
WindowsError::InvalidPipeName(cause) => write!(f, "invalid pipe name: `{cause}`"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -272,7 +272,7 @@ impl fmt::Display for Cmd {
|
||||||
|
|
||||||
impl From<Cmd> for String {
|
impl From<Cmd> for String {
|
||||||
fn from(cmd: Cmd) -> Self {
|
fn from(cmd: Cmd) -> Self {
|
||||||
format!("{:?}", cmd)
|
format!("{cmd:?}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,10 @@ use alloc::boxed::Box;
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
pub trait Source: std::error::Error + Sync + Send + 'static {}
|
pub trait Source: core::error::Error + Sync + Send + 'static {}
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
impl<T> Source for T where T: std::error::Error + Sync + Send + 'static {}
|
impl<T> Source for T where T: core::error::Error + Sync + Send + 'static {}
|
||||||
|
|
||||||
#[cfg(not(feature = "std"))]
|
#[cfg(not(feature = "std"))]
|
||||||
pub trait Source: fmt::Display + fmt::Debug + Send + Sync + 'static {}
|
pub trait Source: fmt::Display + fmt::Debug + Send + Sync + 'static {}
|
||||||
|
@ -25,7 +25,7 @@ pub struct Error<Kind> {
|
||||||
pub context: &'static str,
|
pub context: &'static str,
|
||||||
pub kind: Kind,
|
pub kind: Kind,
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
source: Option<Box<dyn std::error::Error + Sync + Send>>,
|
source: Option<Box<dyn core::error::Error + Sync + Send>>,
|
||||||
#[cfg(all(not(feature = "std"), feature = "alloc"))]
|
#[cfg(all(not(feature = "std"), feature = "alloc"))]
|
||||||
source: Option<Box<dyn Source>>,
|
source: Option<Box<dyn Source>>,
|
||||||
}
|
}
|
||||||
|
@ -94,11 +94,11 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
impl<Kind> std::error::Error for Error<Kind>
|
impl<Kind> core::error::Error for Error<Kind>
|
||||||
where
|
where
|
||||||
Kind: std::error::Error,
|
Kind: core::error::Error,
|
||||||
{
|
{
|
||||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
|
||||||
if let Some(source) = self.kind.source() {
|
if let Some(source) = self.kind.source() {
|
||||||
Some(source)
|
Some(source)
|
||||||
} else {
|
} else {
|
||||||
|
@ -115,10 +115,10 @@ where
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
impl<Kind> From<Error<Kind>> for std::io::Error
|
impl<Kind> From<Error<Kind>> for std::io::Error
|
||||||
where
|
where
|
||||||
Kind: std::error::Error + Send + Sync + 'static,
|
Kind: core::error::Error + Send + Sync + 'static,
|
||||||
{
|
{
|
||||||
fn from(error: Error<Kind>) -> Self {
|
fn from(error: Error<Kind>) -> Self {
|
||||||
Self::new(std::io::ErrorKind::Other, error)
|
Self::other(error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,10 +127,10 @@ pub struct ErrorReport<'a, Kind>(&'a Error<Kind>);
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
impl<Kind> fmt::Display for ErrorReport<'_, Kind>
|
impl<Kind> fmt::Display for ErrorReport<'_, Kind>
|
||||||
where
|
where
|
||||||
Kind: std::error::Error,
|
Kind: core::error::Error,
|
||||||
{
|
{
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
use std::error::Error;
|
use core::error::Error;
|
||||||
|
|
||||||
write!(f, "{}", self.0)?;
|
write!(f, "{}", self.0)?;
|
||||||
|
|
||||||
|
|
|
@ -11,5 +11,5 @@ pub mod renderer;
|
||||||
mod draw;
|
mod draw;
|
||||||
mod surface;
|
mod surface;
|
||||||
|
|
||||||
type Error = Box<dyn std::error::Error + Send + Sync + 'static>;
|
type Error = Box<dyn core::error::Error + Send + Sync + 'static>;
|
||||||
type Result<T> = std::result::Result<T, Error>;
|
type Result<T> = std::result::Result<T, Error>;
|
||||||
|
|
|
@ -372,11 +372,11 @@ impl ColorStrideReader {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bit_stride_size_align_u8(size_bits: usize) -> usize {
|
fn bit_stride_size_align_u8(size_bits: usize) -> usize {
|
||||||
(size_bits + 7) / 8
|
size_bits.div_ceil(8)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bit_stride_size_align_u16(size_bits: usize) -> usize {
|
fn bit_stride_size_align_u16(size_bits: usize) -> usize {
|
||||||
((size_bits + 15) / 16) * 2
|
size_bits.div_ceil(16) * 2
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Message-agnostic pointer data.
|
/// Message-agnostic pointer data.
|
||||||
|
|
|
@ -48,7 +48,7 @@ impl<'a> BitmapStreamDecoderImpl<'a> {
|
||||||
// its size is rounded up to the nearest greater integer, to take into account odd image
|
// its size is rounded up to the nearest greater integer, to take into account odd image
|
||||||
// size (e.g. if width is 3, then chroma plane width is 2, not 1, to take into account
|
// size (e.g. if width is 3, then chroma plane width is 2, not 1, to take into account
|
||||||
// the odd column which expands to 1 pixel instead of 2 during supersampling)
|
// the odd column which expands to 1 pixel instead of 2 during supersampling)
|
||||||
((image_width + 1) / 2, (image_height + 1) / 2)
|
(image_width.div_ceil(2), image_height.div_ceil(2))
|
||||||
} else {
|
} else {
|
||||||
(image_width, image_height)
|
(image_width, image_height)
|
||||||
};
|
};
|
||||||
|
|
|
@ -324,7 +324,7 @@ Several other concerns arise:
|
||||||
|
|
||||||
- `Unknown(2)` and `ThirdValue` are conceptually the same thing, but are represented differently in memory.
|
- `Unknown(2)` and `ThirdValue` are conceptually the same thing, but are represented differently in memory.
|
||||||
- The default `PartialEq` implementation that can be derived will return `false` when testing for
|
- The default `PartialEq` implementation that can be derived will return `false` when testing for
|
||||||
equality (i.e.: `Unknown(2) != ThirdValue`). Fixing this requires manual implementation of `PartialEq`.
|
equality (i.e.: `Unknown(2) != ThirdValue`). Fixing this requires manual implementation of `PartialEq`.
|
||||||
- Even if `PartialEq` is fixed, the pattern matching issue can’t be fixed.
|
- Even if `PartialEq` is fixed, the pattern matching issue can’t be fixed.
|
||||||
- The size of this type is bigger than necessary.
|
- The size of this type is bigger than necessary.
|
||||||
|
|
||||||
|
@ -414,11 +414,11 @@ The **TL;DR** is:
|
||||||
|
|
||||||
- Use **both** `from_bits_retain` and `const _ = !0` when resilient parsing is required.
|
- Use **both** `from_bits_retain` and `const _ = !0` when resilient parsing is required.
|
||||||
- `const _ = !0` ensures we don’t accidentally have non resilient or destructive parsing. In
|
- `const _ = !0` ensures we don’t accidentally have non resilient or destructive parsing. In
|
||||||
addition to that, generated methods such as `complement` (`!`) will consider additional bits
|
addition to that, generated methods such as `complement` (`!`) will consider additional bits
|
||||||
and follow the principle of least surprise (`!!flags == flags`).
|
and follow the principle of least surprise (`!!flags == flags`).
|
||||||
- `from_bits_retain` makes it clear at the call site that preserving all the bits is intentional.
|
- `from_bits_retain` makes it clear at the call site that preserving all the bits is intentional.
|
||||||
- Use `from_bits` WITHOUT `const _ = !0` when strictness is required (almost never in IronRDP), and
|
- Use `from_bits` WITHOUT `const _ = !0` when strictness is required (almost never in IronRDP), and
|
||||||
document why with an in-source comment.
|
document why with an in-source comment.
|
||||||
|
|
||||||
Bit flags are used quite pervasively in the RDP protocol.
|
Bit flags are used quite pervasively in the RDP protocol.
|
||||||
IronRDP is relying on the [`bitflags` crate][bitflags] to generate well-defined flags structures,
|
IronRDP is relying on the [`bitflags` crate][bitflags] to generate well-defined flags structures,
|
||||||
|
|
|
@ -59,7 +59,7 @@ impl Encode for BitmapStreamHeader {
|
||||||
let mut header = ((self.enable_rle_compression as u8) << 4) | ((!self.use_alpha as u8) << 5);
|
let mut header = ((self.enable_rle_compression as u8) << 4) | ((!self.use_alpha as u8) << 5);
|
||||||
|
|
||||||
match self.color_plane_definition {
|
match self.color_plane_definition {
|
||||||
ColorPlaneDefinition::Argb { .. } => {
|
ColorPlaneDefinition::Argb => {
|
||||||
// ARGB color planes keep cll and cs flags set to 0
|
// ARGB color planes keep cll and cs flags set to 0
|
||||||
}
|
}
|
||||||
ColorPlaneDefinition::AYCoCg {
|
ColorPlaneDefinition::AYCoCg {
|
||||||
|
@ -108,7 +108,7 @@ impl<'a> BitmapStream<'a> {
|
||||||
|
|
||||||
pub fn has_subsampled_chroma(&self) -> bool {
|
pub fn has_subsampled_chroma(&self) -> bool {
|
||||||
match self.header.color_plane_definition {
|
match self.header.color_plane_definition {
|
||||||
ColorPlaneDefinition::Argb { .. } => false,
|
ColorPlaneDefinition::Argb => false,
|
||||||
ColorPlaneDefinition::AYCoCg {
|
ColorPlaneDefinition::AYCoCg {
|
||||||
use_chroma_subsampling, ..
|
use_chroma_subsampling, ..
|
||||||
} => use_chroma_subsampling,
|
} => use_chroma_subsampling,
|
||||||
|
|
|
@ -65,7 +65,7 @@ impl PduErrorExt for PduError {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::error::Error for PduErrorKind {}
|
impl core::error::Error for PduErrorKind {}
|
||||||
|
|
||||||
impl fmt::Display for PduErrorKind {
|
impl fmt::Display for PduErrorKind {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
|
|
@ -1180,7 +1180,7 @@ mod legacy {
|
||||||
|
|
||||||
impl From<McsError> for io::Error {
|
impl From<McsError> for io::Error {
|
||||||
fn from(e: McsError) -> io::Error {
|
fn from(e: McsError) -> io::Error {
|
||||||
io::Error::new(io::ErrorKind::Other, format!("MCS Connection Sequence error: {e}"))
|
io::Error::other(format!("MCS Connection Sequence error: {e}"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ pub(crate) enum PerError {
|
||||||
NumericStringTooBig,
|
NumericStringTooBig,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::error::Error for PerError {}
|
impl core::error::Error for PerError {}
|
||||||
|
|
||||||
impl fmt::Display for PerError {
|
impl fmt::Display for PerError {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
@ -276,7 +276,7 @@ pub(crate) fn write_octet_string(dst: &mut WriteCursor<'_>, octet_string: &[u8],
|
||||||
|
|
||||||
pub(crate) fn read_numeric_string(src: &mut ReadCursor<'_>, min: u16) -> Result<(), PerError> {
|
pub(crate) fn read_numeric_string(src: &mut ReadCursor<'_>, min: u16) -> Result<(), PerError> {
|
||||||
let (length, _) = read_length(src)?;
|
let (length, _) = read_length(src)?;
|
||||||
let length = usize::from((length + min + 1) / 2);
|
let length = usize::from((length + min).div_ceil(2));
|
||||||
|
|
||||||
if src.len() < length {
|
if src.len() < length {
|
||||||
Err(PerError::NotEnoughBytes {
|
Err(PerError::NotEnoughBytes {
|
||||||
|
@ -525,7 +525,7 @@ pub(crate) mod legacy {
|
||||||
pub(crate) fn read_numeric_string(mut stream: impl io::Read, min: u16) -> io::Result<()> {
|
pub(crate) fn read_numeric_string(mut stream: impl io::Read, min: u16) -> io::Result<()> {
|
||||||
let (read_length, _) = read_length(&mut stream)?;
|
let (read_length, _) = read_length(&mut stream)?;
|
||||||
|
|
||||||
let length = (read_length + min + 1) / 2;
|
let length = (read_length + min).div_ceil(2);
|
||||||
|
|
||||||
let mut read_numeric_string = vec![0; length as usize];
|
let mut read_numeric_string = vec![0; length as usize];
|
||||||
stream.read_exact(read_numeric_string.as_mut())?;
|
stream.read_exact(read_numeric_string.as_mut())?;
|
||||||
|
|
|
@ -112,6 +112,6 @@ impl From<PduError> for RdpError {
|
||||||
|
|
||||||
impl From<RdpError> for io::Error {
|
impl From<RdpError> for io::Error {
|
||||||
fn from(e: RdpError) -> io::Error {
|
fn from(e: RdpError) -> io::Error {
|
||||||
io::Error::new(io::ErrorKind::Other, format!("RDP Connection Sequence error: {e}"))
|
io::Error::other(format!("RDP Connection Sequence error: {e}"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -627,7 +627,7 @@ impl Debug for CodecId {
|
||||||
3 => "RemoteFx",
|
3 => "RemoteFx",
|
||||||
_ => "unknown",
|
_ => "unknown",
|
||||||
};
|
};
|
||||||
write!(f, "CodecId({})", name)
|
write!(f, "CodecId({name})")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -672,7 +672,7 @@ pub fn client_codecs_capabilities(config: &[&str]) -> Result<BitmapCodecs, Strin
|
||||||
let state = match state_str {
|
let state = match state_str {
|
||||||
"on" => true,
|
"on" => true,
|
||||||
"off" => false,
|
"off" => false,
|
||||||
_ => return Err(format!("Unhandled configuration: {}", state_str)),
|
_ => return Err(format!("Unhandled configuration: {state_str}")),
|
||||||
};
|
};
|
||||||
|
|
||||||
result.insert(codec_name, state);
|
result.insert(codec_name, state);
|
||||||
|
@ -710,7 +710,7 @@ List of codecs:
|
||||||
|
|
||||||
let codec_names = config.keys().copied().collect::<Vec<_>>().join(", ");
|
let codec_names = config.keys().copied().collect::<Vec<_>>().join(", ");
|
||||||
if !codec_names.is_empty() {
|
if !codec_names.is_empty() {
|
||||||
return Err(format!("Unknown codecs: {}", codec_names));
|
return Err(format!("Unknown codecs: {codec_names}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(BitmapCodecs(codecs))
|
Ok(BitmapCodecs(codecs))
|
||||||
|
|
|
@ -24,7 +24,7 @@ bitflags! {
|
||||||
///
|
///
|
||||||
/// * `flags` - virtual channel compression flags
|
/// * `flags` - virtual channel compression flags
|
||||||
/// * `chunk_size` - when sent from server to client, this field contains the maximum allowed size of a virtual channel chunk and MUST be greater than or equal to 1600 and less than or equal to 16256.
|
/// * `chunk_size` - when sent from server to client, this field contains the maximum allowed size of a virtual channel chunk and MUST be greater than or equal to 1600 and less than or equal to 16256.
|
||||||
/// When sent from client to server, the value in this field is ignored by the server. This value is not verified in IronRDP and MUST be verified on the caller's side
|
/// When sent from client to server, the value in this field is ignored by the server. This value is not verified in IronRDP and MUST be verified on the caller's side
|
||||||
///
|
///
|
||||||
/// # MSDN
|
/// # MSDN
|
||||||
///
|
///
|
||||||
|
|
|
@ -111,6 +111,6 @@ impl From<PduError> for ChannelError {
|
||||||
|
|
||||||
impl From<ChannelError> for io::Error {
|
impl From<ChannelError> for io::Error {
|
||||||
fn from(e: ChannelError) -> io::Error {
|
fn from(e: ChannelError) -> io::Error {
|
||||||
io::Error::new(io::ErrorKind::Other, format!("Virtual channel error: {e}"))
|
io::Error::other(format!("Virtual channel error: {e}"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ impl CapabilitySet {
|
||||||
CapabilitySet::V8 { .. } => CapabilityVersion::V8,
|
CapabilitySet::V8 { .. } => CapabilityVersion::V8,
|
||||||
CapabilitySet::V8_1 { .. } => CapabilityVersion::V8_1,
|
CapabilitySet::V8_1 { .. } => CapabilityVersion::V8_1,
|
||||||
CapabilitySet::V10 { .. } => CapabilityVersion::V10,
|
CapabilitySet::V10 { .. } => CapabilityVersion::V10,
|
||||||
CapabilitySet::V10_1 { .. } => CapabilityVersion::V10_1,
|
CapabilitySet::V10_1 => CapabilityVersion::V10_1,
|
||||||
CapabilitySet::V10_2 { .. } => CapabilityVersion::V10_2,
|
CapabilitySet::V10_2 { .. } => CapabilityVersion::V10_2,
|
||||||
CapabilitySet::V10_3 { .. } => CapabilityVersion::V10_3,
|
CapabilitySet::V10_3 { .. } => CapabilityVersion::V10_3,
|
||||||
CapabilitySet::V10_4 { .. } => CapabilityVersion::V10_4,
|
CapabilitySet::V10_4 { .. } => CapabilityVersion::V10_4,
|
||||||
|
@ -109,7 +109,7 @@ impl Encode for CapabilitySet {
|
||||||
| CapabilitySet::V10_6 { .. }
|
| CapabilitySet::V10_6 { .. }
|
||||||
| CapabilitySet::V10_6Err { .. }
|
| CapabilitySet::V10_6Err { .. }
|
||||||
| CapabilitySet::V10_7 { .. } => 4,
|
| CapabilitySet::V10_7 { .. } => 4,
|
||||||
CapabilitySet::V10_1 { .. } => 16,
|
CapabilitySet::V10_1 => 16,
|
||||||
CapabilitySet::Unknown(data) => data.len(),
|
CapabilitySet::Unknown(data) => data.len(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ impl fmt::Display for RDCleanPathErr {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::error::Error for RDCleanPathErr {}
|
impl core::error::Error for RDCleanPathErr {}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, der::Sequence)]
|
#[derive(Clone, Debug, Eq, PartialEq, der::Sequence)]
|
||||||
#[asn1(tag_mode = "EXPLICIT")]
|
#[asn1(tag_mode = "EXPLICIT")]
|
||||||
|
@ -296,7 +296,7 @@ impl fmt::Display for MissingRDCleanPathField {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::error::Error for MissingRDCleanPathField {}
|
impl core::error::Error for MissingRDCleanPathField {}
|
||||||
|
|
||||||
impl TryFrom<RDCleanPathPdu> for RDCleanPath {
|
impl TryFrom<RDCleanPathPdu> for RDCleanPath {
|
||||||
type Error = MissingRDCleanPathField;
|
type Error = MissingRDCleanPathField;
|
||||||
|
|
|
@ -205,49 +205,49 @@ impl fmt::Debug for RdpdrPdu {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
Self::VersionAndIdPdu(it) => {
|
Self::VersionAndIdPdu(it) => {
|
||||||
write!(f, "RdpdrPdu({:?})", it)
|
write!(f, "RdpdrPdu({it:?})")
|
||||||
}
|
}
|
||||||
Self::ClientNameRequest(it) => {
|
Self::ClientNameRequest(it) => {
|
||||||
write!(f, "RdpdrPdu({:?})", it)
|
write!(f, "RdpdrPdu({it:?})")
|
||||||
}
|
}
|
||||||
Self::CoreCapability(it) => {
|
Self::CoreCapability(it) => {
|
||||||
write!(f, "RdpdrPdu({:?})", it)
|
write!(f, "RdpdrPdu({it:?})")
|
||||||
}
|
}
|
||||||
Self::ClientDeviceListAnnounce(it) => {
|
Self::ClientDeviceListAnnounce(it) => {
|
||||||
write!(f, "RdpdrPdu({:?})", it)
|
write!(f, "RdpdrPdu({it:?})")
|
||||||
}
|
}
|
||||||
Self::ServerDeviceAnnounceResponse(it) => {
|
Self::ServerDeviceAnnounceResponse(it) => {
|
||||||
write!(f, "RdpdrPdu({:?})", it)
|
write!(f, "RdpdrPdu({it:?})")
|
||||||
}
|
}
|
||||||
Self::DeviceIoRequest(it) => {
|
Self::DeviceIoRequest(it) => {
|
||||||
write!(f, "RdpdrPdu({:?})", it)
|
write!(f, "RdpdrPdu({it:?})")
|
||||||
}
|
}
|
||||||
Self::DeviceControlResponse(it) => {
|
Self::DeviceControlResponse(it) => {
|
||||||
write!(f, "RdpdrPdu({:?})", it)
|
write!(f, "RdpdrPdu({it:?})")
|
||||||
}
|
}
|
||||||
Self::DeviceCreateResponse(it) => {
|
Self::DeviceCreateResponse(it) => {
|
||||||
write!(f, "RdpdrPdu({:?})", it)
|
write!(f, "RdpdrPdu({it:?})")
|
||||||
}
|
}
|
||||||
Self::ClientDriveQueryInformationResponse(it) => {
|
Self::ClientDriveQueryInformationResponse(it) => {
|
||||||
write!(f, "RdpdrPdu({:?})", it)
|
write!(f, "RdpdrPdu({it:?})")
|
||||||
}
|
}
|
||||||
Self::DeviceCloseResponse(it) => {
|
Self::DeviceCloseResponse(it) => {
|
||||||
write!(f, "RdpdrPdu({:?})", it)
|
write!(f, "RdpdrPdu({it:?})")
|
||||||
}
|
}
|
||||||
Self::ClientDriveQueryDirectoryResponse(it) => {
|
Self::ClientDriveQueryDirectoryResponse(it) => {
|
||||||
write!(f, "RdpdrPdu({:?})", it)
|
write!(f, "RdpdrPdu({it:?})")
|
||||||
}
|
}
|
||||||
Self::ClientDriveQueryVolumeInformationResponse(it) => {
|
Self::ClientDriveQueryVolumeInformationResponse(it) => {
|
||||||
write!(f, "RdpdrPdu({:?})", it)
|
write!(f, "RdpdrPdu({it:?})")
|
||||||
}
|
}
|
||||||
Self::DeviceReadResponse(it) => {
|
Self::DeviceReadResponse(it) => {
|
||||||
write!(f, "RdpdrPdu({:?})", it)
|
write!(f, "RdpdrPdu({it:?})")
|
||||||
}
|
}
|
||||||
Self::DeviceWriteResponse(it) => {
|
Self::DeviceWriteResponse(it) => {
|
||||||
write!(f, "RdpdrPdu({:?})", it)
|
write!(f, "RdpdrPdu({it:?})")
|
||||||
}
|
}
|
||||||
Self::ClientDriveSetInformationResponse(it) => {
|
Self::ClientDriveSetInformationResponse(it) => {
|
||||||
write!(f, "RdpdrPdu({:?})", it)
|
write!(f, "RdpdrPdu({it:?})")
|
||||||
}
|
}
|
||||||
Self::UserLoggedon => {
|
Self::UserLoggedon => {
|
||||||
write!(f, "RdpdrPdu(UserLoggedon)")
|
write!(f, "RdpdrPdu(UserLoggedon)")
|
||||||
|
|
|
@ -8,9 +8,9 @@ use crate::pdu::{self, ClientAudioFormatPdu, QualityMode};
|
||||||
|
|
||||||
pub type RdpsndSvcMessages = SvcProcessorMessages<RdpsndServer>;
|
pub type RdpsndSvcMessages = SvcProcessorMessages<RdpsndServer>;
|
||||||
|
|
||||||
pub trait RdpsndError: std::error::Error + Send + Sync + 'static {}
|
pub trait RdpsndError: core::error::Error + Send + Sync + 'static {}
|
||||||
|
|
||||||
impl<T> RdpsndError for T where T: std::error::Error + Send + Sync + 'static {}
|
impl<T> RdpsndError for T where T: core::error::Error + Send + Sync + 'static {}
|
||||||
|
|
||||||
/// Message sent by the event loop.
|
/// Message sent by the event loop.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
|
@ -16,7 +16,7 @@ use glutin::event_loop::ControlFlow;
|
||||||
use ironrdp::pdu::dvc::gfx::{GraphicsPipelineError, ServerPdu};
|
use ironrdp::pdu::dvc::gfx::{GraphicsPipelineError, ServerPdu};
|
||||||
use ironrdp_glutin_renderer::renderer::Renderer;
|
use ironrdp_glutin_renderer::renderer::Renderer;
|
||||||
|
|
||||||
pub type Error = Box<dyn std::error::Error + Send + Sync + 'static>;
|
pub type Error = Box<dyn core::error::Error + Send + Sync + 'static>;
|
||||||
|
|
||||||
/// Devolutions IronRDP client
|
/// Devolutions IronRDP client
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use std::net::SocketAddr;
|
use core::net::SocketAddr;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use tokio_rustls::TlsAcceptor;
|
use tokio_rustls::TlsAcceptor;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use std::net::SocketAddr;
|
use core::net::SocketAddr;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
|
|
@ -47,8 +47,8 @@ impl fmt::Display for SessionErrorKind {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::error::Error for SessionErrorKind {
|
impl core::error::Error for SessionErrorKind {
|
||||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
|
||||||
match &self {
|
match &self {
|
||||||
SessionErrorKind::Pdu(e) => Some(e),
|
SessionErrorKind::Pdu(e) => Some(e),
|
||||||
SessionErrorKind::Encode(e) => Some(e),
|
SessionErrorKind::Encode(e) => Some(e),
|
||||||
|
@ -70,7 +70,7 @@ pub trait SessionErrorExt {
|
||||||
fn reason(context: &'static str, reason: impl Into<String>) -> Self;
|
fn reason(context: &'static str, reason: impl Into<String>) -> Self;
|
||||||
fn custom<E>(context: &'static str, e: E) -> Self
|
fn custom<E>(context: &'static str, e: E) -> Self
|
||||||
where
|
where
|
||||||
E: std::error::Error + Sync + Send + 'static;
|
E: core::error::Error + Sync + Send + 'static;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SessionErrorExt for SessionError {
|
impl SessionErrorExt for SessionError {
|
||||||
|
@ -96,7 +96,7 @@ impl SessionErrorExt for SessionError {
|
||||||
|
|
||||||
fn custom<E>(context: &'static str, e: E) -> Self
|
fn custom<E>(context: &'static str, e: E) -> Self
|
||||||
where
|
where
|
||||||
E: std::error::Error + Sync + Send + 'static,
|
E: core::error::Error + Sync + Send + 'static,
|
||||||
{
|
{
|
||||||
Self::new(context, SessionErrorKind::Custom).with_source(e)
|
Self::new(context, SessionErrorKind::Custom).with_source(e)
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ pub trait SessionResultExt {
|
||||||
#[must_use]
|
#[must_use]
|
||||||
fn with_source<E>(self, source: E) -> Self
|
fn with_source<E>(self, source: E) -> Self
|
||||||
where
|
where
|
||||||
E: std::error::Error + Sync + Send + 'static;
|
E: core::error::Error + Sync + Send + 'static;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> SessionResultExt for SessionResult<T> {
|
impl<T> SessionResultExt for SessionResult<T> {
|
||||||
|
@ -121,7 +121,7 @@ impl<T> SessionResultExt for SessionResult<T> {
|
||||||
|
|
||||||
fn with_source<E>(self, source: E) -> Self
|
fn with_source<E>(self, source: E) -> Self
|
||||||
where
|
where
|
||||||
E: std::error::Error + Sync + Send + 'static,
|
E: core::error::Error + Sync + Send + 'static,
|
||||||
{
|
{
|
||||||
self.map_err(|e| e.with_source(source))
|
self.map_err(|e| e.with_source(source))
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ fn expect_pointer_png(pointer: &DecodedPointer, expected_file_path: &str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if !std::path::Path::new(&path).exists() {
|
if !std::path::Path::new(&path).exists() {
|
||||||
panic!("Test file {} does not exist", path);
|
panic!("Test file {path} does not exist");
|
||||||
}
|
}
|
||||||
|
|
||||||
let png_buffer = std::fs::read(path).unwrap();
|
let png_buffer = std::fs::read(path).unwrap();
|
||||||
|
|
|
@ -41,7 +41,7 @@ where
|
||||||
.1
|
.1
|
||||||
.peer_certificates()
|
.peer_certificates()
|
||||||
.and_then(|certificates| certificates.first())
|
.and_then(|certificates| certificates.first())
|
||||||
.ok_or_else(|| io::Error::new(io::ErrorKind::Other, "peer certificate is missing"))?;
|
.ok_or_else(|| io::Error::other("peer certificate is missing"))?;
|
||||||
crate::extract_tls_server_public_key(cert)?
|
crate::extract_tls_server_public_key(cert)?
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use core::future::Future;
|
use core::future::Future;
|
||||||
|
use core::net::{IpAddr, Ipv4Addr};
|
||||||
use core::pin::Pin;
|
use core::pin::Pin;
|
||||||
use std::net::{IpAddr, Ipv4Addr};
|
|
||||||
|
|
||||||
use ironrdp_connector::{custom_err, ConnectorResult};
|
use ironrdp_connector::{custom_err, ConnectorResult};
|
||||||
use reqwest::Client;
|
use reqwest::Client;
|
||||||
|
@ -50,19 +50,19 @@ impl ReqwestNetworkClient {
|
||||||
|
|
||||||
let mut stream = TcpStream::connect(addr)
|
let mut stream = TcpStream::connect(addr)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| Error::new(ErrorKind::NoAuthenticatingAuthority, format!("{:?}", e)))
|
.map_err(|e| Error::new(ErrorKind::NoAuthenticatingAuthority, format!("{e:?}")))
|
||||||
.map_err(|e| custom_err!("failed to send KDC request over TCP", e))?;
|
.map_err(|e| custom_err!("failed to send KDC request over TCP", e))?;
|
||||||
|
|
||||||
stream
|
stream
|
||||||
.write(data)
|
.write(data)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| Error::new(ErrorKind::NoAuthenticatingAuthority, format!("{:?}", e)))
|
.map_err(|e| Error::new(ErrorKind::NoAuthenticatingAuthority, format!("{e:?}")))
|
||||||
.map_err(|e| custom_err!("failed to send KDC request over TCP", e))?;
|
.map_err(|e| custom_err!("failed to send KDC request over TCP", e))?;
|
||||||
|
|
||||||
let len = stream
|
let len = stream
|
||||||
.read_u32()
|
.read_u32()
|
||||||
.await
|
.await
|
||||||
.map_err(|e| Error::new(ErrorKind::NoAuthenticatingAuthority, format!("{:?}", e)))
|
.map_err(|e| Error::new(ErrorKind::NoAuthenticatingAuthority, format!("{e:?}")))
|
||||||
.map_err(|e| custom_err!("failed to send KDC request over TCP", e))?;
|
.map_err(|e| custom_err!("failed to send KDC request over TCP", e))?;
|
||||||
|
|
||||||
let mut buf = vec![0; len as usize + 4];
|
let mut buf = vec![0; len as usize + 4];
|
||||||
|
@ -71,7 +71,7 @@ impl ReqwestNetworkClient {
|
||||||
stream
|
stream
|
||||||
.read_exact(&mut buf[4..])
|
.read_exact(&mut buf[4..])
|
||||||
.await
|
.await
|
||||||
.map_err(|e| Error::new(ErrorKind::NoAuthenticatingAuthority, format!("{:?}", e)))
|
.map_err(|e| Error::new(ErrorKind::NoAuthenticatingAuthority, format!("{e:?}")))
|
||||||
.map_err(|e| custom_err!("failed to send KDC request over TCP", e))?;
|
.map_err(|e| custom_err!("failed to send KDC request over TCP", e))?;
|
||||||
|
|
||||||
Ok(buf)
|
Ok(buf)
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use core::cell::RefCell;
|
use core::cell::RefCell;
|
||||||
|
use core::net::{Ipv4Addr, SocketAddrV4};
|
||||||
use core::num::NonZeroU32;
|
use core::num::NonZeroU32;
|
||||||
use core::time::Duration;
|
use core::time::Duration;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::net::{Ipv4Addr, SocketAddrV4};
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use anyhow::Context as _;
|
use anyhow::Context as _;
|
||||||
|
@ -926,7 +926,7 @@ async fn connect(
|
||||||
let mut framed = ironrdp_futures::LocalFuturesFramed::new(ws);
|
let mut framed = ironrdp_futures::LocalFuturesFramed::new(ws);
|
||||||
|
|
||||||
// In web browser environments, we do not have an easy access to the local address of the socket.
|
// In web browser environments, we do not have an easy access to the local address of the socket.
|
||||||
let dummy_client_addr = std::net::SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::LOCALHOST, 33899));
|
let dummy_client_addr = core::net::SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::LOCALHOST, 33899));
|
||||||
|
|
||||||
let mut connector = ClientConnector::new(config, dummy_client_addr);
|
let mut connector = ClientConnector::new(config, dummy_client_addr);
|
||||||
|
|
||||||
|
|
|
@ -302,7 +302,7 @@ fn active_stage(
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn lookup_addr(hostname: &str, port: u16) -> anyhow::Result<std::net::SocketAddr> {
|
fn lookup_addr(hostname: &str, port: u16) -> anyhow::Result<core::net::SocketAddr> {
|
||||||
use std::net::ToSocketAddrs as _;
|
use std::net::ToSocketAddrs as _;
|
||||||
let addr = (hostname, port).to_socket_addrs()?.next().unwrap();
|
let addr = (hostname, port).to_socket_addrs()?.next().unwrap();
|
||||||
Ok(addr)
|
Ok(addr)
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate tracing;
|
extern crate tracing;
|
||||||
|
|
||||||
|
use core::net::SocketAddr;
|
||||||
use core::num::NonZeroU16;
|
use core::num::NonZeroU16;
|
||||||
use std::net::SocketAddr;
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
|
|
18
ffi/build.rs
18
ffi/build.rs
|
@ -15,9 +15,9 @@ mod win {
|
||||||
|
|
||||||
fn generate_version_rc() -> String {
|
fn generate_version_rc() -> String {
|
||||||
let output_name = "DevolutionsIronRdp";
|
let output_name = "DevolutionsIronRdp";
|
||||||
let filename = format!("{}.dll", output_name);
|
let filename = format!("{output_name}.dll");
|
||||||
let company_name = "Devolutions Inc.";
|
let company_name = "Devolutions Inc.";
|
||||||
let legal_copyright = format!("Copyright 2019-2024 {}", company_name);
|
let legal_copyright = format!("Copyright 2019-2024 {company_name}");
|
||||||
|
|
||||||
let mut cargo_version = env::var("CARGO_PKG_VERSION").unwrap();
|
let mut cargo_version = env::var("CARGO_PKG_VERSION").unwrap();
|
||||||
cargo_version.push_str(".0");
|
cargo_version.push_str(".0");
|
||||||
|
@ -67,17 +67,7 @@ BEGIN
|
||||||
VALUE "Translation", 0x409, 1200
|
VALUE "Translation", 0x409, 1200
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
"#,
|
"#
|
||||||
vs_file_version = vs_file_version,
|
|
||||||
vs_product_version = vs_product_version,
|
|
||||||
company_name = company_name,
|
|
||||||
file_description = file_description,
|
|
||||||
file_version = file_version,
|
|
||||||
internal_name = internal_name,
|
|
||||||
legal_copyright = legal_copyright,
|
|
||||||
original_filename = original_filename,
|
|
||||||
product_name = product_name,
|
|
||||||
product_version = product_version
|
|
||||||
);
|
);
|
||||||
|
|
||||||
version_rc
|
version_rc
|
||||||
|
@ -85,7 +75,7 @@ END
|
||||||
|
|
||||||
pub(crate) fn main_stub() {
|
pub(crate) fn main_stub() {
|
||||||
let out_dir = env::var("OUT_DIR").unwrap();
|
let out_dir = env::var("OUT_DIR").unwrap();
|
||||||
let version_rc_file = format!("{}/version.rc", out_dir);
|
let version_rc_file = format!("{out_dir}/version.rc");
|
||||||
let version_rc_data = generate_version_rc();
|
let version_rc_data = generate_version_rc();
|
||||||
let mut file = File::create(&version_rc_file).expect("cannot create version.rc file");
|
let mut file = File::create(&version_rc_file).expect("cannot create version.rc file");
|
||||||
file.write_all(version_rc_data.as_bytes()).unwrap();
|
file.write_all(version_rc_data.as_bytes()).unwrap();
|
||||||
|
|
|
@ -163,7 +163,7 @@ pub mod ffi {
|
||||||
impl<'a> DynState<'a> {
|
impl<'a> DynState<'a> {
|
||||||
pub fn get_name(&'a self, writeable: &'a mut DiplomatWriteable) -> Result<(), Box<IronRdpError>> {
|
pub fn get_name(&'a self, writeable: &'a mut DiplomatWriteable) -> Result<(), Box<IronRdpError>> {
|
||||||
let name = self.0.name();
|
let name = self.0.name();
|
||||||
write!(writeable, "{}", name)?;
|
write!(writeable, "{name}")?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ pub mod ffi {
|
||||||
pub fn get_url(&self, writeable: &mut diplomat_runtime::DiplomatWriteable) -> Result<(), Box<IronRdpError>> {
|
pub fn get_url(&self, writeable: &mut diplomat_runtime::DiplomatWriteable) -> Result<(), Box<IronRdpError>> {
|
||||||
use core::fmt::Write;
|
use core::fmt::Write;
|
||||||
let url: &str = self.0.url.as_ref();
|
let url: &str = self.0.url.as_ref();
|
||||||
write!(writeable, "{}", url)?;
|
write!(writeable, "{url}")?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,7 +257,7 @@ impl WrongOSError {
|
||||||
impl Display for WrongOSError {
|
impl Display for WrongOSError {
|
||||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||||
if let Some(custom_message) = &self.custom_message {
|
if let Some(custom_message) = &self.custom_message {
|
||||||
write!(f, "{}", custom_message)?;
|
write!(f, "{custom_message}")?;
|
||||||
}
|
}
|
||||||
write!(f, "expected platform {}", self.expected)
|
write!(f, "expected platform {}", self.expected)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use std::error::Error;
|
use core::error::Error;
|
||||||
use std::sync::Once;
|
use std::sync::Once;
|
||||||
|
|
||||||
static INIT_LOG: Once = Once::new();
|
static INIT_LOG: Once = Once::new();
|
||||||
|
|
|
@ -184,8 +184,8 @@ pub mod ffi {
|
||||||
match &self.0 {
|
match &self.0 {
|
||||||
ironrdp::session::ActiveStageOutput::ResponseFrame { .. } => ActiveStageOutputType::ResponseFrame,
|
ironrdp::session::ActiveStageOutput::ResponseFrame { .. } => ActiveStageOutputType::ResponseFrame,
|
||||||
ironrdp::session::ActiveStageOutput::GraphicsUpdate { .. } => ActiveStageOutputType::GraphicsUpdate,
|
ironrdp::session::ActiveStageOutput::GraphicsUpdate { .. } => ActiveStageOutputType::GraphicsUpdate,
|
||||||
ironrdp::session::ActiveStageOutput::PointerDefault { .. } => ActiveStageOutputType::PointerDefault,
|
ironrdp::session::ActiveStageOutput::PointerDefault => ActiveStageOutputType::PointerDefault,
|
||||||
ironrdp::session::ActiveStageOutput::PointerHidden { .. } => ActiveStageOutputType::PointerHidden,
|
ironrdp::session::ActiveStageOutput::PointerHidden => ActiveStageOutputType::PointerHidden,
|
||||||
ironrdp::session::ActiveStageOutput::PointerPosition { .. } => ActiveStageOutputType::PointerPosition,
|
ironrdp::session::ActiveStageOutput::PointerPosition { .. } => ActiveStageOutputType::PointerPosition,
|
||||||
ironrdp::session::ActiveStageOutput::PointerBitmap { .. } => ActiveStageOutputType::PointerBitmap,
|
ironrdp::session::ActiveStageOutput::PointerBitmap { .. } => ActiveStageOutputType::PointerBitmap,
|
||||||
ironrdp::session::ActiveStageOutput::Terminate { .. } => ActiveStageOutputType::Terminate,
|
ironrdp::session::ActiveStageOutput::Terminate { .. } => ActiveStageOutputType::Terminate,
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "1.85.0"
|
channel = "1.88.0"
|
||||||
components = ["rustfmt", "clippy"]
|
components = ["rustfmt", "clippy"]
|
||||||
|
|
|
@ -86,7 +86,7 @@ pub fn report_github(sh: &Shell, repo: &str, pr_id: u32) -> anyhow::Result<()> {
|
||||||
|
|
||||||
println!("Past:\n{past_report}");
|
println!("Past:\n{past_report}");
|
||||||
println!("New:\n{report}");
|
println!("New:\n{report}");
|
||||||
println!("Diff: {:+}%", diff);
|
println!("Diff: {diff:+}%");
|
||||||
|
|
||||||
// `GH_TOKEN` environment variable sanity checks
|
// `GH_TOKEN` environment variable sanity checks
|
||||||
match std::env::var_os("GH_TOKEN") {
|
match std::env::var_os("GH_TOKEN") {
|
||||||
|
@ -122,7 +122,7 @@ pub fn report_github(sh: &Shell, repo: &str, pr_id: u32) -> anyhow::Result<()> {
|
||||||
writeln!(body, "{COMMENT_HEADER}")?;
|
writeln!(body, "{COMMENT_HEADER}")?;
|
||||||
writeln!(body, "**Past**:\n{past_report}")?;
|
writeln!(body, "**Past**:\n{past_report}")?;
|
||||||
writeln!(body, "**New**:\n{report}")?;
|
writeln!(body, "**New**:\n{report}")?;
|
||||||
writeln!(body, "**Diff**: {:+.2}%", diff)?;
|
writeln!(body, "**Diff**: {diff:+.2}%")?;
|
||||||
writeln!(body, "\n[this comment will be updated automatically]")?;
|
writeln!(body, "\n[this comment will be updated automatically]")?;
|
||||||
|
|
||||||
let command = cmd!(sh, "gh api")
|
let command = cmd!(sh, "gh api")
|
||||||
|
|
|
@ -120,7 +120,7 @@ fn remove_cs_files(dir: &Path) -> anyhow::Result<()> {
|
||||||
let entry = entry?;
|
let entry = entry?;
|
||||||
let path = entry.path();
|
let path = entry.path();
|
||||||
if path.is_file() && path.extension().and_then(|s| s.to_str()) == Some("cs") {
|
if path.is_file() && path.extension().and_then(|s| s.to_str()) == Some("cs") {
|
||||||
println!("Removing file: {:?}", path);
|
println!("Removing file: {path:?}");
|
||||||
fs::remove_file(path)?;
|
fs::remove_file(path)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,10 +62,8 @@ pub fn build(sh: &Shell, wasm_pack_dev: bool) -> anyhow::Result<()> {
|
||||||
|
|
||||||
// Modify the js file to get rid of the `URL` object.
|
// Modify the js file to get rid of the `URL` object.
|
||||||
// Vite doesn't work properly with inlined urls in `new URL(url, import.meta.url)`.
|
// Vite doesn't work properly with inlined urls in `new URL(url, import.meta.url)`.
|
||||||
let ironrdp_web_js_content = format!(
|
let ironrdp_web_js_content =
|
||||||
"import wasmUrl from './ironrdp_web_bg.wasm?url';\n\n{}",
|
format!("import wasmUrl from './ironrdp_web_bg.wasm?url';\n\n{ironrdp_web_js_content}");
|
||||||
ironrdp_web_js_content
|
|
||||||
);
|
|
||||||
let ironrdp_web_js_content =
|
let ironrdp_web_js_content =
|
||||||
ironrdp_web_js_content.replace("new URL('ironrdp_web_bg.wasm', import.meta.url)", "wasmUrl");
|
ironrdp_web_js_content.replace("new URL('ironrdp_web_bg.wasm', import.meta.url)", "wasmUrl");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue