ntsys/BINARY.md
2026-02-25 19:53:14 +04:00

37 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Структура файла
Файл содержит заголовок, сигнатуру и исполняемый код.
Файл является 16-битным.
В качестве порядка размещения байт используется **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
```
Для запуска введите:
```bash
ntsys hello_world.exe
```