ProcessSessionId::ProcessSessionId(DWORD processId) {
  id = 0;
  if (!_ProcessIdToSessionId.isValid())
    return;
  if (processId == -1)
    processId = GetCurrentProcessId();
  (*_ProcessIdToSessionId)(GetCurrentProcessId(), &id);
}
Exemple #2
0
ProcessSessionId::ProcessSessionId(DWORD processId) {
  id = 0;
  if (!_ProcessIdToSessionId.isValid())
    return;
  if (processId == -1)
    processId = GetCurrentProcessId();
  if (!(*_ProcessIdToSessionId)(GetCurrentProcessId(), &id))
    vnclog.Print(LL_INTERR, VNCLOG("ProcessIdToSessionId failed (error %d)"), GetLastError());
}
void setConsoleSession(DWORD sessionId) {
#ifdef RFB_HAVE_WINSTATION_CONNECT
  if (!_WinStationConnect.isValid()) {
    return;
  }
  if (sessionId == -1)
    sessionId = mySessionId.id;

  // Try to reconnect our session to the console
  ConsoleSessionId console;
  if (!(*_WinStationConnect)(0, sessionId, console.id, L"", 0)) {
    return;
  }

  // Lock the newly connected session, for security
  if (_LockWorkStation.isValid())
    (*_LockWorkStation)();
#else

#endif
}
Exemple #4
0
void setConsoleSession(DWORD sessionId) {
#ifdef RFB_HAVE_WINSTATION_CONNECT
  if (!_WinStationConnect.isValid()) {
    vnclog.Print(LL_INTERR, VNCLOG("WinSta APIs missing"));
    return;
  }
  if (sessionId == -1)
    sessionId = mySessionId.id;

  // Try to reconnect our session to the console
  ConsoleSessionId console;
  vnclog.Print(LL_INTINFO, VNCLOG("Console session is %d"), console.id);
  if (!(*_WinStationConnect)(0, sessionId, console.id, L"", 0)) {
    vnclog.Print(LL_INTERR, VNCLOG("Unable to connect session to Console (error %d)"), GetLastError());
    return;
  }

  // Lock the newly connected session, for security
  if (_LockWorkStation.isValid())
    (*_LockWorkStation)();
#else
  vnclog.Print(LL_INTERR, VNCLOG("setConsoleSession not implemented"));
#endif
}
ConsoleSessionId::ConsoleSessionId() {
  if (_WTSGetActiveConsoleSessionId.isValid())
    id = (*_WTSGetActiveConsoleSessionId)();
  else
    id = 0;
}