Zydis  v2.0.0-alpha1
Decoder.h File Reference
#include <Zydis/CommonTypes.h>
#include <Zydis/DecoderTypes.h>
#include <Zydis/Defines.h>
#include <Zydis/Status.h>
Include dependency graph for Decoder.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ZydisDecoder_
 Defines the ZydisDecoder struct. More...
 

Typedefs

typedef uint32_t ZydisDecodeGranularity
 Defines the ZydisDecodeGranularity datatype. More...
 
typedef struct ZydisDecoder_ ZydisDecoder
 Defines the ZydisDecoder struct. More...
 

Enumerations

enum  ZydisDecodeGranularities { ZYDIS_DECODE_GRANULARITY_DEFAULT , ZYDIS_DECODE_GRANULARITY_MINIMAL , ZYDIS_DECODE_GRANULARITY_FULL }
 Decoder modes defining how granular the instruction should be decoded. More...
 

Functions

ZYDIS_EXPORT ZydisStatus ZydisDecoderInit (ZydisDecoder *decoder, ZydisMachineMode machineMode, ZydisAddressWidth addressWidth)
 Initializes the given ZydisDecoder instance. More...
 
ZYDIS_EXPORT ZydisStatus ZydisDecoderInitEx (ZydisDecoder *decoder, ZydisMachineMode machineMode, ZydisAddressWidth addressWidth, ZydisDecodeGranularity decodeGranularity)
 Initializes the given ZydisDecoder instance. More...
 
ZYDIS_EXPORT ZydisStatus ZydisDecoderDecodeBuffer (const ZydisDecoder *decoder, const void *buffer, size_t bufferLen, uint64_t instructionPointer, ZydisDecodedInstruction *instruction)
 Decodes the instruction in the given input buffer. More...
 

Typedef Documentation

◆ ZydisDecodeGranularity

typedef uint32_t ZydisDecodeGranularity

Defines the ZydisDecodeGranularity datatype.

◆ ZydisDecoder

typedef struct ZydisDecoder_ ZydisDecoder

Defines the ZydisDecoder struct.

Enumeration Type Documentation

◆ ZydisDecodeGranularities

Decoder modes defining how granular the instruction should be decoded.

Enumerator
ZYDIS_DECODE_GRANULARITY_DEFAULT 

Defaults to ZYDIS_DECODE_GRANULARITY_FULL.

ZYDIS_DECODE_GRANULARITY_MINIMAL 

Minimal instruction decoding without semantic analysis.

This mode provides access to the mnemonic, the instruction-length, the effective operand-size, the effective address-width, some attributes (e.g. ZYDIS_ATTRIB_IS_RELATIVE) and all of the information in the raw field of the ZydisDecodedInstruction struct.

Operands, most attributes and other specific information (like AVX info) are not accessible in this mode.

ZYDIS_DECODE_GRANULARITY_FULL 

Full physical and semantic instruction-decoding.

Function Documentation

◆ ZydisDecoderDecodeBuffer()

ZYDIS_EXPORT ZydisStatus ZydisDecoderDecodeBuffer ( const ZydisDecoder decoder,
const void *  buffer,
size_t  bufferLen,
uint64_t  instructionPointer,
ZydisDecodedInstruction instruction 
)

Decodes the instruction in the given input buffer.

Parameters
decoderA pointer to the ZydisDecoder instance.
bufferA pointer to the input buffer.
bufferLenThe length of the input buffer.
instructionPointerThe instruction-pointer.
instructionA pointer to the ZydisDecodedInstruction struct, that receives the details about the decoded instruction.
Returns
A zydis status code.

◆ ZydisDecoderInit()

ZYDIS_EXPORT ZydisStatus ZydisDecoderInit ( ZydisDecoder decoder,
ZydisMachineMode  machineMode,
ZydisAddressWidth  addressWidth 
)

Initializes the given ZydisDecoder instance.

Parameters
decoderA pointer to the ZydisDecoder instance.
machineModeThe machine mode.
addressWidthThe address width.
Returns
A zydis status code.

◆ ZydisDecoderInitEx()

ZYDIS_EXPORT ZydisStatus ZydisDecoderInitEx ( ZydisDecoder decoder,
ZydisMachineMode  machineMode,
ZydisAddressWidth  addressWidth,
ZydisDecodeGranularity  decodeGranularity 
)

Initializes the given ZydisDecoder instance.

Parameters
decoderA pointer to the ZydisDecoder instance.
machineModeThe machine mode.
addressWidthThe address width.
decodeGranularityThe decode granularity.
Returns
A zydis status code.