Zydis  v2.0.0-alpha2
CommonTypes.h
Go to the documentation of this file.
1 /***************************************************************************************************
2 
3  Zyan Disassembler Library (Zydis)
4 
5  Original Author : Florian Bernd, Joel Höner
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_COMMONTYPES_H
33 #define ZYDIS_COMMONTYPES_H
34 
35 #include <Zydis/Defines.h>
36 
37 /* ============================================================================================== */
38 /* Integral types */
39 /* ============================================================================================== */
40 
41 // Fixed width integer types.
42 #if defined(ZYDIS_WINKERNEL)
43 # if !defined(ZYDIS_MSVC)
44 # error "Windows kernel drivers are only supported with MSVC"
45 # endif
46  typedef unsigned __int8 uint8_t;
47  typedef unsigned __int16 uint16_t;
48  typedef unsigned __int32 uint32_t;
49  typedef unsigned __int64 uint64_t;
50  typedef __int8 int8_t;
51  typedef __int16 int16_t;
52  typedef __int32 int32_t;
53  typedef __int64 int64_t;
54 # define UINT8_MAX (255)
55 # define UINT16_MAX (65535U)
56 # define UINT32_MAX (4294967295UL)
57 # define UINT64_MAX (18446744073709551615ULL)
58 # define INT8_MAX (127)
59 # define INT8_MIN (-128)
60 # define INT16_MAX (32767)
61 # define INT16_MIN (-32767-1)
62 # define INT32_MIN (-2147483647L-1)
63 # define INT32_MAX (2147483647L)
64 # define INT64_MIN (-9223372036854775807LL-1)
65 # define INT64_MAX (9223372036854775807LL)
66 # define PRIX8 "hhX"
67 # define PRIX16 "hX"
68 # define PRIX32 "X"
69 # define PRIX64 "llX"
70 #else
71 # include <stdint.h>
72 # include <inttypes.h>
73 #endif
74 
75 // size_t, ptrdiff_t
76 #include <stddef.h>
77 
78 #ifdef __cplusplus
79 extern "C" {
80 #endif
81 
82 /* ============================================================================================== */
83 /* Boolean */
84 /* ============================================================================================== */
85 
86 #define ZYDIS_FALSE 0
87 #define ZYDIS_TRUE 1
88 
92 typedef uint8_t ZydisBool;
93 
94 /* ============================================================================================== */
95 
96 #ifdef __cplusplus
97 }
98 #endif
99 
100 #endif /* ZYDIS_COMMONTYPES_H */
uint8_t ZydisBool
@briefs Defines the ZydisBool datatype.
Definition: CommonTypes.h:92
General helper and platform detection macros.