remove useless is_rdp_service_open
This commit is contained in:
parent
b511a52e09
commit
f1373234dd
@ -490,28 +490,6 @@ extern "C"
|
||||
wcsncpy_s(buf, bufSize, tmpStr.c_str(), tmpStr.size());
|
||||
}
|
||||
}
|
||||
|
||||
BOOL has_rdp_service()
|
||||
{
|
||||
PWTS_SESSION_INFOA pInfos;
|
||||
DWORD count;
|
||||
auto rdp = "rdp";
|
||||
auto nrdp = strlen(rdp);
|
||||
auto rdp_or_console = WTSGetActiveConsoleSessionId();
|
||||
if (WTSEnumerateSessionsA(WTS_CURRENT_SERVER_HANDLE, NULL, 1, &pInfos, &count))
|
||||
{
|
||||
for (DWORD i = 0; i < count; i++)
|
||||
{
|
||||
auto info = pInfos[i];
|
||||
if (!strnicmp(info.pWinStationName, rdp, nrdp))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
WTSFreeMemory(pInfos);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
} // end of extern "C"
|
||||
|
||||
// below copied from https://github.com/TigerVNC/tigervnc/blob/master/vncviewer/win32.c
|
||||
|
@ -440,7 +440,6 @@ pub fn start_os_service() {
|
||||
const SERVICE_TYPE: ServiceType = ServiceType::OWN_PROCESS;
|
||||
|
||||
extern "C" {
|
||||
fn has_rdp_service() -> BOOL;
|
||||
fn get_current_session(rdp: BOOL) -> DWORD;
|
||||
fn LaunchProcessWin(cmd: *const u16, session_id: DWORD, as_user: BOOL) -> HANDLE;
|
||||
fn GetSessionUserTokenWin(lphUserToken: LPHANDLE, dwSessionId: DWORD, as_user: BOOL) -> BOOL;
|
||||
@ -1478,10 +1477,6 @@ pub fn bootstrap() {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_rdp_service_open() -> bool {
|
||||
unsafe { has_rdp_service() == TRUE }
|
||||
}
|
||||
|
||||
pub fn create_shortcut(id: &str) -> ResultType<()> {
|
||||
let exe = std::env::current_exe()?.to_str().unwrap_or("").to_owned();
|
||||
let shortcut = write_cmds(
|
||||
|
Loading…
x
Reference in New Issue
Block a user