Deskflow
1.26.0.418
Keyboard and mouse sharing utility
Toggle main menu visibility
Loading...
Searching...
No Matches
MSWindowsProcess.h
Go to the documentation of this file.
1
/*
2
* Deskflow -- mouse and keyboard sharing utility
3
* SPDX-FileCopyrightText: (C) 2025 Synergy App Ltd
4
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
5
*/
6
7
#pragma once
8
9
#define WIN32_LEAN_AND_MEAN
10
#include <Windows.h>
11
12
#include <string>
13
14
namespace
deskflow::platform
{
15
16
namespace
{
// NOSONAR -- Deliberate anonymous
17
const
auto
kDefaultShutdownTimeout = 10;
18
}
19
20
class
MSWindowsProcess
21
{
22
public
:
23
explicit
MSWindowsProcess
(
const
std::wstring &command, HANDLE stdOutput =
nullptr
, HANDLE stdError =
nullptr
);
24
~MSWindowsProcess
();
25
26
BOOL
startInForeground
();
27
BOOL
startAsUser
(HANDLE userToken, LPSECURITY_ATTRIBUTES sa);
28
void
shutdown
(
int
timeout
= kDefaultShutdownTimeout);
29
DWORD
waitForExit
();
30
void
createPipes
();
31
std::wstring
readStdOutput
();
32
std::wstring
readStdError
();
33
34
PROCESS_INFORMATION
info
()
const
35
{
36
return
m_info;
37
}
38
39
static
void
shutdown
(HANDLE handle,
DWORD
pid,
int
timeout
= kDefaultShutdownTimeout);
40
43
static
bool
startDetachedAsSessionUser
(
const
std::wstring &command);
44
45
private
:
46
void
setStartupInfo(STARTUPINFO &si);
47
48
static
std::wstring readOutput(HANDLE handle);
49
50
std::wstring m_command;
51
HANDLE m_stdOutput;
52
HANDLE m_stdError;
53
HANDLE m_outputPipe =
nullptr
;
54
HANDLE m_errorPipe =
nullptr
;
55
PROCESS_INFORMATION m_info;
56
BOOL
m_createProcessResult = FALSE;
57
};
58
59
}
// namespace deskflow::platform
DWORD
static const WSAEVENT FAR DWORD
Definition
ArchNetworkWinsock.cpp:56
BOOL
static const WSAEVENT FAR BOOL
Definition
ArchNetworkWinsock.cpp:56
timeout
static fd_set FAR fd_set FAR fd_set FAR const struct timeval FAR * timeout
Definition
ArchNetworkWinsock.cpp:41
deskflow::platform::MSWindowsProcess::MSWindowsProcess
MSWindowsProcess(const std::wstring &command, HANDLE stdOutput=nullptr, HANDLE stdError=nullptr)
Definition
MSWindowsProcess.cpp:25
deskflow::platform::MSWindowsProcess::startAsUser
BOOL startAsUser(HANDLE userToken, LPSECURITY_ATTRIBUTES sa)
Definition
MSWindowsProcess.cpp:58
deskflow::platform::MSWindowsProcess::readStdError
std::wstring readStdError()
Definition
MSWindowsProcess.cpp:270
deskflow::platform::MSWindowsProcess::startInForeground
BOOL startInForeground()
Definition
MSWindowsProcess.cpp:40
deskflow::platform::MSWindowsProcess::createPipes
void createPipes()
Definition
MSWindowsProcess.cpp:237
deskflow::platform::MSWindowsProcess::info
PROCESS_INFORMATION info() const
Definition
MSWindowsProcess.h:34
deskflow::platform::MSWindowsProcess::waitForExit
DWORD waitForExit()
Definition
MSWindowsProcess.cpp:94
deskflow::platform::MSWindowsProcess::startDetachedAsSessionUser
static bool startDetachedAsSessionUser(const std::wstring &command)
Definition
MSWindowsProcess.cpp:192
deskflow::platform::MSWindowsProcess::readStdOutput
std::wstring readStdOutput()
Definition
MSWindowsProcess.cpp:265
deskflow::platform::MSWindowsProcess::shutdown
void shutdown(int timeout=kDefaultShutdownTimeout)
Definition
MSWindowsProcess.cpp:120
deskflow::platform
Definition
PlatformInfo.h:13
src
lib
platform
MSWindowsProcess.h
Generated by
1.18.0