In the Python bindings, a new instance of ImportEntry
has it's type hard-coded to PE_TYPE::PE32, with no
way to change the type once created.
This prevents adding new ordinal imports to PE32+,
aka 64-bit, binaries.
The fix is to allow ImportEntry to also accept PE_TYPE.
In addition, the unittest also documents how to add an ordinal
using LIEF.
* Update ImportEntry to accept PE_TYPE
* Update python bindings for ImportEntry
* Add unittest for ImportEntry and ordinals
This commit (obviously non-atomic) cleans LIEF's code base by:
- Using pointer semantics (`std::unique_ptr<>`)
- Using LEAF boost error in the binary stream
- Reducing the scope of the iterators (`it_section`, ...)
- Removing `Structures.hpp` from the public headers
- etc
This commit removes the public include of nlohmann/json
as it is a *detail of implementation*. Instead, the public
API exposes:
```cpp
std::string to_json(...);
```
In addition, it enables to externally provide nlohmann/json using
the cmake option ``-DLIEF_OPT_NLOHMANN_JSON_EXTERNAL=on``.
For instance, this option can be used as follows:
```bash
$ cmake -DLIEF_OPT_NLOHMANN_JSON_EXTERNAL=on \
-Dnlohmann_json_DIR=<PATH>/lib/cmake/nlohmann_json
```
Related to #605
Among the changes:
- It removes the ``and, or, not`` keywords
- It updates the Documentation
- It moves the internal structures in the ``details::`` namespace
The following Python code currently fails with Python 3.9:
import lief
elf = lief.ELF.Binary("test", lief.ELF.ELF_CLASS.CLASS32)
elf.header.identity = bytes.fromhex("7f454c46010101000000000000000000")
The reported error is:
TypeError: b'\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00' is not supported!
It is possible to use `.decode()` to convert the bytes to string, or to
use `list(...)` to convert them to a list of integers. Both these
solutions work, but they are not as elegant as directly using `bytes`.
Modify the `identity` setter to support bytes. As `Header::identity_t`
is directly an array of `uint8_t`, casting it from `py::bytes` is
straightforward.
It seems that on recent version on the SDK, Microsoft renamed the
field LoadConfiguration::reserved1 into DependentLoadFlags.
This commit create an alias on this field
Resolve#621