1 /*
2  * Basic Windows type definitions to be able to use NLS-specific APIs
3  * for mdbtools use
4  */
5 #if !defined(WIN32)
6 #include <wchar.h>
7 
8 #define FAR
9 #define WINAPI
10 
11 #ifndef BYTE
12         typedef unsigned char BYTE;
13 #endif
14         typedef unsigned char UCHAR;
15         typedef unsigned char *PUCHAR;
16         typedef unsigned short USHORT;
17 
18         typedef unsigned long ULONG;
19 		typedef unsigned int  UINT;
20         typedef void *LPVOID;
21 		typedef void *PVOID;
22         typedef short BOOL, *LPBOOL;
23 
24         typedef unsigned long *PULONG;
25         typedef const void *LPCVOID;
26         typedef unsigned long DWORD;
27         typedef unsigned long *PDWORD;
28         typedef unsigned short WORD;
29         typedef long LONG;
30         typedef long RESPONSECODE;
31         typedef const char *LPCSTR;
32         typedef const BYTE *LPCBYTE;
33         typedef BYTE *LPBYTE;
34         typedef DWORD *LPDWORD;
35         typedef char *LPSTR;
36 		typedef DWORD LCID;
37 		typedef short WCHAR;
38 		typedef char CHAR;
39 		typedef WCHAR *NWPSTR, *LPWSTR, *PWSTR, *PZZWSTR ;
40 		typedef const WCHAR *LPCWSTR, *PCWSTR;
41 		typedef long LONG_PTR;
42 		typedef unsigned long ULONG_PTR;
43 		typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
44 		typedef LONG_PTR  LPARAM;
45 		typedef short WPARAM;
46 		typedef int (FAR WINAPI *FARPROC)();
47 		typedef int INT;
48 		typedef unsigned long long ULONGLONG, *PULONGLONG;
49 		typedef WORD LANGID;
50 		typedef WORD *LPWORD;
51 
52 typedef struct _GUID {
53     unsigned long  Data1;
54     unsigned short Data2;
55     unsigned short Data3;
56     unsigned char  Data4[ 8 ];
57 } GUID;
58 
59 typedef struct _SYSTEMTIME {
60     WORD wYear;
61     WORD wMonth;
62     WORD wDayOfWeek;
63     WORD wDay;
64     WORD wHour;
65     WORD wMinute;
66     WORD wSecond;
67     WORD wMilliseconds;
68 } SYSTEMTIME, *PSYSTEMTIME, *LPSYSTEMTIME;
69 
70 
71 #ifndef TRUE
72 #define TRUE	1
73 #endif
74 #ifndef FALSE
75 #define FALSE	0
76 #endif
77 
78 #define MAX_PATH	260
79 #define DECL_WINELIB_TYPE_AW(x)
80 #define CALLBACK
81 #define WINBASEAPI
82 #define DECLSPEC_IMPORT
83 
84 #define LANG_NEUTRAL                     0x00
85 #define LANG_INVARIANT                   0x7f
86 
87 #define LANG_AFRIKAANS                   0x36
88 #define LANG_ALBANIAN                    0x1c
89 #define LANG_ARABIC                      0x01
90 #define LANG_ARMENIAN                    0x2b
91 #define LANG_ASSAMESE                    0x4d
92 #define LANG_AZERI                       0x2c
93 #define LANG_BASQUE                      0x2d
94 #define LANG_BELARUSIAN                  0x23
95 #define LANG_BENGALI                     0x45
96 #define LANG_BULGARIAN                   0x02
97 #define LANG_CATALAN                     0x03
98 #define LANG_CHINESE                     0x04
99 #define LANG_CROATIAN                    0x1a
100 #define LANG_CZECH                       0x05
101 #define LANG_DANISH                      0x06
102 #define LANG_DIVEHI                      0x65
103 #define LANG_DUTCH                       0x13
104 #define LANG_ENGLISH                     0x09
105 #define LANG_ESTONIAN                    0x25
106 #define LANG_FAEROESE                    0x38
107 #define LANG_FARSI                       0x29
108 #define LANG_FINNISH                     0x0b
109 #define LANG_FRENCH                      0x0c
110 #define LANG_GALICIAN                    0x56
111 #define LANG_GEORGIAN                    0x37
112 #define LANG_GERMAN                      0x07
113 #define LANG_GREEK                       0x08
114 #define LANG_GUJARATI                    0x47
115 #define LANG_HEBREW                      0x0d
116 #define LANG_HINDI                       0x39
117 #define LANG_HUNGARIAN                   0x0e
118 #define LANG_ICELANDIC                   0x0f
119 #define LANG_INDONESIAN                  0x21
120 #define LANG_ITALIAN                     0x10
121 #define LANG_JAPANESE                    0x11
122 #define LANG_KANNADA                     0x4b
123 #define LANG_KASHMIRI                    0x60
124 #define LANG_KAZAK                       0x3f
125 #define LANG_KONKANI                     0x57
126 #define LANG_KOREAN                      0x12
127 #define LANG_KYRGYZ                      0x40
128 #define LANG_LATVIAN                     0x26
129 #define LANG_LITHUANIAN                  0x27
130 #define LANG_MACEDONIAN                  0x2f   // the Former Yugoslav Republic of Macedonia
131 #define LANG_MALAY                       0x3e
132 #define LANG_MALAYALAM                   0x4c
133 #define LANG_MANIPURI                    0x58
134 #define LANG_MARATHI                     0x4e
135 #define LANG_MONGOLIAN                   0x50
136 #define LANG_NEPALI                      0x61
137 #define LANG_NORWEGIAN                   0x14
138 #define LANG_ORIYA                       0x48
139 #define LANG_POLISH                      0x15
140 #define LANG_PORTUGUESE                  0x16
141 #define LANG_PUNJABI                     0x46
142 #define LANG_ROMANIAN                    0x18
143 #define LANG_RUSSIAN                     0x19
144 #define LANG_SANSKRIT                    0x4f
145 #define LANG_SERBIAN                     0x1a
146 #define LANG_SINDHI                      0x59
147 #define LANG_SLOVAK                      0x1b
148 #define LANG_SLOVENIAN                   0x24
149 #define LANG_SPANISH                     0x0a
150 #define LANG_SWAHILI                     0x41
151 #define LANG_SWEDISH                     0x1d
152 #define LANG_SYRIAC                      0x5a
153 #define LANG_TAMIL                       0x49
154 #define LANG_TATAR                       0x44
155 #define LANG_TELUGU                      0x4a
156 #define LANG_THAI                        0x1e
157 #define LANG_TURKISH                     0x1f
158 #define LANG_UKRAINIAN                   0x22
159 #define LANG_URDU                        0x20
160 #define LANG_UZBEK                       0x43
161 #define LANG_VIETNAMESE                  0x2a
162 
163 //
164 //  Sublanguage IDs.
165 //
166 //  The name immediately following SUBLANG_ dictates which primary
167 //  language ID that sublanguage ID can be combined with to form a
168 //  valid language ID.
169 //
170 
171 #define SUBLANG_NEUTRAL                  0x00    // language neutral
172 #define SUBLANG_DEFAULT                  0x01    // user default
173 #define SUBLANG_SYS_DEFAULT              0x02    // system default
174 
175 #define SUBLANG_ARABIC_SAUDI_ARABIA      0x01    // Arabic (Saudi Arabia)
176 #define SUBLANG_ARABIC_IRAQ              0x02    // Arabic (Iraq)
177 #define SUBLANG_ARABIC_EGYPT             0x03    // Arabic (Egypt)
178 #define SUBLANG_ARABIC_LIBYA             0x04    // Arabic (Libya)
179 #define SUBLANG_ARABIC_ALGERIA           0x05    // Arabic (Algeria)
180 #define SUBLANG_ARABIC_MOROCCO           0x06    // Arabic (Morocco)
181 #define SUBLANG_ARABIC_TUNISIA           0x07    // Arabic (Tunisia)
182 #define SUBLANG_ARABIC_OMAN              0x08    // Arabic (Oman)
183 #define SUBLANG_ARABIC_YEMEN             0x09    // Arabic (Yemen)
184 #define SUBLANG_ARABIC_SYRIA             0x0a    // Arabic (Syria)
185 #define SUBLANG_ARABIC_JORDAN            0x0b    // Arabic (Jordan)
186 #define SUBLANG_ARABIC_LEBANON           0x0c    // Arabic (Lebanon)
187 #define SUBLANG_ARABIC_KUWAIT            0x0d    // Arabic (Kuwait)
188 #define SUBLANG_ARABIC_UAE               0x0e    // Arabic (U.A.E)
189 #define SUBLANG_ARABIC_BAHRAIN           0x0f    // Arabic (Bahrain)
190 #define SUBLANG_ARABIC_QATAR             0x10    // Arabic (Qatar)
191 #define SUBLANG_AZERI_LATIN              0x01    // Azeri (Latin)
192 #define SUBLANG_AZERI_CYRILLIC           0x02    // Azeri (Cyrillic)
193 #define SUBLANG_CHINESE_TRADITIONAL      0x01    // Chinese (Taiwan)
194 #define SUBLANG_CHINESE_SIMPLIFIED       0x02    // Chinese (PR China)
195 #define SUBLANG_CHINESE_HONGKONG         0x03    // Chinese (Hong Kong S.A.R., P.R.C.)
196 #define SUBLANG_CHINESE_SINGAPORE        0x04    // Chinese (Singapore)
197 #define SUBLANG_CHINESE_MACAU            0x05    // Chinese (Macau S.A.R.)
198 #define SUBLANG_DUTCH                    0x01    // Dutch
199 #define SUBLANG_DUTCH_BELGIAN            0x02    // Dutch (Belgian)
200 #define SUBLANG_ENGLISH_US               0x01    // English (USA)
201 #define SUBLANG_ENGLISH_UK               0x02    // English (UK)
202 #define SUBLANG_ENGLISH_AUS              0x03    // English (Australian)
203 #define SUBLANG_ENGLISH_CAN              0x04    // English (Canadian)
204 #define SUBLANG_ENGLISH_NZ               0x05    // English (New Zealand)
205 #define SUBLANG_ENGLISH_EIRE             0x06    // English (Irish)
206 #define SUBLANG_ENGLISH_SOUTH_AFRICA     0x07    // English (South Africa)
207 #define SUBLANG_ENGLISH_JAMAICA          0x08    // English (Jamaica)
208 #define SUBLANG_ENGLISH_CARIBBEAN        0x09    // English (Caribbean)
209 #define SUBLANG_ENGLISH_BELIZE           0x0a    // English (Belize)
210 #define SUBLANG_ENGLISH_TRINIDAD         0x0b    // English (Trinidad)
211 #define SUBLANG_ENGLISH_ZIMBABWE         0x0c    // English (Zimbabwe)
212 #define SUBLANG_ENGLISH_PHILIPPINES      0x0d    // English (Philippines)
213 #define SUBLANG_FRENCH                   0x01    // French
214 #define SUBLANG_FRENCH_BELGIAN           0x02    // French (Belgian)
215 #define SUBLANG_FRENCH_CANADIAN          0x03    // French (Canadian)
216 #define SUBLANG_FRENCH_SWISS             0x04    // French (Swiss)
217 #define SUBLANG_FRENCH_LUXEMBOURG        0x05    // French (Luxembourg)
218 #define SUBLANG_FRENCH_MONACO            0x06    // French (Monaco)
219 #define SUBLANG_GERMAN                   0x01    // German
220 #define SUBLANG_GERMAN_SWISS             0x02    // German (Swiss)
221 #define SUBLANG_GERMAN_AUSTRIAN          0x03    // German (Austrian)
222 #define SUBLANG_GERMAN_LUXEMBOURG        0x04    // German (Luxembourg)
223 #define SUBLANG_GERMAN_LIECHTENSTEIN     0x05    // German (Liechtenstein)
224 #define SUBLANG_ITALIAN                  0x01    // Italian
225 #define SUBLANG_ITALIAN_SWISS            0x02    // Italian (Swiss)
226 #if _WIN32_WINNT >= 0x0501
227 #define SUBLANG_KASHMIRI_SASIA           0x02    // Kashmiri (South Asia)
228 #endif
229 #define SUBLANG_KASHMIRI_INDIA           0x02    // For app compatibility only
230 #define SUBLANG_KOREAN                   0x01    // Korean (Extended Wansung)
231 #define SUBLANG_LITHUANIAN               0x01    // Lithuanian
232 #define SUBLANG_MALAY_MALAYSIA           0x01    // Malay (Malaysia)
233 #define SUBLANG_MALAY_BRUNEI_DARUSSALAM  0x02    // Malay (Brunei Darussalam)
234 #define SUBLANG_NEPALI_INDIA             0x02    // Nepali (India)
235 #define SUBLANG_NORWEGIAN_BOKMAL         0x01    // Norwegian (Bokmal)
236 #define SUBLANG_NORWEGIAN_NYNORSK        0x02    // Norwegian (Nynorsk)
237 #define SUBLANG_PORTUGUESE               0x02    // Portuguese
238 #define SUBLANG_PORTUGUESE_BRAZILIAN     0x01    // Portuguese (Brazilian)
239 #define SUBLANG_SERBIAN_LATIN            0x02    // Serbian (Latin)
240 #define SUBLANG_SERBIAN_CYRILLIC         0x03    // Serbian (Cyrillic)
241 #define SUBLANG_SPANISH                  0x01    // Spanish (Castilian)
242 #define SUBLANG_SPANISH_MEXICAN          0x02    // Spanish (Mexican)
243 #define SUBLANG_SPANISH_MODERN           0x03    // Spanish (Spain)
244 #define SUBLANG_SPANISH_GUATEMALA        0x04    // Spanish (Guatemala)
245 #define SUBLANG_SPANISH_COSTA_RICA       0x05    // Spanish (Costa Rica)
246 #define SUBLANG_SPANISH_PANAMA           0x06    // Spanish (Panama)
247 #define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07  // Spanish (Dominican Republic)
248 #define SUBLANG_SPANISH_VENEZUELA        0x08    // Spanish (Venezuela)
249 #define SUBLANG_SPANISH_COLOMBIA         0x09    // Spanish (Colombia)
250 #define SUBLANG_SPANISH_PERU             0x0a    // Spanish (Peru)
251 #define SUBLANG_SPANISH_ARGENTINA        0x0b    // Spanish (Argentina)
252 #define SUBLANG_SPANISH_ECUADOR          0x0c    // Spanish (Ecuador)
253 #define SUBLANG_SPANISH_CHILE            0x0d    // Spanish (Chile)
254 #define SUBLANG_SPANISH_URUGUAY          0x0e    // Spanish (Uruguay)
255 #define SUBLANG_SPANISH_PARAGUAY         0x0f    // Spanish (Paraguay)
256 #define SUBLANG_SPANISH_BOLIVIA          0x10    // Spanish (Bolivia)
257 #define SUBLANG_SPANISH_EL_SALVADOR      0x11    // Spanish (El Salvador)
258 #define SUBLANG_SPANISH_HONDURAS         0x12    // Spanish (Honduras)
259 #define SUBLANG_SPANISH_NICARAGUA        0x13    // Spanish (Nicaragua)
260 #define SUBLANG_SPANISH_PUERTO_RICO      0x14    // Spanish (Puerto Rico)
261 #define SUBLANG_SWEDISH                  0x01    // Swedish
262 #define SUBLANG_SWEDISH_FINLAND          0x02    // Swedish (Finland)
263 #define SUBLANG_URDU_PAKISTAN            0x01    // Urdu (Pakistan)
264 #define SUBLANG_URDU_INDIA               0x02    // Urdu (India)
265 #define SUBLANG_UZBEK_LATIN              0x01    // Uzbek (Latin)
266 #define SUBLANG_UZBEK_CYRILLIC           0x02    // Uzbek (Cyrillic)
267 
268 //
269 //  Sorting IDs.
270 //
271 
272 #define SORT_DEFAULT                     0x0     // sorting default
273 
274 #define SORT_JAPANESE_XJIS               0x0     // Japanese XJIS order
275 #define SORT_JAPANESE_UNICODE            0x1     // Japanese Unicode order
276 
277 #define SORT_CHINESE_BIG5                0x0     // Chinese BIG5 order
278 #define SORT_CHINESE_PRCP                0x0     // PRC Chinese Phonetic order
279 #define SORT_CHINESE_UNICODE             0x1     // Chinese Unicode order
280 #define SORT_CHINESE_PRC                 0x2     // PRC Chinese Stroke Count order
281 #define SORT_CHINESE_BOPOMOFO            0x3     // Traditional Chinese Bopomofo order
282 
283 #define SORT_KOREAN_KSC                  0x0     // Korean KSC order
284 #define SORT_KOREAN_UNICODE              0x1     // Korean Unicode order
285 
286 #define SORT_GERMAN_PHONE_BOOK           0x1     // German Phone Book order
287 
288 #define SORT_HUNGARIAN_DEFAULT           0x0     // Hungarian Default order
289 #define SORT_HUNGARIAN_TECHNICAL         0x1     // Hungarian Technical order
290 
291 #define SORT_GEORGIAN_TRADITIONAL        0x0     // Georgian Traditional order
292 #define SORT_GEORGIAN_MODERN             0x1     // Georgian Modern order
293 
294 // end_r_winnt
295 
296 //
297 //  A language ID is a 16 bit value which is the combination of a
298 //  primary language ID and a secondary language ID.  The bits are
299 //  allocated as follows:
300 //
301 //       +-----------------------+-------------------------+
302 //       |     Sublanguage ID    |   Primary Language ID   |
303 //       +-----------------------+-------------------------+
304 //        15                   10 9                       0   bit
305 //
306 //
307 //  Language ID creation/extraction macros:
308 //
309 //    MAKELANGID    - construct language id from a primary language id and
310 //                    a sublanguage id.
311 //    PRIMARYLANGID - extract primary language id from a language id.
312 //    SUBLANGID     - extract sublanguage id from a language id.
313 //
314 
315 #define MAKELANGID(p, s)       ((((WORD  )(s)) << 10) | (WORD  )(p))
316 #define PRIMARYLANGID(lgid)    ((WORD  )(lgid) & 0x3ff)
317 #define SUBLANGID(lgid)        ((WORD  )(lgid) >> 10)
318 
319 //
320 //  A locale ID is a 32 bit value which is the combination of a
321 //  language ID, a sort ID, and a reserved area.  The bits are
322 //  allocated as follows:
323 //
324 //       +-------------+---------+-------------------------+
325 //       |   Reserved  | Sort ID |      Language ID        |
326 //       +-------------+---------+-------------------------+
327 //        31         20 19     16 15                      0   bit
328 //
329 //
330 //  Locale ID creation/extraction macros:
331 //
332 //    MAKELCID            - construct the locale id from a language id and a sort id.
333 //    MAKESORTLCID        - construct the locale id from a language id, sort id, and sort version.
334 //    LANGIDFROMLCID      - extract the language id from a locale id.
335 //    SORTIDFROMLCID      - extract the sort id from a locale id.
336 //    SORTVERSIONFROMLCID - extract the sort version from a locale id.
337 //
338 
339 #define NLS_VALID_LOCALE_MASK  0x000fffff
340 
341 #define MAKELCID(lgid, srtid)  ((DWORD)((((DWORD)((WORD  )(srtid))) << 16) |  \
342                                          ((DWORD)((WORD  )(lgid)))))
343 #define MAKESORTLCID(lgid, srtid, ver)                                            \
344                                ((DWORD)((MAKELCID(lgid, srtid)) |             \
345                                     (((DWORD)((WORD  )(ver))) << 20)))
346 #define LANGIDFROMLCID(lcid)   ((WORD  )(lcid))
347 #define SORTIDFROMLCID(lcid)   ((WORD  )((((DWORD)(lcid)) >> 16) & 0xf))
348 #define SORTVERSIONFROMLCID(lcid)  ((WORD  )((((DWORD)(lcid)) >> 20) & 0xf))
349 
350 
351 //
352 //  Default System and User IDs for language and locale.
353 //
354 
355 #define LANG_SYSTEM_DEFAULT    (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
356 #define LANG_USER_DEFAULT      (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
357 
358 #define LOCALE_SYSTEM_DEFAULT  (MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT))
359 #define LOCALE_USER_DEFAULT    (MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT))
360 
361 #define LOCALE_NEUTRAL                                                        \
362           (MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), SORT_DEFAULT))
363 
364 #define LOCALE_INVARIANT                                                      \
365           (MAKELCID(MAKELANGID(LANG_INVARIANT, SUBLANG_NEUTRAL), SORT_DEFAULT))
366 
367 
368 #define MAKEWORD(a, b)      ((WORD)(((BYTE)((DWORD_PTR)(a) & 0xff)) | ((WORD)((BYTE)((DWORD_PTR)(b) & 0xff))) << 8))
369 #define MAKELONG(a, b)      ((LONG)(((WORD)((DWORD_PTR)(a) & 0xffff)) | ((DWORD)((WORD)((DWORD_PTR)(b) & 0xffff))) << 16))
370 #define LOWORD(l)           ((WORD)((DWORD_PTR)(l) & 0xffff))
371 #define HIWORD(l)           ((WORD)((DWORD_PTR)(l) >> 16))
372 #define LOBYTE(w)           ((BYTE)((DWORD_PTR)(w) & 0xff))
373 #define HIBYTE(w)           ((BYTE)((DWORD_PTR)(w) >> 8))
374 
375 
376 #else
377 #define WIN32_LEAN_AND_MEAN
378 #include <windows.h>
379 #endif
380