1 /**
2     Windows API header module
3 
4     Translated from MinGW API for MS-Windows 4.0
5 
6     License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
7     Authors: Stewart Gordon, Luna Nielsen
8 */
9 module nulib.system.win32.w32api;
10 
11 
12 import nulib.system.win32.sdkddkver;
13 
14 version (ANSI) {} else version = Unicode;
15 
16 enum __W32API_VERSION = 3.17;
17 enum __W32API_MAJOR_VERSION = 3;
18 enum __W32API_MINOR_VERSION = 17;
19 
20 enum Windows95 = 0x0400;
21 enum Windows98 = 0x0410;
22 enum WindowsME = 0x0500;
23 
24 enum WindowsNT4   = 0x0400;
25 enum Windows2000  = 0x0500;
26 enum WindowsXP    = 0x0501;
27 enum Windows2003  = 0x0502;
28 enum WindowsVista = 0x0600;
29 enum Windows7     = 0x0601;
30 enum Windows8     = 0x0602;
31 
32 enum IE3   = 0x0300;
33 enum IE301 = 0x0300;
34 enum IE302 = 0x0300;
35 enum IE4   = 0x0400;
36 enum IE401 = 0x0401;
37 enum IE5   = 0x0500;
38 enum IE5a  = 0x0500;
39 enum IE5b  = 0x0500;
40 enum IE501 = 0x0501;
41 enum IE55  = 0x0501;
42 enum IE56  = 0x0560;
43 enum IE6   = 0x0600;
44 enum IE601 = 0x0601;
45 enum IE602 = 0x0603;
46 enum IE7   = 0x0700;
47 enum IE8   = 0x0800;
48 enum IE9   = 0x0900;
49 enum IE10  = 0x0A00;
50 
51 /*  These version identifiers are used to specify the minimum version of Windows that an
52  *  application will support.
53  *
54  *  Previously the minimum Windows 9x and Windows NT versions could be specified.  However, since
55  *  Windows 9x is no longer supported, either by Microsoft or by DMD, this distinction has been
56  *  removed in order to simplify the bindings.
57  */
58 version (Windows11) {
59     enum uint _WIN32_WINNT = _WIN32_WINNT_WIN10;
60 } else version (Windows10) {
61     enum uint _WIN32_WINNT = _WIN32_WINNT_WIN10;
62 } else version (Windows8_1) {    // also Windows2012R2
63     enum uint _WIN32_WINNT = _WIN32_WINNT_WINBLUE;
64 } else version (Windows8) {      // also Windows2012
65     enum uint _WIN32_WINNT = _WIN32_WINNT_WIN8;
66 } else version (Windows7) {      // also Windows2008R2
67     enum uint _WIN32_WINNT = _WIN32_WINNT_WIN7;
68 } else version (WindowsVista) {  // also Windows2008
69     enum uint _WIN32_WINNT = _WIN32_WINNT_VISTA;
70 } else version (Windows2003) {   // also WindowsHomeServer, WindowsXP64
71     enum uint _WIN32_WINNT = _WIN32_WINNT_WS03;
72 } else version (WindowsXP) {
73     enum uint _WIN32_WINNT = _WIN32_WINNT_WINXP;
74 } else version (Windows2000) {
75     // Current DMD doesn't support any version of Windows older than XP,
76     // but third-party compilers could use this
77     enum uint _WIN32_WINNT = _WIN32_WINNT_WIN2K;
78 } else {
79     enum uint _WIN32_WINNT = _WIN32_WINNT_WIN7;
80 }
81 
82 version (IE11) {
83     enum uint _WIN32_IE = _WIN32_IE_IE110;
84 } else version (IE10) {
85     enum uint _WIN32_IE = _WIN32_IE_IE100;
86 } else version (IE9) {
87     enum uint _WIN32_IE = _WIN32_IE_IE90;
88 } else version (IE8) {
89     enum uint _WIN32_IE = _WIN32_IE_IE80;
90 } else version (IE7) {
91     enum uint _WIN32_IE = _WIN32_IE_IE70;
92 } else version (IE602) {
93     enum uint _WIN32_IE = _WIN32_IE_IE60SP2;
94 } else version (IE601) {
95     enum uint _WIN32_IE = _WIN32_IE_IE60SP1;
96 } else version (IE6) {
97     enum uint _WIN32_IE = _WIN32_IE_IE60;
98 } else version (IE56) {
99     enum uint _WIN32_IE = _WIN32_IE_IE60;
100 } else version (IE55) {
101     enum uint _WIN32_IE = _WIN32_IE_IE55;
102 } else version (IE501) {
103     enum uint _WIN32_IE = _WIN32_IE_IE501;
104 } else version (IE5) {
105     enum uint _WIN32_IE = _WIN32_IE_IE50;
106 } else version (IE401) {
107     enum uint _WIN32_IE = _WIN32_IE_IE401;
108 } else version (IE4) {
109     enum uint _WIN32_IE = _WIN32_IE_IE40;
110 } else version (IE3) {
111     enum uint _WIN32_IE = _WIN32_IE_IE30;
112 } else static if (_WIN32_WINNT >= _WIN32_WINNT_WIN2K) {
113     enum uint _WIN32_IE = _WIN32_IE_IE60;
114 } else static if (_WIN32_WINNT >= Windows98) { //NOTE: _WIN32_WINNT will never be set this low
115     enum uint _WIN32_IE = _WIN32_IE_IE40;
116 } else {
117     enum uint _WIN32_IE = 0;
118 }
119 
120 debug (WindowsUnitTest) {
121     unittest {
122         printf("Windows NT version: %03x\n", _WIN32_WINNT);
123         printf("IE version:         %03x\n", _WIN32_IE);
124     }
125 }
126 
127 version (Unicode) {
128     enum bool _WIN32_UNICODE = true;
129     package template DECLARE_AW(string name) {
130         mixin("alias " ~ name ~ " = " ~ name ~ "W;");
131     }
132 } else {
133     enum bool _WIN32_UNICODE = false;
134     package template DECLARE_AW(string name) {
135         mixin("alias " ~ name ~ " = " ~ name ~ "A;");
136     }
137 }