2 * versioninfo.h: Version info structures found in PE file resources
5 * Dick Porter (dick@ximian.com)
7 * (C) 2002 Ximian, Inc.
10 #ifndef _WAPI_VERSIONINFO_H_
11 #define _WAPI_VERSIONINFO_H_
18 * 2 bytes: Length in bytes (this block, and all child blocks. does _not_ include alignment padding between blocks)
19 * 2 bytes: Length in bytes of VS_FIXEDFILEINFO struct
20 * 2 bytes: Type (contains 1 if version resource contains text data and 0 if version resource contains binary data)
21 * Variable length unicode string (null terminated): Key (currently "VS_VERSION_INFO")
22 * Variable length padding to align VS_FIXEDFILEINFO on a 32-bit boundary
23 * VS_FIXEDFILEINFO struct
24 * Variable length padding to align Child struct on a 32-bit boundary
25 * Child struct (zero or one StringFileInfo structs, zero or one VarFileInfo structs)
31 * 2 bytes: Length in bytes (includes this block, as well as all Child blocks)
32 * 2 bytes: Value length (always zero)
33 * 2 bytes: Type (contains 1 if version resource contains text data and 0 if version resource contains binary data)
34 * Variable length unicode string: Key (currently "StringFileInfo")
35 * Variable length padding to align Child struct on a 32-bit boundary
36 * Child structs ( one or more StringTable structs. Each StringTable struct's Key member indicates the appropriate language and code page for displaying the text in that StringTable struct.)
42 * 2 bytes: Length in bytes (includes this block as well as all Child blocks, but excludes any padding between String blocks)
43 * 2 bytes: Value length (always zero)
44 * 2 bytes: Type (contains 1 if version resource contains text data and 0 if version resource contains binary data)
45 * Variable length unicode string: Key. An 8-digit hex number stored as a unicode string. The four most significant digits represent the language identifier. The four least significant digits represent the code page for which the data is formatted.
46 * Variable length padding to align Child struct on a 32-bit boundary
47 * Child structs (an array of one or more String structs (each aligned on a 32-bit boundary)
53 * 2 bytes: Length in bytes (of this block)
54 * 2 bytes: Value length (the length in words of the Value member)
55 * 2 bytes: Type (contains 1 if version resource contains text data and 0 if version resource contains binary data)
56 * Variable length unicode string: Key. arbitrary string, identifies data.
57 * Variable length padding to align Value on a 32-bit boundary
58 * Value: Variable length unicode string, holding data.
64 * 2 bytes: Length in bytes (includes this block, as well as all Child blocks)
65 * 2 bytes: Value length (always zero)
66 * 2 bytes: Type (contains 1 if version resource contains text data and 0 if version resource contains binary data)
67 * Variable length unicode string: Key (currently "VarFileInfo")
68 * Variable length padding to align Child struct on a 32-bit boundary
69 * Child structs (a Var struct)
75 * 2 bytes: Length in bytes of this block
76 * 2 bytes: Value length in bytes of the Value
77 * 2 bytes: Type (contains 1 if version resource contains text data and 0 if version resource contains binary data)
78 * Variable length unicode string: Key ("Translation")
79 * Variable length padding to align Value on a 32-bit boundary
80 * Value: an array of one or more 4 byte values that are language and code page identifier pairs, low-order word containing a language identifier, and the high-order word containing a code page number. Either word can be zero, indicating that the file is language or code page independent.
85 guint32 dwSignature
; /* Should contain 0xFEEF04BD
87 guint32 dwStrucVersion
;
88 guint32 dwFileVersionMS
;
89 guint32 dwFileVersionLS
;
90 guint32 dwProductVersionMS
;
91 guint32 dwProductVersionLS
;
92 guint32 dwFileFlagsMask
;
96 guint32 dwFileSubtype
;
101 #if G_BYTE_ORDER == G_BIG_ENDIAN
102 #define VS_FFI_SIGNATURE 0xbd04effe
103 #define VS_FFI_STRUCVERSION 0x00000100
105 #define VS_FFI_SIGNATURE 0xfeef04bd
106 #define VS_FFI_STRUCVERSION 0x00010000
109 #define VS_FFI_FILEFLAGSMASK 0x3f
113 gpointer lpBaseOfDll
;
118 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
120 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
121 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
122 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
123 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
124 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
125 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
126 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
127 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
128 #define IMAGE_DIRECTORY_ENTRY_ARCHITECTURE 7
129 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8
130 #define IMAGE_DIRECTORY_ENTRY_TLS 9
131 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
132 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
133 #define IMAGE_DIRECTORY_ENTRY_IAT 12
134 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
135 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
137 #define IMAGE_SIZEOF_SHORT_NAME 8
139 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
140 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
142 #if G_BYTE_ORDER != G_LITTLE_ENDIAN
143 #define IMAGE_DOS_SIGNATURE 0x4d5a
144 #define IMAGE_NT_SIGNATURE 0x50450000
145 #define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0xb10
146 #define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0xb20
148 #define IMAGE_DOS_SIGNATURE 0x5a4d
149 #define IMAGE_NT_SIGNATURE 0x00004550
150 #define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
151 #define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
175 } WapiImageDosHeader
;
180 guint16 NumberOfSections
;
181 guint32 TimeDateStamp
;
182 guint32 PointerToSymbolTable
;
183 guint32 NumberOfSymbols
;
184 guint16 SizeOfOptionalHeader
;
185 guint16 Characteristics
;
186 } WapiImageFileHeader
;
190 guint32 VirtualAddress
;
192 } WapiImageDataDirectory
;
197 guint8 MajorLinkerVersion
;
198 guint8 MinorLinkerVersion
;
200 guint32 SizeOfInitializedData
;
201 guint32 SizeOfUninitializedData
;
202 guint32 AddressOfEntryPoint
;
206 guint32 SectionAlignment
;
207 guint32 FileAlignment
;
208 guint16 MajorOperatingSystemVersion
;
209 guint16 MinorOperatingSystemVersion
;
210 guint16 MajorImageVersion
;
211 guint16 MinorImageVersion
;
212 guint16 MajorSubsystemVersion
;
213 guint16 MinorSubsystemVersion
;
214 guint32 Win32VersionValue
;
216 guint32 SizeOfHeaders
;
219 guint16 DllCharacteristics
;
220 guint32 SizeOfStackReserve
;
221 guint32 SizeOfStackCommit
;
222 guint32 SizeOfHeapReserve
;
223 guint32 SizeOfHeapCommit
;
225 guint32 NumberOfRvaAndSizes
;
226 WapiImageDataDirectory DataDirectory
[IMAGE_NUMBEROF_DIRECTORY_ENTRIES
];
227 } WapiImageOptionalHeader32
;
232 guint8 MajorLinkerVersion
;
233 guint8 MinorLinkerVersion
;
235 guint32 SizeOfInitializedData
;
236 guint32 SizeOfUninitializedData
;
237 guint32 AddressOfEntryPoint
;
240 guint32 SectionAlignment
;
241 guint32 FileAlignment
;
242 guint16 MajorOperatingSystemVersion
;
243 guint16 MinorOperatingSystemVersion
;
244 guint16 MajorImageVersion
;
245 guint16 MinorImageVersion
;
246 guint16 MajorSubsystemVersion
;
247 guint16 MinorSubsystemVersion
;
248 guint32 Win32VersionValue
;
250 guint32 SizeOfHeaders
;
253 guint16 DllCharacteristics
;
254 guint64 SizeOfStackReserve
;
255 guint64 SizeOfStackCommit
;
256 guint64 SizeOfHeapReserve
;
257 guint64 SizeOfHeapCommit
;
259 guint32 NumberOfRvaAndSizes
;
260 WapiImageDataDirectory DataDirectory
[IMAGE_NUMBEROF_DIRECTORY_ENTRIES
];
261 } WapiImageOptionalHeader64
;
263 #if SIZEOF_VOID_P == 8
264 typedef WapiImageOptionalHeader64 WapiImageOptionalHeader
;
266 typedef WapiImageOptionalHeader32 WapiImageOptionalHeader
;
272 WapiImageFileHeader FileHeader
;
273 WapiImageOptionalHeader32 OptionalHeader
;
274 } WapiImageNTHeaders32
;
279 WapiImageFileHeader FileHeader
;
280 WapiImageOptionalHeader64 OptionalHeader
;
281 } WapiImageNTHeaders64
;
283 #if SIZEOF_VOID_P == 8
284 typedef WapiImageNTHeaders64 WapiImageNTHeaders
;
286 typedef WapiImageNTHeaders32 WapiImageNTHeaders
;
291 guint8 Name
[IMAGE_SIZEOF_SHORT_NAME
];
294 guint32 PhysicalAddress
;
297 guint32 VirtualAddress
;
298 guint32 SizeOfRawData
;
299 guint32 PointerToRawData
;
300 guint32 PointerToRelocations
;
301 guint32 PointerToLinenumbers
;
302 guint16 NumberOfRelocations
;
303 guint16 NumberOfLinenumbers
;
304 guint32 Characteristics
;
305 } WapiImageSectionHeader
;
307 #define IMAGE_FIRST_SECTION(header) ((WapiImageSectionHeader *)((gsize)(header) + G_STRUCT_OFFSET (WapiImageNTHeaders, OptionalHeader) + GUINT16_FROM_LE (((WapiImageNTHeaders *)(header))->FileHeader.SizeOfOptionalHeader)))
309 #define _WAPI_IMAGE_FIRST_SECTION32(header) ((WapiImageSectionHeader *)((gsize)(header) + G_STRUCT_OFFSET (WapiImageNTHeaders32, OptionalHeader) + GUINT16_FROM_LE (((WapiImageNTHeaders32 *)(header))->FileHeader.SizeOfOptionalHeader)))
311 #define RT_CURSOR 0x01
312 #define RT_BITMAP 0x02
315 #define RT_DIALOG 0x05
316 #define RT_STRING 0x06
317 #define RT_FONTDIR 0x07
319 #define RT_ACCELERATOR 0x09
320 #define RT_RCDATA 0x0a
321 #define RT_MESSAGETABLE 0x0b
322 #define RT_GROUP_CURSOR 0x0c
323 #define RT_GROUP_ICON 0x0e
324 #define RT_VERSION 0x10
325 #define RT_DLGINCLUDE 0x11
326 #define RT_PLUGPLAY 0x13
328 #define RT_ANICURSOR 0x15
329 #define RT_ANIICON 0x16
331 #define RT_MANIFEST 0x18
335 guint32 Characteristics
;
336 guint32 TimeDateStamp
;
337 guint16 MajorVersion
;
338 guint16 MinorVersion
;
339 guint16 NumberOfNamedEntries
;
340 guint16 NumberOfIdEntries
;
341 } WapiImageResourceDirectory
;
349 #if G_BYTE_ORDER == G_BIG_ENDIAN
350 guint32 NameIsString
:1;
351 guint32 NameOffset
:31;
353 guint32 NameOffset
:31;
354 guint32 NameIsString
:1;
358 #if G_BYTE_ORDER == G_BIG_ENDIAN
361 guint16 __wapi_big_endian_padding
;
370 guint32 OffsetToData
;
373 #if G_BYTE_ORDER == G_BIG_ENDIAN
374 guint32 DataIsDirectory
:1;
375 guint32 OffsetToDirectory
:31;
377 guint32 OffsetToDirectory
:31;
378 guint32 DataIsDirectory
:1;
382 } WapiImageResourceDirectoryEntry
;
386 guint32 OffsetToData
;
390 } WapiImageResourceDataEntry
;
392 #define VS_FF_DEBUG 0x0001
393 #define VS_FF_PRERELEASE 0x0002
394 #define VS_FF_PATCHED 0x0004
395 #define VS_FF_PRIVATEBUILD 0x0008
396 #define VS_FF_INFOINFERRED 0x0010
397 #define VS_FF_SPECIALBUILD 0x0020
399 #define VOS_UNKNOWN 0x00000000
400 #define VOS_DOS 0x00010000
401 #define VOS_OS216 0x00020000
402 #define VOS_OS232 0x00030000
403 #define VOS_NT 0x00040000
404 #define VOS__BASE 0x00000000
405 #define VOS__WINDOWS16 0x00000001
406 #define VOS__PM16 0x00000002
407 #define VOS__PM32 0x00000003
408 #define VOS__WINDOWS32 0x00000004
409 /* Should "embrace and extend" here with some entries for linux etc */
411 #define VOS_DOS_WINDOWS16 0x00010001
412 #define VOS_DOS_WINDOWS32 0x00010004
413 #define VOS_OS216_PM16 0x00020002
414 #define VOS_OS232_PM32 0x00030003
415 #define VOS_NT_WINDOWS32 0x00040004
417 #define VFT_UNKNOWN 0x0000
418 #define VFT_APP 0x0001
419 #define VFT_DLL 0x0002
420 #define VFT_DRV 0x0003
421 #define VFT_FONT 0x0004
422 #define VFT_VXD 0x0005
423 #define VFT_STATIC_LIB 0x0007
425 #define VFT2_UNKNOWN 0x0000
426 #define VFT2_DRV_PRINTER 0x0001
427 #define VFT2_DRV_KEYBOARD 0x0002
428 #define VFT2_DRV_LANGUAGE 0x0003
429 #define VFT2_DRV_DISPLAY 0x0004
430 #define VFT2_DRV_MOUSE 0x0005
431 #define VFT2_DRV_NETWORK 0x0006
432 #define VFT2_DRV_SYSTEM 0x0007
433 #define VFT2_DRV_INSTALLABLE 0x0008
434 #define VFT2_DRV_SOUND 0x0009
435 #define VFT2_DRV_COMM 0x000a
436 #define VFT2_DRV_INPUTMETHOD 0x000b
437 #define VFT2_FONT_RASTER 0x0001
438 #define VFT2_FONT_VECTOR 0x0002
439 #define VFT2_FONT_TRUETYPE 0x0003
441 #define MAKELANGID(primary,secondary) ((guint16)((secondary << 10) | (primary)))
443 extern guint32
GetFileVersionInfoSize (gunichar2
*filename
, guint32
*handle
);
444 extern gboolean
GetFileVersionInfo (gunichar2
*filename
, guint32 handle
,
445 guint32 len
, gpointer data
);
446 extern gboolean
VerQueryValue (gconstpointer datablock
,
447 const gunichar2
*subblock
, gpointer
*buffer
,
449 extern guint32
VerLanguageName (guint32 lang
, gunichar2
*lang_out
,
452 #endif /* _WAPI_VERSIONINFO_H_ */