LIEF: Library to Instrument Executable Formats
Version 2.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
lief-install
x86_64
static
include
LIEF
runtime
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 <unordered_map>
19
#include <cstdint>
20
#include <string>
21
22
#include "
LIEF/runtime/utils.hpp
"
23
#include "
LIEF/visibility.h
"
24
#include <optional>
25
26
27
namespace
LIEF::assembly
{
28
class
Engine
;
29
}
30
31
32
namespace
LIEF::runtime
{
33
36
class
LIEF_API
Process
{
37
public
:
39
struct
EnvVars
{
40
std::unordered_map<std::string, std::string>
vars
;
41
42
bool
empty
()
const
{
43
return
vars
.empty();
44
}
45
};
46
48
static
int32_t
pid
();
49
51
static
uint32_t
tid
();
52
54
static
constexpr
ARCH
arch
() {
55
return
runtime::arch();
56
}
57
59
static
constexpr
PLATFORMS
platform
() {
60
return
runtime::platform();
61
}
62
68
static
uint32_t
page_size
();
69
71
static
std::optional<std::string>
get_env
(
const
std::string& key);
72
74
static
EnvVars
get_envs
();
75
77
static
assembly::Engine
*
default_engine
();
78
};
79
}
80
81
#endif
LIEF::assembly::Engine
This class interfaces the assembler/disassembler support.
Definition
Engine.hpp:37
LIEF::runtime::Process
This structure represents the current process and provides functions to query process-level informati...
Definition
Process.hpp:36
LIEF::runtime::Process::pid
static int32_t pid()
Get the Process ID of the current process.
LIEF::runtime::Process::page_size
static uint32_t page_size()
Return the number of bytes in a memory page.
LIEF::runtime::Process::get_envs
static EnvVars get_envs()
Return the environment variables present in the current process.
LIEF::runtime::Process::get_env
static std::optional< std::string > get_env(const std::string &key)
Return the environment variable associated with the given key.
LIEF::runtime::Process::arch
static constexpr ARCH arch()
Return the target architecture of the current process.
Definition
Process.hpp:54
LIEF::runtime::Process::platform
static constexpr PLATFORMS platform()
Return the target platform of the current process.
Definition
Process.hpp:59
LIEF::runtime::Process::tid
static uint32_t tid()
Get the Thread ID of the current thread.
LIEF::runtime::Process::default_engine
static assembly::Engine * default_engine()
Return the assembler/disassembler for the current process.
LIEF::assembly
Namespace related to assembly/disassembly support.
Definition
Abstract/Binary.hpp:48
LIEF::runtime
Definition
android/Host.hpp:24
LIEF::runtime::ARCH
ARCH
Definition
runtime/utils.hpp:37
LIEF::runtime::PLATFORMS
PLATFORMS
Definition
runtime/utils.hpp:28
utils.hpp
LIEF::runtime::Process::EnvVars
This structure wraps environment variables.
Definition
Process.hpp:39
LIEF::runtime::Process::EnvVars::empty
bool empty() const
Definition
Process.hpp:42
LIEF::runtime::Process::EnvVars::vars
std::unordered_map< std::string, std::string > vars
Definition
Process.hpp:40
visibility.h
LIEF_API
#define LIEF_API
Definition
visibility.h:45
Generated by
1.18.0