mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-03-26 14:41:04 +03:00
use sihost.exe as fallback for run_as_user if no explorer.exe (#8305)
* There is no relevant information, but I found that each session has a unique sihost.exe, and the user name of the process is consistent with the user name of the session, and after using the task manager to kill this process, it will automatically restart. Checking sessionUserName=siHost UserName may be unnecessary, but since there is no evidence, check it anyway. * GetFallbackUserPid is called only when explorer.exe does not exist. * ProcessHacker shows that the tokens of explorer.exe and sihost.exe are the same, I know little about it. Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
@@ -825,12 +825,12 @@ fn get_current_session_username() -> Option<String> {
|
||||
|
||||
fn get_session_username(session_id: u32) -> String {
|
||||
extern "C" {
|
||||
fn get_session_user_info(path: *mut u16, n: u32, rdp: bool, session_id: u32) -> u32;
|
||||
fn get_session_user_info(path: *mut u16, n: u32, session_id: u32) -> u32;
|
||||
}
|
||||
let buff_size = 256;
|
||||
let mut buff: Vec<u16> = Vec::with_capacity(buff_size);
|
||||
buff.resize(buff_size, 0);
|
||||
let n = unsafe { get_session_user_info(buff.as_mut_ptr(), buff_size as _, true, session_id) };
|
||||
let n = unsafe { get_session_user_info(buff.as_mut_ptr(), buff_size as _, session_id) };
|
||||
if n == 0 {
|
||||
return "".to_owned();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user