2013-10-10 16:06:13 +00:00
|
|
|
/*
|
2024-09-17 19:00:25 +00:00
|
|
|
* Deskflow -- mouse and keyboard sharing utility
|
2025-01-24 00:11:17 +00:00
|
|
|
* SPDX-FileCopyrightText: (C) 2013 - 2016 Symless Ltd.
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
2013-10-10 16:06:13 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2025-01-06 00:55:07 +00:00
|
|
|
#include <string>
|
2014-10-27 16:39:18 +00:00
|
|
|
|
2013-10-10 16:06:13 +00:00
|
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
|
#include <Windows.h>
|
2024-07-02 19:07:06 +00:00
|
|
|
|
2014-10-22 11:53:14 +00:00
|
|
|
#include <Tlhelp32.h>
|
2013-10-10 16:06:13 +00:00
|
|
|
|
2024-10-17 18:04:35 +00:00
|
|
|
class MSWindowsSession
|
|
|
|
|
{
|
2013-10-10 16:06:13 +00:00
|
|
|
public:
|
2024-07-02 19:07:06 +00:00
|
|
|
MSWindowsSession();
|
|
|
|
|
~MSWindowsSession();
|
|
|
|
|
|
|
|
|
|
//!
|
|
|
|
|
/*!
|
|
|
|
|
Returns true if the session ID has changed since updateActiveSession was
|
|
|
|
|
called.
|
|
|
|
|
*/
|
|
|
|
|
BOOL hasChanged();
|
2013-10-10 16:06:13 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
bool isProcessInSession(const char *name, PHANDLE process);
|
2013-10-14 16:29:02 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
HANDLE getUserToken(LPSECURITY_ATTRIBUTES security);
|
2013-10-10 16:06:13 +00:00
|
|
|
|
2024-10-17 18:04:35 +00:00
|
|
|
DWORD getActiveSessionId()
|
|
|
|
|
{
|
|
|
|
|
return m_activeSessionId;
|
|
|
|
|
}
|
2013-10-10 16:06:13 +00:00
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
void updateActiveSession();
|
2013-10-10 16:06:13 +00:00
|
|
|
|
2025-01-06 00:55:07 +00:00
|
|
|
std::string getActiveDesktopName();
|
2014-10-27 16:39:18 +00:00
|
|
|
|
2014-10-22 11:53:14 +00:00
|
|
|
private:
|
2024-07-02 19:07:06 +00:00
|
|
|
BOOL nextProcessEntry(HANDLE snapshot, LPPROCESSENTRY32 entry);
|
2014-10-22 11:53:14 +00:00
|
|
|
|
2013-10-10 16:06:13 +00:00
|
|
|
private:
|
2024-07-02 19:07:06 +00:00
|
|
|
DWORD m_activeSessionId;
|
2013-10-10 16:06:13 +00:00
|
|
|
};
|