1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef CRASHPAD_COMPAT_NON_WIN_WINNT_H_
16 #define CRASHPAD_COMPAT_NON_WIN_WINNT_H_
17 
18 #include <stdint.h>
19 
20 //! \file
21 
22 //! \anchor VER_SUITE_x
23 //! \name VER_SUITE_*
24 //!
25 //! \brief Installable product values for MINIDUMP_SYSTEM_INFO::SuiteMask.
26 //! \{
27 #define VER_SUITE_SMALLBUSINESS 0x0001
28 #define VER_SUITE_ENTERPRISE 0x0002
29 #define VER_SUITE_BACKOFFICE 0x0004
30 #define VER_SUITE_COMMUNICATIONS 0x0008
31 #define VER_SUITE_TERMINAL 0x0010
32 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x0020
33 #define VER_SUITE_EMBEDDEDNT 0x0040
34 #define VER_SUITE_DATACENTER 0x0080
35 #define VER_SUITE_SINGLEUSERTS 0x0100
36 #define VER_SUITE_PERSONAL 0x0200
37 #define VER_SUITE_BLADE 0x0400
38 #define VER_SUITE_EMBEDDED_RESTRICTED 0x0800
39 #define VER_SUITE_SECURITY_APPLIANCE 0x1000
40 #define VER_SUITE_STORAGE_SERVER 0x2000
41 #define VER_SUITE_COMPUTE_SERVER 0x4000
42 #define VER_SUITE_WH_SERVER 0x8000
43 //! \}
44 
45 //! \brief The maximum number of exception parameters present in the
46 //!     MINIDUMP_EXCEPTION::ExceptionInformation array.
47 #define EXCEPTION_MAXIMUM_PARAMETERS 15
48 
49 //! \anchor PROCESSOR_ARCHITECTURE_x
50 //! \name PROCESSOR_ARCHITECTURE_*
51 //!
52 //! \brief CPU type values for MINIDUMP_SYSTEM_INFO::ProcessorArchitecture.
53 //!
54 //! \sa crashpad::MinidumpCPUArchitecture
55 //! \{
56 #define PROCESSOR_ARCHITECTURE_INTEL 0
57 #define PROCESSOR_ARCHITECTURE_MIPS 1
58 #define PROCESSOR_ARCHITECTURE_ALPHA 2
59 #define PROCESSOR_ARCHITECTURE_PPC 3
60 #define PROCESSOR_ARCHITECTURE_SHX 4
61 #define PROCESSOR_ARCHITECTURE_ARM 5
62 #define PROCESSOR_ARCHITECTURE_IA64 6
63 #define PROCESSOR_ARCHITECTURE_ALPHA64 7
64 #define PROCESSOR_ARCHITECTURE_MSIL 8
65 #define PROCESSOR_ARCHITECTURE_AMD64 9
66 #define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 10
67 #define PROCESSOR_ARCHITECTURE_NEUTRAL 11
68 #define PROCESSOR_ARCHITECTURE_ARM64 12
69 #define PROCESSOR_ARCHITECTURE_ARM32_ON_WIN64 13
70 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xffff
71 //! \}
72 
73 //! \anchor PF_x
74 //! \name PF_*
75 //!
76 //! \brief CPU feature values for \ref CPU_INFORMATION::ProcessorFeatures
77 //!     "CPU_INFORMATION::OtherCpuInfo::ProcessorFeatures".
78 //!
79 //! \{
80 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
81 #define PF_FLOATING_POINT_EMULATED 1
82 #define PF_COMPARE_EXCHANGE_DOUBLE 2
83 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
84 #define PF_PPC_MOVEMEM_64BIT_OK 4
85 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
86 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
87 #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
88 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
89 #define PF_PAE_ENABLED 9
90 #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
91 #define PF_SSE_DAZ_MODE_AVAILABLE 11
92 #define PF_NX_ENABLED 12
93 #define PF_SSE3_INSTRUCTIONS_AVAILABLE 13
94 #define PF_COMPARE_EXCHANGE128 14
95 #define PF_COMPARE64_EXCHANGE128 15
96 #define PF_CHANNELS_ENABLED 16
97 #define PF_XSAVE_ENABLED 17
98 #define PF_ARM_VFP_32_REGISTERS_AVAILABLE 18
99 #define PF_ARM_NEON_INSTRUCTIONS_AVAILABLE 19
100 #define PF_SECOND_LEVEL_ADDRESS_TRANSLATION 20
101 #define PF_VIRT_FIRMWARE_ENABLED 21
102 #define PF_RDWRFSGSBASE_AVAILABLE 22
103 #define PF_FASTFAIL_AVAILABLE 23
104 #define PF_ARM_DIVIDE_INSTRUCTION_AVAILABLE 24
105 #define PF_ARM_64BIT_LOADSTORE_ATOMIC 25
106 #define PF_ARM_EXTERNAL_CACHE_AVAILABLE 26
107 #define PF_ARM_FMAC_INSTRUCTIONS_AVAILABLE 27
108 #define PF_RDRAND_INSTRUCTION_AVAILABLE 28
109 #define PF_ARM_V8_INSTRUCTIONS_AVAILABLE 29
110 #define PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE 30
111 #define PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE 31
112 #define PF_RDTSCP_INSTRUCTION_AVAILABLE 32
113 //! \}
114 
115 //! \anchor PAGE_x
116 //! \name PAGE_*
117 //!
118 //! \brief Memory protection constants for MINIDUMP_MEMORY_INFO::Protect and
119 //!     MINIDUMP_MEMORY_INFO::AllocationProtect.
120 //! \{
121 #define PAGE_NOACCESS 0x1
122 #define PAGE_READONLY 0x2
123 #define PAGE_READWRITE 0x4
124 #define PAGE_WRITECOPY 0x8
125 #define PAGE_EXECUTE 0x10
126 #define PAGE_EXECUTE_READ 0x20
127 #define PAGE_EXECUTE_READWRITE 0x40
128 #define PAGE_EXECUTE_WRITECOPY 0x80
129 #define PAGE_GUARD 0x100
130 #define PAGE_NOCACHE 0x200
131 #define PAGE_WRITECOMBINE 0x400
132 //! \}
133 
134 //! \anchor MEM_x
135 //! \name MEM_*
136 //!
137 //! \brief Memory state and type constants for MINIDUMP_MEMORY_INFO::State and
138 //!     MINIDUMP_MEMORY_INFO::Type.
139 //! \{
140 #define MEM_COMMIT 0x1000
141 #define MEM_RESERVE 0x2000
142 #define MEM_DECOMMIT 0x4000
143 #define MEM_RELEASE 0x8000
144 #define MEM_FREE 0x10000
145 #define MEM_PRIVATE 0x20000
146 #define MEM_MAPPED 0x40000
147 #define MEM_RESET 0x80000
148 //! \}
149 
150 //! \brief The maximum number of distinct identifiable features that could
151 //!     possibly be carried in an XSAVE area.
152 //!
153 //! This corresponds to the number of bits in the XSAVE state-component bitmap,
154 //! XSAVE_BV. See Intel Software Developer’s Manual, Volume 1: Basic
155 //! Architecture (253665-060), 13.4.2 “XSAVE Header”.
156 #define MAXIMUM_XSTATE_FEATURES (64)
157 
158 //! \brief The location of a single state component within an XSAVE area.
159 struct XSTATE_FEATURE {
160   //! \brief The location of a state component within a CPU-specific context
161   //!     structure.
162   //!
163   //! This is equivalent to the difference (`ptrdiff_t`) between the return
164   //! value of `LocateXStateFeature()` and its \a Context argument.
165   uint32_t Offset;
166 
167   //! \brief The size of a state component with a CPU-specific context
168   //!     structure.
169   //!
170   //! This is equivalent to the size returned by `LocateXStateFeature()` in \a
171   //!     Length.
172   uint32_t Size;
173 };
174 
175 //! \anchor IMAGE_DEBUG_MISC_x
176 //! \name IMAGE_DEBUG_MISC_*
177 //!
178 //! Data type values for IMAGE_DEBUG_MISC::DataType.
179 //! \{
180 
181 //! \brief A pointer to a `.dbg` file.
182 //!
183 //! IMAGE_DEBUG_MISC::Data will contain the path or file name of the `.dbg` file
184 //! associated with the module.
185 #define IMAGE_DEBUG_MISC_EXENAME 1
186 
187 //! \}
188 
189 //! \brief Miscellaneous debugging record.
190 //!
191 //! This structure is referenced by MINIDUMP_MODULE::MiscRecord. It is obsolete,
192 //! superseded by the CodeView record.
193 struct IMAGE_DEBUG_MISC {
194   //! \brief The type of data carried in the #Data field.
195   //!
196   //! This is a value of \ref IMAGE_DEBUG_MISC_x "IMAGE_DEBUG_MISC_*".
197   uint32_t DataType;
198 
199   //! \brief The length of this structure in bytes, including the entire #Data
200   //!     field and its `NUL` terminator.
201   //!
202   //! \note The Windows documentation states that this field is rounded up to
203   //!     nearest nearest 4-byte multiple.
204   uint32_t Length;
205 
206   //! \brief The encoding of the #Data field.
207   //!
208   //! If this field is `0`, #Data contains narrow or multibyte character data.
209   //! If this field is `1`, #Data is UTF-16-encoded.
210   //!
211   //! On Windows, with this field set to `0`, #Data will be encoded in the code
212   //! page of the system that linked the module. On other operating systems,
213   //! UTF-8 may be used.
214   uint8_t Unicode;
215 
216   uint8_t Reserved[3];
217 
218   //! \brief The data carried within this structure.
219   //!
220   //! For string data, this field will be `NUL`-terminated. If #Unicode is `1`,
221   //! this field is UTF-16-encoded, and will be terminated by a UTF-16 `NUL`
222   //! code unit (two `NUL` bytes).
223   uint8_t Data[1];
224 };
225 
226 //! \anchor VER_NT_x
227 //! \name VER_NT_*
228 //!
229 //! \brief Operating system type values for MINIDUMP_SYSTEM_INFO::ProductType.
230 //!
231 //! \sa crashpad::MinidumpOSType
232 //! \{
233 #define VER_NT_WORKSTATION 1
234 #define VER_NT_DOMAIN_CONTROLLER 2
235 #define VER_NT_SERVER 3
236 //! \}
237 
238 //! \anchor VER_PLATFORM_x
239 //! \name VER_PLATFORM_*
240 //!
241 //! \brief Operating system family values for MINIDUMP_SYSTEM_INFO::PlatformId.
242 //!
243 //! \sa crashpad::MinidumpOS
244 //! \{
245 #define VER_PLATFORM_WIN32s 0
246 #define VER_PLATFORM_WIN32_WINDOWS 1
247 #define VER_PLATFORM_WIN32_NT 2
248 //! \}
249 
250 #endif  // CRASHPAD_COMPAT_NON_WIN_WINNT_H_
251