Zydis  v2.0.1
Status.h
Go to the documentation of this file.
1 /***************************************************************************************************
2 
3  Zyan Disassembler Library (Zydis)
4 
5  Original Author : Florian Bernd
6 
7  * Permission is hereby granted, free of charge, to any person obtaining a copy
8  * of this software and associated documentation files (the "Software"), to deal
9  * in the Software without restriction, including without limitation the rights
10  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11  * copies of the Software, and to permit persons to whom the Software is
12  * furnished to do so, subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included in all
15  * copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23  * SOFTWARE.
24 
25 ***************************************************************************************************/
26 
32 #ifndef ZYDIS_STATUS_H
33 #define ZYDIS_STATUS_H
34 
35 #include <Zydis/CommonTypes.h>
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 /* ============================================================================================== */
42 /* Enums and types */
43 /* ============================================================================================== */
44 
49 
54 {
55  /* ------------------------------------------------------------------------------------------ */
56  /* General */
57  /* ------------------------------------------------------------------------------------------ */
58 
62  ZYDIS_STATUS_SUCCESS = 0x00000000,
75 
76  /* ------------------------------------------------------------------------------------------ */
77  /* Decoder */
78  /* ------------------------------------------------------------------------------------------ */
79 
123  ZYDIS_STATUS_MALFORMED_MVEX, // TODO: Do we need this?
128 
129  /* ------------------------------------------------------------------------------------------ */
130  /* Formatter */
131  /* ------------------------------------------------------------------------------------------ */
132 
138 
139  /* ------------------------------------------------------------------------------------------ */
140  /* Encoder */
141  /* ------------------------------------------------------------------------------------------ */
142 
144 
145  /* ------------------------------------------------------------------------------------------ */
146  /* Misc */
147  /* ------------------------------------------------------------------------------------------ */
148 
152  ZYDIS_STATUS_USER = 0x10000000
153 
154  // Max value entry intentionally omitted since users might define custom error codes for
155  // formatter hooks.
156 };
157 
158 /* ============================================================================================== */
159 /* Macros */
160 /* ============================================================================================== */
161 
167 #define ZYDIS_SUCCESS(status) (status == ZYDIS_STATUS_SUCCESS)
168 
174 #define ZYDIS_CHECK(status) \
175  do \
176  { \
177  ZydisStatus status_038560234 = status; \
178  if (!ZYDIS_SUCCESS(status_038560234)) \
179  { \
180  return status_038560234; \
181  } \
182  } while (0)
183 
184 /* ============================================================================================== */
185 
186 #ifdef __cplusplus
187 }
188 #endif
189 
190 #endif /* ZYDIS_STATUS_H */
Includes and defines some default datatypes.
uint32_t ZydisU32
Definition: CommonTypes.h:47
ZydisStatusCodes
Values that represent a zydis status-codes.
Definition: Status.h:54
@ ZYDIS_STATUS_NO_MORE_DATA
An attempt was made to read data from an input data-source that has no more data available.
Definition: Status.h:84
@ ZYDIS_STATUS_SKIP_OPERAND
Returning this status code in operand-related custom formatter callbacks will cause the formatter to ...
Definition: Status.h:137
@ ZYDIS_STATUS_MALFORMED_MVEX
An error occured while decoding the MVEX-prefix.
Definition: Status.h:123
@ ZYDIS_STATUS_IMPOSSIBLE_INSTRUCTION
Definition: Status.h:143
@ ZYDIS_STATUS_INSUFFICIENT_BUFFER_SIZE
A buffer passed to a function was too small to complete the requested operation.
Definition: Status.h:74
@ ZYDIS_STATUS_INVALID_MASK
An invalid write-mask was specified for an EVEX/MVEX instruction.
Definition: Status.h:127
@ ZYDIS_STATUS_ILLEGAL_LEGACY_PFX
A legacy-prefix (F2, F3, 66) was found while decoding a XOP/VEX/EVEX/MVEX instruction.
Definition: Status.h:107
@ ZYDIS_STATUS_ILLEGAL_LOCK
A lock-prefix (F0) was found while decoding an instruction that does not support locking.
Definition: Status.h:102
@ ZYDIS_STATUS_ILLEGAL_REX
A rex-prefix was found while decoding a XOP/VEX/EVEX/MVEX instruction.
Definition: Status.h:111
@ ZYDIS_STATUS_SUCCESS
The operation completed successfully.
Definition: Status.h:62
@ ZYDIS_STATUS_USER
The base value for user-defined status codes.
Definition: Status.h:152
@ ZYDIS_STATUS_INVALID_PARAMETER
An invalid parameter was passed to a function.
Definition: Status.h:66
@ ZYDIS_STATUS_DECODING_ERROR
An general error occured while decoding the current instruction.
Definition: Status.h:89
@ ZYDIS_STATUS_INSTRUCTION_TOO_LONG
The instruction exceeded the maximum length of 15 bytes.
Definition: Status.h:93
@ ZYDIS_STATUS_INVALID_OPERATION
An attempt was made to perform an invalid operation.
Definition: Status.h:70
@ ZYDIS_STATUS_BAD_REGISTER
The instruction encoded an invalid register.
Definition: Status.h:97
@ ZYDIS_STATUS_INVALID_MAP
An invalid opcode-map value was found while decoding a XOP/VEX/EVEX/MVEX-prefix.
Definition: Status.h:115
@ ZYDIS_STATUS_MALFORMED_EVEX
An error occured while decoding the EVEX-prefix.
Definition: Status.h:119
ZydisU32 ZydisStatus
Defines the ZydisStatus datatype.
Definition: Status.h:48