fix: review windows

make windows version able to run

Signed-off-by: cailue <cailue@bupt.edu.cn>
This commit is contained in:
cailue 2023-09-08 20:37:14 +08:00
parent a7bb90e7e6
commit af131cd1e5
3 changed files with 16 additions and 7 deletions

View File

@ -41,6 +41,7 @@ use utf16string::WStr;
use crate::{ClipboardFile, CliprdrError};
#[cfg(target_os = "linux")]
use super::LDAP_EPOCH_DELTA;
/// block size for fuse, align to our asynchronic request size over FileContentsRequest.

View File

@ -8,7 +8,10 @@ pub fn create_cliprdr_context(
enable_others: bool,
response_wait_timeout_secs: u32,
) -> crate::ResultType<Box<dyn crate::CliprdrServiceContext>> {
windows::create_cliprdr_context(enable_files, enable_others, response_wait_timeout_secs)
let boxed =
windows::create_cliprdr_context(enable_files, enable_others, response_wait_timeout_secs)?
as Box<_>;
Ok(boxed)
}
#[cfg(any(target_os = "linux", target_os = "macos"))]
@ -63,4 +66,5 @@ impl CliprdrServiceContext for DummyCliprdrContext {
// begin of epoch used by microsoft
// 1601-01-01 00:00:00 + LDAP_EPOCH_DELTA*(100 ns) = 1970-01-01 00:00:00
#[cfg(target_os = "linux")]
const LDAP_EPOCH_DELTA: u64 = 116444772610000000;

View File

@ -5,11 +5,15 @@
#![allow(non_snake_case)]
#![allow(deref_nullptr)]
use std::{boxed::Box, result::Result};
use std::{
boxed::Box,
ffi::{CStr, CString},
result::Result,
};
use crate::{
allow_err, log, send_data, CStr, CString, ClipboardFile, CliprdrError, CliprdrServiceContext,
ResultType, ERR_CODE_INVALID_PARAMETER, ERR_CODE_SERVER_FUNCTION_NONE, VEC_MSG_CHANNEL,
allow_err, log, send_data, ClipboardFile, CliprdrError, CliprdrServiceContext, ResultType,
ERR_CODE_INVALID_PARAMETER, ERR_CODE_SERVER_FUNCTION_NONE, VEC_MSG_CHANNEL,
};
// only used error code will be recorded here
@ -590,8 +594,8 @@ impl CliprdrServiceContext for CliprdrClientContext {
Ok(())
}
fn empty_clipboard(&mut self, conn_id: i32) -> bool {
empty_clipboard(self, conn_id)
fn empty_clipboard(&mut self, conn_id: i32) -> Result<bool, CliprdrError> {
Ok(empty_clipboard(self, conn_id))
}
fn server_clip_file(&mut self, conn_id: i32, msg: ClipboardFile) -> Result<(), CliprdrError> {
@ -611,7 +615,7 @@ fn ret_to_result(ret: u32) -> Result<(), CliprdrError> {
}
}
pub fn empty_clipboard(context: &mut CliprdrClientContext, conn_id: i32) -> bool {
unsafe { TRUE == cliprdr::empty_cliprdr(context, conn_id as u32) }
unsafe { TRUE == empty_cliprdr(context, conn_id as u32) }
}
pub fn server_clip_file(