Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavide Beatrici <git@davidebeatrici.dev>2020-10-28 21:26:53 +0300
committerDavide Beatrici <git@davidebeatrici.dev>2020-10-28 21:26:56 +0300
commit253b814ba56dbfe22927428857e3db3a1c92dc5d (patch)
treed28055d22aad1b81bc19492efd1d88b001d73df1 /plugins/HostWindows.h
parent5debd105e33835d5e7f8681cecae5ccf225c19a7 (diff)
FEAT(plugins): Add classes for process-related functions
Since most of the functions are already using C++, why not use classes as well? This commit introduces the following classes: - HostLinux: can only be compiled on Linux. Implements peek() and module(). - HostWindows: can only be compiled on Windows. Implements peek() and module(). - Process: abstract (cannot be instantiated directly). Inherits from HostLinux on Linux and from HostWindows on Windows. Provides functions that can be used with both Linux and Windows processes. Pure virtual functions are implemented in the following classes: - ProcessLinux: meant to be used with Linux processes, inherits from Process. Only implements exportedSymbol(), due to the other functions being universal. The constructor detects the architecture through the ELF header. - ProcessWindows: meant to be used with Windows processes, inherits from Process. Only implements exportedSymbol(), due to the other functions being universal. The constructor detects the architecture through the NT header.
Diffstat (limited to 'plugins/HostWindows.h')
-rw-r--r--plugins/HostWindows.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/plugins/HostWindows.h b/plugins/HostWindows.h
new file mode 100644
index 000000000..a8253669e
--- /dev/null
+++ b/plugins/HostWindows.h
@@ -0,0 +1,32 @@
+// Copyright 2020 The Mumble Developers. All rights reserved.
+// Use of this source code is governed by a BSD-style license
+// that can be found in the LICENSE file at the root of the
+// Mumble source tree or at <https://www.mumble.info/LICENSE>.
+
+#ifndef HOSTWINDOWS_H_
+#define HOSTWINDOWS_H_
+
+#include <cstddef>
+#include <cstdint>
+#include <string>
+
+typedef uint32_t procid_t;
+typedef uint64_t procptr_t;
+
+class HostWindows {
+protected:
+ bool m_ok;
+ procid_t m_pid;
+ void *m_handle;
+
+public:
+ inline bool isOk() const { return m_ok; }
+
+ bool peek(const procptr_t address, void *dst, const size_t size) const;
+ procptr_t module(const std::string &module) const;
+
+ HostWindows(const procid_t pid);
+ virtual ~HostWindows();
+};
+
+#endif