VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
Image.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <cstddef>
4
#include <cstdint>
5
#include <string>
6
#include <string_view>
7
#include <vector>
8
9
namespace
VoltMod
10
{
11
12
/** A process mapping and the file backing it. */
13
struct
Image
14
{
15
const
uint8_t
*
Base
=
nullptr
;
16
size_t
Size
= 0;
17
std::string
Path
;
18
19
bool
Contains
(
const
void
*
address
)
const
20
{
21
const
auto
*
at
=
static_cast<
const
uint8_t
*
>
(
address
);
22
return
Base
&&
at
>=
Base
&&
at
<
Base
+
Size
;
23
}
24
};
25
26
struct
ScanRange
27
{
28
const
uint8_t
*
Base
;
29
size_t
Size
;
30
};
31
32
/**
33
* Locate the exact platform @p fileName and populate its mapping and readable scan ranges.
34
*
35
* Windows returns the mapped image as one range. Linux returns individual PT_LOAD segments because
36
* the full module span may contain unmapped gaps.
37
*
38
* @return false when the module is not loaded. Both outputs remain unchanged.
39
*/
40
bool
FindModuleAndRanges
(std::string_view
fileName
,
Image
&
module
, std::vector<ScanRange>&
ranges
);
41
42
}
// namespace VoltMod
VoltMod
Definition
Options.hpp:13
VoltMod::FindModuleAndRanges
bool FindModuleAndRanges(std::string_view fileName, Image &module, std::vector< ScanRange > &ranges)
Definition
Image.linux.cpp:61
VoltMod::ReadFile
static std::string ReadFile(const std::filesystem::path &path)
Definition
Loader.cpp:56
VoltMod::Image
Definition
Image.hpp:14
VoltMod::Image::Path
std::string Path
Definition
Image.hpp:17
VoltMod::Image::Base
const uint8_t * Base
Definition
Image.hpp:15
VoltMod::Image::Size
size_t Size
Definition
Image.hpp:16
VoltMod::Image::Contains
bool Contains(const void *address) const
Definition
Image.hpp:19
VoltMod::ScanRange
Definition
Image.hpp:27
VoltMod::ScanRange::Base
const uint8_t * Base
Definition
Image.hpp:28
VoltMod::ScanRange::Size
size_t Size
Definition
Image.hpp:29
src
Engine
Memory
Image.hpp
Generated by
1.9.8