Differences From Artifact [a45ec6a241aff65f]:
- File
src/win32/w32api.d
- 2015-04-21 10:46:55 - part of checkin [4e2933c620] on branch trunk - Rebased to the latest verson dmd 2.067. Not yet verified the outcome. (user: kinaba) [annotate]
To Artifact [02649da4f1c3ff63]:
- File
src/win32/w32api.d
-
2015-05-05 06:49:05
- part of checkin
[9b639cf2d6]
on branch trunk
- Working version for update to 2.067.
The problem was __gshared. Replacing it with TLS fixed the issue. Remaining problem is that "hack.d"'s CloseHandle hack is not working anymore.
(user: kinaba) [annotate]
-
2015-05-05 06:49:05
- part of checkin
[9b639cf2d6]
on branch trunk
- Working version for update to 2.067.
1 1 /***********************************************************************\
2 2 * w32api.d *
3 3 * *
4 4 * Windows API header module *
5 5 * *
6 -* Translated from MinGW API for MS-Windows 3.12 *
6 +* Translated from MinGW API for MS-Windows 4.0 *
7 7 * by Stewart Gordon *
8 8 * *
9 9 * Placed into public domain *
10 10 \***********************************************************************/
11 11 module win32.w32api;
12 12
13 -const __W32API_VERSION = 3.12;
14 -const __W32API_MAJOR_VERSION = 3;
15 -const __W32API_MINOR_VERSION = 12;
13 +enum __W32API_VERSION = 3.17;
14 +enum __W32API_MAJOR_VERSION = 3;
15 +enum __W32API_MINOR_VERSION = 17;
16 16
17 -/* These version identifiers are used to specify the minimum version of
18 - * Windows that an application will support.
17 +/* These version identifiers are used to specify the minimum version of Windows that an
18 + * application will support.
19 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.
20 + * Previously the minimum Windows 9x and Windows NT versions could be specified. However, since
21 + * Windows 9x is no longer supported, either by Microsoft or by DMD, this distinction has been
22 + * removed in order to simplify the bindings.
27 23 */
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 -
24 + version (Windows10) {
25 + enum uint _WIN32_WINNT = 0x604;
26 +} else version (Windows8_1) { // also Windows2012R2
27 + enum uint _WIN32_WINNT = 0x603;
28 +} else version (Windows8) { // also Windows2012
29 + enum uint _WIN32_WINNT = 0x602;
30 +} else version (Windows7) { // also Windows2008R2
31 + enum uint _WIN32_WINNT = 0x601;
32 +} else version (WindowsVista) { // also Windows2008
33 + enum uint _WIN32_WINNT = 0x600;
34 +} else version (Windows2003) { // also WindowsHomeServer, WindowsXP64
35 + enum uint _WIN32_WINNT = 0x502;
43 36 } else version (WindowsXP) {
44 - const uint
45 - _WIN32_WINNT = 0x501,
46 - _WIN32_WINDOWS = uint.max;
37 + enum uint _WIN32_WINNT = 0x501;
38 +} else version (Windows2000) {
39 + enum uint _WIN32_WINNT = 0x500;
40 +} else {
41 + enum uint _WIN32_WINNT = 0x501;
42 +}
47 43
44 +version (IE10) {
45 + enum uint _WIN32_IE = 0xA00;
46 +} else version (IE9) {
47 + enum uint _WIN32_IE = 0x900;
48 +} else version (IE8) {
49 + enum uint _WIN32_IE = 0x800;
50 +} else version (IE7) {
51 + enum uint _WIN32_IE = 0x700;
52 +} else version (IE602) {
53 + enum uint _WIN32_IE = 0x603;
54 +} else version (IE601) {
55 + enum uint _WIN32_IE = 0x601;
56 +} else version (IE6) {
57 + enum uint _WIN32_IE = 0x600;
58 +} else version (IE56) {
59 + enum uint _WIN32_IE = 0x560;
60 +} else version (IE501) {
61 + enum uint _WIN32_IE = 0x501;
62 +} else version (IE5) {
63 + enum uint _WIN32_IE = 0x500;
64 +} else version (IE401) {
65 + enum uint _WIN32_IE = 0x401;
66 +} else version (IE4) {
67 + enum uint _WIN32_IE = 0x400;
68 +} else version (IE3) {
69 + enum uint _WIN32_IE = 0x300;
70 +} else static if (_WIN32_WINNT >= 0x410) {
71 + enum uint _WIN32_IE = 0x400;
48 72 } 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 - }
73 + enum uint _WIN32_IE = 0;
74 +}
57 75
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;
76 +debug (WindowsUnitTest) {
77 + unittest {
78 + printf("Windows NT version: %03x\n", _WIN32_WINNT);
79 + printf("IE version: %03x\n", _WIN32_IE);
66 80 }
67 81 }
68 82
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;
83 +version (Unicode) {
84 + enum bool _WIN32_UNICODE = true;
85 + package template DECLARE_AW(string name) {
86 + mixin("alias " ~ name ~ "W " ~ name ~ ";");
87 + }
96 88 } 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);
89 + enum bool _WIN32_UNICODE = false;
90 + package template DECLARE_AW(string name) {
91 + mixin("alias " ~ name ~ "A " ~ name ~ ";");
105 92 }
106 93 }