remove remote conn id
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
8770552448
commit
5a07701b90
@ -18,8 +18,7 @@ extern "C"
|
||||
|
||||
/* Clipboard Messages */
|
||||
#define DEFINE_CLIPRDR_HEADER_COMMON() \
|
||||
UINT32 serverConnID; \
|
||||
UINT32 remoteConnID; \
|
||||
UINT32 connID; \
|
||||
UINT16 msgType; \
|
||||
UINT16 msgFlags; \
|
||||
UINT32 dataLen
|
||||
@ -192,7 +191,7 @@ extern "C"
|
||||
typedef UINT (*pcCliprdrServerFileContentsResponse)(
|
||||
CliprdrClientContext *context, const CLIPRDR_FILE_CONTENTS_RESPONSE *fileContentsResponse);
|
||||
|
||||
typedef BOOL (*pcCheckEnabled)(UINT32 server_conn_id, UINT32 remote_conn_id);
|
||||
typedef BOOL (*pcCheckEnabled)(UINT32 connID);
|
||||
|
||||
// TODO: hide more members of clipboard context
|
||||
struct _cliprdr_client_context
|
||||
|
@ -175,8 +175,7 @@ pub const FALSE: ::std::os::raw::c_int = 0;
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct _CLIPRDR_HEADER {
|
||||
pub serverConnID: UINT32,
|
||||
pub remoteConnID: UINT32,
|
||||
pub connID: UINT32,
|
||||
pub msgType: UINT16,
|
||||
pub msgFlags: UINT16,
|
||||
pub dataLen: UINT32,
|
||||
@ -201,8 +200,7 @@ pub type CLIPRDR_GENERAL_CAPABILITY_SET = _CLIPRDR_GENERAL_CAPABILITY_SET;
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct _CLIPRDR_CAPABILITIES {
|
||||
pub serverConnID: UINT32,
|
||||
pub remoteConnID: UINT32,
|
||||
pub connID: UINT32,
|
||||
pub msgType: UINT16,
|
||||
pub msgFlags: UINT16,
|
||||
pub dataLen: UINT32,
|
||||
@ -213,8 +211,7 @@ pub type CLIPRDR_CAPABILITIES = _CLIPRDR_CAPABILITIES;
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct _CLIPRDR_MONITOR_READY {
|
||||
pub serverConnID: UINT32,
|
||||
pub remoteConnID: UINT32,
|
||||
pub connID: UINT32,
|
||||
pub msgType: UINT16,
|
||||
pub msgFlags: UINT16,
|
||||
pub dataLen: UINT32,
|
||||
@ -223,8 +220,7 @@ pub type CLIPRDR_MONITOR_READY = _CLIPRDR_MONITOR_READY;
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct _CLIPRDR_TEMP_DIRECTORY {
|
||||
pub serverConnID: UINT32,
|
||||
pub remoteConnID: UINT32,
|
||||
pub connID: UINT32,
|
||||
pub msgType: UINT16,
|
||||
pub msgFlags: UINT16,
|
||||
pub dataLen: UINT32,
|
||||
@ -241,8 +237,7 @@ pub type CLIPRDR_FORMAT = _CLIPRDR_FORMAT;
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct _CLIPRDR_FORMAT_LIST {
|
||||
pub serverConnID: UINT32,
|
||||
pub remoteConnID: UINT32,
|
||||
pub connID: UINT32,
|
||||
pub msgType: UINT16,
|
||||
pub msgFlags: UINT16,
|
||||
pub dataLen: UINT32,
|
||||
@ -253,8 +248,7 @@ pub type CLIPRDR_FORMAT_LIST = _CLIPRDR_FORMAT_LIST;
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct _CLIPRDR_FORMAT_LIST_RESPONSE {
|
||||
pub serverConnID: UINT32,
|
||||
pub remoteConnID: UINT32,
|
||||
pub connID: UINT32,
|
||||
pub msgType: UINT16,
|
||||
pub msgFlags: UINT16,
|
||||
pub dataLen: UINT32,
|
||||
@ -263,8 +257,7 @@ pub type CLIPRDR_FORMAT_LIST_RESPONSE = _CLIPRDR_FORMAT_LIST_RESPONSE;
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct _CLIPRDR_LOCK_CLIPBOARD_DATA {
|
||||
pub serverConnID: UINT32,
|
||||
pub remoteConnID: UINT32,
|
||||
pub connID: UINT32,
|
||||
pub msgType: UINT16,
|
||||
pub msgFlags: UINT16,
|
||||
pub dataLen: UINT32,
|
||||
@ -274,8 +267,7 @@ pub type CLIPRDR_LOCK_CLIPBOARD_DATA = _CLIPRDR_LOCK_CLIPBOARD_DATA;
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct _CLIPRDR_UNLOCK_CLIPBOARD_DATA {
|
||||
pub serverConnID: UINT32,
|
||||
pub remoteConnID: UINT32,
|
||||
pub connID: UINT32,
|
||||
pub msgType: UINT16,
|
||||
pub msgFlags: UINT16,
|
||||
pub dataLen: UINT32,
|
||||
@ -285,8 +277,7 @@ pub type CLIPRDR_UNLOCK_CLIPBOARD_DATA = _CLIPRDR_UNLOCK_CLIPBOARD_DATA;
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct _CLIPRDR_FORMAT_DATA_REQUEST {
|
||||
pub serverConnID: UINT32,
|
||||
pub remoteConnID: UINT32,
|
||||
pub connID: UINT32,
|
||||
pub msgType: UINT16,
|
||||
pub msgFlags: UINT16,
|
||||
pub dataLen: UINT32,
|
||||
@ -296,8 +287,7 @@ pub type CLIPRDR_FORMAT_DATA_REQUEST = _CLIPRDR_FORMAT_DATA_REQUEST;
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct _CLIPRDR_FORMAT_DATA_RESPONSE {
|
||||
pub serverConnID: UINT32,
|
||||
pub remoteConnID: UINT32,
|
||||
pub connID: UINT32,
|
||||
pub msgType: UINT16,
|
||||
pub msgFlags: UINT16,
|
||||
pub dataLen: UINT32,
|
||||
@ -307,8 +297,7 @@ pub type CLIPRDR_FORMAT_DATA_RESPONSE = _CLIPRDR_FORMAT_DATA_RESPONSE;
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct _CLIPRDR_FILE_CONTENTS_REQUEST {
|
||||
pub serverConnID: UINT32,
|
||||
pub remoteConnID: UINT32,
|
||||
pub connID: UINT32,
|
||||
pub msgType: UINT16,
|
||||
pub msgFlags: UINT16,
|
||||
pub dataLen: UINT32,
|
||||
@ -325,8 +314,7 @@ pub type CLIPRDR_FILE_CONTENTS_REQUEST = _CLIPRDR_FILE_CONTENTS_REQUEST;
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct _CLIPRDR_FILE_CONTENTS_RESPONSE {
|
||||
pub serverConnID: UINT32,
|
||||
pub remoteConnID: UINT32,
|
||||
pub connID: UINT32,
|
||||
pub msgType: UINT16,
|
||||
pub msgFlags: UINT16,
|
||||
pub dataLen: UINT32,
|
||||
@ -457,7 +445,7 @@ pub type pcCliprdrServerFileContentsResponse = ::std::option::Option<
|
||||
) -> UINT,
|
||||
>;
|
||||
pub type pcCheckEnabled = ::std::option::Option<
|
||||
unsafe extern "C" fn(server_conn_id: UINT32, remote_conn_id: UINT32) -> BOOL,
|
||||
unsafe extern "C" fn(connID: UINT32) -> BOOL,
|
||||
>;
|
||||
|
||||
// TODO: hide more members of clipboard context
|
||||
@ -498,8 +486,7 @@ extern "C" {
|
||||
pub(crate) fn uninit_cliprdr(context: *mut CliprdrClientContext) -> BOOL;
|
||||
pub(crate) fn empty_cliprdr(
|
||||
context: *mut CliprdrClientContext,
|
||||
server_conn_id: UINT32,
|
||||
remote_conn_id: UINT32,
|
||||
connID: UINT32,
|
||||
) -> BOOL;
|
||||
}
|
||||
|
||||
|
@ -17,39 +17,28 @@ use std::{
|
||||
|
||||
pub mod cliprdr;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ConnID {
|
||||
pub server_conn_id: u32,
|
||||
pub remote_conn_id: u32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[serde(tag = "t", content = "c")]
|
||||
pub enum ClipbaordFile {
|
||||
ServerFormatList {
|
||||
server_conn_id: i32,
|
||||
remote_conn_id: i32,
|
||||
conn_id: i32,
|
||||
format_list: Vec<(i32, String)>,
|
||||
},
|
||||
ServerFormatListResponse {
|
||||
server_conn_id: i32,
|
||||
remote_conn_id: i32,
|
||||
conn_id: i32,
|
||||
msg_flags: i32,
|
||||
},
|
||||
ServerFormatDataRequest {
|
||||
server_conn_id: i32,
|
||||
remote_conn_id: i32,
|
||||
conn_id: i32,
|
||||
requested_format_id: i32,
|
||||
},
|
||||
ServerFormatDataResponse {
|
||||
server_conn_id: i32,
|
||||
remote_conn_id: i32,
|
||||
conn_id: i32,
|
||||
msg_flags: i32,
|
||||
format_data: Vec<u8>,
|
||||
},
|
||||
FileContentsRequest {
|
||||
server_conn_id: i32,
|
||||
remote_conn_id: i32,
|
||||
conn_id: i32,
|
||||
stream_id: i32,
|
||||
list_index: i32,
|
||||
dw_flags: i32,
|
||||
@ -60,8 +49,7 @@ pub enum ClipbaordFile {
|
||||
clip_data_id: i32,
|
||||
},
|
||||
FileContentsResponse {
|
||||
server_conn_id: i32,
|
||||
remote_conn_id: i32,
|
||||
conn_id: i32,
|
||||
msg_flags: i32,
|
||||
stream_id: i32,
|
||||
requested_data: Vec<u8>,
|
||||
@ -70,12 +58,11 @@ pub enum ClipbaordFile {
|
||||
|
||||
#[derive(Default)]
|
||||
struct ConnEnabled {
|
||||
server_conn_enabled: HashMap<i32, bool>,
|
||||
remote_conn_enabled: HashMap<i32, bool>,
|
||||
conn_enabled: HashMap<i32, bool>,
|
||||
}
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
static ref MSG_CHANNEL_CLIENT: (UnboundedSender<(ConnID, ClipbaordFile)>, TokioMutex<UnboundedReceiver<(ConnID, ClipbaordFile)>>) = {
|
||||
static ref MSG_CHANNEL_CLIENT: (UnboundedSender<(i32, ClipbaordFile)>, TokioMutex<UnboundedReceiver<(i32, ClipbaordFile)>>) = {
|
||||
let (tx, rx) = unbounded_channel();
|
||||
(tx, TokioMutex::new(rx))
|
||||
};
|
||||
@ -84,120 +71,78 @@ lazy_static::lazy_static! {
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn get_rx_clip_client<'a>() -> &'a TokioMutex<UnboundedReceiver<(ConnID, ClipbaordFile)>> {
|
||||
pub fn get_rx_clip_client<'a>() -> &'a TokioMutex<UnboundedReceiver<(i32, ClipbaordFile)>> {
|
||||
&MSG_CHANNEL_CLIENT.1
|
||||
}
|
||||
|
||||
pub fn set_conn_enabled(server_conn_id: i32, remote_conn_id: i32, enabled: bool) {
|
||||
pub fn set_conn_enabled(conn_id: i32, enabled: bool) {
|
||||
let mut lock = CLIP_CONN_ENABLED.lock().unwrap();
|
||||
if server_conn_id != 0 {
|
||||
let _ = lock.server_conn_enabled.insert(server_conn_id, enabled);
|
||||
}
|
||||
if remote_conn_id != 0 {
|
||||
let _ = lock.remote_conn_enabled.insert(remote_conn_id, enabled);
|
||||
if conn_id != 0 {
|
||||
let _ = lock.conn_enabled.insert(conn_id, enabled);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn empty_clipboard(
|
||||
context: &mut Box<CliprdrClientContext>,
|
||||
server_conn_id: i32,
|
||||
remote_conn_id: i32,
|
||||
) -> bool {
|
||||
unsafe {
|
||||
TRUE == cliprdr::empty_cliprdr(
|
||||
&mut (**context),
|
||||
server_conn_id as u32,
|
||||
remote_conn_id as u32,
|
||||
)
|
||||
}
|
||||
pub fn empty_clipboard(context: &mut Box<CliprdrClientContext>, conn_id: i32) -> bool {
|
||||
unsafe { TRUE == cliprdr::empty_cliprdr(&mut (**context), conn_id as u32) }
|
||||
}
|
||||
|
||||
pub fn server_clip_file(
|
||||
context: &mut Box<CliprdrClientContext>,
|
||||
conn_id: ConnID,
|
||||
s_conn_id: i32,
|
||||
msg: ClipbaordFile,
|
||||
) -> u32 {
|
||||
match msg {
|
||||
ClipbaordFile::ServerFormatList {
|
||||
mut server_conn_id,
|
||||
mut remote_conn_id,
|
||||
mut conn_id,
|
||||
format_list,
|
||||
} => {
|
||||
if conn_id.server_conn_id != 0 {
|
||||
server_conn_id = conn_id.server_conn_id as i32;
|
||||
}
|
||||
if conn_id.remote_conn_id != 0 {
|
||||
remote_conn_id = conn_id.remote_conn_id as i32;
|
||||
if s_conn_id != 0 {
|
||||
conn_id = s_conn_id as i32;
|
||||
}
|
||||
log::debug!("server_format_list called");
|
||||
let ret = server_format_list(context, server_conn_id, remote_conn_id, format_list);
|
||||
let ret = server_format_list(context, conn_id, format_list);
|
||||
log::debug!("server_format_list called, return {}", ret);
|
||||
ret
|
||||
}
|
||||
ClipbaordFile::ServerFormatListResponse {
|
||||
mut server_conn_id,
|
||||
mut remote_conn_id,
|
||||
mut conn_id,
|
||||
msg_flags,
|
||||
} => {
|
||||
if conn_id.server_conn_id != 0 {
|
||||
server_conn_id = conn_id.server_conn_id as i32;
|
||||
}
|
||||
if conn_id.remote_conn_id != 0 {
|
||||
remote_conn_id = conn_id.remote_conn_id as i32;
|
||||
if s_conn_id != 0 {
|
||||
conn_id = s_conn_id as i32;
|
||||
}
|
||||
log::debug!("format_list_response called");
|
||||
let ret =
|
||||
server_format_list_response(context, server_conn_id, remote_conn_id, msg_flags);
|
||||
let ret = server_format_list_response(context, conn_id, msg_flags);
|
||||
log::debug!("server_format_list_response called, return {}", ret);
|
||||
ret
|
||||
}
|
||||
ClipbaordFile::ServerFormatDataRequest {
|
||||
mut server_conn_id,
|
||||
mut remote_conn_id,
|
||||
mut conn_id,
|
||||
requested_format_id,
|
||||
} => {
|
||||
if conn_id.server_conn_id != 0 {
|
||||
server_conn_id = conn_id.server_conn_id as i32;
|
||||
}
|
||||
if conn_id.remote_conn_id != 0 {
|
||||
remote_conn_id = conn_id.remote_conn_id as i32;
|
||||
if s_conn_id != 0 {
|
||||
conn_id = s_conn_id as i32;
|
||||
}
|
||||
log::debug!("format_data_request called");
|
||||
let ret = server_format_data_request(
|
||||
context,
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
requested_format_id,
|
||||
);
|
||||
let ret = server_format_data_request(context, conn_id, requested_format_id);
|
||||
log::debug!("server_format_data_request called, return {}", ret);
|
||||
ret
|
||||
}
|
||||
ClipbaordFile::ServerFormatDataResponse {
|
||||
mut server_conn_id,
|
||||
mut remote_conn_id,
|
||||
mut conn_id,
|
||||
msg_flags,
|
||||
format_data,
|
||||
} => {
|
||||
if conn_id.server_conn_id != 0 {
|
||||
server_conn_id = conn_id.server_conn_id as i32;
|
||||
}
|
||||
if conn_id.remote_conn_id != 0 {
|
||||
remote_conn_id = conn_id.remote_conn_id as i32;
|
||||
if s_conn_id != 0 {
|
||||
conn_id = s_conn_id as i32;
|
||||
}
|
||||
log::debug!("format_data_response called");
|
||||
let ret = server_format_data_response(
|
||||
context,
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
msg_flags,
|
||||
format_data,
|
||||
);
|
||||
let ret = server_format_data_response(context, conn_id, msg_flags, format_data);
|
||||
log::debug!("server_format_data_response called, return {}", ret);
|
||||
ret
|
||||
}
|
||||
ClipbaordFile::FileContentsRequest {
|
||||
mut server_conn_id,
|
||||
mut remote_conn_id,
|
||||
mut conn_id,
|
||||
stream_id,
|
||||
list_index,
|
||||
dw_flags,
|
||||
@ -207,17 +152,13 @@ pub fn server_clip_file(
|
||||
have_clip_data_id,
|
||||
clip_data_id,
|
||||
} => {
|
||||
if conn_id.server_conn_id != 0 {
|
||||
server_conn_id = conn_id.server_conn_id as i32;
|
||||
}
|
||||
if conn_id.remote_conn_id != 0 {
|
||||
remote_conn_id = conn_id.remote_conn_id as i32;
|
||||
if s_conn_id != 0 {
|
||||
conn_id = s_conn_id as i32;
|
||||
}
|
||||
log::debug!("file_contents_request called");
|
||||
let ret = server_file_contents_request(
|
||||
context,
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
conn_id,
|
||||
stream_id,
|
||||
list_index,
|
||||
dw_flags,
|
||||
@ -231,23 +172,18 @@ pub fn server_clip_file(
|
||||
ret
|
||||
}
|
||||
ClipbaordFile::FileContentsResponse {
|
||||
mut server_conn_id,
|
||||
mut remote_conn_id,
|
||||
mut conn_id,
|
||||
msg_flags,
|
||||
stream_id,
|
||||
requested_data,
|
||||
} => {
|
||||
if conn_id.server_conn_id != 0 {
|
||||
server_conn_id = conn_id.server_conn_id as i32;
|
||||
}
|
||||
if conn_id.remote_conn_id != 0 {
|
||||
remote_conn_id = conn_id.remote_conn_id as i32;
|
||||
if s_conn_id != 0 {
|
||||
conn_id = s_conn_id as i32;
|
||||
}
|
||||
log::debug!("file_contents_response called");
|
||||
let ret = server_file_contents_response(
|
||||
context,
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
conn_id,
|
||||
msg_flags,
|
||||
stream_id,
|
||||
requested_data,
|
||||
@ -260,8 +196,7 @@ pub fn server_clip_file(
|
||||
|
||||
pub fn server_format_list(
|
||||
context: &mut Box<CliprdrClientContext>,
|
||||
server_conn_id: i32,
|
||||
remote_conn_id: i32,
|
||||
conn_id: i32,
|
||||
format_list: Vec<(i32, String)>,
|
||||
) -> u32 {
|
||||
unsafe {
|
||||
@ -288,8 +223,7 @@ pub fn server_format_list(
|
||||
.collect::<Vec<CLIPRDR_FORMAT>>();
|
||||
|
||||
let format_list = CLIPRDR_FORMAT_LIST {
|
||||
serverConnID: server_conn_id as UINT32,
|
||||
remoteConnID: remote_conn_id as UINT32,
|
||||
connID: conn_id as UINT32,
|
||||
msgType: 0 as UINT16,
|
||||
msgFlags: 0 as UINT16,
|
||||
dataLen: 0 as UINT32,
|
||||
@ -311,14 +245,12 @@ pub fn server_format_list(
|
||||
}
|
||||
pub fn server_format_list_response(
|
||||
context: &mut Box<CliprdrClientContext>,
|
||||
server_conn_id: i32,
|
||||
remote_conn_id: i32,
|
||||
conn_id: i32,
|
||||
msg_flags: i32,
|
||||
) -> u32 {
|
||||
unsafe {
|
||||
let format_list_response = CLIPRDR_FORMAT_LIST_RESPONSE {
|
||||
serverConnID: server_conn_id as UINT32,
|
||||
remoteConnID: remote_conn_id as UINT32,
|
||||
connID: conn_id as UINT32,
|
||||
msgType: 0 as UINT16,
|
||||
msgFlags: msg_flags as UINT16,
|
||||
dataLen: 0 as UINT32,
|
||||
@ -332,14 +264,12 @@ pub fn server_format_list_response(
|
||||
}
|
||||
pub fn server_format_data_request(
|
||||
context: &mut Box<CliprdrClientContext>,
|
||||
server_conn_id: i32,
|
||||
remote_conn_id: i32,
|
||||
conn_id: i32,
|
||||
requested_format_id: i32,
|
||||
) -> u32 {
|
||||
unsafe {
|
||||
let format_data_request = CLIPRDR_FORMAT_DATA_REQUEST {
|
||||
serverConnID: server_conn_id as UINT32,
|
||||
remoteConnID: remote_conn_id as UINT32,
|
||||
connID: conn_id as UINT32,
|
||||
msgType: 0 as UINT16,
|
||||
msgFlags: 0 as UINT16,
|
||||
dataLen: 0 as UINT32,
|
||||
@ -352,15 +282,13 @@ pub fn server_format_data_request(
|
||||
}
|
||||
pub fn server_format_data_response(
|
||||
context: &mut Box<CliprdrClientContext>,
|
||||
server_conn_id: i32,
|
||||
remote_conn_id: i32,
|
||||
conn_id: i32,
|
||||
msg_flags: i32,
|
||||
mut format_data: Vec<u8>,
|
||||
) -> u32 {
|
||||
unsafe {
|
||||
let format_data_response = CLIPRDR_FORMAT_DATA_RESPONSE {
|
||||
serverConnID: server_conn_id as UINT32,
|
||||
remoteConnID: remote_conn_id as UINT32,
|
||||
connID: conn_id as UINT32,
|
||||
msgType: 0 as UINT16,
|
||||
msgFlags: msg_flags as UINT16,
|
||||
dataLen: format_data.len() as UINT32,
|
||||
@ -375,8 +303,7 @@ pub fn server_format_data_response(
|
||||
}
|
||||
pub fn server_file_contents_request(
|
||||
context: &mut Box<CliprdrClientContext>,
|
||||
server_conn_id: i32,
|
||||
remote_conn_id: i32,
|
||||
conn_id: i32,
|
||||
stream_id: i32,
|
||||
list_index: i32,
|
||||
dw_flags: i32,
|
||||
@ -388,8 +315,7 @@ pub fn server_file_contents_request(
|
||||
) -> u32 {
|
||||
unsafe {
|
||||
let file_contents_request = CLIPRDR_FILE_CONTENTS_REQUEST {
|
||||
serverConnID: server_conn_id as UINT32,
|
||||
remoteConnID: remote_conn_id as UINT32,
|
||||
connID: conn_id as UINT32,
|
||||
msgType: 0 as UINT16,
|
||||
msgFlags: 0 as UINT16,
|
||||
dataLen: 0 as UINT32,
|
||||
@ -411,16 +337,14 @@ pub fn server_file_contents_request(
|
||||
}
|
||||
pub fn server_file_contents_response(
|
||||
context: &mut Box<CliprdrClientContext>,
|
||||
server_conn_id: i32,
|
||||
remote_conn_id: i32,
|
||||
conn_id: i32,
|
||||
msg_flags: i32,
|
||||
stream_id: i32,
|
||||
mut requested_data: Vec<u8>,
|
||||
) -> u32 {
|
||||
unsafe {
|
||||
let file_contents_response = CLIPRDR_FILE_CONTENTS_RESPONSE {
|
||||
serverConnID: server_conn_id as UINT32,
|
||||
remoteConnID: remote_conn_id as UINT32,
|
||||
connID: conn_id as UINT32,
|
||||
msgType: 0 as UINT16,
|
||||
msgFlags: msg_flags as UINT16,
|
||||
dataLen: 4 + requested_data.len() as UINT32,
|
||||
@ -453,37 +377,19 @@ pub fn create_cliprdr_context(
|
||||
)?)
|
||||
}
|
||||
|
||||
extern "C" fn check_enabled(server_conn_id: UINT32, remote_conn_id: UINT32) -> BOOL {
|
||||
extern "C" fn check_enabled(conn_id: UINT32) -> BOOL {
|
||||
let lock = CLIP_CONN_ENABLED.lock().unwrap();
|
||||
if server_conn_id == 0 && remote_conn_id == 0 {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
let mut server_conn_enabled = false;
|
||||
if server_conn_id != 0 {
|
||||
if let Some(true) = lock.server_conn_enabled.get(&(server_conn_id as i32)) {
|
||||
server_conn_enabled = true;
|
||||
let mut connd_enabled = false;
|
||||
if conn_id != 0 {
|
||||
if let Some(true) = lock.conn_enabled.get(&(conn_id as i32)) {
|
||||
connd_enabled = true;
|
||||
}
|
||||
} else {
|
||||
server_conn_enabled = true;
|
||||
connd_enabled = true;
|
||||
}
|
||||
|
||||
// let mut remote_conn_enabled = false;
|
||||
// remote connection is always enabled
|
||||
// if remote_conn_id != 0 {
|
||||
// if let Some(true) = lock.remote_conn_enabled.get(&(remote_conn_id as i32)) {
|
||||
// remote_conn_enabled = true;
|
||||
// }
|
||||
// } else {
|
||||
// remote_conn_enabled = true;
|
||||
// }
|
||||
let remote_conn_enabled = true;
|
||||
|
||||
if server_conn_enabled && remote_conn_enabled {
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
return if connd_enabled { TRUE } else { FALSE };
|
||||
}
|
||||
|
||||
extern "C" fn client_format_list(
|
||||
@ -492,8 +398,7 @@ extern "C" fn client_format_list(
|
||||
) -> UINT {
|
||||
log::debug!("client_format_list called");
|
||||
|
||||
let server_conn_id;
|
||||
let remote_conn_id;
|
||||
let conn_id;
|
||||
let mut format_list: Vec<(i32, String)> = Vec::new();
|
||||
unsafe {
|
||||
let mut i = 0u32;
|
||||
@ -515,16 +420,10 @@ extern "C" fn client_format_list(
|
||||
// log::debug!("format list item {}: format id: {}, format name: {}", i, format_data.formatId, &format_name);
|
||||
i += 1;
|
||||
}
|
||||
server_conn_id = (*clip_format_list).serverConnID as i32;
|
||||
remote_conn_id = (*clip_format_list).remoteConnID as i32;
|
||||
conn_id = (*clip_format_list).connID as i32;
|
||||
}
|
||||
let conn_id = ConnID {
|
||||
server_conn_id: server_conn_id as u32,
|
||||
remote_conn_id: remote_conn_id as u32,
|
||||
};
|
||||
let data = ClipbaordFile::ServerFormatList {
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
conn_id,
|
||||
format_list,
|
||||
};
|
||||
// no need to handle result here
|
||||
@ -539,23 +438,13 @@ extern "C" fn client_format_list_response(
|
||||
) -> UINT {
|
||||
log::debug!("client_format_list_response called");
|
||||
|
||||
let server_conn_id;
|
||||
let remote_conn_id;
|
||||
let conn_id;
|
||||
let msg_flags;
|
||||
unsafe {
|
||||
server_conn_id = (*format_list_response).serverConnID as i32;
|
||||
remote_conn_id = (*format_list_response).remoteConnID as i32;
|
||||
conn_id = (*format_list_response).connID as i32;
|
||||
msg_flags = (*format_list_response).msgFlags as i32;
|
||||
}
|
||||
let conn_id = ConnID {
|
||||
server_conn_id: server_conn_id as u32,
|
||||
remote_conn_id: remote_conn_id as u32,
|
||||
};
|
||||
let data = ClipbaordFile::ServerFormatListResponse {
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
msg_flags,
|
||||
};
|
||||
let data = ClipbaordFile::ServerFormatListResponse { conn_id, msg_flags };
|
||||
// no need to handle result here
|
||||
MSG_CHANNEL_CLIENT.0.send((conn_id, data)).unwrap();
|
||||
|
||||
@ -568,21 +457,14 @@ extern "C" fn client_format_data_request(
|
||||
) -> UINT {
|
||||
log::debug!("client_format_data_request called");
|
||||
|
||||
let server_conn_id;
|
||||
let remote_conn_id;
|
||||
let conn_id;
|
||||
let requested_format_id;
|
||||
unsafe {
|
||||
server_conn_id = (*format_data_request).serverConnID as i32;
|
||||
remote_conn_id = (*format_data_request).remoteConnID as i32;
|
||||
conn_id = (*format_data_request).connID as i32;
|
||||
requested_format_id = (*format_data_request).requestedFormatId as i32;
|
||||
}
|
||||
let conn_id = ConnID {
|
||||
server_conn_id: server_conn_id as u32,
|
||||
remote_conn_id: remote_conn_id as u32,
|
||||
};
|
||||
let data = ClipbaordFile::ServerFormatDataRequest {
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
conn_id,
|
||||
requested_format_id,
|
||||
};
|
||||
// no need to handle result here
|
||||
@ -595,15 +477,13 @@ extern "C" fn client_format_data_response(
|
||||
_context: *mut CliprdrClientContext,
|
||||
format_data_response: *const CLIPRDR_FORMAT_DATA_RESPONSE,
|
||||
) -> UINT {
|
||||
log::debug!("client_format_data_response called");
|
||||
log::debug!("cconn_idlient_format_data_response called");
|
||||
|
||||
let server_conn_id;
|
||||
let remote_conn_id;
|
||||
let conn_id;
|
||||
let msg_flags;
|
||||
let format_data;
|
||||
unsafe {
|
||||
server_conn_id = (*format_data_response).serverConnID as i32;
|
||||
remote_conn_id = (*format_data_response).remoteConnID as i32;
|
||||
conn_id = (*format_data_response).connID as i32;
|
||||
msg_flags = (*format_data_response).msgFlags as i32;
|
||||
if (*format_data_response).requestedFormatData.is_null() {
|
||||
format_data = Vec::new();
|
||||
@ -615,13 +495,8 @@ extern "C" fn client_format_data_response(
|
||||
.to_vec();
|
||||
}
|
||||
}
|
||||
let conn_id = ConnID {
|
||||
server_conn_id: server_conn_id as u32,
|
||||
remote_conn_id: remote_conn_id as u32,
|
||||
};
|
||||
let data = ClipbaordFile::ServerFormatDataResponse {
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
conn_id,
|
||||
msg_flags,
|
||||
format_data,
|
||||
};
|
||||
@ -647,8 +522,7 @@ extern "C" fn client_file_contents_request(
|
||||
// return ERROR_INVALID_PARAMETER;
|
||||
// }
|
||||
|
||||
let server_conn_id;
|
||||
let remote_conn_id;
|
||||
let conn_id;
|
||||
let stream_id;
|
||||
let list_index;
|
||||
let dw_flags;
|
||||
@ -658,8 +532,7 @@ extern "C" fn client_file_contents_request(
|
||||
let have_clip_data_id;
|
||||
let clip_data_id;
|
||||
unsafe {
|
||||
server_conn_id = (*file_contents_request).serverConnID as i32;
|
||||
remote_conn_id = (*file_contents_request).remoteConnID as i32;
|
||||
conn_id = (*file_contents_request).connID as i32;
|
||||
stream_id = (*file_contents_request).streamId as i32;
|
||||
list_index = (*file_contents_request).listIndex as i32;
|
||||
dw_flags = (*file_contents_request).dwFlags as i32;
|
||||
@ -669,14 +542,9 @@ extern "C" fn client_file_contents_request(
|
||||
have_clip_data_id = (*file_contents_request).haveClipDataId == TRUE;
|
||||
clip_data_id = (*file_contents_request).clipDataId as i32;
|
||||
}
|
||||
let conn_id = ConnID {
|
||||
server_conn_id: server_conn_id as u32,
|
||||
remote_conn_id: remote_conn_id as u32,
|
||||
};
|
||||
|
||||
let data = ClipbaordFile::FileContentsRequest {
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
conn_id,
|
||||
stream_id,
|
||||
list_index,
|
||||
dw_flags,
|
||||
@ -698,14 +566,12 @@ extern "C" fn client_file_contents_response(
|
||||
) -> UINT {
|
||||
log::debug!("client_file_contents_response called");
|
||||
|
||||
let server_conn_id;
|
||||
let remote_conn_id;
|
||||
let conn_id;
|
||||
let msg_flags;
|
||||
let stream_id;
|
||||
let requested_data;
|
||||
unsafe {
|
||||
server_conn_id = (*file_contents_response).serverConnID as i32;
|
||||
remote_conn_id = (*file_contents_response).remoteConnID as i32;
|
||||
conn_id = (*file_contents_response).connID as i32;
|
||||
msg_flags = (*file_contents_response).msgFlags as i32;
|
||||
stream_id = (*file_contents_response).streamId as i32;
|
||||
if (*file_contents_response).requestedData.is_null() {
|
||||
@ -718,14 +584,8 @@ extern "C" fn client_file_contents_response(
|
||||
.to_vec();
|
||||
}
|
||||
}
|
||||
let conn_id = ConnID {
|
||||
server_conn_id: server_conn_id as u32,
|
||||
remote_conn_id: remote_conn_id as u32,
|
||||
};
|
||||
|
||||
let data = ClipbaordFile::FileContentsResponse {
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
conn_id,
|
||||
msg_flags,
|
||||
stream_id,
|
||||
requested_data,
|
||||
|
@ -99,17 +99,9 @@ struct _CLIPRDR_MFPICT
|
||||
};
|
||||
typedef struct _CLIPRDR_MFPICT CLIPRDR_MFPICT;
|
||||
|
||||
struct _CONN_ID
|
||||
{
|
||||
UINT32 serverConnID;
|
||||
UINT32 remoteConnID;
|
||||
};
|
||||
typedef struct _CONN_ID CONN_ID;
|
||||
|
||||
struct _FORMAT_IDS
|
||||
{
|
||||
UINT32 serverConnID;
|
||||
UINT32 remoteConnID;
|
||||
UINT32 connID;
|
||||
UINT32 size;
|
||||
UINT32 *formats;
|
||||
};
|
||||
@ -186,8 +178,7 @@ struct _CliprdrStream
|
||||
ULARGE_INTEGER m_lOffset;
|
||||
FILEDESCRIPTORW m_Dsc;
|
||||
void *m_pData;
|
||||
UINT32 m_serverConnID;
|
||||
UINT32 m_remoteConnID;
|
||||
UINT32 m_connID;
|
||||
};
|
||||
typedef struct _CliprdrStream CliprdrStream;
|
||||
|
||||
@ -202,8 +193,7 @@ struct _CliprdrDataObject
|
||||
ULONG m_nStreams;
|
||||
IStream **m_pStream;
|
||||
void *m_pData;
|
||||
UINT32 m_serverConnID;
|
||||
UINT32 m_remoteConnID;
|
||||
UINT32 m_connID;
|
||||
};
|
||||
typedef struct _CliprdrDataObject CliprdrDataObject;
|
||||
|
||||
@ -256,13 +246,13 @@ BOOL wf_cliprdr_init(wfClipboard *clipboard, CliprdrClientContext *cliprdr);
|
||||
BOOL wf_cliprdr_uninit(wfClipboard *clipboard, CliprdrClientContext *cliprdr);
|
||||
BOOL wf_do_empty_cliprdr(wfClipboard *clipboard);
|
||||
|
||||
static BOOL wf_create_file_obj(UINT32 serverConnID, UINT32 remoteConnID, wfClipboard *cliprdrrdr, IDataObject **ppDataObject);
|
||||
static BOOL wf_create_file_obj(UINT32 connID, wfClipboard *cliprdrrdr, IDataObject **ppDataObject);
|
||||
static void wf_destroy_file_obj(IDataObject *instance);
|
||||
static UINT32 get_remote_format_id(wfClipboard *clipboard, UINT32 local_format);
|
||||
static UINT cliprdr_send_data_request(UINT32 serverConnID, UINT32 remoteConnID, wfClipboard *clipboard, UINT32 format);
|
||||
static UINT cliprdr_send_data_request(UINT32 connID, wfClipboard *clipboard, UINT32 format);
|
||||
static UINT cliprdr_send_lock(wfClipboard *clipboard);
|
||||
static UINT cliprdr_send_unlock(wfClipboard *clipboard);
|
||||
static UINT cliprdr_send_request_filecontents(wfClipboard *clipboard, UINT32 serverConnID, UINT32 remoteConnID, const void *streamid,
|
||||
static UINT cliprdr_send_request_filecontents(wfClipboard *clipboard, UINT32 connID, const void *streamid,
|
||||
ULONG index, UINT32 flag, DWORD positionhigh,
|
||||
DWORD positionlow, ULONG request);
|
||||
|
||||
@ -352,7 +342,7 @@ static HRESULT STDMETHODCALLTYPE CliprdrStream_Read(IStream *This, void *pv, ULO
|
||||
if (instance->m_lOffset.QuadPart >= instance->m_lSize.QuadPart)
|
||||
return S_FALSE;
|
||||
|
||||
ret = cliprdr_send_request_filecontents(clipboard, instance->m_serverConnID, instance->m_remoteConnID, (void *)This, instance->m_lIndex,
|
||||
ret = cliprdr_send_request_filecontents(clipboard, instance->m_connID, (void *)This, instance->m_lIndex,
|
||||
FILECONTENTS_RANGE, instance->m_lOffset.HighPart,
|
||||
instance->m_lOffset.LowPart, cb);
|
||||
|
||||
@ -519,7 +509,7 @@ static HRESULT STDMETHODCALLTYPE CliprdrStream_Clone(IStream *This, IStream **pp
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static CliprdrStream *CliprdrStream_New(UINT32 serverConnID, UINT32 remoteConnID, ULONG index, void *pData, const FILEDESCRIPTORW *dsc)
|
||||
static CliprdrStream *CliprdrStream_New(UINT32 connID, ULONG index, void *pData, const FILEDESCRIPTORW *dsc)
|
||||
{
|
||||
IStream *iStream;
|
||||
BOOL success = FALSE;
|
||||
@ -554,8 +544,7 @@ static CliprdrStream *CliprdrStream_New(UINT32 serverConnID, UINT32 remoteConnID
|
||||
instance->m_lIndex = index;
|
||||
instance->m_pData = pData;
|
||||
instance->m_lOffset.QuadPart = 0;
|
||||
instance->m_serverConnID = serverConnID;
|
||||
instance->m_remoteConnID = remoteConnID;
|
||||
instance->m_connID = connID;
|
||||
|
||||
if (instance->m_Dsc.dwFlags & FD_ATTRIBUTES)
|
||||
{
|
||||
@ -566,7 +555,7 @@ static CliprdrStream *CliprdrStream_New(UINT32 serverConnID, UINT32 remoteConnID
|
||||
if (((instance->m_Dsc.dwFlags & FD_FILESIZE) == 0) && !isDir)
|
||||
{
|
||||
/* get content size of this stream */
|
||||
if (cliprdr_send_request_filecontents(clipboard, instance->m_serverConnID, instance->m_remoteConnID, (void *)instance,
|
||||
if (cliprdr_send_request_filecontents(clipboard, instance->m_connID, (void *)instance,
|
||||
instance->m_lIndex, FILECONTENTS_SIZE, 0, 0,
|
||||
8) == CHANNEL_RC_OK)
|
||||
{
|
||||
@ -685,7 +674,7 @@ static HRESULT STDMETHODCALLTYPE CliprdrDataObject_GetData(IDataObject *This, FO
|
||||
return E_INVALIDARG;
|
||||
|
||||
clipboard = (wfClipboard *)instance->m_pData;
|
||||
if (!clipboard->context->CheckEnabled(instance->m_serverConnID, instance->m_remoteConnID))
|
||||
if (!clipboard->context->CheckEnabled(instance->m_connID))
|
||||
{
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
@ -694,7 +683,10 @@ static HRESULT STDMETHODCALLTYPE CliprdrDataObject_GetData(IDataObject *This, FO
|
||||
return E_INVALIDARG;
|
||||
|
||||
if ((idx = cliprdr_lookup_format(instance, pFormatEtc)) == -1)
|
||||
{
|
||||
// empty clipboard here?
|
||||
return DV_E_FORMATETC;
|
||||
}
|
||||
|
||||
pMedium->tymed = instance->m_pFormatEtc[idx].tymed;
|
||||
pMedium->pUnkForRelease = 0;
|
||||
@ -705,7 +697,7 @@ static HRESULT STDMETHODCALLTYPE CliprdrDataObject_GetData(IDataObject *This, FO
|
||||
FILEGROUPDESCRIPTORW *dsc;
|
||||
// DWORD remote_format_id = get_remote_format_id(clipboard, instance->m_pFormatEtc[idx].cfFormat);
|
||||
// FIXME: origin code may be failed here???
|
||||
if (cliprdr_send_data_request(instance->m_serverConnID, instance->m_remoteConnID, clipboard, instance->m_pFormatEtc[idx].cfFormat) != 0)
|
||||
if (cliprdr_send_data_request(instance->m_connID, clipboard, instance->m_pFormatEtc[idx].cfFormat) != 0)
|
||||
{
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
@ -734,7 +726,7 @@ static HRESULT STDMETHODCALLTYPE CliprdrDataObject_GetData(IDataObject *This, FO
|
||||
for (i = 0; i < instance->m_nStreams; i++)
|
||||
{
|
||||
instance->m_pStream[i] =
|
||||
(IStream *)CliprdrStream_New(instance->m_serverConnID, instance->m_remoteConnID, i, clipboard, &dsc->fgd[i]);
|
||||
(IStream *)CliprdrStream_New(instance->m_connID, i, clipboard, &dsc->fgd[i]);
|
||||
|
||||
if (!instance->m_pStream[i])
|
||||
return E_OUTOFMEMORY;
|
||||
@ -867,7 +859,7 @@ static HRESULT STDMETHODCALLTYPE CliprdrDataObject_EnumDAdvise(IDataObject *This
|
||||
return OLE_E_ADVISENOTSUPPORTED;
|
||||
}
|
||||
|
||||
static CliprdrDataObject *CliprdrDataObject_New(UINT32 serverConnID, UINT32 remoteConnID, FORMATETC *fmtetc, STGMEDIUM *stgmed, ULONG count,
|
||||
static CliprdrDataObject *CliprdrDataObject_New(UINT32 connID, FORMATETC *fmtetc, STGMEDIUM *stgmed, ULONG count,
|
||||
void *data)
|
||||
{
|
||||
CliprdrDataObject *instance;
|
||||
@ -900,8 +892,7 @@ static CliprdrDataObject *CliprdrDataObject_New(UINT32 serverConnID, UINT32 remo
|
||||
instance->m_pData = data;
|
||||
instance->m_nStreams = 0;
|
||||
instance->m_pStream = NULL;
|
||||
instance->m_serverConnID = serverConnID;
|
||||
instance->m_remoteConnID = remoteConnID;
|
||||
instance->m_connID = connID;
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
@ -951,7 +942,7 @@ void CliprdrDataObject_Delete(CliprdrDataObject *instance)
|
||||
}
|
||||
}
|
||||
|
||||
static BOOL wf_create_file_obj(CONN_ID *conn_id, wfClipboard *clipboard, IDataObject **ppDataObject)
|
||||
static BOOL wf_create_file_obj(UINT32 *connID, wfClipboard *clipboard, IDataObject **ppDataObject)
|
||||
{
|
||||
FORMATETC fmtetc[2];
|
||||
STGMEDIUM stgmeds[2];
|
||||
@ -975,7 +966,7 @@ static BOOL wf_create_file_obj(CONN_ID *conn_id, wfClipboard *clipboard, IDataOb
|
||||
stgmeds[1].tymed = TYMED_ISTREAM;
|
||||
stgmeds[1].pstm = NULL;
|
||||
stgmeds[1].pUnkForRelease = NULL;
|
||||
*ppDataObject = (IDataObject *)CliprdrDataObject_New(conn_id->serverConnID, conn_id->remoteConnID, fmtetc, stgmeds, 2, clipboard);
|
||||
*ppDataObject = (IDataObject *)CliprdrDataObject_New(*connID, fmtetc, stgmeds, 2, clipboard);
|
||||
return (*ppDataObject) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
@ -1424,8 +1415,7 @@ static UINT cliprdr_send_format_list(wfClipboard *clipboard)
|
||||
}
|
||||
}
|
||||
|
||||
formatList.serverConnID = 0;
|
||||
formatList.remoteConnID = 0;
|
||||
formatList.connID = 0;
|
||||
formatList.numFormats = numFormats;
|
||||
formatList.formats = formats;
|
||||
formatList.msgType = CB_FORMAT_LIST;
|
||||
@ -1446,7 +1436,7 @@ static UINT cliprdr_send_format_list(wfClipboard *clipboard)
|
||||
return rc;
|
||||
}
|
||||
|
||||
static UINT cliprdr_send_data_request(UINT32 serverConnID, UINT32 remoteConnID, wfClipboard *clipboard, UINT32 formatId)
|
||||
static UINT cliprdr_send_data_request(UINT32 connID, wfClipboard *clipboard, UINT32 formatId)
|
||||
{
|
||||
UINT rc;
|
||||
UINT32 remoteFormatId;
|
||||
@ -1457,8 +1447,7 @@ static UINT cliprdr_send_data_request(UINT32 serverConnID, UINT32 remoteConnID,
|
||||
|
||||
remoteFormatId = get_remote_format_id(clipboard, formatId);
|
||||
|
||||
formatDataRequest.serverConnID = serverConnID;
|
||||
formatDataRequest.remoteConnID = remoteConnID;
|
||||
formatDataRequest.connID = connID;
|
||||
formatDataRequest.requestedFormatId = remoteFormatId;
|
||||
clipboard->requestedFormatId = formatId;
|
||||
rc = clipboard->context->ClientFormatDataRequest(clipboard->context, &formatDataRequest);
|
||||
@ -1473,7 +1462,7 @@ static UINT cliprdr_send_data_request(UINT32 serverConnID, UINT32 remoteConnID,
|
||||
DWORD waitRes = WaitForSingleObject(clipboard->response_data_event, 50);
|
||||
if (waitRes == WAIT_TIMEOUT)
|
||||
{
|
||||
if (clipboard->context->CheckEnabled(serverConnID, remoteConnID))
|
||||
if (clipboard->context->CheckEnabled(connID))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -1514,7 +1503,7 @@ static UINT cliprdr_send_data_request(UINT32 serverConnID, UINT32 remoteConnID,
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
UINT cliprdr_send_request_filecontents(wfClipboard *clipboard, UINT32 serverConnID, UINT32 remoteConnID, const void *streamid, ULONG index,
|
||||
UINT cliprdr_send_request_filecontents(wfClipboard *clipboard, UINT32 connID, const void *streamid, ULONG index,
|
||||
UINT32 flag, DWORD positionhigh, DWORD positionlow,
|
||||
ULONG nreq)
|
||||
{
|
||||
@ -1524,8 +1513,7 @@ UINT cliprdr_send_request_filecontents(wfClipboard *clipboard, UINT32 serverConn
|
||||
if (!clipboard || !clipboard->context || !clipboard->context->ClientFileContentsRequest)
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
fileContentsRequest.serverConnID = serverConnID;
|
||||
fileContentsRequest.remoteConnID = remoteConnID;
|
||||
fileContentsRequest.connID = connID;
|
||||
fileContentsRequest.streamId = (UINT32)(ULONG_PTR)streamid;
|
||||
fileContentsRequest.listIndex = index;
|
||||
fileContentsRequest.dwFlags = flag;
|
||||
@ -1546,7 +1534,7 @@ UINT cliprdr_send_request_filecontents(wfClipboard *clipboard, UINT32 serverConn
|
||||
DWORD waitRes = WaitForSingleObject(clipboard->req_fevent, 50);
|
||||
if (waitRes == WAIT_TIMEOUT)
|
||||
{
|
||||
if (clipboard->context->CheckEnabled(serverConnID, remoteConnID))
|
||||
if (clipboard->context->CheckEnabled(connID))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -1588,8 +1576,7 @@ UINT cliprdr_send_request_filecontents(wfClipboard *clipboard, UINT32 serverConn
|
||||
|
||||
static UINT cliprdr_send_response_filecontents(
|
||||
wfClipboard *clipboard,
|
||||
UINT32 serverConnID,
|
||||
UINT32 remoteConnID,
|
||||
UINT32 connID,
|
||||
UINT16 msgFlags,
|
||||
UINT32 streamId,
|
||||
UINT32 size,
|
||||
@ -1604,8 +1591,7 @@ static UINT cliprdr_send_response_filecontents(
|
||||
msgFlags = CB_RESPONSE_FAIL;
|
||||
}
|
||||
|
||||
fileContentsResponse.serverConnID = serverConnID;
|
||||
fileContentsResponse.remoteConnID = remoteConnID;
|
||||
fileContentsResponse.connID = connID;
|
||||
fileContentsResponse.streamId = streamId;
|
||||
fileContentsResponse.cbRequested = size;
|
||||
fileContentsResponse.requestedData = data;
|
||||
@ -1749,7 +1735,7 @@ static LRESULT CALLBACK cliprdr_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM
|
||||
wf_destroy_file_obj(clipboard->data_obj);
|
||||
clipboard->data_obj = NULL;
|
||||
}
|
||||
if (wf_create_file_obj((CONN_ID *)lParam, clipboard, &clipboard->data_obj))
|
||||
if (wf_create_file_obj((UINT32 *)lParam, clipboard, &clipboard->data_obj))
|
||||
{
|
||||
HRESULT res = OleSetClipboard(clipboard->data_obj);
|
||||
if (res != S_OK)
|
||||
@ -1779,7 +1765,7 @@ static LRESULT CALLBACK cliprdr_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM
|
||||
|
||||
for (UINT32 i = 0; i < format_ids->size; ++i)
|
||||
{
|
||||
if (cliprdr_send_data_request(format_ids->serverConnID, format_ids->remoteConnID, clipboard, format_ids->formats[i]) != 0)
|
||||
if (cliprdr_send_data_request(format_ids->connID, clipboard, format_ids->formats[i]) != 0)
|
||||
{
|
||||
DEBUG_CLIPRDR("error: cliprdr_send_data_request failed.");
|
||||
continue;
|
||||
@ -2145,8 +2131,7 @@ static UINT wf_cliprdr_send_client_capabilities(wfClipboard *clipboard)
|
||||
if (!clipboard || !clipboard->context || !clipboard->context->ClientCapabilities)
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
capabilities.serverConnID = 0;
|
||||
capabilities.remoteConnID = 0;
|
||||
capabilities.connID = 0;
|
||||
capabilities.cCapabilitiesSets = 1;
|
||||
capabilities.capabilitySets = (CLIPRDR_CAPABILITY_SET *)&(generalCapabilitySet);
|
||||
generalCapabilitySet.capabilitySetType = CB_CAPSTYPE_GENERAL;
|
||||
@ -2262,9 +2247,8 @@ static UINT wf_cliprdr_server_format_list(CliprdrClientContext *context,
|
||||
{
|
||||
if (context->enableFiles)
|
||||
{
|
||||
CONN_ID *p_conn_id = (CONN_ID *)calloc(1, sizeof(CONN_ID));
|
||||
p_conn_id->serverConnID = formatList->serverConnID;
|
||||
p_conn_id->remoteConnID = formatList->remoteConnID;
|
||||
UINT32 *p_conn_id = (UINT32 *)calloc(1, sizeof(UINT32));
|
||||
*p_conn_id = formatList->connID;
|
||||
if (PostMessage(clipboard->hwnd, WM_CLIPRDR_MESSAGE, OLE_SETCLIPBOARD, p_conn_id))
|
||||
rc = CHANNEL_RC_OK;
|
||||
}
|
||||
@ -2287,8 +2271,7 @@ static UINT wf_cliprdr_server_format_list(CliprdrClientContext *context,
|
||||
// SetClipboardData(clipboard->format_mappings[i].local_format_id, NULL);
|
||||
|
||||
FORMAT_IDS *format_ids = (FORMAT_IDS *)calloc(1, sizeof(FORMAT_IDS));
|
||||
format_ids->serverConnID = formatList->serverConnID;
|
||||
format_ids->remoteConnID = formatList->remoteConnID;
|
||||
format_ids->connID = formatList->connID;
|
||||
format_ids->size = (UINT32)clipboard->map_size;
|
||||
format_ids->formats = (UINT32 *)calloc(format_ids->size, sizeof(UINT32));
|
||||
for (i = 0; i < format_ids->size; ++i)
|
||||
@ -2563,8 +2546,7 @@ exit:
|
||||
{
|
||||
response.msgFlags = CB_RESPONSE_FAIL;
|
||||
}
|
||||
response.serverConnID = formatDataRequest->serverConnID;
|
||||
response.remoteConnID = formatDataRequest->remoteConnID;
|
||||
response.connID = formatDataRequest->connID;
|
||||
response.dataLen = size;
|
||||
response.requestedFormatData = (BYTE *)buff;
|
||||
if (ERROR_SUCCESS != clipboard->context->ClientFormatDataResponse(clipboard->context, &response))
|
||||
@ -2848,8 +2830,7 @@ exit:
|
||||
sRc =
|
||||
cliprdr_send_response_filecontents(
|
||||
clipboard,
|
||||
fileContentsRequest->serverConnID,
|
||||
fileContentsRequest->remoteConnID,
|
||||
fileContentsRequest->connID,
|
||||
rc == CHANNEL_RC_OK ? CB_RESPONSE_OK : CB_RESPONSE_FAIL,
|
||||
fileContentsRequest->streamId,
|
||||
uSize,
|
||||
@ -3047,7 +3028,7 @@ BOOL uninit_cliprdr(CliprdrClientContext *context)
|
||||
return wf_cliprdr_uninit(&clipboard, context);
|
||||
}
|
||||
|
||||
BOOL empty_cliprdr(CliprdrClientContext *context, UINT32 server_conn_id, UINT32 remote_conn_id)
|
||||
BOOL empty_cliprdr(CliprdrClientContext *context, UINT32 connID)
|
||||
{
|
||||
wfClipboard *clipboard = NULL;
|
||||
CliprdrDataObject *instance = NULL;
|
||||
@ -3056,7 +3037,7 @@ BOOL empty_cliprdr(CliprdrClientContext *context, UINT32 server_conn_id, UINT32
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if (server_conn_id == 0 && remote_conn_id == 0)
|
||||
if (connID == 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@ -3070,11 +3051,7 @@ BOOL empty_cliprdr(CliprdrClientContext *context, UINT32 server_conn_id, UINT32
|
||||
instance = clipboard->data_obj;
|
||||
if (instance)
|
||||
{
|
||||
if (server_conn_id != 0 && instance->m_serverConnID != server_conn_id)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
if (remote_conn_id != 0 && instance->m_remoteConnID != remote_conn_id)
|
||||
if (instance->m_connID != connID)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -308,58 +308,50 @@ message FileDirCreate {
|
||||
|
||||
// main logic from freeRDP
|
||||
message CliprdrMonitorReady {
|
||||
int32 server_conn_id = 1;
|
||||
int32 remote_conn_id = 2;
|
||||
int32 conn_id = 1;
|
||||
}
|
||||
|
||||
message CliprdrFormat {
|
||||
int32 server_conn_id = 1;
|
||||
int32 remote_conn_id = 2;
|
||||
int32 id = 3;
|
||||
string format = 4;
|
||||
int32 conn_id = 1;
|
||||
int32 id = 2;
|
||||
string format = 3;
|
||||
}
|
||||
|
||||
message CliprdrServerFormatList {
|
||||
int32 server_conn_id = 1;
|
||||
int32 remote_conn_id = 2;
|
||||
repeated CliprdrFormat formats = 3;
|
||||
int32 conn_id = 1;
|
||||
repeated CliprdrFormat formats = 2;
|
||||
}
|
||||
|
||||
message CliprdrServerFormatListResponse {
|
||||
int32 server_conn_id = 1;
|
||||
int32 remote_conn_id = 2;
|
||||
int32 msg_flags = 3;
|
||||
int32 conn_id = 1;
|
||||
int32 msg_flags = 2;
|
||||
}
|
||||
|
||||
message CliprdrServerFormatDataRequest {
|
||||
int32 server_conn_id = 1;
|
||||
int32 remote_conn_id = 2;
|
||||
int32 requested_format_id = 3;
|
||||
int32 conn_id = 1;
|
||||
int32 requested_format_id = 2;
|
||||
}
|
||||
|
||||
message CliprdrServerFormatDataResponse {
|
||||
int32 server_conn_id = 1;
|
||||
int32 remote_conn_id = 2;
|
||||
int32 msg_flags = 3;
|
||||
bytes format_data = 4;
|
||||
int32 conn_id = 1;
|
||||
int32 msg_flags = 2;
|
||||
bytes format_data = 3;
|
||||
}
|
||||
|
||||
message CliprdrFileContentsRequest {
|
||||
int32 server_conn_id = 1;
|
||||
int32 remote_conn_id = 2;
|
||||
int32 stream_id = 3;
|
||||
int32 list_index = 4;
|
||||
int32 dw_flags = 5;
|
||||
int32 n_position_low = 6;
|
||||
int32 n_position_high = 7;
|
||||
int32 cb_requested = 8;
|
||||
bool have_clip_data_id = 9;
|
||||
int32 clip_data_id = 10;
|
||||
int32 conn_id = 1;
|
||||
int32 stream_id = 2;
|
||||
int32 list_index = 3;
|
||||
int32 dw_flags = 4;
|
||||
int32 n_position_low = 5;
|
||||
int32 n_position_high = 6;
|
||||
int32 cb_requested = 7;
|
||||
bool have_clip_data_id = 8;
|
||||
int32 clip_data_id = 9;
|
||||
}
|
||||
|
||||
message CliprdrFileContentsResponse {
|
||||
int32 server_conn_id = 1;
|
||||
int32 remote_conn_id = 2;
|
||||
int32 conn_id = 1;
|
||||
int32 msg_flags = 3;
|
||||
int32 stream_id = 4;
|
||||
bytes requested_data = 5;
|
||||
|
@ -4,15 +4,13 @@ use hbb_common::message_proto::*;
|
||||
pub fn clip_2_msg(clip: ClipbaordFile) -> Message {
|
||||
match clip {
|
||||
ClipbaordFile::ServerFormatList {
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
conn_id,
|
||||
format_list,
|
||||
} => {
|
||||
let mut formats: Vec<CliprdrFormat> = Vec::new();
|
||||
for v in format_list.iter() {
|
||||
formats.push(CliprdrFormat {
|
||||
server_conn_id: 0,
|
||||
remote_conn_id: 0,
|
||||
conn_id: 0,
|
||||
id: v.0,
|
||||
format: v.1.clone(),
|
||||
..Default::default()
|
||||
@ -21,8 +19,7 @@ pub fn clip_2_msg(clip: ClipbaordFile) -> Message {
|
||||
Message {
|
||||
union: Some(message::Union::cliprdr(Cliprdr {
|
||||
union: Some(cliprdr::Union::format_list(CliprdrServerFormatList {
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
conn_id,
|
||||
formats,
|
||||
..Default::default()
|
||||
})),
|
||||
@ -31,16 +28,11 @@ pub fn clip_2_msg(clip: ClipbaordFile) -> Message {
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
ClipbaordFile::ServerFormatListResponse {
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
msg_flags,
|
||||
} => Message {
|
||||
ClipbaordFile::ServerFormatListResponse { conn_id, msg_flags } => Message {
|
||||
union: Some(message::Union::cliprdr(Cliprdr {
|
||||
union: Some(cliprdr::Union::format_list_response(
|
||||
CliprdrServerFormatListResponse {
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
conn_id,
|
||||
msg_flags,
|
||||
..Default::default()
|
||||
},
|
||||
@ -50,15 +42,13 @@ pub fn clip_2_msg(clip: ClipbaordFile) -> Message {
|
||||
..Default::default()
|
||||
},
|
||||
ClipbaordFile::ServerFormatDataRequest {
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
conn_id,
|
||||
requested_format_id,
|
||||
} => Message {
|
||||
union: Some(message::Union::cliprdr(Cliprdr {
|
||||
union: Some(cliprdr::Union::format_data_request(
|
||||
CliprdrServerFormatDataRequest {
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
conn_id,
|
||||
requested_format_id,
|
||||
..Default::default()
|
||||
},
|
||||
@ -68,16 +58,14 @@ pub fn clip_2_msg(clip: ClipbaordFile) -> Message {
|
||||
..Default::default()
|
||||
},
|
||||
ClipbaordFile::ServerFormatDataResponse {
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
conn_id,
|
||||
msg_flags,
|
||||
format_data,
|
||||
} => Message {
|
||||
union: Some(message::Union::cliprdr(Cliprdr {
|
||||
union: Some(cliprdr::Union::format_data_response(
|
||||
CliprdrServerFormatDataResponse {
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
conn_id,
|
||||
msg_flags,
|
||||
format_data,
|
||||
..Default::default()
|
||||
@ -88,8 +76,7 @@ pub fn clip_2_msg(clip: ClipbaordFile) -> Message {
|
||||
..Default::default()
|
||||
},
|
||||
ClipbaordFile::FileContentsRequest {
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
conn_id,
|
||||
stream_id,
|
||||
list_index,
|
||||
dw_flags,
|
||||
@ -102,8 +89,7 @@ pub fn clip_2_msg(clip: ClipbaordFile) -> Message {
|
||||
union: Some(message::Union::cliprdr(Cliprdr {
|
||||
union: Some(cliprdr::Union::file_contents_request(
|
||||
CliprdrFileContentsRequest {
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
conn_id,
|
||||
stream_id,
|
||||
list_index,
|
||||
dw_flags,
|
||||
@ -120,8 +106,7 @@ pub fn clip_2_msg(clip: ClipbaordFile) -> Message {
|
||||
..Default::default()
|
||||
},
|
||||
ClipbaordFile::FileContentsResponse {
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
conn_id,
|
||||
msg_flags,
|
||||
stream_id,
|
||||
requested_data,
|
||||
@ -129,8 +114,7 @@ pub fn clip_2_msg(clip: ClipbaordFile) -> Message {
|
||||
union: Some(message::Union::cliprdr(Cliprdr {
|
||||
union: Some(cliprdr::Union::file_contents_response(
|
||||
CliprdrFileContentsResponse {
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
conn_id,
|
||||
msg_flags,
|
||||
stream_id,
|
||||
requested_data,
|
||||
@ -152,37 +136,32 @@ pub fn msg_2_clip(msg: Cliprdr) -> Option<ClipbaordFile> {
|
||||
format_list.push((v.id, v.format.clone()));
|
||||
}
|
||||
Some(ClipbaordFile::ServerFormatList {
|
||||
server_conn_id: data.server_conn_id,
|
||||
remote_conn_id: data.remote_conn_id,
|
||||
conn_id: data.conn_id,
|
||||
format_list,
|
||||
})
|
||||
}
|
||||
Some(cliprdr::Union::format_list_response(data)) => {
|
||||
Some(ClipbaordFile::ServerFormatListResponse {
|
||||
server_conn_id: data.server_conn_id,
|
||||
remote_conn_id: data.remote_conn_id,
|
||||
conn_id: data.conn_id,
|
||||
msg_flags: data.msg_flags,
|
||||
})
|
||||
}
|
||||
Some(cliprdr::Union::format_data_request(data)) => {
|
||||
Some(ClipbaordFile::ServerFormatDataRequest {
|
||||
server_conn_id: data.server_conn_id,
|
||||
remote_conn_id: data.remote_conn_id,
|
||||
conn_id: data.conn_id,
|
||||
requested_format_id: data.requested_format_id,
|
||||
})
|
||||
}
|
||||
Some(cliprdr::Union::format_data_response(data)) => {
|
||||
Some(ClipbaordFile::ServerFormatDataResponse {
|
||||
server_conn_id: data.server_conn_id,
|
||||
remote_conn_id: data.remote_conn_id,
|
||||
conn_id: data.conn_id,
|
||||
msg_flags: data.msg_flags,
|
||||
format_data: data.format_data,
|
||||
})
|
||||
}
|
||||
Some(cliprdr::Union::file_contents_request(data)) => {
|
||||
Some(ClipbaordFile::FileContentsRequest {
|
||||
server_conn_id: data.server_conn_id,
|
||||
remote_conn_id: data.remote_conn_id,
|
||||
conn_id: data.conn_id,
|
||||
stream_id: data.stream_id,
|
||||
list_index: data.list_index,
|
||||
dw_flags: data.dw_flags,
|
||||
@ -195,8 +174,7 @@ pub fn msg_2_clip(msg: Cliprdr) -> Option<ClipbaordFile> {
|
||||
}
|
||||
Some(cliprdr::Union::file_contents_response(data)) => {
|
||||
Some(ClipbaordFile::FileContentsResponse {
|
||||
server_conn_id: data.server_conn_id,
|
||||
remote_conn_id: data.remote_conn_id,
|
||||
conn_id: data.conn_id,
|
||||
msg_flags: data.msg_flags,
|
||||
stream_id: data.stream_id,
|
||||
requested_data: data.requested_data,
|
||||
|
15
src/ui/cm.rs
15
src/ui/cm.rs
@ -1,8 +1,7 @@
|
||||
use crate::ipc::{self, new_listener, Connection, Data};
|
||||
#[cfg(windows)]
|
||||
use clipboard::{
|
||||
create_cliprdr_context, empty_clipboard, get_rx_clip_client, server_clip_file,
|
||||
set_conn_enabled, ConnID,
|
||||
create_cliprdr_context, empty_clipboard, get_rx_clip_client, server_clip_file, set_conn_enabled,
|
||||
};
|
||||
use hbb_common::{
|
||||
allow_err,
|
||||
@ -514,7 +513,7 @@ async fn start_clipboard_file(
|
||||
Some((conn_id, clip)) => {
|
||||
cmd_inner_send(
|
||||
&cm,
|
||||
conn_id.server_conn_id as i32,
|
||||
conn_id,
|
||||
Data::ClipbaordFile(clip)
|
||||
);
|
||||
}
|
||||
@ -523,11 +522,7 @@ async fn start_clipboard_file(
|
||||
}
|
||||
},
|
||||
server_msg = rx.recv() => match server_msg {
|
||||
Some(ClipboardFileData::Clip((server_conn_id, clip))) => {
|
||||
let conn_id = ConnID {
|
||||
server_conn_id: server_conn_id as u32,
|
||||
remote_conn_id: 0,
|
||||
};
|
||||
Some(ClipboardFileData::Clip((conn_id, clip))) => {
|
||||
if let Some(ctx) = cliprdr_context.as_mut() {
|
||||
server_clip_file(ctx, conn_id, clip);
|
||||
}
|
||||
@ -548,10 +543,10 @@ async fn start_clipboard_file(
|
||||
}
|
||||
});
|
||||
}
|
||||
set_conn_enabled(id, 0, enabled);
|
||||
set_conn_enabled(id, enabled);
|
||||
if !enabled {
|
||||
if let Some(ctx) = cliprdr_context.as_mut() {
|
||||
empty_clipboard(ctx, id, 0);
|
||||
empty_clipboard(ctx, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ use crate::{
|
||||
#[cfg(windows)]
|
||||
use clipboard::{
|
||||
cliprdr::CliprdrClientContext, create_cliprdr_context as create_clipboard_file_context,
|
||||
get_rx_clip_client, server_clip_file, ConnID as ClipboardFileConnID,
|
||||
get_rx_clip_client, server_clip_file,
|
||||
};
|
||||
use enigo::{self, Enigo, KeyboardControllable};
|
||||
use hbb_common::{
|
||||
@ -349,7 +349,8 @@ impl Handler {
|
||||
} else {
|
||||
let mut chr = match evt.name {
|
||||
Some(ref s) => {
|
||||
if s.len() <= 2 { // exclude chinese characters
|
||||
if s.len() <= 2 {
|
||||
// exclude chinese characters
|
||||
s.chars().next().unwrap_or('\0')
|
||||
} else {
|
||||
'\0'
|
||||
@ -357,7 +358,8 @@ impl Handler {
|
||||
}
|
||||
_ => '\0',
|
||||
};
|
||||
if chr == '·' { // special for Chinese
|
||||
if chr == '·' {
|
||||
// special for Chinese
|
||||
chr = '`';
|
||||
}
|
||||
if chr == '\0' {
|
||||
@ -1251,8 +1253,6 @@ async fn io_loop(handler: Handler) {
|
||||
first_frame: false,
|
||||
#[cfg(windows)]
|
||||
clipboard_file_context: None,
|
||||
#[cfg(windows)]
|
||||
pid: std::process::id(),
|
||||
};
|
||||
remote.io_loop().await;
|
||||
}
|
||||
@ -1294,8 +1294,6 @@ struct Remote {
|
||||
first_frame: bool,
|
||||
#[cfg(windows)]
|
||||
clipboard_file_context: Option<Box<CliprdrClientContext>>,
|
||||
#[cfg(windows)]
|
||||
pid: u32,
|
||||
}
|
||||
|
||||
impl Remote {
|
||||
@ -1356,10 +1354,8 @@ impl Remote {
|
||||
_msg = rx_clip_client.recv() => {
|
||||
#[cfg(windows)]
|
||||
match _msg {
|
||||
Some((conn_id, clip)) => {
|
||||
if conn_id.remote_conn_id == 0 || conn_id.remote_conn_id == self.pid {
|
||||
allow_err!(peer.send(&clip_2_msg(clip)).await);
|
||||
}
|
||||
Some((_, clip)) => {
|
||||
allow_err!(peer.send(&clip_2_msg(clip)).await);
|
||||
}
|
||||
None => {
|
||||
// unreachable!()
|
||||
@ -1747,14 +1743,7 @@ impl Remote {
|
||||
if !self.handler.lc.read().unwrap().disable_clipboard {
|
||||
if let Some(context) = &mut self.clipboard_file_context {
|
||||
if let Some(clip) = msg_2_clip(clip) {
|
||||
server_clip_file(
|
||||
context,
|
||||
ClipboardFileConnID {
|
||||
server_conn_id: 0,
|
||||
remote_conn_id: self.pid,
|
||||
},
|
||||
clip,
|
||||
);
|
||||
server_clip_file(context, 0, clip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user