LIEF: Library to Instrument Executable Formats
Version 1.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
* 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_DSC_UTILS_H
17
#define LIEF_DSC_UTILS_H
18
19
#include <
LIEF/visibility.h
>
20
21
#include "
LIEF/BinaryStream/FileStream.hpp
"
22
#include "
LIEF/BinaryStream/SpanStream.hpp
"
23
24
#include <string>
25
26
namespace
LIEF
{
27
namespace
dsc
{
28
30
LIEF_API
bool
is_shared_cache
(
BinaryStream
& stream);
31
33
inline
bool
is_shared_cache
(
const
std::string& file) {
34
auto
fs =
LIEF::FileStream::from_file
(file);
35
if
(!fs) {
36
return
false
;
37
}
38
return
is_shared_cache
(*fs);
39
}
40
42
inline
bool
is_shared_cache
(
const
uint8_t* buffer,
size_t
size) {
43
LIEF::SpanStream
strm(buffer, size);
44
return
is_shared_cache
(strm);
45
}
46
48
inline
bool
is_shared_cache
(
const
std::vector<uint8_t>& buffer) {
49
return
is_shared_cache
(buffer.data(), buffer.size());
50
}
51
52
}
53
}
54
#endif
FileStream.hpp
SpanStream.hpp
LIEF::BinaryStream
Class that is used to a read stream of data from different sources.
Definition
BinaryStream.hpp:33
LIEF::FileStream::from_file
static result< FileStream > from_file(const std::string &file)
LIEF::SpanStream
Definition
SpanStream.hpp:32
LIEF::dsc
Namespace related to the dyld shared cache support.
Definition
caching.hpp:22
LIEF::dsc::is_shared_cache
bool is_shared_cache(BinaryStream &stream)
Check if the given stream wraps a Dyld Shared Cache.
LIEF
LIEF namespace.
Definition
Abstract/Binary.hpp:40
visibility.h
LIEF_API
#define LIEF_API
Definition
visibility.h:41
Generated by
1.17.0