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
COFF
COFF/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_COFF_UTILS_H
17
#define LIEF_COFF_UTILS_H
18
#include "
LIEF/visibility.h
"
19
#include "
LIEF/COFF/Header.hpp
"
20
#include "
LIEF/BinaryStream/FileStream.hpp
"
21
#include "
LIEF/BinaryStream/SpanStream.hpp
"
22
#include <string>
23
24
namespace
LIEF
{
25
namespace
COFF
{
26
29
LIEF_API
Header::KIND
get_kind
(
BinaryStream
& stream);
30
32
LIEF_API
inline
bool
is_coff
(
BinaryStream
& stream) {
33
return
get_kind
(stream) !=
Header::KIND::UNKNOWN
;
34
}
35
37
LIEF_API
bool
is_coff
(
const
std::string& file);
38
40
LIEF_API
inline
bool
is_coff
(
const
uint8_t* buffer,
size_t
size) {
41
LIEF::SpanStream
strm(buffer, size);
42
return
is_coff
(strm);
43
}
44
46
LIEF_API
inline
bool
is_coff
(
const
std::vector<uint8_t>& buffer) {
47
return
is_coff
(buffer.data(), buffer.size());
48
}
49
51
LIEF_API
inline
bool
is_bigobj
(
BinaryStream
& stream) {
52
return
get_kind
(stream) ==
Header::KIND::BIGOBJ
;
53
}
54
57
LIEF_API
inline
bool
is_regular
(
BinaryStream
& stream) {
58
return
get_kind
(stream) ==
Header::KIND::REGULAR
;
59
}
60
61
}
62
}
63
#endif
Header.hpp
FileStream.hpp
SpanStream.hpp
LIEF::BinaryStream
Class that is used to a read stream of data from different sources.
Definition
BinaryStream.hpp:33
LIEF::COFF::Header::KIND
KIND
Definition
COFF/Header.hpp:36
LIEF::COFF::Header::KIND::UNKNOWN
@ UNKNOWN
Definition
COFF/Header.hpp:37
LIEF::COFF::Header::KIND::REGULAR
@ REGULAR
Definition
COFF/Header.hpp:38
LIEF::COFF::Header::KIND::BIGOBJ
@ BIGOBJ
Definition
COFF/Header.hpp:39
LIEF::SpanStream
Definition
SpanStream.hpp:32
LIEF::COFF
Definition
AuxiliarySymbol.hpp:29
LIEF::COFF::get_kind
Header::KIND get_kind(BinaryStream &stream)
This function determines if the given stream wraps a COFF binary and if so, whether it's a regular or...
LIEF::COFF::is_coff
bool is_coff(BinaryStream &stream)
Check if the given stream wraps a COFF file.
Definition
COFF/utils.hpp:32
LIEF::COFF::is_bigobj
bool is_bigobj(BinaryStream &stream)
Check if the COFF file wrapped by the given stream is a bigobj.
Definition
COFF/utils.hpp:51
LIEF::COFF::is_regular
bool is_regular(BinaryStream &stream)
Check if the COFF file wrapped by the given stream is regular (i.e. not a bigobj).
Definition
COFF/utils.hpp:57
LIEF
LIEF namespace.
Definition
Abstract/Binary.hpp:40
visibility.h
LIEF_API
#define LIEF_API
Definition
visibility.h:41
Generated by
1.17.0