1 /***********************************************************************\
2 *                                w32api.d                               *
3 *                                                                       *
4 *                       Windows API header module                       *
5 *                                                                       *
6 *             Translated from MinGW API for MS-Windows 3.12             *
7 *                           by Stewart Gordon                           *
8 *                                                                       *
9 *                       Placed into public domain                       *
10 \***********************************************************************/
11 module win32.w32api;
12 
13 const __W32API_VERSION = 3.12;
14 const __W32API_MAJOR_VERSION = 3;
15 const __W32API_MINOR_VERSION = 12;
16 
17 /*	These version identifiers are used to specify the minimum version of
18  *	Windows that an application will support.
19  *
20  *	The programmer should set two version identifiers: one for the
21  *	minimum Windows NT version and one for the minimum Windows 9x
22  *	version.  If no Windows NT version is specified, Windows NT 4 is
23  *	assumed.  If no Windows 9x version is specified, Windows 95 is
24  *	assumed, unless WindowsNTonly, WindowsXP, Windows2003 or WindowsVista
25  *	is specified, implying that the application supports only the NT line of
26  *	versions.
27  */
28 
29 /*	For Windows XP and later, assume no Windows 9x support.
30  *	API features new to Windows Vista are not yet included in this
31  *	translation or in MinGW, but this is here ready to start adding them.
32  */
33 version (WindowsVista) {
34 	const uint
35 		_WIN32_WINNT   = 0x600,
36 		_WIN32_WINDOWS = uint.max;
37 
38 } else version (Windows2003) {
39 	const uint
40 		_WIN32_WINNT   = 0x502,
41 		_WIN32_WINDOWS = uint.max;
42 
43 } else version (WindowsXP) {
44 	const uint
45 		_WIN32_WINNT   = 0x501,
46 		_WIN32_WINDOWS = uint.max;
47 
48 } else {
49 	/*	for earlier Windows versions, separate version identifiers into
50 	 *	the NT and 9x lines
51 	 */
52 	version (Windows2000) {
53 		const uint _WIN32_WINNT = 0x500;
54 	} else {
55 		const uint _WIN32_WINNT = 0x400;
56 	}
57 
58 	version (WindowsNTonly) {
59 		const uint _WIN32_WINDOWS = uint.max;
60 	} else version (WindowsME) {
61 		const uint _WIN32_WINDOWS = 0x500;
62 	} else version (Windows98) {
63 		const uint _WIN32_WINDOWS = 0x410;
64 	} else {
65 		const uint _WIN32_WINDOWS = 0x400;
66 	}
67 }
68 
69 // Just a bit of syntactic sugar for the static ifs
70 const uint WINVER = _WIN32_WINDOWS < _WIN32_WINNT ?
71                     _WIN32_WINDOWS : _WIN32_WINNT;
72 const bool _WIN32_WINNT_ONLY = _WIN32_WINDOWS == uint.max;
73 
74 version (IE7) {
75 	const uint _WIN32_IE = 0x700;
76 } else version (IE602) {
77 	const uint _WIN32_IE = 0x603;
78 } else version (IE601) {
79 	const uint _WIN32_IE = 0x601;
80 } else version (IE6) {
81 	const uint _WIN32_IE = 0x600;
82 } else version (IE56) {
83 	const uint _WIN32_IE = 0x560;
84 } else version (IE501) {
85 	const uint _WIN32_IE = 0x501;
86 } else version (IE5) {
87 	const uint _WIN32_IE = 0x500;
88 } else version (IE401) {
89 	const uint _WIN32_IE = 0x401;
90 } else version (IE4) {
91 	const uint _WIN32_IE = 0x400;
92 } else version (IE3) {
93 	const uint _WIN32_IE = 0x300;
94 } else static if (WINVER >= 0x410) {
95 	const uint _WIN32_IE = 0x400;
96 } else {
97 	const uint _WIN32_IE = 0;
98 }
99 
100 debug (WindowsUnitTest) {
101 	unittest {
102 		printf("Windows NT version: %03x\n", _WIN32_WINNT);
103 		printf("Windows 9x version: %03x\n", _WIN32_WINDOWS);
104 		printf("IE version:         %03x\n", _WIN32_IE);
105 	}
106 }