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
DyldSharedCache
DyldSharedCache/utils.hpp
Go to the documentation of this file.
1
/* Copyright 2017 - 2026 R. Thomas
2
*
3
* Licensed under the Apache License, Version 2.0 (the "License");
4
* you may not use this file except in compliance with the License.
5
* You may obtain a copy of the License at
6
*
7
* http://www.apache.org/licenses/LICENSE-2.0
8
*
9
* Unless required by applicable law or agreed to in writing, software
10
* distributed under the License is distributed on an "AS IS" BASIS,
11
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
* See the License for the specific language governing permissions and
13
* limitations under the License.
14
*/
15
#ifndef LIEF_DSC_UTILS_H
16
#define LIEF_DSC_UTILS_H
17
18
#include "
LIEF/visibility.h
"
19
20
#include "
LIEF/BinaryStream/FileStream.hpp
"
21
#include "
LIEF/BinaryStream/SpanStream.hpp
"
22
23
#include <string_view>
24
25
26
namespace
LIEF::dsc
{
27
29
LIEF_API
bool
is_shared_cache
(
BinaryStream
& stream);
30
32
inline
bool
is_shared_cache
(std::string_view file) {
33
auto
fs =
LIEF::FileStream::from_file
(file);
34
if
(!fs) {
35
return
false
;
36
}
37
return
is_shared_cache
(*fs);
38
}
39
41
inline
bool
is_shared_cache
(
const
uint8_t* buffer,
size_t
size) {
42
LIEF::SpanStream
strm(buffer, size);
43
return
is_shared_cache
(strm);
44
}
45
47
inline
bool
is_shared_cache
(
const
std::vector<uint8_t>& buffer) {
48
return
is_shared_cache
(buffer.data(), buffer.size());
49
}
50
51
}
52
53
#endif
FileStream.hpp
SpanStream.hpp
LIEF::BinaryStream
Class that is used to a read stream of data from different sources.
Definition
BinaryStream.hpp:34
LIEF::FileStream::from_file
static result< FileStream > from_file(std::string_view file)
LIEF::SpanStream
Definition
SpanStream.hpp:31
LIEF::dsc
Namespace related to the dyld shared cache support.
Definition
caching.hpp:21
LIEF::dsc::is_shared_cache
bool is_shared_cache(BinaryStream &stream)
Check if the given stream wraps a Dyld Shared Cache.
visibility.h
LIEF_API
#define LIEF_API
Definition
visibility.h:44
Generated by
1.19.0