LIEF: Library to Instrument Executable Formats Version 1.0.0
Loading...
Searching...
No Matches
Process.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2026 R. Thomas
2 * Copyright 2017 - 2026 Quarkslab
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#ifndef LIEF_RUNTIME_PROCESS_H
17#define LIEF_RUNTIME_PROCESS_H
18#include <cstdint>
19#include <string>
20#include <unordered_map>
21
22#include "LIEF/visibility.h"
24#include "LIEF/optional.hpp"
25
26namespace LIEF {
27namespace assembly {
28class Engine;
29}
30}
31
32namespace LIEF {
33namespace runtime {
34
38 public:
40 struct EnvVars {
41 std::unordered_map<std::string, std::string> vars;
42
43 bool empty() const {
44 return vars.empty();
45 }
46 };
47
49 static int32_t pid();
50
52 static uint32_t tid();
53
55 static constexpr ARCH arch() {
56 return runtime::arch();
57 }
58
60 static constexpr PLATFORMS platform() {
61 return runtime::platform();
62 }
63
69 static uint32_t page_size();
70
72 static optional<std::string> get_env(const std::string& key);
73
75 static EnvVars get_envs();
76
79};
80}
81}
82#endif
This class interfaces the assembler/disassembler support.
Definition Engine.hpp:37
Definition optional.hpp:23
This structure represents the current process and provides functions to query process-level informati...
Definition Process.hpp:37
static int32_t pid()
Get the Process ID of the current process.
static uint32_t page_size()
Return the number of bytes in a memory page.
static optional< std::string > get_env(const std::string &key)
Return the environment variable associated with the given key.
static EnvVars get_envs()
Return the environment variables present in the current process.
static constexpr ARCH arch()
Return the target architecture of the current process.
Definition Process.hpp:55
static constexpr PLATFORMS platform()
Return the target platform of the current process.
Definition Process.hpp:60
static uint32_t tid()
Get the Thread ID of the current thread.
static assembly::Engine * default_engine()
Return the assembler/disassembler for the current process.
Namespace related to assembly/disassembly support.
Definition Abstract/Binary.hpp:48
Definition android/Host.hpp:24
ARCH
Definition runtime/utils.hpp:37
PLATFORMS
Definition runtime/utils.hpp:28
LIEF namespace.
Definition Abstract/Binary.hpp:41
This structure wraps environment variables.
Definition Process.hpp:40
bool empty() const
Definition Process.hpp:43
std::unordered_map< std::string, std::string > vars
Definition Process.hpp:41
#define LIEF_API
Definition visibility.h:45