mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
fix kill occupied ipc process, find with enumerate, kill with NtTerminateProcess (#8289)
* I reproduced the issue, that process did't have title, couldn't be connected to and taskkill not work * Test whether ipc is opccupied with enumerating named pipe * With NtTerminateProcess, it was killed successfully. * There is a way to find the exact process which occupy the ipc, I have not check it, it's from https://github.com/winsiderss/systeminformer Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
25
src/ipc.rs
25
src/ipc.rs
@@ -970,10 +970,27 @@ pub async fn test_rendezvous_server() -> ResultType<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
pub async fn test_ipc_connection() -> ResultType<()> {
|
||||
connect(1000, "").await?;
|
||||
Ok(())
|
||||
#[cfg(windows)]
|
||||
pub fn is_ipc_file_exist(suffix: &str) -> ResultType<bool> {
|
||||
let file_name = format!("{}\\query{}", crate::get_app_name(), suffix);
|
||||
let mut err = None;
|
||||
for entry in std::fs::read_dir("\\\\.\\pipe\\")? {
|
||||
match entry {
|
||||
Ok(entry) => {
|
||||
if entry.file_name().into_string().unwrap_or_default() == file_name {
|
||||
return Ok(true);
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
err = Some(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(e) = err {
|
||||
Err(e.into())
|
||||
} else {
|
||||
Ok(false)
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
|
||||
Reference in New Issue
Block a user