LIEF: Library to Instrument Executable Formats
Version 1.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
install
linux
x86_64
sdk
static
include
LIEF
runtime
windows
injector.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_WIN_INJECTOR_H
17
#define LIEF_RUNTIME_WIN_INJECTOR_H
18
19
#include "
LIEF/visibility.h
"
20
#include "
LIEF/errors.hpp
"
21
22
#include <ostream>
23
#include <string>
24
#include <unordered_map>
25
26
namespace
LIEF
{
27
namespace
runtime
{
28
namespace
windows
{
29
31
struct
LIEF_API
injection_context_t
{
33
std::string
target_path
;
34
36
std::string
args
;
37
39
std::string
library
;
40
43
std::unordered_map<std::string, std::string>
env
;
44
47
bool
validate
()
const
;
48
49
operator
bool()
const
{
50
return
validate
();
51
}
52
53
std::string
to_string
()
const
;
54
55
friend
LIEF_API
std::ostream&
operator<<
(std::ostream& os,
56
const
injection_context_t
& ctx) {
57
os << ctx.
to_string
();
58
return
os;
59
}
60
};
61
67
LIEF_API
ok_error_t
inject_spawn
(
const
injection_context_t
& ctx);
68
69
}
70
}
71
}
72
#endif
LIEF::ok_error_t
Opaque structure that is used by LIEF to avoid writing result<void> f(...). Instead,...
Definition
errors.hpp:119
errors.hpp
LIEF::runtime::windows
Definition
windows/Host.hpp:25
LIEF::runtime::windows::inject_spawn
ok_error_t inject_spawn(const injection_context_t &ctx)
Spawn the target described by the given injection context and inject the associated library before th...
LIEF::runtime
Definition
android/Host.hpp:24
LIEF
LIEF namespace.
Definition
Abstract/Binary.hpp:41
LIEF::runtime::windows::injection_context_t
Describes how to spawn a new process and inject a library into it.
Definition
injector.hpp:31
LIEF::runtime::windows::injection_context_t::operator<<
friend std::ostream & operator<<(std::ostream &os, const injection_context_t &ctx)
Definition
injector.hpp:55
LIEF::runtime::windows::injection_context_t::args
std::string args
Command-line arguments passed to the spawned process.
Definition
injector.hpp:36
LIEF::runtime::windows::injection_context_t::validate
bool validate() const
Check whether the context is consistent (required paths filled-in and readable).
LIEF::runtime::windows::injection_context_t::library
std::string library
Absolute path to the library (DLL) that should be injected.
Definition
injector.hpp:39
LIEF::runtime::windows::injection_context_t::env
std::unordered_map< std::string, std::string > env
Environment variables to set in the spawned process. If left empty, the current process environment i...
Definition
injector.hpp:43
LIEF::runtime::windows::injection_context_t::target_path
std::string target_path
Absolute path to the target executable to spawn.
Definition
injector.hpp:33
LIEF::runtime::windows::injection_context_t::to_string
std::string to_string() const
visibility.h
LIEF_API
#define LIEF_API
Definition
visibility.h:45
Generated by
1.18.0