在将 VNC 与 RDP 结合使用时,我注意到 VNC 的一种行为,即当您使用 RDP (mstsc) 连接到一台机器,然后您想使用 VNC 连接到那台机器时,它将断开 RDP 会话,你会在目标机器上看到一个屏幕闪烁(黑屏一秒钟),然后你通过 VNC 连接,我想知道 VNC 如何断开活动的 RDP 会话,任何代码片段都会很有帮助.. 谢谢
Muhammad Ummar Iqbal
问问题
2192 次
1 回答
2
当您使用 VNC 连接时,它会尝试使用 WinStationConnectW(未记录)连接到控制台会话,这将断开 RDP 会话。
void setConsoleSession(DWORD sessionId) {
#ifdef RFB_HAVE_WINSTATION_CONNECT
if (!_WinStationConnect.isValid())
throw rdr::Exception("WinSta APIs missing");
if (sessionId == -1)
sessionId = mySessionId.id;
// Try to reconnect our session to the console
ConsoleSessionId console;
vlog.info("Console session is %d", console.id);
if (!(*_WinStationConnect)(0, sessionId, console.id, L"", 0))
throw rdr::SystemException("Unable to connect session to Console", GetLastError());
// Lock the newly connected session, for security
if (_LockWorkStation.isValid())
(*_LockWorkStation)();
#else
throw rdr::Exception("setConsoleSession not implemented");
#endif
}
于 2009-06-30T07:41:29.833 回答