1 /**
2  * Windows API header module
3  *
4  * Translated from MinGW Windows headers
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/_winnls.d)
9  */
10 module core.sys.windows.winnls;
11 version (Windows):
12 
13 version (ANSI) {} else version = Unicode;
14 pragma(lib, "kernel32");
15 
16 import core.sys.windows.basetsd, core.sys.windows.w32api, core.sys.windows.winbase, core.sys.windows.windef;
17 
18 alias DWORD LCTYPE, CALTYPE, CALID, LGRPID, GEOID, GEOTYPE, GEOCLASS;
19 
20 enum size_t
21     MAX_DEFAULTCHAR =  2,
22     MAX_LEADBYTES   = 12;
23 
24 enum LCTYPE
25     LOCALE_USE_CP_ACP    = 0x40000000,
26     LOCALE_RETURN_NUMBER = 0x20000000;
27 
28 enum : LCTYPE {
29     LOCALE_ILANGUAGE = 1,
30     LOCALE_SLANGUAGE,
31     LOCALE_SABBREVLANGNAME,
32     LOCALE_SNATIVELANGNAME,
33     LOCALE_ICOUNTRY,
34     LOCALE_SCOUNTRY,
35     LOCALE_SABBREVCTRYNAME,
36     LOCALE_SNATIVECTRYNAME,
37     LOCALE_IDEFAULTLANGUAGE,
38     LOCALE_IDEFAULTCOUNTRY,
39     LOCALE_IDEFAULTCODEPAGE,
40     LOCALE_SLIST,
41     LOCALE_IMEASURE,
42     LOCALE_SDECIMAL,
43     LOCALE_STHOUSAND,
44     LOCALE_SGROUPING,
45     LOCALE_IDIGITS,
46     LOCALE_ILZERO,
47     LOCALE_SNATIVEDIGITS,
48     LOCALE_SCURRENCY,
49     LOCALE_SINTLSYMBOL,
50     LOCALE_SMONDECIMALSEP,
51     LOCALE_SMONTHOUSANDSEP,
52     LOCALE_SMONGROUPING,
53     LOCALE_ICURRDIGITS,
54     LOCALE_IINTLCURRDIGITS,
55     LOCALE_ICURRENCY,
56     LOCALE_INEGCURR,
57     LOCALE_SDATE,
58     LOCALE_STIME,
59     LOCALE_SSHORTDATE,
60     LOCALE_SLONGDATE,
61     LOCALE_IDATE,
62     LOCALE_ILDATE,
63     LOCALE_ITIME,
64     LOCALE_ICENTURY,
65     LOCALE_ITLZERO,
66     LOCALE_IDAYLZERO,
67     LOCALE_IMONLZERO,
68     LOCALE_S1159,
69     LOCALE_S2359,
70     LOCALE_SDAYNAME1,
71     LOCALE_SDAYNAME2,
72     LOCALE_SDAYNAME3,
73     LOCALE_SDAYNAME4,
74     LOCALE_SDAYNAME5,
75     LOCALE_SDAYNAME6,
76     LOCALE_SDAYNAME7,
77     LOCALE_SABBREVDAYNAME1,
78     LOCALE_SABBREVDAYNAME2,
79     LOCALE_SABBREVDAYNAME3,
80     LOCALE_SABBREVDAYNAME4,
81     LOCALE_SABBREVDAYNAME5,
82     LOCALE_SABBREVDAYNAME6,
83     LOCALE_SABBREVDAYNAME7,
84     LOCALE_SMONTHNAME1,
85     LOCALE_SMONTHNAME2,
86     LOCALE_SMONTHNAME3,
87     LOCALE_SMONTHNAME4,
88     LOCALE_SMONTHNAME5,
89     LOCALE_SMONTHNAME6,
90     LOCALE_SMONTHNAME7,
91     LOCALE_SMONTHNAME8,
92     LOCALE_SMONTHNAME9,
93     LOCALE_SMONTHNAME10,
94     LOCALE_SMONTHNAME11,
95     LOCALE_SMONTHNAME12,
96     LOCALE_SABBREVMONTHNAME1,
97     LOCALE_SABBREVMONTHNAME2,
98     LOCALE_SABBREVMONTHNAME3,
99     LOCALE_SABBREVMONTHNAME4,
100     LOCALE_SABBREVMONTHNAME5,
101     LOCALE_SABBREVMONTHNAME6,
102     LOCALE_SABBREVMONTHNAME7,
103     LOCALE_SABBREVMONTHNAME8,
104     LOCALE_SABBREVMONTHNAME9,
105     LOCALE_SABBREVMONTHNAME10,
106     LOCALE_SABBREVMONTHNAME11,
107     LOCALE_SABBREVMONTHNAME12,
108     LOCALE_SPOSITIVESIGN,
109     LOCALE_SNEGATIVESIGN,
110     LOCALE_IPOSSIGNPOSN,
111     LOCALE_INEGSIGNPOSN,
112     LOCALE_IPOSSYMPRECEDES,
113     LOCALE_IPOSSEPBYSPACE,
114     LOCALE_INEGSYMPRECEDES,
115     LOCALE_INEGSEPBYSPACE,
116     LOCALE_FONTSIGNATURE,
117     LOCALE_SISO639LANGNAME,
118     LOCALE_SISO3166CTRYNAME, // = 90
119     LOCALE_SENGLANGUAGE         = 0x1001,
120     LOCALE_SENGCOUNTRY          = 0x1002,
121     LOCALE_IDEFAULTANSICODEPAGE = 0x1004,
122     LOCALE_INEGNUMBER           = 0x1010,
123     LOCALE_STIMEFORMAT          = 0x1003,
124     LOCALE_ITIMEMARKPOSN        = 0x1005,
125     LOCALE_ICALENDARTYPE        = 0x1009,
126     LOCALE_IOPTIONALCALENDAR    = 0x100B,
127     LOCALE_IFIRSTDAYOFWEEK      = 0x100C,
128     LOCALE_IFIRSTWEEKOFYEAR     = 0x100D,
129     LOCALE_SMONTHNAME13         = 0x100E,
130     LOCALE_SABBREVMONTHNAME13   = 0x100F
131 }
132 
133 enum : LCID {
134     LOCALE_USER_DEFAULT   = 0x400,
135     LOCALE_SYSTEM_DEFAULT = 0x800
136 }
137 
138 enum DWORD
139     NORM_IGNORECASE     =       1,
140     NORM_IGNORENONSPACE =       2,
141     NORM_IGNORESYMBOLS  =       4,
142     SORT_STRINGSORT     = 0x01000,
143     NORM_IGNOREKANATYPE = 0x10000,
144     NORM_IGNOREWIDTH    = 0x20000;
145 
146 enum DWORD
147     LCMAP_LOWERCASE           = 0x00000100,
148     LCMAP_UPPERCASE           = 0x00000200,
149     LCMAP_SORTKEY             = 0x00000400,
150     LCMAP_BYTEREV             = 0x00000800,
151     LCMAP_HIRAGANA            = 0x00100000,
152     LCMAP_KATAKANA            = 0x00200000,
153     LCMAP_HALFWIDTH           = 0x00400000,
154     LCMAP_FULLWIDTH           = 0x00800000,
155     LCMAP_LINGUISTIC_CASING   = 0x01000000,
156     LCMAP_SIMPLIFIED_CHINESE  = 0x02000000,
157     LCMAP_TRADITIONAL_CHINESE = 0x04000000;
158 
159 enum CALID ENUM_ALL_CALENDARS = -1;
160 
161 enum DWORD
162     DATE_SHORTDATE        =          1,
163     DATE_LONGDATE         =          2,
164     DATE_USE_ALT_CALENDAR =          4,
165     LOCALE_NOUSEROVERRIDE = 0x80000000;
166 
167 enum : DWORD {
168     CP_INSTALLED = 1,
169     CP_SUPPORTED
170 }
171 
172 enum : DWORD {
173     LCID_INSTALLED       = 1,
174     LCID_SUPPORTED       = 2,
175     LCID_ALTERNATE_SORTS = 4
176 }
177 
178 enum DWORD
179     MAP_FOLDCZONE   =  16,
180     MAP_PRECOMPOSED =  32,
181     MAP_COMPOSITE   =  64,
182     MAP_FOLDDIGITS  = 128;
183 
184 enum : UINT {
185     CP_ACP,
186     CP_OEMCP,
187     CP_MACCP,
188     CP_THREAD_ACP, // =     3
189     CP_SYMBOL         =    42,
190     CP_UTF7           = 65000,
191     CP_UTF8           = 65001
192 }
193 
194 enum : DWORD {
195     CT_CTYPE1 = 1,
196     CT_CTYPE2 = 2,
197     CT_CTYPE3 = 4
198 }
199 
200 enum WORD
201     C1_UPPER  =   1,
202     C1_LOWER  =   2,
203     C1_DIGIT  =   4,
204     C1_SPACE  =   8,
205     C1_PUNCT  =  16,
206     C1_CNTRL  =  32,
207     C1_BLANK  =  64,
208     C1_XDIGIT = 128,
209     C1_ALPHA  = 256;
210 
211 enum : WORD {
212     C2_NOTAPPLICABLE,
213     C2_LEFTTORIGHT,
214     C2_RIGHTTOLEFT,
215     C2_EUROPENUMBER,
216     C2_EUROPESEPARATOR,
217     C2_EUROPETERMINATOR,
218     C2_ARABICNUMBER,
219     C2_COMMONSEPARATOR,
220     C2_BLOCKSEPARATOR,
221     C2_SEGMENTSEPARATOR,
222     C2_WHITESPACE,
223     C2_OTHERNEUTRAL  // = 11
224 }
225 
226 enum WORD
227     C3_NOTAPPLICABLE =      0,
228     C3_NONSPACING    =      1,
229     C3_DIACRITIC     =      2,
230     C3_VOWELMARK     =      4,
231     C3_SYMBOL        =      8,
232     C3_KATAKANA      = 0x0010,
233     C3_HIRAGANA      = 0x0020,
234     C3_HALFWIDTH     = 0x0040,
235     C3_FULLWIDTH     = 0x0080,
236     C3_IDEOGRAPH     = 0x0100,
237     C3_KASHIDA       = 0x0200,
238     C3_LEXICAL       = 0x0400,
239     C3_ALPHA         = 0x8000;
240 
241 enum DWORD
242     TIME_NOMINUTESORSECONDS = 1,
243     TIME_NOSECONDS          = 2,
244     TIME_NOTIMEMARKER       = 4,
245     TIME_FORCE24HOURFORMAT  = 8;
246 
247 enum DWORD
248     MB_PRECOMPOSED       = 1,
249     MB_COMPOSITE         = 2,
250     MB_USEGLYPHCHARS     = 4,
251     MB_ERR_INVALID_CHARS = 8;
252 
253 enum DWORD
254     WC_DISCARDNS      =  16,
255     WC_SEPCHARS       =  32,
256     WC_DEFAULTCHAR    =  64,
257     WC_COMPOSITECHECK = 512;
258 
259 enum : LONG {
260     CTRY_DEFAULT            =   0,
261     CTRY_DOMINICAN_REPUBLIC =   1,
262     CTRY_PUERTO_RICO        =   1,
263     CTRY_CARIBBEAN          =   1,
264     CTRY_JAMAICA            =   1,
265     CTRY_UNITED_STATES      =   1,
266     CTRY_TRINIDAD_Y_TOBAGO  =   1,
267     CTRY_CANADA             =   2,
268     CTRY_RUSSIA             =   7,
269     CTRY_UZBEKISTAN         =   7,
270     CTRY_KAZAKSTAN          =   7,
271     CTRY_TATARSTAN          =   7,
272     CTRY_EGYPT              =  20,
273     CTRY_SOUTH_AFRICA       =  27,
274     CTRY_GREECE             =  30,
275     CTRY_NETHERLANDS        =  31,
276     CTRY_BELGIUM            =  32,
277     CTRY_FRANCE             =  33,
278     CTRY_MONACO             =  33,
279     CTRY_SPAIN              =  34,
280     CTRY_HUNGARY            =  36,
281     CTRY_ITALY              =  39,
282     CTRY_ROMANIA            =  40,
283     CTRY_SWITZERLAND        =  41,
284     CTRY_LIECHTENSTEIN      =  41,
285     CTRY_AUSTRIA            =  43,
286     CTRY_UNITED_KINGDOM     =  44,
287     CTRY_DENMARK            =  45,
288     CTRY_SWEDEN             =  46,
289     CTRY_NORWAY             =  47,
290     CTRY_POLAND             =  48,
291     CTRY_GERMANY            =  49,
292     CTRY_PERU               =  51,
293     CTRY_MEXICO             =  52,
294     CTRY_ARGENTINA          =  54,
295     CTRY_BRAZIL             =  55,
296     CTRY_CHILE              =  56,
297     CTRY_COLOMBIA           =  57,
298     CTRY_VENEZUELA          =  58,
299     CTRY_MALAYSIA           =  60,
300     CTRY_AUSTRALIA          =  61,
301     CTRY_INDONESIA          =  62,
302     CTRY_PHILIPPINES        =  63,
303     CTRY_NEW_ZEALAND        =  64,
304     CTRY_SINGAPORE          =  65,
305     CTRY_THAILAND           =  66,
306     CTRY_JAPAN              =  81,
307     CTRY_SOUTH_KOREA        =  82,
308     CTRY_VIET_NAM           =  84,
309     CTRY_PRCHINA            =  86,
310     CTRY_TURKEY             =  90,
311     CTRY_INDIA              =  91,
312     CTRY_PAKISTAN           =  92,
313     CTRY_MOROCCO            = 212,
314     CTRY_ALGERIA            = 213,
315     CTRY_TUNISIA            = 216,
316     CTRY_LIBYA              = 218,
317     CTRY_KENYA              = 254,
318     CTRY_ZIMBABWE           = 263,
319     CTRY_FAEROE_ISLANDS     = 298,
320     CTRY_PORTUGAL           = 351,
321     CTRY_LUXEMBOURG         = 352,
322     CTRY_IRELAND            = 353,
323     CTRY_ICELAND            = 354,
324     CTRY_ALBANIA            = 355,
325     CTRY_FINLAND            = 358,
326     CTRY_BULGARIA           = 359,
327     CTRY_LITHUANIA          = 370,
328     CTRY_LATVIA             = 371,
329     CTRY_ESTONIA            = 372,
330     CTRY_ARMENIA            = 374,
331     CTRY_BELARUS            = 375,
332     CTRY_UKRAINE            = 380,
333     CTRY_SERBIA             = 381,
334     CTRY_CROATIA            = 385,
335     CTRY_SLOVENIA           = 386,
336     CTRY_MACEDONIA          = 389,
337     CTRY_CZECH              = 420,
338     CTRY_SLOVAK             = 421,
339     CTRY_BELIZE             = 501,
340     CTRY_GUATEMALA          = 502,
341     CTRY_EL_SALVADOR        = 503,
342     CTRY_HONDURAS           = 504,
343     CTRY_NICARAGUA          = 505,
344     CTRY_COSTA_RICA         = 506,
345     CTRY_PANAMA             = 507,
346     CTRY_BOLIVIA            = 591,
347     CTRY_ECUADOR            = 593,
348     CTRY_PARAGUAY           = 595,
349     CTRY_URUGUAY            = 598,
350     CTRY_BRUNEI_DARUSSALAM  = 673,
351     CTRY_HONG_KONG          = 852,
352     CTRY_MACAU              = 853,
353     CTRY_TAIWAN             = 886,
354     CTRY_MALDIVES           = 960,
355     CTRY_LEBANON            = 961,
356     CTRY_JORDAN             = 962,
357     CTRY_SYRIA              = 963,
358     CTRY_IRAQ               = 964,
359     CTRY_KUWAIT             = 965,
360     CTRY_SAUDI_ARABIA       = 966,
361     CTRY_YEMEN              = 967,
362     CTRY_OMAN               = 968,
363     CTRY_UAE                = 971,
364     CTRY_ISRAEL             = 972,
365     CTRY_BAHRAIN            = 973,
366     CTRY_QATAR              = 974,
367     CTRY_MONGOLIA           = 976,
368     CTRY_IRAN               = 981,
369     CTRY_AZERBAIJAN         = 994,
370     CTRY_GEORGIA            = 995,
371     CTRY_KYRGYZSTAN         = 996
372 }
373 
374 enum : CALTYPE {
375     CAL_ICALINTVALUE          = 1,
376     CAL_SCALNAME,
377     CAL_IYEAROFFSETRANGE,
378     CAL_SERASTRING,
379     CAL_SSHORTDATE,
380     CAL_SLONGDATE,
381     CAL_SDAYNAME1,
382     CAL_SDAYNAME2,
383     CAL_SDAYNAME3,
384     CAL_SDAYNAME4,
385     CAL_SDAYNAME5,
386     CAL_SDAYNAME6,
387     CAL_SDAYNAME7,
388     CAL_SABBREVDAYNAME1,
389     CAL_SABBREVDAYNAME2,
390     CAL_SABBREVDAYNAME3,
391     CAL_SABBREVDAYNAME4,
392     CAL_SABBREVDAYNAME5,
393     CAL_SABBREVDAYNAME6,
394     CAL_SABBREVDAYNAME7,
395     CAL_SMONTHNAME1,
396     CAL_SMONTHNAME2,
397     CAL_SMONTHNAME3,
398     CAL_SMONTHNAME4,
399     CAL_SMONTHNAME5,
400     CAL_SMONTHNAME6,
401     CAL_SMONTHNAME7,
402     CAL_SMONTHNAME8,
403     CAL_SMONTHNAME9,
404     CAL_SMONTHNAME10,
405     CAL_SMONTHNAME11,
406     CAL_SMONTHNAME12,
407     CAL_SMONTHNAME13,
408     CAL_SABBREVMONTHNAME1,
409     CAL_SABBREVMONTHNAME2,
410     CAL_SABBREVMONTHNAME3,
411     CAL_SABBREVMONTHNAME4,
412     CAL_SABBREVMONTHNAME5,
413     CAL_SABBREVMONTHNAME6,
414     CAL_SABBREVMONTHNAME7,
415     CAL_SABBREVMONTHNAME8,
416     CAL_SABBREVMONTHNAME9,
417     CAL_SABBREVMONTHNAME10,
418     CAL_SABBREVMONTHNAME11,
419     CAL_SABBREVMONTHNAME12,
420     CAL_SABBREVMONTHNAME13 // = 46
421 }
422 
423 
424 enum : CALTYPE {
425     CAL_GREGORIAN                =  1,
426     CAL_GREGORIAN_US,
427     CAL_JAPAN,
428     CAL_TAIWAN,
429     CAL_KOREA,
430     CAL_HIJRI,
431     CAL_THAI,
432     CAL_HEBREW,
433     CAL_GREGORIAN_ME_FRENCH,
434     CAL_GREGORIAN_ARABIC,
435     CAL_GREGORIAN_XLIT_ENGLISH,
436     CAL_GREGORIAN_XLIT_FRENCH // = 12
437 }
438 
439 enum : int {
440     CSTR_LESS_THAN    = 1,
441     CSTR_EQUAL,
442     CSTR_GREATER_THAN
443 }
444 
445 enum : DWORD {
446     LGRPID_INSTALLED = 1,
447     LGRPID_SUPPORTED
448 }
449 
450 enum : LGRPID {
451     LGRPID_WESTERN_EUROPE = 1,
452     LGRPID_CENTRAL_EUROPE,
453     LGRPID_BALTIC,
454     LGRPID_GREEK,
455     LGRPID_CYRILLIC,
456     LGRPID_TURKISH,
457     LGRPID_JAPANESE,
458     LGRPID_KOREAN,
459     LGRPID_TRADITIONAL_CHINESE,
460     LGRPID_SIMPLIFIED_CHINESE,
461     LGRPID_THAI,
462     LGRPID_HEBREW,
463     LGRPID_ARABIC,
464     LGRPID_VIETNAMESE,
465     LGRPID_INDIC,
466     LGRPID_GEORGIAN,
467     LGRPID_ARMENIAN // = 17
468 }
469 
470 static if (_WIN32_WINNT >= 0x500) {
471     enum : LCTYPE {
472         LOCALE_SYEARMONTH             = 0x1006,
473         LOCALE_SENGCURRNAME           = 0x1007,
474         LOCALE_SNATIVECURRNAME        = 0x1008,
475         LOCALE_IDEFAULTEBCDICCODEPAGE = 0x1012,
476         LOCALE_SSORTNAME              = 0x1013,
477         LOCALE_IDIGITSUBSTITUTION     = 0x1014,
478         LOCALE_IPAPERSIZE             = 0x100A
479     }
480 
481 enum DWORD
482         DATE_YEARMONTH  =  8,
483         DATE_LTRREADING = 16,
484         DATE_RTLREADING = 32;
485 
486 enum DWORD MAP_EXPAND_LIGATURES = 0x2000;
487 enum DWORD WC_NO_BEST_FIT_CHARS = 1024;
488 
489     enum : CALTYPE {
490         CAL_SYEARMONTH       = 47,
491         CAL_ITWODIGITYEARMAX = 48,
492         CAL_NOUSEROVERRIDE   = LOCALE_NOUSEROVERRIDE,
493         CAL_RETURN_NUMBER    = LOCALE_RETURN_NUMBER,
494         CAL_USE_CP_ACP       = LOCALE_USE_CP_ACP
495     }
496 } // (_WIN32_WINNT >= 0x500)
497 
498 extern (Windows) {
499     alias BOOL function(LPSTR) CALINFO_ENUMPROCA;
500     alias BOOL function(LPWSTR) CALINFO_ENUMPROCW;
501     alias BOOL function(LPSTR, CALID) CALINFO_ENUMPROCEXA;
502     alias BOOL function(LPWSTR, CALID) CALINFO_ENUMPROCEXW;
503     alias BOOL function(LGRPID, LPSTR, LPSTR, DWORD, LONG_PTR)
504       LANGUAGEGROUP_ENUMPROCA;
505     alias BOOL function(LGRPID, LPWSTR, LPWSTR, DWORD, LONG_PTR)
506       LANGUAGEGROUP_ENUMPROCW;
507     alias BOOL function(LGRPID, LCID, LPSTR, LONG_PTR)
508       LANGGROUPLOCALE_ENUMPROCA;
509     alias BOOL function(LGRPID, LCID, LPWSTR, LONG_PTR)
510       LANGGROUPLOCALE_ENUMPROCW;
511     alias BOOL function(LPWSTR, LONG_PTR) UILANGUAGE_ENUMPROCW;
512     alias BOOL function(LPSTR, LONG_PTR) UILANGUAGE_ENUMPROCA;
513     alias BOOL function(LPSTR) LOCALE_ENUMPROCA;
514     alias BOOL function(LPWSTR) LOCALE_ENUMPROCW;
515     alias BOOL function(LPSTR) CODEPAGE_ENUMPROCA;
516     alias BOOL function(LPWSTR) CODEPAGE_ENUMPROCW;
517     alias BOOL function(LPSTR) DATEFMT_ENUMPROCA;
518     alias BOOL function(LPWSTR) DATEFMT_ENUMPROCW;
519     alias BOOL function(LPSTR, CALID) DATEFMT_ENUMPROCEXA;
520     alias BOOL function(LPWSTR, CALID) DATEFMT_ENUMPROCEXW;
521     alias BOOL function(LPSTR) TIMEFMT_ENUMPROCA;
522     alias BOOL function(LPWSTR) TIMEFMT_ENUMPROCW;
523     alias BOOL function(GEOID) GEO_ENUMPROC;
524 }
525 
526 enum NLS_FUNCTION {
527     COMPARE_STRING = 0x0001
528 }
529 
530 enum SYSGEOCLASS {
531     GEOCLASS_NATION = 16,
532     GEOCLASS_REGION = 14
533 }
534 
535 enum SYSGEOTYPE {
536     GEO_NATION            = 0x0001,
537     GEO_LATITUDE          = 0x0002,
538     GEO_LONGITUDE         = 0x0003,
539     GEO_ISO2              = 0x0004,
540     GEO_ISO3              = 0x0005,
541     GEO_RFC1766           = 0x0006,
542     GEO_LCID              = 0x0007,
543     GEO_FRIENDLYNAME      = 0x0008,
544     GEO_OFFICIALNAME      = 0x0009,
545     GEO_TIMEZONES         = 0x000a,
546     GEO_OFFICIALLANGUAGES = 0x000a
547 }
548 
549 struct CPINFO {
550     UINT                  MaxCharSize;
551     BYTE[MAX_DEFAULTCHAR] DefaultChar;
552     BYTE[MAX_LEADBYTES]   LeadByte;
553 }
554 alias CPINFO* LPCPINFO;
555 
556 struct CPINFOEXA {
557     UINT                  MaxCharSize;
558     BYTE[MAX_DEFAULTCHAR] DefaultChar;
559     BYTE[MAX_LEADBYTES]   LeadByte;
560     WCHAR                 UnicodeDefaultChar = 0;
561     UINT                  CodePage;
562     CHAR[MAX_PATH]        CodePageName = 0;
563 }
564 alias CPINFOEXA* LPCPINFOEXA;
565 
566 struct CPINFOEXW {
567     UINT                  MaxCharSize;
568     BYTE[MAX_DEFAULTCHAR] DefaultChar;
569     BYTE[MAX_LEADBYTES]   LeadByte;
570     WCHAR                 UnicodeDefaultChar = 0;
571     UINT                  CodePage;
572     WCHAR[MAX_PATH]       CodePageName = 0;
573 }
574 alias CPINFOEXW* LPCPINFOEXW;
575 
576 struct CURRENCYFMTA {
577     UINT  NumDigits;
578     UINT  LeadingZero;
579     UINT  Grouping;
580     LPSTR lpDecimalSep;
581     LPSTR lpThousandSep;
582     UINT  NegativeOrder;
583     UINT  PositiveOrder;
584     LPSTR lpCurrencySymbol;
585 }
586 alias CURRENCYFMTA* LPCURRENCYFMTA;
587 
588 struct CURRENCYFMTW {
589     UINT   NumDigits;
590     UINT   LeadingZero;
591     UINT   Grouping;
592     LPWSTR lpDecimalSep;
593     LPWSTR lpThousandSep;
594     UINT   NegativeOrder;
595     UINT   PositiveOrder;
596     LPWSTR lpCurrencySymbol;
597 }
598 alias CURRENCYFMTW* LPCURRENCYFMTW;
599 
600 struct NLSVERSIONINFO {
601     DWORD dwNLSVersionInfoSize;
602     DWORD dwNLSVersion;
603     DWORD dwDefinedVersion;
604 }
605 alias NLSVERSIONINFO* LPNLSVERSIONINFO;
606 
607 struct NUMBERFMTA {
608     UINT  NumDigits;
609     UINT  LeadingZero;
610     UINT  Grouping;
611     LPSTR lpDecimalSep;
612     LPSTR lpThousandSep;
613     UINT  NegativeOrder;
614 }
615 alias NUMBERFMTA* LPNUMBERFMTA;
616 
617 struct NUMBERFMTW {
618     UINT   NumDigits;
619     UINT   LeadingZero;
620     UINT   Grouping;
621     LPWSTR lpDecimalSep;
622     LPWSTR lpThousandSep;
623     UINT   NegativeOrder;
624 }
625 alias NUMBERFMTW* LPNUMBERFMTW;
626 
627 extern (Windows) nothrow @nogc {
628     int CompareStringA(LCID, DWORD, LPCSTR, int, LPCSTR, int);
629     int CompareStringW(LCID, DWORD, LPCWSTR, int, LPCWSTR, int);
630     LCID ConvertDefaultLocale(LCID);
631     BOOL EnumCalendarInfoA(CALINFO_ENUMPROCA, LCID, CALID, CALTYPE);
632     BOOL EnumCalendarInfoW(CALINFO_ENUMPROCW, LCID, CALID, CALTYPE);
633     BOOL EnumDateFormatsA(DATEFMT_ENUMPROCA, LCID, DWORD);
634     BOOL EnumDateFormatsW(DATEFMT_ENUMPROCW, LCID, DWORD);
635     BOOL EnumSystemCodePagesA(CODEPAGE_ENUMPROCA, DWORD);
636     BOOL EnumSystemCodePagesW(CODEPAGE_ENUMPROCW, DWORD);
637     BOOL EnumSystemGeoID(GEOCLASS, GEOID, GEO_ENUMPROC);
638     BOOL EnumSystemLocalesA(LOCALE_ENUMPROCA, DWORD);
639     BOOL EnumSystemLocalesW(LOCALE_ENUMPROCW, DWORD);
640     BOOL EnumTimeFormatsA(TIMEFMT_ENUMPROCA, LCID, DWORD);
641     BOOL EnumTimeFormatsW(TIMEFMT_ENUMPROCW, LCID, DWORD);
642     int FoldStringA(DWORD, LPCSTR, int, LPSTR, int);
643     int FoldStringW(DWORD, LPCWSTR, int, LPWSTR, int);
644     UINT GetACP();
645     int GetCalendarInfoA(LCID, CALID, CALTYPE, LPSTR, int, LPDWORD);
646     int GetCalendarInfoW(LCID, CALID, CALTYPE, LPWSTR, int, LPDWORD);
647     BOOL GetCPInfo(UINT, LPCPINFO);
648     BOOL GetCPInfoExA(UINT, DWORD, LPCPINFOEXA);
649     BOOL GetCPInfoExW(UINT, DWORD, LPCPINFOEXW);
650     int GetCurrencyFormatA(LCID, DWORD, LPCSTR,  const(CURRENCYFMTA)*, LPSTR, int);
651     int GetCurrencyFormatW(LCID, DWORD, LPCWSTR,  const(CURRENCYFMTW)*, LPWSTR,
652       int);
653     int GetDateFormatA(LCID, DWORD,  const(SYSTEMTIME)*, LPCSTR, LPSTR, int);
654     int GetDateFormatW(LCID, DWORD,  const(SYSTEMTIME)*, LPCWSTR, LPWSTR, int);
655     int GetGeoInfoA(GEOID, GEOTYPE, LPSTR, int, LANGID);
656     int GetGeoInfoW(GEOID, GEOTYPE, LPWSTR, int, LANGID);
657     int GetLocaleInfoA(LCID, LCTYPE, LPSTR, int);
658     int GetLocaleInfoW(LCID, LCTYPE, LPWSTR, int);
659     BOOL GetNLSVersion(NLS_FUNCTION, LCID, LPNLSVERSIONINFO);
660     int GetNumberFormatA(LCID, DWORD, LPCSTR,  const(NUMBERFMTA)*, LPSTR, int);
661     int GetNumberFormatW(LCID, DWORD, LPCWSTR,  const(NUMBERFMTW)*, LPWSTR, int);
662     UINT GetOEMCP();
663     BOOL GetStringTypeA(LCID, DWORD, LPCSTR, int, LPWORD);
664     BOOL GetStringTypeW(DWORD, LPCWSTR, int, LPWORD);
665     BOOL GetStringTypeExA(LCID, DWORD, LPCSTR, int, LPWORD);
666     BOOL GetStringTypeExW(LCID, DWORD, LPCWSTR, int, LPWORD);
667     LANGID GetSystemDefaultLangID();
668     LCID GetSystemDefaultLCID();
669     LCID GetThreadLocale();
670     int GetTimeFormatA(LCID, DWORD,  const(SYSTEMTIME)*, LPCSTR, LPSTR, int);
671     int GetTimeFormatW(LCID, DWORD,  const(SYSTEMTIME)*, LPCWSTR, LPWSTR, int);
672     LANGID GetUserDefaultLangID();
673     LCID GetUserDefaultLCID();
674     GEOID GetUserGeoID(GEOCLASS);
675     BOOL IsDBCSLeadByte(BYTE);
676     BOOL IsDBCSLeadByteEx(UINT, BYTE);
677     BOOL IsNLSDefinedString(NLS_FUNCTION, DWORD, LPNLSVERSIONINFO, LPCWSTR,
678       int);
679     BOOL IsValidCodePage(UINT);
680     BOOL IsValidLocale(LCID, DWORD);
681     int LCMapStringA(LCID, DWORD, LPCSTR, int, LPSTR, int);
682     int LCMapStringW(LCID, DWORD, LPCWSTR, int, LPWSTR, int);
683     int MultiByteToWideChar(UINT, DWORD, LPCSTR, int, LPWSTR, int);
684     int SetCalendarInfoA(LCID, CALID, CALTYPE, LPCSTR);
685     int SetCalendarInfoW(LCID, CALID, CALTYPE, LPCWSTR);
686     BOOL SetLocaleInfoA(LCID, LCTYPE, LPCSTR);
687     BOOL SetLocaleInfoW(LCID, LCTYPE, LPCWSTR);
688     BOOL SetThreadLocale(LCID);
689     BOOL SetUserGeoID(GEOID);
690     int WideCharToMultiByte(UINT, DWORD, LPCWSTR, int, LPSTR, int, LPCSTR,
691       LPBOOL);
692 
693     static if (_WIN32_WINNT >= 0x410) {
694         BOOL EnumCalendarInfoExA(CALINFO_ENUMPROCEXA, LCID, CALID, CALTYPE);
695         BOOL EnumCalendarInfoExW(CALINFO_ENUMPROCEXW, LCID, CALID, CALTYPE);
696         BOOL EnumDateFormatsExA(DATEFMT_ENUMPROCEXA, LCID, DWORD);
697         BOOL EnumDateFormatsExW(DATEFMT_ENUMPROCEXW, LCID, DWORD);
698         BOOL IsValidLanguageGroup(LGRPID, DWORD);
699     }
700 
701     static if (_WIN32_WINNT >= 0x500) {
702         LANGID GetSystemDefaultUILanguage();
703         LANGID GetUserDefaultUILanguage();
704 
705         BOOL EnumSystemLanguageGroupsA(LANGUAGEGROUP_ENUMPROCA, DWORD,
706           LONG_PTR);
707         BOOL EnumSystemLanguageGroupsW(LANGUAGEGROUP_ENUMPROCW, DWORD,
708           LONG_PTR);
709         BOOL EnumLanguageGroupLocalesA(LANGGROUPLOCALE_ENUMPROCA, LGRPID,
710           DWORD, LONG_PTR);
711         BOOL EnumLanguageGroupLocalesW(LANGGROUPLOCALE_ENUMPROCW, LGRPID,
712           DWORD, LONG_PTR);
713         BOOL EnumUILanguagesA(UILANGUAGE_ENUMPROCA, DWORD, LONG_PTR);
714         BOOL EnumUILanguagesW(UILANGUAGE_ENUMPROCW, DWORD, LONG_PTR);
715     }
716 }
717 
718 version (Unicode) {
719     alias CALINFO_ENUMPROCW CALINFO_ENUMPROC;
720     alias CALINFO_ENUMPROCEXW CALINFO_ENUMPROCEX;
721     alias LOCALE_ENUMPROCW LOCALE_ENUMPROC;
722     alias CODEPAGE_ENUMPROCW CODEPAGE_ENUMPROC;
723     alias DATEFMT_ENUMPROCW DATEFMT_ENUMPROC;
724     alias DATEFMT_ENUMPROCEXW DATEFMT_ENUMPROCEX;
725     alias TIMEFMT_ENUMPROCW TIMEFMT_ENUMPROC;
726     alias LANGUAGEGROUP_ENUMPROCW LANGUAGEGROUP_ENUMPROC;
727     alias LANGGROUPLOCALE_ENUMPROCW LANGGROUPLOCALE_ENUMPROC;
728     alias UILANGUAGE_ENUMPROCW UILANGUAGE_ENUMPROC;
729     alias CPINFOEXW CPINFOEX;
730     alias LPCPINFOEXW LPCPINFOEX;
731     alias CURRENCYFMTW CURRENCYFMT;
732     alias LPCURRENCYFMTW LPCURRENCYFMT;
733     alias NUMBERFMTW NUMBERFMT;
734     alias LPNUMBERFMTW LPNUMBERFMT;
735     alias CompareStringW CompareString;
736     alias EnumCalendarInfoW EnumCalendarInfo;
737     alias EnumSystemCodePagesW EnumSystemCodePages;
738     alias EnumSystemLocalesW EnumSystemLocales;
739     alias EnumTimeFormatsW EnumTimeFormats;
740     alias FoldStringW FoldString;
741     alias GetCalendarInfoW GetCalendarInfo;
742     alias GetCPInfoExW GetCPInfoEx;
743     alias GetCurrencyFormatW GetCurrencyFormat;
744     alias GetDateFormatW GetDateFormat;
745     alias GetGeoInfoW GetGeoInfo;
746     alias GetLocaleInfoW GetLocaleInfo;
747     alias GetNumberFormatW GetNumberFormat;
748     alias GetStringTypeExW GetStringTypeEx;
749     alias GetTimeFormatW GetTimeFormat;
750     alias LCMapStringW LCMapString;
751     alias SetCalendarInfoW SetCalendarInfo;
752     alias SetLocaleInfoW SetLocaleInfo;
753 
754     static if (_WIN32_WINNT >= 0x410) {
755         alias EnumCalendarInfoExW EnumCalendarInfoEx;
756         alias EnumDateFormatsExW EnumDateFormatsEx;
757     }
758 
759     static if (_WIN32_WINNT >= 0x500) {
760         alias EnumSystemLanguageGroupsW EnumSystemLanguageGroups;
761         alias EnumLanguageGroupLocalesW EnumLanguageGroupLocales;
762         alias EnumUILanguagesW EnumUILanguages;
763     }
764 
765 } else {
766     alias CALINFO_ENUMPROCA CALINFO_ENUMPROC;
767     alias CALINFO_ENUMPROCEXA CALINFO_ENUMPROCEX;
768     alias LOCALE_ENUMPROCA LOCALE_ENUMPROC;
769     alias CODEPAGE_ENUMPROCA CODEPAGE_ENUMPROC;
770     alias DATEFMT_ENUMPROCA DATEFMT_ENUMPROC;
771     alias DATEFMT_ENUMPROCEXA DATEFMT_ENUMPROCEX;
772     alias TIMEFMT_ENUMPROCA TIMEFMT_ENUMPROC;
773     alias LANGUAGEGROUP_ENUMPROCA LANGUAGEGROUP_ENUMPROC;
774     alias LANGGROUPLOCALE_ENUMPROCA LANGGROUPLOCALE_ENUMPROC;
775     alias UILANGUAGE_ENUMPROCA UILANGUAGE_ENUMPROC;
776     alias CPINFOEXA CPINFOEX;
777     alias LPCPINFOEXA LPCPINFOEX;
778     alias CURRENCYFMTA CURRENCYFMT;
779     alias LPCURRENCYFMTA LPCURRENCYFMT;
780     alias NUMBERFMTA NUMBERFMT;
781     alias LPNUMBERFMTA LPNUMBERFMT;
782     alias CompareStringA CompareString;
783     alias EnumCalendarInfoA EnumCalendarInfo;
784     alias EnumSystemCodePagesA EnumSystemCodePages;
785     alias EnumSystemLocalesA EnumSystemLocales;
786     alias EnumTimeFormatsA EnumTimeFormats;
787     alias FoldStringA FoldString;
788     alias GetCalendarInfoA GetCalendarInfo;
789     alias GetCPInfoExA GetCPInfoEx;
790     alias GetCurrencyFormatA GetCurrencyFormat;
791     alias GetDateFormatA GetDateFormat;
792     alias GetGeoInfoA GetGeoInfo;
793     alias GetLocaleInfoA GetLocaleInfo;
794     alias GetNumberFormatA GetNumberFormat;
795     alias GetStringTypeExA GetStringTypeEx;
796     alias GetTimeFormatA GetTimeFormat;
797     alias LCMapStringA LCMapString;
798     alias SetCalendarInfoA SetCalendarInfo;
799     alias SetLocaleInfoA SetLocaleInfo;
800 
801     static if (_WIN32_WINNT >= 0x410) {
802         alias EnumCalendarInfoExA EnumCalendarInfoEx;
803         alias EnumDateFormatsExA EnumDateFormatsEx;
804     }
805 
806     static if (_WIN32_WINNT >= 0x500) {
807         alias EnumSystemLanguageGroupsA EnumSystemLanguageGroups;
808         alias EnumLanguageGroupLocalesA EnumLanguageGroupLocales;
809         alias EnumUILanguagesA EnumUILanguages;
810     }
811 }