1/* This is an implementation of the threads API of POSIX 1003.1-2001.
2 *
3 * --------------------------------------------------------------------------
4 *
5 *      Pthreads-win32 - POSIX Threads Library for Win32
6 *      Copyright(C) 1998 John E. Bossom
7 *      Copyright(C) 1999,2005 Pthreads-win32 contributors
8 *
9 *      Contact Email: rpj@callisto.canberra.edu.au
10 *
11 *      The current list of contributors is contained
12 *      in the file CONTRIBUTORS included with the source
13 *      code distribution. The list can also be seen at the
14 *      following World Wide Web location:
15 *      http://sources.redhat.com/pthreads-win32/contributors.html
16 *
17 *      This library is free software; you can redistribute it and/or
18 *      modify it under the terms of the GNU Lesser General Public
19 *      License as published by the Free Software Foundation; either
20 *      version 2 of the License, or (at your option) any later version.
21 *
22 *      This library is distributed in the hope that it will be useful,
23 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
24 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
25 *      Lesser General Public License for more details.
26 *
27 *      You should have received a copy of the GNU Lesser General Public
28 *      License along with this library in the file COPYING.LIB;
29 *      if not, write to the Free Software Foundation, Inc.,
30 *      51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
31 */
32
33#include <winver.h>
34#include "pthread.h"
35
36/*
37 * Note: the correct __CLEANUP_* macro must be defined corresponding to
38 * the definition used for the object file builds. This is done in the
39 * relevent makefiles for the command line builds, but users should ensure
40 * that their resource compiler knows what it is too.
41 * If using the default (no __CLEANUP_* defined), pthread.h will define it
42 * as __CLEANUP_C.
43 */
44
45#if defined(__MINGW64__)
46#  define PTW32_ARCH "x64 (mingw64)"
47#elif defined (__MINGW32__)
48#  define PTW32_ARCH "x86 (mingw32)"
49#endif
50#if defined(PTW32_ARCHx64)
51#  define PTW32_ARCH "x64"
52#elif defined(PTW32_ARCHx86)
53#  define PTW32_ARCH "x86"
54#endif
55
56#if defined(PTW32_RC_MSC)
57#  if defined(__CLEANUP_C)
58#    define PTW32_VERSIONINFO_NAME "pthreadVC2.DLL\0"
59#    define PTW32_VERSIONINFO_DESCRIPTION "MS C " PTW32_ARCH "\0"
60#  elif defined(__CLEANUP_CXX)
61#    define PTW32_VERSIONINFO_NAME "pthreadVCE2.DLL\0"
62#    define PTW32_VERSIONINFO_DESCRIPTION "MS C++ " PTW32_ARCH "\0"
63#  elif defined(__CLEANUP_SEH)
64#    define PTW32_VERSIONINFO_NAME "pthreadVSE2.DLL\0"
65#    define PTW32_VERSIONINFO_DESCRIPTION "MS C SEH " PTW32_ARCH "\0"
66#  else
67#    error Resource compiler doesn't know which cleanup style you're using - see version.rc
68#  endif
69#elif defined(__GNUC__)
70#  if defined(__CLEANUP_C)
71#    define PTW32_VERSIONINFO_NAME "pthreadGC2.DLL\0"
72#    define PTW32_VERSIONINFO_DESCRIPTION "GNU C " PTW32_ARCH "\0"
73#  elif defined(__CLEANUP_CXX)
74#    define PTW32_VERSIONINFO_NAME "pthreadGCE2.DLL\0"
75#    define PTW32_VERSIONINFO_DESCRIPTION "GNU C++ " PTW32_ARCH "\0"
76#  else
77#    error Resource compiler doesn't know which cleanup style you're using - see version.rc
78#  endif
79#elif defined(__BORLANDC__)
80#  if defined(__CLEANUP_C)
81#    define PTW32_VERSIONINFO_NAME "pthreadBC2.DLL\0"
82#    define PTW32_VERSIONINFO_DESCRIPTION "BORLAND C " PTW32_ARCH "\0"
83#  elif defined(__CLEANUP_CXX)
84#    define PTW32_VERSIONINFO_NAME "pthreadBCE2.DLL\0"
85#    define PTW32_VERSIONINFO_DESCRIPTION "BORLAND C++ " PTW32_ARCH "\0"
86#  else
87#    error Resource compiler doesn't know which cleanup style you're using - see version.rc
88#  endif
89#elif defined(__WATCOMC__)
90#  if defined(__CLEANUP_C)
91#    define PTW32_VERSIONINFO_NAME "pthreadWC2.DLL\0"
92#    define PTW32_VERSIONINFO_DESCRIPTION "WATCOM C " PTW32_ARCH "\0"
93#  elif defined(__CLEANUP_CXX)
94#    define PTW32_VERSIONINFO_NAME "pthreadWCE2.DLL\0"
95#    define PTW32_VERSIONINFO_DESCRIPTION "WATCOM C++ " PTW32_ARCH "\0"
96#  else
97#    error Resource compiler doesn't know which cleanup style you're using - see version.rc
98#  endif
99#else
100#  error Resource compiler doesn't know which compiler you're using - see version.rc
101#endif
102
103
104VS_VERSION_INFO VERSIONINFO
105  FILEVERSION    PTW32_VERSION
106  PRODUCTVERSION PTW32_VERSION
107  FILEFLAGSMASK  VS_FFI_FILEFLAGSMASK
108  FILEFLAGS      0
109  FILEOS         VOS__WINDOWS32
110  FILETYPE       VFT_DLL
111BEGIN
112    BLOCK "StringFileInfo"
113    BEGIN
114        BLOCK "040904b0"
115        BEGIN
116            VALUE "ProductName", "POSIX Threads for Windows LPGL\0"
117            VALUE "ProductVersion", PTW32_VERSION_STRING
118            VALUE "FileVersion", PTW32_VERSION_STRING
119            VALUE "FileDescription", PTW32_VERSIONINFO_DESCRIPTION
120            VALUE "InternalName", PTW32_VERSIONINFO_NAME
121            VALUE "OriginalFilename", PTW32_VERSIONINFO_NAME
122            VALUE "CompanyName", "Open Source Software community LGPL\0"
123            VALUE "LegalCopyright", "Copyright (C) Project contributors 2012\0"
124            VALUE "Comments", "http://sourceware.org/pthreads-win32/\0"
125        END
126    END
127    BLOCK "VarFileInfo"
128    BEGIN
129        VALUE "Translation", 0x409, 1200
130    END
131END
132
133/*
134VERSIONINFO Resource
135
136The VERSIONINFO resource-definition statement creates a version-information
137resource. The resource contains such information about the file as its
138version number, its intended operating system, and its original filename.
139The resource is intended to be used with the Version Information functions.
140
141versionID VERSIONINFO fixed-info  { block-statement...}
142
143versionID
144    Version-information resource identifier. This value must be 1.
145
146fixed-info
147    Version information, such as the file version and the intended operating
148    system. This parameter consists of the following statements.
149
150
151    Statement 		Description
152    --------------------------------------------------------------------------
153    FILEVERSION
154    version 		Binary version number for the file. The version
155			consists of two 32-bit integers, defined by four
156			16-bit integers. For example, "FILEVERSION 3,10,0,61"
157			is translated into two doublewords: 0x0003000a and
158			0x0000003d, in that order. Therefore, if version is
159			defined by the DWORD values dw1 and dw2, they need
160			to appear in the FILEVERSION statement as follows:
161			HIWORD(dw1), LOWORD(dw1), HIWORD(dw2), LOWORD(dw2).
162    PRODUCTVERSION
163    version 		Binary version number for the product with which the
164			file is distributed. The version parameter is two
165			32-bit integers, defined by four 16-bit integers.
166			For more information about version, see the
167			FILEVERSION description.
168    FILEFLAGSMASK
169    fileflagsmask 	Bits in the FILEFLAGS statement are valid. If a bit
170			is set, the corresponding bit in FILEFLAGS is valid.
171    FILEFLAGSfileflags 	Attributes of the file. The fileflags parameter must
172			be the combination of all the file flags that are
173			valid at compile time. For 16-bit Windows, this
174			value is 0x3f.
175    FILEOSfileos 	Operating system for which this file was designed.
176			The fileos parameter can be one of the operating
177			system values given in the Remarks section.
178    FILETYPEfiletype 	General type of file. The filetype parameter can be
179			one of the file type values listed in the Remarks
180			section.
181    FILESUBTYPE
182    subtype 		Function of the file. The subtype parameter is zero
183			unless the type parameter in the FILETYPE statement
184			is VFT_DRV, VFT_FONT, or VFT_VXD. For a list of file
185			subtype values, see the Remarks section.
186
187block-statement
188    Specifies one or more version-information blocks. A block can contain
189    string information or variable information. For more information, see
190    StringFileInfo Block or VarFileInfo Block.
191
192Remarks
193
194To use the constants specified with the VERSIONINFO statement, you must
195include the Winver.h or Windows.h header file in the resource-definition file.
196
197The following list describes the parameters used in the VERSIONINFO statement:
198
199fileflags
200    A combination of the following values.
201
202    Value 		Description
203
204    VS_FF_DEBUG 	File contains debugging information or is compiled
205			with debugging features enabled.
206    VS_FF_PATCHED 	File has been modified and is not identical to the
207			original shipping file of the same version number.
208    VS_FF_PRERELEASE 	File is a development version, not a commercially
209			released product.
210    VS_FF_PRIVATEBUILD 	File was not built using standard release procedures.
211			If this value is given, the StringFileInfo block must
212			contain a PrivateBuild string.
213    VS_FF_SPECIALBUILD 	File was built by the original company using standard
214			release procedures but is a variation of the standard
215			file of the same version number. If this value is
216			given, the StringFileInfo block must contain a
217			SpecialBuild string.
218
219fileos
220    One of the following values.
221
222    Value 		Description
223
224    VOS_UNKNOWN 	The operating system for which the file was designed
225			is unknown.
226    VOS_DOS 		File was designed for MS-DOS.
227    VOS_NT 		File was designed for Windows Server 2003 family,
228			Windows XP, Windows 2000, or Windows NT.
229    VOS__WINDOWS16 	File was designed for 16-bit Windows.
230    VOS__WINDOWS32 	File was designed for 32-bit Windows.
231    VOS_DOS_WINDOWS16 	File was designed for 16-bit Windows running with
232			MS-DOS.
233    VOS_DOS_WINDOWS32 	File was designed for 32-bit Windows running with
234			MS-DOS.
235    VOS_NT_WINDOWS32 	File was designed for Windows Server 2003 family,
236			Windows XP, Windows 2000, or Windows NT.
237
238    The values 0x00002L, 0x00003L, 0x20000L and 0x30000L are reserved.
239
240filetype
241    One of the following values.
242
243    Value 		Description
244
245    VFT_UNKNOWN 	File type is unknown.
246    VFT_APP 		File contains an application.
247    VFT_DLL 		File contains a dynamic-link library (DLL).
248    VFT_DRV 		File contains a device driver. If filetype is
249			VFT_DRV, subtype contains a more specific
250			description of the driver.
251    VFT_FONT 		File contains a font. If filetype is VFT_FONT,
252			subtype contains a more specific description of the
253			font.
254    VFT_VXD 		File contains a virtual device.
255    VFT_STATIC_LIB 	File contains a static-link library.
256
257    All other values are reserved for use by Microsoft.
258
259subtype
260    Additional information about the file type.
261
262    If filetype specifies VFT_DRV, this parameter can be one of the
263    following values.
264
265    Value 			Description
266
267    VFT2_UNKNOWN 		Driver type is unknown.
268    VFT2_DRV_COMM 		File contains a communications driver.
269    VFT2_DRV_PRINTER 		File contains a printer driver.
270    VFT2_DRV_KEYBOARD 		File contains a keyboard driver.
271    VFT2_DRV_LANGUAGE 		File contains a language driver.
272    VFT2_DRV_DISPLAY 		File contains a display driver.
273    VFT2_DRV_MOUSE 		File contains a mouse driver.
274    VFT2_DRV_NETWORK 		File contains a network driver.
275    VFT2_DRV_SYSTEM 		File contains a system driver.
276    VFT2_DRV_INSTALLABLE 	File contains an installable driver.
277    VFT2_DRV_SOUND 		File contains a sound driver.
278    VFT2_DRV_VERSIONED_PRINTER 	File contains a versioned printer driver.
279
280    If filetype specifies VFT_FONT, this parameter can be one of the
281    following values.
282
283    Value 		Description
284
285    VFT2_UNKNOWN 	Font type is unknown.
286    VFT2_FONT_RASTER 	File contains a raster font.
287    VFT2_FONT_VECTOR 	File contains a vector font.
288    VFT2_FONT_TRUETYPE 	File contains a TrueType font.
289
290    If filetype specifies VFT_VXD, this parameter must be the virtual-device
291    identifier included in the virtual-device control block.
292
293    All subtype values not listed here are reserved for use by Microsoft.
294
295langID
296    One of the following language codes.
297
298    Code 	Language 		Code 	Language
299
300    0x0401 	Arabic 			0x0415 	Polish
301    0x0402 	Bulgarian 		0x0416 	Portuguese (Brazil)
302    0x0403 	Catalan 		0x0417 	Rhaeto-Romanic
303    0x0404 	Traditional Chinese 	0x0418 	Romanian
304    0x0405 	Czech 			0x0419 	Russian
305    0x0406 	Danish 			0x041A 	Croato-Serbian (Latin)
306    0x0407 	German 			0x041B 	Slovak
307    0x0408 	Greek 			0x041C 	Albanian
308    0x0409 	U.S. English 		0x041D 	Swedish
309    0x040A 	Castilian Spanish 	0x041E 	Thai
310    0x040B 	Finnish 		0x041F 	Turkish
311    0x040C 	French 			0x0420 	Urdu
312    0x040D 	Hebrew 			0x0421 	Bahasa
313    0x040E 	Hungarian 		0x0804 	Simplified Chinese
314    0x040F 	Icelandic 		0x0807 	Swiss German
315    0x0410 	Italian 		0x0809 	U.K. English
316    0x0411 	Japanese 		0x080A 	Mexican Spanish
317    0x0412 	Korean 			0x080C 	Belgian French
318    0x0413 	Dutch 			0x0C0C 	Canadian French
319    0x0414 	Norwegian – Bokmal 	0x100C 	Swiss French
320    0x0810 	Swiss Italian 		0x0816 	Portuguese (Portugal)
321    0x0813 	Belgian Dutch 		0x081A 	Serbo-Croatian (Cyrillic)
322    0x0814 	Norwegian – Nynorsk
323
324charsetID
325    One of the following character-set identifiers.
326
327    Identifier 	Character Set
328
329    0 		7-bit ASCII
330    932 	Japan (Shift %G–%@ JIS X-0208)
331    949 	Korea (Shift %G–%@ KSC 5601)
332    950 	Taiwan (Big5)
333    1200 	Unicode
334    1250 	Latin-2 (Eastern European)
335    1251 	Cyrillic
336    1252 	Multilingual
337    1253 	Greek
338    1254 	Turkish
339    1255 	Hebrew
340    1256 	Arabic
341
342string-name
343    One of the following predefined names.
344
345    Name 		Description
346
347    Comments 		Additional information that should be displayed for
348			diagnostic purposes.
349    CompanyName 	Company that produced the file%G—%@for example,
350			"Microsoft Corporation" or "Standard Microsystems
351			Corporation, Inc." This string is required.
352    FileDescription 	File description to be presented to users. This
353			string may be displayed in a list box when the user
354			is choosing files to install%G—%@for example,
355			"Keyboard Driver for AT-Style Keyboards". This
356			string is required.
357    FileVersion 	Version number of the file%G—%@for example,
358			"3.10" or "5.00.RC2". This string is required.
359    InternalName 	Internal name of the file, if one exists — for
360			example, a module name if the file is a dynamic-link
361			library. If the file has no internal name, this
362			string should be the original filename, without
363			extension. This string is required.
364    LegalCopyright 	Copyright notices that apply to the file. This
365			should include the full text of all notices, legal
366			symbols, copyright dates, and so on — for example,
367			"Copyright (C) Microsoft Corporation 1990–1999".
368			This string is optional.
369    LegalTrademarks 	Trademarks and registered trademarks that apply to
370			the file. This should include the full text of all
371			notices, legal symbols, trademark numbers, and so on.
372			This string is optional.
373    OriginalFilename 	Original name of the file, not including a path.
374			This information enables an application to determine
375			whether a file has been renamed by a user. The
376			format of the name depends on the file system for
377			which the file was created. This string is required.
378    PrivateBuild 	Information about a private version of the file — for
379			example, "Built by TESTER1 on \TESTBED". This string
380			should be present only if VS_FF_PRIVATEBUILD is
381			specified in the fileflags parameter of the root
382			block.
383    ProductName 	Name of the product with which the file is
384			distributed. This string is required.
385    ProductVersion 	Version of the product with which the file is
386			distributed — for example, "3.10" or "5.00.RC2".
387			This string is required.
388    SpecialBuild 	Text that indicates how this version of the file
389			differs from the standard version — for example,
390			"Private build for TESTER1 solving mouse problems
391			on M250 and M250E computers". This string should be
392			present only if VS_FF_SPECIALBUILD is specified in
393			the fileflags parameter of the root block.
394 */
395