Binary structure DOCUMENTATION
This commit is contained in:
parent
b4a2139224
commit
2336f4391a
33
BINARY.md
Normal file
33
BINARY.md
Normal file
@ -0,0 +1,33 @@
|
||||
# Структура файла
|
||||
Файл содержит заголовок, сигнатуру и исполняемый код.
|
||||
В качестве порядка размещения байт используется **LITTLE-ENDIAN** в не зависимости от платформы.
|
||||
## Заголовок
|
||||
Его структура следующая:
|
||||
- Сигнатура (16 BIT) это текст MZ (0x4D5A)
|
||||
- Размер памяти под файл (32 BIT)
|
||||
- Размер стека (16 BIT)
|
||||
Пример записи заголовка на **BASH**:
|
||||
```bash
|
||||
touch hello_world.hex
|
||||
echo "4d5a240000002000" > hello_world.hex
|
||||
touch hello_world.exe
|
||||
xxd -r -p hello_world.hex hello_world.exe
|
||||
```
|
||||
## Структура
|
||||
Файл содержит исполняемые команды. Подробнее [здесь](https://gitlabor.ru/German/ntsys/src/branch/main/BINCOM.md).
|
||||
Пример записи структуры на **BASH**:
|
||||
```bash
|
||||
touch hello_world.hex
|
||||
echo "0248656c6c6f2c20776f726c64210a000001001a00022a00" >> hello_world.hex
|
||||
touch hello_world.exe
|
||||
xxd -r -p hello_world.hex hello_world.exe
|
||||
```
|
||||
# Пример
|
||||
Выполните следующий скрипт:
|
||||
```bash
|
||||
touch hello_world.hex
|
||||
echo "4d5a2400000020000248656c6c6f2c20776f726c64210a000001001a00022a00" > hello_world.hex
|
||||
touch hello_world.exe
|
||||
xxd -r -p hello_world.hex hello_world.exe
|
||||
ntsys hello_world.exe
|
||||
```
|
||||
BIN
hello_world.exe
Normal file
BIN
hello_world.exe
Normal file
Binary file not shown.
1
hello_world.hex
Normal file
1
hello_world.hex
Normal file
@ -0,0 +1 @@
|
||||
4d5a2400000020000248656c6c6f2c20776f726c64210a000001001a00022a00
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user