/
Process.h
106 lines (74 loc) · 3.16 KB
/
Process.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
////////////////////////////////////////////////////////////////////////////////
// -------------------------------------------------------------------------- //
// //
// (C) 2010-2017 Robot Developers //
// See LICENSE for licensing info //
// //
// -------------------------------------------------------------------------- //
////////////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------------//
// Prefaces //
//----------------------------------------------------------------------------//
#pragma once
#include "Types.h"
#include <memory>
#include <string>
#include <vector>
ROBOT_NS_BEGIN
class Process;
class Module;
class Window;
#ifdef ROBOT_OS_WIN
#pragma warning (push)
// Ignore the VS C4251 warning
#pragma warning (disable:4251)
#endif
//----------------------------------------------------------------------------//
// Types //
//----------------------------------------------------------------------------//
////////////////////////////////////////////////////////////////////////////////
typedef std::vector<Module> ModuleList;
////////////////////////////////////////////////////////////////////////////////
typedef std::vector<Window> WindowList;
////////////////////////////////////////////////////////////////////////////////
typedef std::vector<Process> ProcessList;
//----------------------------------------------------------------------------//
// Classes //
//----------------------------------------------------------------------------//
////////////////////////////////////////////////////////////////////////////////
class ROBOT_EXPORT Process
{
public:
explicit Process (int32 pid = 0);
public:
bool Open (int32 pid);
void Close (void);
bool IsValid (void) const;
bool Is64Bit (void) const;
bool IsDebugged (void) const;
int32 GetPID (void) const;
uintptr GetHandle (void) const;
std::string GetName (void) const;
std::string GetPath (void) const;
bool Exit (void);
bool Kill (void);
bool HasExited (void) const;
ModuleList GetModules (const char* name = nullptr) const;
WindowList GetWindows (const char* title = nullptr) const;
static ProcessList GetList (const char* name = nullptr);
static Process GetCurrent (void);
static int32 GetCurrentPID (void);
static bool IsSys64Bit (void); // #Deprecated
public:
bool operator == (const Process& process) const;
bool operator != (const Process& process) const;
bool operator == (int32 pid) const;
bool operator != (int32 pid) const;
private:
struct Data;
std::shared_ptr<Data> mData; // Shared information
};
#ifdef ROBOT_OS_WIN
#pragma warning (pop)
#endif
ROBOT_NS_END