2013-10-10 16:06:13 +00:00
|
|
|
/*
|
2024-09-17 19:00:25 +00:00
|
|
|
* Deskflow -- mouse and keyboard sharing utility
|
2026-06-08 20:37:23 +00:00
|
|
|
* SPDX-FileCopyrightText: (C) 2013 - 2016 Synergy App Ltd
|
2025-01-24 00:11:17 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
2013-10-10 16:06:13 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#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();
|
2025-05-02 12:29:56 +00:00
|
|
|
~MSWindowsSession() = default;
|
2024-07-02 19:07:06 +00:00
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
Returns true if the session ID has changed since updateActiveSession was
|
|
|
|
|
called.
|
|
|
|
|
*/
|
|
|
|
|
BOOL hasChanged();
|
2013-10-10 16:06:13 +00:00
|
|
|
|
2025-05-30 22:26:02 +00:00
|
|
|
bool isProcessInSession(const wchar_t *name, PHANDLE process);
|
2024-07-02 19:07:06 +00:00
|
|
|
HANDLE getUserToken(LPSECURITY_ATTRIBUTES security);
|
2025-02-13 17:37:58 +00:00
|
|
|
void updateActiveSession();
|
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
|
|
|
|
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
|
|
|
};
|