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_VERRSRC_H_
16 #define CRASHPAD_COMPAT_NON_WIN_VERRSRC_H_
17 
18 #include <stdint.h>
19 
20 //! \file
21 
22 //! \brief The magic number for a VS_FIXEDFILEINFO structure, stored in
23 //!     VS_FIXEDFILEINFO::dwSignature.
24 #define VS_FFI_SIGNATURE 0xfeef04bd
25 
26 //! \brief The version of a VS_FIXEDFILEINFO structure, stored in
27 //!     VS_FIXEDFILEINFO::dwStrucVersion.
28 #define VS_FFI_STRUCVERSION 0x00010000
29 
30 //! \anchor VS_FF_x
31 //! \name VS_FF_*
32 //!
33 //! \brief File attribute values for VS_FIXEDFILEINFO::dwFileFlags and
34 //!     VS_FIXEDFILEINFO::dwFileFlagsMask.
35 //! \{
36 #define VS_FF_DEBUG 0x00000001
37 #define VS_FF_PRERELEASE 0x00000002
38 #define VS_FF_PATCHED 0x00000004
39 #define VS_FF_PRIVATEBUILD 0x00000008
40 #define VS_FF_INFOINFERRED 0x00000010
41 #define VS_FF_SPECIALBUILD 0x00000020
42 //! \}
43 
44 //! \anchor VOS_x
45 //! \name VOS_*
46 //!
47 //! \brief Operating system values for VS_FIXEDFILEINFO::dwFileOS.
48 //! \{
49 #define VOS_UNKNOWN 0x00000000
50 #define VOS_DOS 0x00010000
51 #define VOS_OS216 0x00020000
52 #define VOS_OS232 0x00030000
53 #define VOS_NT 0x00040000
54 #define VOS_WINCE 0x00050000
55 #define VOS__BASE 0x00000000
56 #define VOS__WINDOWS16 0x00000001
57 #define VOS__PM16 0x00000002
58 #define VOS__PM32 0x00000003
59 #define VOS__WINDOWS32 0x00000004
60 #define VOS_DOS_WINDOWS16 0x00010001
61 #define VOS_DOS_WINDOWS32 0x00010004
62 #define VOS_OS216_PM16 0x00020002
63 #define VOS_OS232_PM32 0x00030003
64 #define VOS_NT_WINDOWS32 0x00040004
65 //! \}
66 
67 //! \anchor VFT_x
68 //! \name VFT_*
69 //!
70 //! \brief File type values for VS_FIXEDFILEINFO::dwFileType.
71 //! \{
72 #define VFT_UNKNOWN 0x00000000
73 #define VFT_APP 0x00000001
74 #define VFT_DLL 0x00000002
75 #define VFT_DRV 0x00000003
76 #define VFT_FONT 0x00000004
77 #define VFT_VXD 0x00000005
78 #define VFT_STATIC_LIB 0x00000007
79 //! \}
80 
81 //! \anchor VFT2_x
82 //! \name VFT2_*
83 //!
84 //! \brief File subtype values for VS_FIXEDFILEINFO::dwFileSubtype.
85 //! \{
86 #define VFT2_UNKNOWN 0x00000000
87 #define VFT2_DRV_PRINTER 0x00000001
88 #define VFT2_DRV_KEYBOARD 0x00000002
89 #define VFT2_DRV_LANGUAGE 0x00000003
90 #define VFT2_DRV_DISPLAY 0x00000004
91 #define VFT2_DRV_MOUSE 0x00000005
92 #define VFT2_DRV_NETWORK 0x00000006
93 #define VFT2_DRV_SYSTEM 0x00000007
94 #define VFT2_DRV_INSTALLABLE 0x00000008
95 #define VFT2_DRV_SOUND 0x00000009
96 #define VFT2_DRV_COMM 0x0000000A
97 #define VFT2_DRV_INPUTMETHOD 0x0000000B
98 #define VFT2_DRV_VERSIONED_PRINTER 0x0000000C
99 #define VFT2_FONT_RASTER 0x00000001
100 #define VFT2_FONT_VECTOR 0x00000002
101 #define VFT2_FONT_TRUETYPE 0x00000003
102 //! \}
103 
104 //! \brief Version information for a file.
105 //!
106 //! On Windows, this information is derived from a file’s version information
107 //! resource, and is obtained by calling `VerQueryValue()` with an `lpSubBlock`
108 //! argument of `"\"` (a single backslash).
109 struct VS_FIXEDFILEINFO {
110   //! \brief The structure’s magic number, ::VS_FFI_SIGNATURE.
111   uint32_t dwSignature;
112 
113   //! \brief The structure’s version, ::VS_FFI_STRUCVERSION.
114   uint32_t dwStrucVersion;
115 
116   //! \brief The more-significant portion of the file’s version number.
117   //!
118   //! This field contains the first two components of a four-component version
119   //! number. For a file whose version is 1.2.3.4, this field would be
120   //! `0x00010002`.
121   //!
122   //! \sa dwFileVersionLS
123   uint32_t dwFileVersionMS;
124 
125   //! \brief The less-significant portion of the file’s version number.
126   //!
127   //! This field contains the last two components of a four-component version
128   //! number. For a file whose version is 1.2.3.4, this field would be
129   //! `0x00030004`.
130   //!
131   //! \sa dwFileVersionMS
132   uint32_t dwFileVersionLS;
133 
134   //! \brief The more-significant portion of the product’s version number.
135   //!
136   //! This field contains the first two components of a four-component version
137   //! number. For a product whose version is 1.2.3.4, this field would be
138   //! `0x00010002`.
139   //!
140   //! \sa dwProductVersionLS
141   uint32_t dwProductVersionMS;
142 
143   //! \brief The less-significant portion of the product’s version number.
144   //!
145   //! This field contains the last two components of a four-component version
146   //! number. For a product whose version is 1.2.3.4, this field would be
147   //! `0x00030004`.
148   //!
149   //! \sa dwProductVersionMS
150   uint32_t dwProductVersionLS;
151 
152   //! \brief A bitmask of \ref VS_FF_x "VS_FF_*" values indicating which bits in
153   //!     #dwFileFlags are valid.
154   uint32_t dwFileFlagsMask;
155 
156   //! \brief A bitmask of \ref VS_FF_x "VS_FF_*" values identifying attributes
157   //!     of the file. Only bits present in #dwFileFlagsMask are valid.
158   uint32_t dwFileFlags;
159 
160   //! \brief The file’s intended operating system, a value of \ref VOS_x
161   //!     "VOS_*".
162   uint32_t dwFileOS;
163 
164   //! \brief The file’s type, a value of \ref VFT_x "VFT_*".
165   uint32_t dwFileType;
166 
167   //! \brief The file’s subtype, a value of \ref VFT2_x "VFT2_*" corresponding
168   //!     to its #dwFileType, if the file type has subtypes.
169   uint32_t dwFileSubtype;
170 
171   //! \brief The more-significant portion of the file’s creation date.
172   //!
173   //! The intended encoding of this field is unknown. This field is unused and
174   //! always has the value `0`.
175   uint32_t dwFileDateMS;
176 
177   //! \brief The less-significant portion of the file’s creation date.
178   //!
179   //! The intended encoding of this field is unknown. This field is unused and
180   //! always has the value `0`.
181   uint32_t dwFileDateLS;
182 };
183 
184 #endif  // CRASHPAD_COMPAT_NON_WIN_VERRSRC_H_
185