The OpenD Programming Language

1 /**
2  * Windows API header module
3  *
4  * Translated from MinGW API for MS-Windows 4.0
5  *
6  * Authors: Stewart Gordon
7  * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
8  * Source: $(DRUNTIMESRC core/sys/windows/_w32api.d)
9  */
10 module core.sys.windows.w32api;
11 version (Windows):
12 
13 version (ANSI) {} else version = Unicode;
14 
15 enum __W32API_VERSION = 3.17;
16 enum __W32API_MAJOR_VERSION = 3;
17 enum __W32API_MINOR_VERSION = 17;
18 
19 /*  These version identifiers are used to specify the minimum version of Windows that an
20  *  application will support.
21  *
22  *  Previously the minimum Windows 9x and Windows NT versions could be specified.  However, since
23  *  Windows 9x is no longer supported, either by Microsoft or by DMD, this distinction has been
24  *  removed in order to simplify the bindings.
25  */
26  version (Windows10) {
27     enum uint _WIN32_WINNT = 0xA00;
28 } else version (Windows8_1) {    // also Windows2012R2
29     enum uint _WIN32_WINNT = 0x603;
30 } else version (Windows8) {      // also Windows2012
31     enum uint _WIN32_WINNT = 0x602;
32 } else version (Windows7) {      // also Windows2008R2
33     enum uint _WIN32_WINNT = 0x601;
34 } else version (WindowsVista) {  // also Windows2008
35     enum uint _WIN32_WINNT = 0x600;
36 } else version (Windows2003) {   // also WindowsHomeServer, WindowsXP64
37     enum uint _WIN32_WINNT = 0x502;
38 } else version (WindowsXP) {
39     enum uint _WIN32_WINNT = 0x501;
40 } else version (Windows2000) {
41     // Current DMD doesn't support any version of Windows older than XP,
42     // but third-party compilers could use this
43     enum uint _WIN32_WINNT = 0x500;
44 } else {
45     enum uint _WIN32_WINNT = 0x501;
46 }
47 
48 version (IE11) {
49     enum uint _WIN32_IE = 0xA00;
50 } else version (IE10) {
51     enum uint _WIN32_IE = 0xA00;
52 } else version (IE9) {
53     enum uint _WIN32_IE = 0x900;
54 } else version (IE8) {
55     enum uint _WIN32_IE = 0x800;
56 } else version (IE7) {
57     enum uint _WIN32_IE = 0x700;
58 } else version (IE602) {
59     enum uint _WIN32_IE = 0x603;
60 } else version (IE601) {
61     enum uint _WIN32_IE = 0x601;
62 } else version (IE6) {
63     enum uint _WIN32_IE = 0x600;
64 } else version (IE56) {
65     enum uint _WIN32_IE = 0x560;
66 } else version (IE55) {
67     enum uint _WIN32_IE = 0x550;
68 } else version (IE501) {
69     enum uint _WIN32_IE = 0x501;
70 } else version (IE5) {
71     enum uint _WIN32_IE = 0x500;
72 } else version (IE401) {
73     enum uint _WIN32_IE = 0x401;
74 } else version (IE4) {
75     enum uint _WIN32_IE = 0x400;
76 } else version (IE3) {
77     enum uint _WIN32_IE = 0x300;
78 } else static if (_WIN32_WINNT >= 0x500) {
79     enum uint _WIN32_IE = 0x600;
80 } else static if (_WIN32_WINNT >= 0x410) {
81     enum uint _WIN32_IE = 0x400;
82 } else {
83     enum uint _WIN32_IE = 0;
84 }
85 
86 debug (WindowsUnitTest) {
87     unittest {
88         printf("Windows NT version: %03x\n", _WIN32_WINNT);
89         printf("IE version:         %03x\n", _WIN32_IE);
90     }
91 }
92 
93 version (Unicode) {
94     enum bool _WIN32_UNICODE = true;
95     package template DECLARE_AW(string name) {
96         mixin("alias " ~ name ~ "W " ~ name ~ ";");
97     }
98 } else {
99     enum bool _WIN32_UNICODE = false;
100     package template DECLARE_AW(string name) {
101         mixin("alias " ~ name ~ "A " ~ name ~ ";");
102     }
103 }