mirror of
https://github.com/Devolutions/IronRDP.git
synced 2025-08-04 15:18:17 +00:00
WIP add PDU support
This commit is contained in:
parent
5e6e4e1627
commit
f79954cc87
3 changed files with 36 additions and 2 deletions
|
@ -21,6 +21,7 @@ pub struct Config {
|
|||
pub connector: connector::Config,
|
||||
pub clipboard_type: ClipboardType,
|
||||
pub rdcleanpath: Option<RDCleanPathConfig>,
|
||||
pub pcb: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
|
||||
|
@ -238,6 +239,10 @@ struct Args {
|
|||
/// The bitmap codecs to use (remotefx:on, ...)
|
||||
#[clap(long, value_parser, num_args = 1.., value_delimiter = ',')]
|
||||
codecs: Vec<String>,
|
||||
|
||||
/// The Preconnection Blob
|
||||
#[clap(long)]
|
||||
pcb: Option<String>,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
|
@ -357,6 +362,7 @@ impl Config {
|
|||
connector,
|
||||
clipboard_type,
|
||||
rdcleanpath,
|
||||
pcb: args.pcb,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use ironrdp::cliprdr::backend::{ClipboardMessage, CliprdrBackendFactory};
|
||||
use ironrdp::connector::connection_activation::ConnectionActivationState;
|
||||
use ironrdp::connector::{ConnectionResult, ConnectorResult};
|
||||
use ironrdp::core::Encode;
|
||||
use ironrdp::displaycontrol::client::DisplayControlClient;
|
||||
use ironrdp::displaycontrol::pdu::MonitorLayoutEntry;
|
||||
use ironrdp::graphics::image_processing::PixelFormat;
|
||||
|
@ -8,7 +9,7 @@ use ironrdp::pdu::input::fast_path::FastPathInputEvent;
|
|||
use ironrdp::session::image::DecodedImage;
|
||||
use ironrdp::session::{fast_path, ActiveStage, ActiveStageOutput, GracefulDisconnectReason, SessionResult};
|
||||
use ironrdp::{cliprdr, connector, rdpdr, rdpsnd, session};
|
||||
use ironrdp_core::WriteBuf;
|
||||
use ironrdp_core::{WriteBuf, WriteCursor};
|
||||
use ironrdp_rdpsnd_native::cpal;
|
||||
use ironrdp_tokio::reqwest::ReqwestNetworkClient;
|
||||
use ironrdp_tokio::{single_sequence_step_read, split_tokio_framed, FramedWrite};
|
||||
|
@ -146,6 +147,24 @@ async fn connect(
|
|||
connector.attach_static_channel(cliprdr);
|
||||
}
|
||||
|
||||
if let Some(pcb) = &config.pcb {
|
||||
let pdu = ironrdp::pdu::pcb::PreconnectionBlob {
|
||||
id: 0,
|
||||
version: ironrdp::pdu::pcb::PcbVersion::V2,
|
||||
v2_payload: Some(pcb.to_owned()),
|
||||
};
|
||||
|
||||
let mut encoded: Vec<_> = Vec::new();
|
||||
let mut cursor = WriteCursor::new(&mut encoded);
|
||||
pdu.encode(&mut cursor)
|
||||
.map_err(|e| connector::custom_err!("encode PreconnectionBlob", e))?;
|
||||
|
||||
framed
|
||||
.write_all(&encoded)
|
||||
.await
|
||||
.map_err(|e| connector::custom_err!("couldn’t write PreconnectionBlob", e))?;
|
||||
}
|
||||
|
||||
let should_upgrade = ironrdp_tokio::connect_begin(&mut framed, &mut connector).await?;
|
||||
|
||||
debug!("TLS upgrade");
|
||||
|
|
|
@ -84,6 +84,15 @@ encode_decode_test! {
|
|||
"004b00770056004d0048004300660059007400650036004900330066004c006100590031005f006200330053007200",
|
||||
"77005800490057006a006e00350041000000"
|
||||
)).expect("pcb_v2_with_jwt payload");
|
||||
v2_hyperv_guid :
|
||||
PreconnectionBlob {
|
||||
version: PcbVersion::V2,
|
||||
id: 0,
|
||||
v2_payload: Some(String::from("ff995b48-a34f-404a-938f-303e4bb5bf31")),
|
||||
},
|
||||
hex::decode(concat!(
|
||||
"5c0000000000000002000000000000002500660066003900390035006200340038002d0061003300340066002d0034003000340061002d0039003300380066002d003300300033006500340062006200350062006600330031000000"
|
||||
)).expect("v2_hyperv_guid payload");
|
||||
}
|
||||
|
||||
const PRECONNECTION_PDU_V1_NULL_SIZE_BUF: [u8; 16] = [
|
||||
|
@ -165,4 +174,4 @@ fn pcb_v2_string_too_big() {
|
|||
}
|
||||
"#]]
|
||||
.assert_debug_eq(&e);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue