win, clipboard, debug
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
ccd2cbd760
commit
a903ec065b
@ -62,7 +62,9 @@ impl ContextSend {
|
|||||||
if lock.addr != 0 {
|
if lock.addr != 0 {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut context = Box::from_raw(lock.addr as *mut CliprdrClientContext);
|
let mut context = Box::from_raw(lock.addr as *mut CliprdrClientContext);
|
||||||
f(&mut context)
|
let code = f(&mut context);
|
||||||
|
std::mem::forget(context);
|
||||||
|
code
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
0
|
0
|
||||||
|
@ -18,6 +18,8 @@ pub mod cliprdr;
|
|||||||
pub mod context_send;
|
pub mod context_send;
|
||||||
pub use context_send::*;
|
pub use context_send::*;
|
||||||
|
|
||||||
|
const ERR_CODE_SERVER_FUNCTION_NONE: u32 = 0x00000001;
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[serde(tag = "t", content = "c")]
|
#[serde(tag = "t", content = "c")]
|
||||||
pub enum ClipboardFile {
|
pub enum ClipboardFile {
|
||||||
@ -247,8 +249,12 @@ pub fn server_monitor_ready(context: &mut Box<CliprdrClientContext>, conn_id: i3
|
|||||||
msgFlags: 0 as UINT16,
|
msgFlags: 0 as UINT16,
|
||||||
dataLen: 0 as UINT32,
|
dataLen: 0 as UINT32,
|
||||||
};
|
};
|
||||||
let ret = ((**context).MonitorReady.unwrap())(&mut (**context), &monitor_ready);
|
if let Some(f) = (**context).MonitorReady {
|
||||||
ret as u32
|
let ret = f(&mut (**context), &monitor_ready);
|
||||||
|
ret as u32
|
||||||
|
} else {
|
||||||
|
ERR_CODE_SERVER_FUNCTION_NONE
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,7 +295,11 @@ pub fn server_format_list(
|
|||||||
formats: formats.as_mut_ptr(),
|
formats: formats.as_mut_ptr(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let ret = ((**context).ServerFormatList.unwrap())(&mut (**context), &format_list);
|
let ret = if let Some(f) = (**context).ServerFormatList {
|
||||||
|
f(&mut (**context), &format_list)
|
||||||
|
} else {
|
||||||
|
ERR_CODE_SERVER_FUNCTION_NONE
|
||||||
|
};
|
||||||
|
|
||||||
for f in formats {
|
for f in formats {
|
||||||
if !f.formatName.is_null() {
|
if !f.formatName.is_null() {
|
||||||
@ -315,10 +325,11 @@ pub fn server_format_list_response(
|
|||||||
dataLen: 0 as UINT32,
|
dataLen: 0 as UINT32,
|
||||||
};
|
};
|
||||||
|
|
||||||
let ret =
|
if let Some(f) = (**context).ServerFormatListResponse {
|
||||||
(**context).ServerFormatListResponse.unwrap()(&mut (**context), &format_list_response);
|
f(&mut (**context), &format_list_response)
|
||||||
|
} else {
|
||||||
ret as u32
|
ERR_CODE_SERVER_FUNCTION_NONE
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,9 +346,11 @@ pub fn server_format_data_request(
|
|||||||
dataLen: 0 as UINT32,
|
dataLen: 0 as UINT32,
|
||||||
requestedFormatId: requested_format_id as UINT32,
|
requestedFormatId: requested_format_id as UINT32,
|
||||||
};
|
};
|
||||||
let ret =
|
if let Some(f) = (**context).ServerFormatDataRequest {
|
||||||
((**context).ServerFormatDataRequest.unwrap())(&mut (**context), &format_data_request);
|
f(&mut (**context), &format_data_request)
|
||||||
ret as u32
|
} else {
|
||||||
|
ERR_CODE_SERVER_FUNCTION_NONE
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,11 +368,11 @@ pub fn server_format_data_response(
|
|||||||
dataLen: format_data.len() as UINT32,
|
dataLen: format_data.len() as UINT32,
|
||||||
requestedFormatData: format_data.as_mut_ptr(),
|
requestedFormatData: format_data.as_mut_ptr(),
|
||||||
};
|
};
|
||||||
let ret = ((**context).ServerFormatDataResponse.unwrap())(
|
if let Some(f) = (**context).ServerFormatDataResponse {
|
||||||
&mut (**context),
|
f(&mut (**context), &format_data_response)
|
||||||
&format_data_response,
|
} else {
|
||||||
);
|
ERR_CODE_SERVER_FUNCTION_NONE
|
||||||
ret as u32
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -390,11 +403,11 @@ pub fn server_file_contents_request(
|
|||||||
haveClipDataId: if have_clip_data_id { TRUE } else { FALSE },
|
haveClipDataId: if have_clip_data_id { TRUE } else { FALSE },
|
||||||
clipDataId: clip_data_id as UINT32,
|
clipDataId: clip_data_id as UINT32,
|
||||||
};
|
};
|
||||||
let ret = ((**context).ServerFileContentsRequest.unwrap())(
|
if let Some(f) = (**context).ServerFileContentsRequest {
|
||||||
&mut (**context),
|
f(&mut (**context), &file_contents_request)
|
||||||
&file_contents_request,
|
} else {
|
||||||
);
|
ERR_CODE_SERVER_FUNCTION_NONE
|
||||||
ret as u32
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -415,11 +428,11 @@ pub fn server_file_contents_response(
|
|||||||
cbRequested: requested_data.len() as UINT32,
|
cbRequested: requested_data.len() as UINT32,
|
||||||
requestedData: requested_data.as_mut_ptr(),
|
requestedData: requested_data.as_mut_ptr(),
|
||||||
};
|
};
|
||||||
let ret = ((**context).ServerFileContentsResponse.unwrap())(
|
if let Some(f) = (**context).ServerFileContentsResponse {
|
||||||
&mut (**context),
|
f(&mut (**context), &file_contents_response)
|
||||||
&file_contents_response,
|
} else {
|
||||||
);
|
ERR_CODE_SERVER_FUNCTION_NONE
|
||||||
ret as u32
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,6 +419,7 @@ impl<T: InvokeUiCM> IpcTaskRunner<T> {
|
|||||||
}
|
}
|
||||||
Some(data) = self.rx.recv() => {
|
Some(data) = self.rx.recv() => {
|
||||||
if let Data::SwitchPermission{name, enabled} = &data {
|
if let Data::SwitchPermission{name, enabled} = &data {
|
||||||
|
#[cfg(windows)]
|
||||||
if name == "file" {
|
if name == "file" {
|
||||||
self.file_transfer_enabled = *enabled;
|
self.file_transfer_enabled = *enabled;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user