Functions allowing encoding of instruction bytes from a machine interpretable struct.
More...
Functions allowing encoding of instruction bytes from a machine interpretable struct.
◆ ZydisEncoderDecodedInstructionToEncoderRequest()
Converts decoded instruction to encoder request that can be passed to ZydisEncoderEncodeInstruction
.
- Parameters
-
instruction | A pointer to the ZydisDecodedInstruction struct. |
operands | A pointer to the decoded operands. |
operand_count_visible | The number of visible instruction operands. |
request | A pointer to the ZydisEncoderRequest struct, that receives information necessary for encoder to re-encode the instruction. |
This function performs simple structure conversion and does minimal sanity checks on the input. There's no guarantee that produced request will be accepted by ZydisEncoderEncodeInstruction
if malformed ZydisDecodedInstruction
or malformed ZydisDecodedOperands
is passed to this function.
- Returns
- A zyan status code.
◆ ZydisEncoderEncodeInstruction()
Encodes instruction with semantics specified in encoder request structure.
- Parameters
-
request | A pointer to the ZydisEncoderRequest struct. |
buffer | A pointer to the output buffer receiving encoded instruction. |
length | A pointer to the variable containing length of the output buffer. Upon successful return this variable receives length of the encoded instruction. |
- Returns
- A zyan status code.
◆ ZydisEncoderEncodeInstructionAbsolute()
ZYDIS_EXPORT ZyanStatus ZydisEncoderEncodeInstructionAbsolute |
( |
ZydisEncoderRequest * |
request, |
|
|
void * |
buffer, |
|
|
ZyanUSize * |
length, |
|
|
ZyanU64 |
runtime_address |
|
) |
| |
Encodes instruction with semantics specified in encoder request structure.
This function expects absolute addresses inside encoder request instead of EIP
/RIP
-relative values. Function predicts final instruction length prior to encoding and writes back calculated relative operands to provided encoder request.
- Parameters
-
request | A pointer to the ZydisEncoderRequest struct. |
buffer | A pointer to the output buffer receiving encoded instruction. |
length | A pointer to the variable containing length of the output buffer. Upon successful return this variable receives length of the encoded instruction. |
runtime_address | The runtime address of the instruction. |
- Returns
- A zyan status code.
◆ ZydisEncoderNopFill()
ZYDIS_EXPORT ZyanStatus ZydisEncoderNopFill |
( |
void * |
buffer, |
|
|
ZyanUSize |
length |
|
) |
| |
Fills provided buffer with NOP
instructions using longest possible multi-byte instructions.
- Parameters
-
buffer | A pointer to the output buffer receiving encoded instructions. |
length | Size of the output buffer. |
- Returns
- A zyan status code.