442
|
1 /* Copyright (C) 2000 Free Software Foundation, Inc.
|
2367
|
2 Copyright (C) 2000, 2001, 2002, 2004 Ben Wing.
|
442
|
3
|
|
4 This file is part of XEmacs.
|
|
5
|
|
6 XEmacs is free software; you can redistribute it and/or modify it
|
|
7 under the terms of the GNU General Public License as published by the
|
|
8 Free Software Foundation; either version 2, or (at your option) any
|
|
9 later version.
|
|
10
|
|
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 for more details.
|
|
15
|
|
16 You should have received a copy of the GNU General Public License
|
|
17 along with XEmacs; see the file COPYING. If not, write to
|
|
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
19 Boston, MA 02111-1307, USA. */
|
|
20
|
|
21 /* Synched up with: Not in FSF. */
|
|
22
|
|
23 /* Authorship:
|
|
24
|
771
|
25 Current primary author: Ben Wing <ben@xemacs.org>
|
|
26
|
442
|
27 Created May 2000 by Andy Piper.
|
771
|
28 Windows-Mule stuff added by Ben Wing, 2000-2001.
|
|
29 September 2001 Ben Wing reorganized and included nt.h and ntheap.h into
|
|
30 this file; comments in those files say:
|
|
31 * Adapted for XEmacs by David Hobley <david@spook-le0.cia.com.au>
|
|
32 * Sync'ed with Emacs 19.34.6 by Marc Paquette <marcpa@cam.org>
|
|
33 (Note: Sync messages from Marc Paquette may indicate
|
|
34 incomplete synching, so beware.)
|
|
35 (in ntheap.h only) Geoff Voelker (voelker@cs.washington.edu) 7-29-94
|
|
36
|
442
|
37 */
|
|
38
|
|
39 #ifndef INCLUDED_syswindows_h_
|
|
40 #define INCLUDED_syswindows_h_
|
|
41
|
2367
|
42 /* See win32.c for info about the different Windows files in XEmacs. */
|
442
|
43
|
771
|
44 /* ------------------------- Basic includes ------------------------- */
|
442
|
45
|
|
46 #ifndef WIN32_LEAN_AND_MEAN
|
|
47 #define WIN32_LEAN_AND_MEAN
|
|
48 #endif
|
|
49
|
665
|
50 #if defined (CYGWIN) || defined (MINGW)
|
771
|
51 # define CYGWIN_HEADERS
|
|
52 # ifndef _WIN32_IE
|
|
53 # define _WIN32_IE 0x0400
|
|
54 # endif
|
665
|
55
|
1743
|
56 BEGIN_C_DECLS
|
665
|
57
|
|
58 /* Fucking GCC complains about "no previous prototype" for inline
|
|
59 functions. DUH! See DECLARE_INLINE_HEADER. */
|
|
60 extern __inline void *GetCurrentFiber (void);
|
|
61 extern __inline void *GetFiberData (void);
|
|
62
|
1743
|
63 END_C_DECLS
|
665
|
64
|
|
65 #endif
|
|
66
|
771
|
67 /* Defines for COM so it's usable in both C and C++. XECOMCALLn() calls a
|
|
68 method with the specified number of parameters. XECOMID() surrounds a
|
|
69 class or interface name when passed to CoCreateInstance, a
|
|
70 QueryInterface method, or the like. */
|
|
71 #ifdef __cplusplus
|
|
72 #define XECOMCALL0(cl, meth) ((cl)->meth ())
|
|
73 #define XECOMCALL1(cl, meth, a1) ((cl)->meth (a1))
|
|
74 #define XECOMCALL2(cl, meth, a1, a2) ((cl)->meth (a1, a2))
|
|
75 #define XECOMCALL3(cl, meth, a1, a2, a3) ((cl)->meth (a1, a2, a3))
|
|
76 #define XECOMCALL4(cl, meth, a1, a2, a3, a4) ((cl)->meth (a1, a2, a3, a4))
|
|
77 #define XECOMID(id) (id)
|
|
78 #else
|
|
79 #define XECOMCALL0(cl, meth) ((cl)->lpVtbl->meth (cl))
|
|
80 #define XECOMCALL1(cl, meth, a1) ((cl)->lpVtbl->meth (cl, a1))
|
|
81 #define XECOMCALL2(cl, meth, a1, a2) ((cl)->lpVtbl->meth (cl, a1, a2))
|
|
82 #define XECOMCALL3(cl, meth, a1, a2, a3) ((cl)->lpVtbl->meth (cl, a1, a2, a3))
|
|
83 #define XECOMCALL4(cl, meth, a1, a2, a3, a4) \
|
|
84 ((cl)->lpVtbl->meth (cl, a1, a2, a3, a4))
|
|
85 #define XECOMID(id) (&(id))
|
|
86 #endif
|
|
87
|
|
88 #define OEMRESOURCE /* Define OCR_ and friend constants */
|
442
|
89 #include <windows.h>
|
|
90
|
3728
|
91 #include <aclapi.h>
|
|
92
|
558
|
93 #if defined (WIN32_LEAN_AND_MEAN)
|
|
94 # ifdef HAVE_X_WINDOWS
|
442
|
95 /* Christ almighty. The problems you get when combining two large code bases,
|
|
96 neither with any respect for namespace purity. */
|
558
|
97 # undef Status
|
|
98 # endif
|
|
99 # include <winspool.h>
|
|
100 # ifdef HAVE_X_WINDOWS
|
|
101 # define Status int
|
|
102 # endif
|
|
103 # include <mmsystem.h>
|
673
|
104 # include <shlobj.h>
|
558
|
105 # include <shellapi.h>
|
|
106 # include <ddeml.h>
|
442
|
107 #endif
|
|
108
|
546
|
109 #include <lmaccess.h> /* next three for NetUserEnum and friends */
|
531
|
110 #include <lmapibuf.h>
|
|
111 #include <lmerr.h>
|
546
|
112 #include <lmcons.h> /* for UNLEN and possibly other constants */
|
531
|
113
|
771
|
114 #include <cderr.h>
|
|
115 #include <commdlg.h>
|
|
116
|
|
117 #ifdef NEED_MSWINDOWS_COMMCTRL
|
|
118 #include <commctrl.h>
|
442
|
119 #endif
|
771
|
120 #ifdef NEED_MSWINDOWS_OBJBASE
|
|
121 #include <objbase.h>
|
442
|
122 #endif
|
771
|
123 #ifdef NEED_MSWINDOWS_SHLOBJ
|
|
124 #include <shlobj.h>
|
442
|
125 #endif
|
|
126
|
771
|
127 #include <zmouse.h> /* WHEEL_PAGESCROLL under Cygwin */
|
|
128
|
|
129 #include <wchar.h>
|
442
|
130
|
771
|
131 /* ------------------------- Cygwin header brokenness ---------------------- */
|
|
132
|
|
133 #ifdef CYGWIN_HEADERS
|
|
134
|
1683
|
135 #include <cygwin/stat.h> /* for struct stat */
|
1304
|
136 #include <w32api.h> /* for version info */
|
|
137
|
1683
|
138 /* Test for a specific version of w32api */
|
|
139 #define W32API_VER(major,minor) (((major) << 16) + (minor))
|
|
140 #define W32API_INSTALLED_VER \
|
|
141 W32API_VER (__W32API_MAJOR_VERSION, __W32API_MINOR_VERSION)
|
1304
|
142
|
771
|
143 /* Various brokennesses in various versions of Cygwin */
|
673
|
144
|
442
|
145 /* windows.h defines. */
|
|
146 #ifndef SPI_GETWHEELSCROLLLINES
|
|
147 #define SPI_GETWHEELSCROLLLINES 104
|
|
148 #endif
|
771
|
149
|
|
150 /* commctrl.h defines. */
|
|
151 #ifndef TB_SETIMAGELIST
|
|
152 #define TB_SETIMAGELIST (WM_USER + 48)
|
442
|
153 #endif
|
771
|
154 #ifndef TB_GETIMAGELIST
|
|
155 #define TB_GETIMAGELIST (WM_USER + 49)
|
|
156 #endif
|
|
157 #ifndef TB_SETDISABLEDIMAGELIST
|
|
158 #define TB_SETDISABLEDIMAGELIST (WM_USER + 54)
|
|
159 #endif
|
|
160 #ifndef TB_GETDISABLEDIMAGELIST
|
|
161 #define TB_GETDISABLEDIMAGELIST (WM_USER + 55)
|
442
|
162 #endif
|
771
|
163 #ifndef TB_SETPADDING
|
|
164 #define TB_SETPADDING (WM_USER + 87)
|
|
165 #endif
|
|
166 #ifndef TB_GETBUTTONINFOA
|
|
167 #define TB_GETBUTTONINFOA (WM_USER + 65)
|
|
168 #endif
|
|
169 #ifndef TB_GETBUTTONINFOW
|
|
170 #define TB_GETBUTTONINFOW (WM_USER + 63)
|
442
|
171 #endif
|
771
|
172 #ifndef TB_SETBUTTONINFOA
|
|
173 #define TB_SETBUTTONINFOA (WM_USER + 66)
|
|
174 #endif
|
|
175 #ifndef TB_SETBUTTONINFOW
|
|
176 #define TB_SETBUTTONINFOW (WM_USER + 64)
|
|
177 #endif
|
|
178 #ifndef TB_INSERTBUTTONA
|
|
179 #define TB_INSERTBUTTONA (WM_USER + 21)
|
442
|
180 #endif
|
771
|
181 #ifndef TB_INSERTBUTTONW
|
|
182 #define TB_INSERTBUTTONW (WM_USER + 67)
|
|
183 #endif
|
|
184 #ifndef TB_ADDBUTTONSA
|
|
185 #define TB_ADDBUTTONSA (WM_USER + 20)
|
|
186 #endif
|
|
187 #ifndef TB_ADDBUTTONSW
|
|
188 #define TB_ADDBUTTONSW (WM_USER + 68)
|
442
|
189 #endif
|
771
|
190 #ifndef LVM_SETBKIMAGEA
|
|
191 #define LVM_SETBKIMAGEA (LVM_FIRST + 68)
|
|
192 #endif
|
|
193 #ifndef LVM_SETBKIMAGEW
|
|
194 #define LVM_SETBKIMAGEW (LVM_FIRST + 138)
|
|
195 #endif
|
|
196 #ifndef LVM_GETBKIMAGEA
|
|
197 #define LVM_GETBKIMAGEA (LVM_FIRST + 69)
|
442
|
198 #endif
|
771
|
199 #ifndef LVM_GETBKIMAGEW
|
|
200 #define LVM_GETBKIMAGEW (LVM_FIRST + 139)
|
|
201 #endif
|
|
202 #ifndef WC_COMBOBOXEXW
|
|
203 #define WC_COMBOBOXEXW L"ComboBoxEx32"
|
|
204 #endif
|
|
205 #ifndef CBEM_INSERTITEMA
|
|
206 #define CBEM_INSERTITEMA (WM_USER + 1)
|
442
|
207 #endif
|
771
|
208 #ifndef CBEM_INSERTITEMW
|
|
209 #define CBEM_INSERTITEMW (WM_USER + 11)
|
442
|
210 #endif
|
771
|
211 #ifndef CBEM_SETITEMA
|
|
212 #define CBEM_SETITEMA (WM_USER + 5)
|
|
213 #endif
|
|
214 #ifndef CBEM_SETITEMW
|
|
215 #define CBEM_SETITEMW (WM_USER + 12)
|
442
|
216 #endif
|
771
|
217 #ifndef CBEM_GETITEMA
|
|
218 #define CBEM_GETITEMA (WM_USER + 4)
|
|
219 #endif
|
|
220 #ifndef CBEM_GETITEMW
|
|
221 #define CBEM_GETITEMW (WM_USER + 13)
|
442
|
222 #endif
|
771
|
223 #ifndef HDN_GETDISPINFOA
|
|
224 #define HDN_GETDISPINFOA (HDN_FIRST - 9)
|
|
225 #endif
|
|
226 #ifndef HDN_GETDISPINFOW
|
|
227 #define HDN_GETDISPINFOW (HDN_FIRST - 29)
|
|
228 #endif
|
|
229 #ifndef TBN_GETDISPINFOA
|
|
230 #define TBN_GETDISPINFOA (TBN_FIRST - 16)
|
442
|
231 #endif
|
771
|
232 #ifndef TBN_GETDISPINFOW
|
|
233 #define TBN_GETDISPINFOW (TBN_FIRST - 17)
|
|
234 #endif
|
|
235 #ifndef TBN_GETINFOTIPA
|
|
236 #define TBN_GETINFOTIPA (TBN_FIRST - 18)
|
442
|
237 #endif
|
771
|
238 #ifndef TBN_GETINFOTIPW
|
|
239 #define TBN_GETINFOTIPW (TBN_FIRST - 19)
|
|
240 #endif
|
|
241 #ifndef TTN_GETDISPINFOA
|
|
242 #define TTN_GETDISPINFOA (TTN_FIRST - 0)
|
|
243 #endif
|
|
244 #ifndef TTN_GETDISPINFOW
|
|
245 #define TTN_GETDISPINFOW (TTN_FIRST - 10)
|
442
|
246 #endif
|
771
|
247
|
|
248 #if (_WIN32_IE >= 0x0400)
|
|
249
|
|
250 #ifndef LVN_GETINFOTIPA
|
|
251 #define LVN_GETINFOTIPA (LVN_FIRST - 57)
|
|
252 #endif
|
|
253 #ifndef LVN_GETINFOTIPW
|
|
254 #define LVN_GETINFOTIPW (LVN_FIRST - 58)
|
442
|
255 #endif
|
771
|
256 #ifndef TVN_GETINFOTIPA
|
|
257 #define TVN_GETINFOTIPA (TVN_FIRST - 13)
|
|
258 #endif
|
|
259 #ifndef TVN_GETINFOTIPW
|
|
260 #define TVN_GETINFOTIPW (TVN_FIRST - 14)
|
|
261 #endif
|
|
262 #ifndef CBEN_GETDISPINFOA
|
|
263 #define CBEN_GETDISPINFOA (CBEN_FIRST - 0)
|
442
|
264 #endif
|
771
|
265 #ifndef CBEN_GETDISPINFOW
|
|
266 #define CBEN_GETDISPINFOW (CBEN_FIRST - 7)
|
|
267 #endif
|
|
268 #ifndef CBEN_DRAGBEGINA
|
|
269 #define CBEN_DRAGBEGINA (CBEN_FIRST - 8)
|
|
270 #endif
|
|
271 #ifndef CBEN_DRAGBEGINW
|
|
272 #define CBEN_DRAGBEGINW (CBEN_FIRST - 9)
|
442
|
273 #endif
|
771
|
274
|
|
275 #endif /* (_WIN32_IE >= 0x0400) */
|
|
276
|
|
277 #ifndef CBEN_ENDEDITA
|
|
278 #define CBEN_ENDEDITA (CBEN_FIRST - 5)
|
442
|
279 #endif
|
771
|
280 #ifndef CBEN_ENDEDITW
|
|
281 #define CBEN_ENDEDITW (CBEN_FIRST - 6)
|
|
282 #endif
|
|
283
|
|
284 #ifndef CBEMAXSTRLEN
|
|
285 #define CBEMAXSTRLEN 260
|
442
|
286 #endif
|
|
287
|
1111
|
288 #ifndef NMCBEENDEDIT
|
|
289
|
|
290 typedef struct
|
|
291 {
|
|
292 NMHDR hdr;
|
|
293 BOOL fChanged;
|
|
294 int iNewSelection;
|
|
295 WCHAR szText[CBEMAXSTRLEN];
|
|
296 int iWhy;
|
771
|
297 } NMCBEENDEDITW, *LPNMCBEENDEDITW, *PNMCBEENDEDITW;
|
|
298
|
1111
|
299 typedef struct
|
|
300 {
|
|
301 NMHDR hdr;
|
|
302 BOOL fChanged;
|
|
303 int iNewSelection;
|
|
304 char szText[CBEMAXSTRLEN];
|
|
305 int iWhy;
|
771
|
306 } NMCBEENDEDITA, *LPNMCBEENDEDITA,*PNMCBEENDEDITA;
|
|
307
|
1111
|
308 #endif /* not NMCBEENDEDIT */
|
|
309
|
771
|
310 #if (_WIN32_IE >= 0x0400)
|
|
311
|
1111
|
312 #ifndef NMCBEDRAGBEGIN
|
|
313
|
|
314 typedef struct
|
|
315 {
|
|
316 NMHDR hdr;
|
|
317 int iItemid;
|
|
318 WCHAR szText[CBEMAXSTRLEN];
|
|
319 } NMCBEDRAGBEGINW, *LPNMCBEDRAGBEGINW, *PNMCBEDRAGBEGINW;
|
771
|
320
|
1111
|
321 typedef struct
|
|
322 {
|
|
323 NMHDR hdr;
|
|
324 int iItemid;
|
|
325 char szText[CBEMAXSTRLEN];
|
|
326 } NMCBEDRAGBEGINA, *LPNMCBEDRAGBEGINA, *PNMCBEDRAGBEGINA;
|
|
327
|
|
328 #endif /* not NMCBEDRAGBEGIN */
|
|
329
|
771
|
330 typedef struct tagNMDATETIMEFORMATA
|
|
331 {
|
1111
|
332 NMHDR nmhdr;
|
|
333 LPCSTR pszFormat;
|
|
334 SYSTEMTIME st;
|
|
335 LPCSTR pszDisplay;
|
|
336 CHAR szDisplay[64];
|
771
|
337 } NMDATETIMEFORMATA, FAR * LPNMDATETIMEFORMATA;
|
|
338
|
|
339 typedef struct tagNMDATETIMEFORMATW
|
|
340 {
|
1111
|
341 NMHDR nmhdr;
|
|
342 LPCWSTR pszFormat;
|
|
343 SYSTEMTIME st;
|
|
344 LPCWSTR pszDisplay;
|
|
345 WCHAR szDisplay[64];
|
771
|
346 } NMDATETIMEFORMATW, FAR * LPNMDATETIMEFORMATW;
|
|
347
|
1683
|
348 #if W32API_INSTALLED_VER < W32API_VER(2,2)
|
1304
|
349
|
1111
|
350 typedef struct tagNMTTDISPIFNOA
|
|
351 {
|
|
352 NMHDR hdr;
|
|
353 LPSTR lpszText;
|
|
354 char szText[80];
|
|
355 HINSTANCE hinst;
|
|
356 UINT uFlags;
|
771
|
357 #if (_WIN32_IE >= 0x0300)
|
1111
|
358 LPARAM lParam;
|
771
|
359 #endif
|
|
360 } NMTTDISPINFOA, FAR *LPNMTTDISPINFOA;
|
|
361
|
1111
|
362 typedef struct tagNMTTDISPINFOW
|
|
363 {
|
|
364 NMHDR hdr;
|
|
365 LPWSTR lpszText;
|
|
366 WCHAR szText[80];
|
|
367 HINSTANCE hinst;
|
|
368 UINT uFlags;
|
771
|
369 #if (_WIN32_IE >= 0x0300)
|
1111
|
370 LPARAM lParam;
|
771
|
371 #endif
|
|
372 } NMTTDISPINFOW, FAR *LPNMTTDISPINFOW;
|
|
373
|
1683
|
374 #endif /* W32API_INSTALLED_VER < W32API_VER(2,2) */
|
1304
|
375
|
771
|
376 #endif /* (_WIN32_IE >= 0x0400) */
|
442
|
377
|
771
|
378 /* shlobj.h defines */
|
|
379 #ifndef BFFM_VALIDATEFAILEDA
|
|
380 #define BFFM_VALIDATEFAILEDA 3
|
|
381 #endif
|
|
382 #ifndef BFFM_VALIDATEFAILEDW
|
|
383 #define BFFM_VALIDATEFAILEDW 4
|
|
384 #endif
|
|
385 #ifndef BFFM_SETSELECTIONA
|
|
386 #define BFFM_SETSELECTIONA (WM_USER + 102)
|
|
387 #endif
|
|
388 #ifndef BFFM_SETSELECTIONW
|
|
389 #define BFFM_SETSELECTIONW (WM_USER + 103)
|
|
390 #endif
|
|
391 #ifndef BFFM_SETSTATUSTEXTA
|
|
392 #define BFFM_SETSTATUSTEXTA (WM_USER + 100)
|
|
393 #endif
|
|
394 #ifndef BFFM_SETSTATUSTEXTW
|
|
395 #define BFFM_SETSTATUSTEXTW (WM_USER + 104)
|
|
396 #endif
|
|
397 #ifndef SHARD_PATHA
|
|
398 #define SHARD_PATHA 2
|
|
399 #endif
|
|
400 #ifndef SHARD_PATHW
|
|
401 #define SHARD_PATHW 3
|
|
402 #endif
|
|
403 #ifndef SHCNF_PATHA
|
|
404 #define SHCNF_PATHA 1
|
|
405 #endif
|
|
406 #ifndef SHCNF_PATHW
|
|
407 #define SHCNF_PATHW 5
|
|
408 #endif
|
|
409 #ifndef SHCNF_PRINTERA
|
|
410 #define SHCNF_PRINTERA 2
|
|
411 #endif
|
|
412 #ifndef SHCNF_PRINTERW
|
|
413 #define SHCNF_PRINTERW 6
|
|
414 #endif
|
|
415 #ifndef BFFM_VALIDATEFAILED
|
|
416 #ifdef UNICODE
|
|
417 #define BFFM_VALIDATEFAILED BFFM_VALIDATEFAILEDW
|
|
418 #else
|
|
419 #define BFFM_VALIDATEFAILED BFFM_VALIDATEFAILEDA
|
|
420 #endif
|
819
|
421 #endif
|
442
|
422
|
800
|
423 /* winnls.h defines */
|
819
|
424 #ifndef MAC_CHARSET
|
|
425 #define MAC_CHARSET 77
|
|
426 #endif
|
800
|
427 #ifndef LOCALE_RETURN_NUMBER
|
819
|
428 #define LOCALE_RETURN_NUMBER 0x20000000
|
800
|
429 #endif
|
|
430
|
771
|
431 /* OEM resources */
|
|
432 #ifndef OCR_ICOCUR
|
|
433 #define OCR_ICOCUR 32647
|
|
434 #define OIC_SAMPLE 32512
|
|
435 #define OIC_HAND 32513
|
|
436 #define OIC_QUES 32514
|
|
437 #define OIC_BANG 32515
|
|
438 #define OIC_NOTE 32516
|
|
439 #define OIC_WINLOGO 32517
|
|
440 #endif
|
|
441
|
|
442 /* More Cygwin stupidity: Current w32api's winuser.h has IME message
|
|
443 constants and they conflict with imm.h. (NOTE: Currently fixed, but
|
|
444 I'm sure the problems were present post 1.0.) */
|
|
445 #undef WM_IME_STARTCOMPOSITION
|
|
446 #undef WM_IME_ENDCOMPOSITION
|
|
447 #undef WM_IME_COMPOSITION
|
|
448 #undef WM_IME_KEYLAST
|
|
449 #undef WM_IME_SETCONTEXT
|
|
450 #undef WM_IME_NOTIFY
|
|
451 #undef WM_IME_CONTROL
|
|
452 #undef WM_IME_COMPOSITIONFULL
|
|
453 #undef WM_IME_SELECT
|
|
454 #undef WM_IME_CHAR
|
|
455 #undef WM_IME_KEYDOWN
|
|
456 #undef WM_IME_KEYUP
|
|
457
|
|
458 #include <imm.h>
|
|
459
|
1683
|
460 #if W32API_INSTALLED_VER < W32API_VER(2,4)
|
771
|
461 typedef struct _SHQUERYRBINFO
|
|
462 {
|
|
463 DWORD cbSize;
|
|
464 __int64 i64Size;
|
|
465 __int64 i64NumItems;
|
|
466 } SHQUERYRBINFO, *LPSHQUERYRBINFO;
|
1683
|
467 #endif
|
771
|
468
|
|
469 typedef LPCDLGTEMPLATE LPCDLGTEMPLATEW;
|
|
470 typedef LPCDLGTEMPLATE LPCDLGTEMPLATEA;
|
|
471
|
1685
|
472 #else /* !CYGWIN_HEADERS */
|
|
473 #define W32API_VER(major,minor) 0
|
|
474 #define W32API_INSTALLED_VER 0
|
771
|
475 #endif /* CYGWIN_HEADERS */
|
|
476
|
|
477 /* Not in VC 6 */
|
|
478 #ifndef BIF_NEWDIALOGSTYLE
|
|
479 #define BIF_NEWDIALOGSTYLE 64
|
|
480 #endif
|
442
|
481
|
|
482 #ifdef CYGWIN
|
|
483
|
|
484 /* All but wcscmp and wcslen left out of Cygwin headers -- but present
|
771
|
485 in /usr/include/mingw/string.h! */
|
442
|
486 wchar_t* wcscat (wchar_t*, const wchar_t*);
|
|
487 wchar_t* wcschr (const wchar_t*, wchar_t);
|
|
488 int wcscoll (const wchar_t*, const wchar_t*);
|
|
489 wchar_t* wcscpy (wchar_t*, const wchar_t*);
|
771
|
490 wchar_t* wcsdup (const wchar_t*);
|
442
|
491 size_t wcscspn (const wchar_t*, const wchar_t*);
|
|
492 /* Note: No wcserror in CRTDLL. */
|
|
493 wchar_t* wcsncat (wchar_t*, const wchar_t*, size_t);
|
771
|
494 int wcsncmp (const wchar_t*, const wchar_t*, size_t);
|
|
495 wchar_t* wcsncpy (wchar_t*, const wchar_t*, size_t);
|
|
496 wchar_t* wcspbrk (const wchar_t*, const wchar_t*);
|
|
497 wchar_t* wcsrchr (const wchar_t*, wchar_t);
|
|
498 size_t wcsspn (const wchar_t*, const wchar_t*);
|
|
499 wchar_t* wcsstr (const wchar_t*, const wchar_t*);
|
|
500 wchar_t* wcstok (wchar_t*, const wchar_t*);
|
|
501 size_t wcsxfrm (wchar_t*, const wchar_t*, size_t);
|
442
|
502
|
|
503 #endif /* CYGWIN */
|
|
504
|
771
|
505 /* ------------------------- Unicode encapsulation ------------------------- */
|
|
506
|
2367
|
507 /* See intl-win32.c for more information about Unicode-encapsulation */
|
771
|
508
|
800
|
509 #define ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
510
|
771
|
511 #include "intl-auto-encap-win32.h"
|
|
512
|
|
513 /* would be encapsulatable but for parsing problems */
|
800
|
514
|
|
515 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
516 #undef DefWindowProc
|
|
517 #define DefWindowProc error use qxeDefWindowProc or DefWindowProcA/DefWindowProcW
|
|
518 #endif
|
771
|
519 LRESULT qxeDefWindowProc (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
800
|
520
|
|
521 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
522 #undef CallWindowProc
|
|
523 #define CallWindowProc error use qxeCallWindowProc or CallWindowProcA/CallWindowProcW
|
|
524 #endif
|
771
|
525 LRESULT qxeCallWindowProc (WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg,
|
|
526 WPARAM wParam, LPARAM lParam);
|
800
|
527
|
|
528 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
529 #undef DefDlgProc
|
|
530 #define DefDlgProc error use qxeDefDlgProc or DefDlgProcA/DefDlgProcW
|
|
531 #endif
|
771
|
532 LRESULT qxeDefDlgProc (HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam);
|
800
|
533
|
|
534 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
535 #undef SetWindowsHook
|
|
536 #define SetWindowsHook error use qxeSetWindowsHook or SetWindowsHookA/SetWindowsHookW
|
|
537 #endif
|
771
|
538 HHOOK qxeSetWindowsHook (int nFilterType, HOOKPROC pfnFilterProc);
|
800
|
539
|
|
540 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
541 #undef DefMDIChildProc
|
|
542 #define DefMDIChildProc error use qxeDefMDIChildProc or DefMDIChildProcA/DefMDIChildProcW
|
|
543 #endif
|
771
|
544 LRESULT qxeDefMDIChildProc (HWND hWnd, UINT uMsg, WPARAM wParam,
|
|
545 LPARAM lParam);
|
|
546
|
800
|
547 #undef GetEnvironmentStrings
|
|
548 #undef GetEnvironmentStringsA
|
|
549 #define GetEnvironmentStringsA GetEnvironmentStrings
|
|
550 Extbyte * qxeGetEnvironmentStrings (void);
|
|
551
|
771
|
552 /* would be encapsulatable but for Cygwin problems */
|
800
|
553
|
|
554 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
1111
|
555 #undef DdeCreateStringHandle
|
|
556 #define DdeCreateStringHandle error use qxeDdeCreateStringHandle or DdeCreateStringHandleA/DdeCreateStringHandleW
|
|
557 #endif
|
|
558 HSZ qxeDdeCreateStringHandle (DWORD idInst, const Extbyte * psz, int iCodePage);
|
|
559
|
|
560 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
800
|
561 #undef RegConnectRegistry
|
|
562 #define RegConnectRegistry error use qxeRegConnectRegistry or RegConnectRegistryA/RegConnectRegistryW
|
|
563 #endif
|
771
|
564 LONG qxeRegConnectRegistry (const Extbyte * lpMachineName, HKEY hKey, PHKEY phkResult);
|
800
|
565
|
|
566 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
567 #undef ExtractIconEx
|
|
568 #define ExtractIconEx error use qxeExtractIconEx or ExtractIconExA/ExtractIconExW
|
|
569 #endif
|
771
|
570 UINT qxeExtractIconEx (const Extbyte * lpszFile, int nIconIndex, HICON FAR * phiconLarge, HICON FAR * phiconSmall, UINT nIcons);
|
800
|
571
|
|
572 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
573 #undef GetICMProfile
|
|
574 #define GetICMProfile error use qxeGetICMProfile or GetICMProfileA/GetICMProfileW
|
|
575 #endif
|
771
|
576 BOOL qxeGetICMProfile (HDC arg1, LPDWORD arg2, Extbyte * arg3);
|
800
|
577
|
|
578 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
579 #undef UpdateICMRegKey
|
|
580 #define UpdateICMRegKey error use qxeUpdateICMRegKey or UpdateICMRegKeyA/UpdateICMRegKeyW
|
|
581 #endif
|
771
|
582 BOOL qxeUpdateICMRegKey (DWORD arg1, Extbyte * arg2, Extbyte * arg3, UINT arg4);
|
|
583
|
2500
|
584 /* would be encapsulatable but for header changes in different versions of VC++ */
|
|
585
|
|
586 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
587 #undef EnumResourceTypes
|
|
588 #define EnumResourceTypes error_use_qxeEnumResourceTypes_or_EnumResourceTypesA_and_EnumResourceTypesW
|
|
589 #endif
|
|
590 #if MSC_VERSION >= 1300
|
|
591 BOOL qxeEnumResourceTypes (HMODULE hModule, ENUMRESTYPEPROCW lpEnumFunc, LONG lParam);
|
|
592 #else
|
|
593 BOOL qxeEnumResourceTypes (HMODULE hModule, ENUMRESTYPEPROC lpEnumFunc, LONG lParam);
|
|
594 #endif
|
|
595
|
|
596 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
597 #undef EnumResourceNames
|
|
598 #define EnumResourceNames error_use_qxeEnumResourceNames_or_EnumResourceNamesA_and_EnumResourceNamesW
|
|
599 #endif
|
|
600 #if MSC_VERSION >= 1300
|
|
601 BOOL qxeEnumResourceNames (HMODULE hModule, const Extbyte * lpType, ENUMRESNAMEPROCW lpEnumFunc, LONG lParam);
|
|
602 #else
|
|
603 BOOL qxeEnumResourceNames (HMODULE hModule, const Extbyte * lpType, ENUMRESNAMEPROC lpEnumFunc, LONG lParam);
|
|
604 #endif
|
|
605
|
|
606 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
607 #undef EnumResourceLanguages
|
|
608 #define EnumResourceLanguages error_use_qxeEnumResourceLanguages_or_EnumResourceLanguagesA_and_EnumResourceLanguagesW
|
|
609 #endif
|
|
610 #if MSC_VERSION >= 1300
|
|
611 BOOL qxeEnumResourceLanguages (HMODULE hModule, const Extbyte * lpType, const Extbyte * lpName, ENUMRESLANGPROCW lpEnumFunc, LONG lParam);
|
|
612 #else
|
|
613 BOOL qxeEnumResourceLanguages (HMODULE hModule, const Extbyte * lpType, const Extbyte * lpName, ENUMRESLANGPROC lpEnumFunc, LONG lParam);
|
|
614 #endif
|
|
615
|
771
|
616 /* files */
|
800
|
617 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
618 #undef FindFirstFile
|
|
619 #define FindFirstFile error use qxeFindFirstFile or FindFirstFileA/FindFirstFileW
|
|
620 #endif
|
771
|
621 HANDLE qxeFindFirstFile (const Extbyte *lpFileName,
|
|
622 WIN32_FIND_DATAW *lpFindFileData);
|
800
|
623
|
|
624 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
625 #undef FindNextFile
|
|
626 #define FindNextFile error use qxeFindNextFile or FindNextFileA/FindNextFileW
|
|
627 #endif
|
771
|
628 BOOL qxeFindNextFile (HANDLE hFindFile, WIN32_FIND_DATAW *lpFindFileData);
|
|
629
|
|
630 /* shell */
|
800
|
631 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
632 #undef SHGetFileInfo
|
|
633 #define SHGetFileInfo error use qxeSHGetFileInfo or SHGetFileInfoA/SHGetFileInfoW
|
|
634 #endif
|
771
|
635 DWORD qxeSHGetFileInfo (const Extbyte *pszPath, DWORD dwFileAttributes,
|
|
636 SHFILEINFOW *psfi, UINT cbFileInfo, UINT uFlags);
|
800
|
637
|
|
638 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
639 #undef SHBrowseForFolder
|
|
640 #define SHBrowseForFolder error use qxeSHBrowseForFolder or SHBrowseForFolderA/SHBrowseForFolderW
|
|
641 #endif
|
771
|
642 LPITEMIDLIST qxeSHBrowseForFolder (LPBROWSEINFOW lpbi);
|
800
|
643
|
|
644 /* Not Unicode-split */
|
771
|
645 VOID qxeSHAddToRecentDocs (UINT uFlags, LPCVOID pv);
|
800
|
646
|
|
647 /* Not Unicode-split */
|
771
|
648 VOID qxeSHChangeNotify (LONG wEventId, UINT uFlags, LPCVOID dwItem1,
|
|
649 LPCVOID dwItem2);
|
800
|
650
|
|
651 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
652 #undef SHGetDataFromIDList
|
|
653 #define SHGetDataFromIDList error use qxeSHGetDataFromIDList or SHGetDataFromIDListA/SHGetDataFromIDListW
|
|
654 #endif
|
771
|
655 HRESULT qxeSHGetDataFromIDList (IShellFolder *psf, LPCITEMIDLIST pidl,
|
|
656 int nFormat, PVOID pv, int cb);
|
|
657
|
|
658 /* devmode */
|
800
|
659 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
660 #undef CreateDC
|
|
661 #define CreateDC error use qxeCreateDC or CreateDCA/CreateDCW
|
|
662 #endif
|
771
|
663 HDC qxeCreateDC (const Extbyte *lpszDriver, const Extbyte *lpszDevice,
|
|
664 const Extbyte *lpszOutput, CONST DEVMODEW *lpInitData);
|
800
|
665
|
|
666 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
667 #undef ResetDC
|
|
668 #define ResetDC error use qxeResetDC or ResetDCA/ResetDCW
|
|
669 #endif
|
771
|
670 HDC qxeResetDC (HDC hdc, CONST DEVMODEW *lpInitData);
|
800
|
671
|
|
672 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
673 #undef OpenPrinter
|
|
674 #define OpenPrinter error use qxeOpenPrinter or OpenPrinterA/OpenPrinterW
|
|
675 #endif
|
771
|
676 DWORD qxeOpenPrinter (Extbyte *pPrinterName, LPHANDLE phPrinter,
|
|
677 LPPRINTER_DEFAULTSW pDefaultconst);
|
800
|
678
|
|
679 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
680 #undef DocumentProperties
|
|
681 #define DocumentProperties error use qxeDocumentProperties or DocumentPropertiesA/DocumentPropertiesW
|
|
682 #endif
|
771
|
683 LONG qxeDocumentProperties (HWND hWnd, HANDLE hPrinter, Extbyte *pDeviceName,
|
|
684 DEVMODEW *pDevModeOutput, DEVMODEW *pDevModeInput,
|
|
685 DWORD fMode);
|
800
|
686
|
|
687 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
688 #undef PrintDlg
|
|
689 #define PrintDlg error use qxePrintDlg or PrintDlgA/PrintDlgW
|
|
690 #endif
|
771
|
691 BOOL qxePrintDlg (PRINTDLGW *lppd);
|
800
|
692
|
|
693 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
694 #undef PageSetupDlg
|
|
695 #define PageSetupDlg error use qxePageSetupDlg or PageSetupDlgA/PageSetupDlgW
|
|
696 #endif
|
771
|
697 BOOL qxePageSetupDlg (PAGESETUPDLGW *lppd);
|
|
698
|
|
699 /* fonts */
|
800
|
700
|
|
701 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
702 #undef EnumFontFamiliesEx
|
|
703 #define EnumFontFamiliesEx error use qxeEnumFontFamiliesEx or EnumFontFamiliesExA/EnumFontFamiliesExW
|
|
704 #endif
|
771
|
705 int qxeEnumFontFamiliesEx (HDC hdc, LOGFONTW *lpLogfont,
|
|
706 FONTENUMPROCW lpEnumFontFamProc, LPARAM lParam,
|
|
707 DWORD dwFlags);
|
800
|
708
|
|
709 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
710 #undef CreateFontIndirect
|
|
711 #define CreateFontIndirect error use qxeCreateFontIndirect or CreateFontIndirectA/CreateFontIndirectW
|
|
712 #endif
|
771
|
713 HFONT qxeCreateFontIndirect (CONST LOGFONTW *lplf);
|
800
|
714
|
2500
|
715 #if defined (HAVE_MS_WINDOWS)
|
800
|
716 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
717 #undef ImmSetCompositionFont
|
|
718 #define ImmSetCompositionFont error use qxeImmSetCompositionFont or ImmSetCompositionFontA/ImmSetCompositionFontW
|
|
719 #endif
|
771
|
720 BOOL qxeImmSetCompositionFont (HIMC imc, LOGFONTW *lplf);
|
2500
|
721 #endif /* defined (HAVE_MS_WINDOWS) */
|
800
|
722
|
2500
|
723 #if defined (HAVE_MS_WINDOWS)
|
800
|
724 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
725 #undef ImmGetCompositionFont
|
|
726 #define ImmGetCompositionFont error use qxeImmGetCompositionFont or ImmGetCompositionFontA/ImmGetCompositionFontW
|
|
727 #endif
|
771
|
728 BOOL qxeImmGetCompositionFont (HIMC imc, LOGFONTW *lplf);
|
2500
|
729 #endif /* defined (HAVE_MS_WINDOWS) */
|
|
730
|
|
731 #if defined (HAVE_MS_WINDOWS)
|
|
732 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
733 #undef ImmSetCompositionString
|
|
734 #define ImmSetCompositionString error_use_qxeImmSetCompositionString_or_ImmSetCompositionStringA_and_ImmSetCompositionStringW
|
|
735 #endif
|
|
736 #if MSC_VERSION >= 1300
|
|
737 BOOL qxeImmSetCompositionString (HIMC arg1, DWORD dwIndex, LPVOID lpComp, DWORD arg4, LPCVOID lpRead, DWORD arg6);
|
|
738 #else
|
|
739 BOOL qxeImmSetCompositionString (HIMC arg1, DWORD dwIndex, LPCVOID lpComp, DWORD arg4, LPCVOID lpRead, DWORD arg6);
|
|
740 #endif
|
|
741 #endif /* defined (HAVE_MS_WINDOWS) */
|
800
|
742
|
|
743 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
744 #undef GetObject
|
|
745 #define GetObject error use qxeGetObject or GetObjectA/GetObjectW
|
|
746 #endif
|
771
|
747 int qxeGetObject (HGDIOBJ hgdiobj, int cbBuffer, LPVOID lpvObject);
|
800
|
748
|
|
749 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
750 #undef GetTextMetrics
|
|
751 #define GetTextMetrics error use qxeGetTextMetrics or GetTextMetricsA/GetTextMetricsW
|
|
752 #endif
|
771
|
753 BOOL qxeGetTextMetrics (HDC hdc, LPTEXTMETRICW lptm);
|
|
754
|
|
755 /* COMMCTRL.H */
|
800
|
756
|
|
757 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
758 #undef SendMessage
|
|
759 #define SendMessage error use qxeSendMessage or SendMessageA/SendMessageW
|
|
760 #endif
|
771
|
761 LRESULT qxeSendMessage (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
|
762
|
|
763 /* windows */
|
800
|
764
|
|
765 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
766 #undef RegisterClass
|
|
767 #define RegisterClass error use qxeRegisterClass or RegisterClassA/RegisterClassW
|
|
768 #endif
|
771
|
769 ATOM qxeRegisterClass (CONST WNDCLASSW * lpWndClass);
|
800
|
770
|
|
771 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
772 #undef UnregisterClass
|
|
773 #define UnregisterClass error use qxeUnregisterClass or UnregisterClassA/UnregisterClassW
|
|
774 #endif
|
771
|
775 BOOL qxeUnregisterClass (const Extbyte * lpClassName, HINSTANCE hInstance);
|
800
|
776
|
|
777 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
778 #undef RegisterClassEx
|
|
779 #define RegisterClassEx error use qxeRegisterClassEx or RegisterClassExA/RegisterClassExW
|
|
780 #endif
|
771
|
781 ATOM qxeRegisterClassEx (CONST WNDCLASSEXW * arg1);
|
800
|
782
|
|
783 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
784 #undef CreateWindow
|
|
785 #define CreateWindow error use qxeCreateWindow or CreateWindowA/CreateWindowW
|
|
786 #endif
|
771
|
787 #define qxeCreateWindow(lpClassName, lpWindowName, dwStyle, x, y, \
|
|
788 nWidth, nHeight, hWndParent, hMenu, hInstance, \
|
|
789 lpParam) \
|
|
790 qxeCreateWindowEx (0L, lpClassName, lpWindowName, dwStyle, x, y, \
|
|
791 nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)
|
|
792
|
|
793 /* ------------------------- Unicode conversion ------------------------- */
|
|
794
|
|
795 /* Set early in command-line processing, when -nuni or
|
|
796 --no-unicode-lib-calls is seen. */
|
|
797 extern int no_mswin_unicode_lib_calls;
|
2367
|
798 /* Set early, in init_win32_very_very_early(). */
|
771
|
799 extern int mswindows_windows9x_p;
|
|
800 #define XEUNICODE_P (!mswindows_windows9x_p && !no_mswin_unicode_lib_calls)
|
|
801
|
|
802 #define XELPTSTR LPWSTR
|
|
803 #define XELPCTSTR LPCWSTR
|
442
|
804
|
|
805 #define XETCHAR_SIZE (XEUNICODE_P ? sizeof (WCHAR) : sizeof (CHAR))
|
|
806 #define MAX_XETCHAR_SIZE sizeof (WCHAR)
|
|
807 #define XETEXT1(arg) (XEUNICODE_P ? ((char *) (L##arg)) : (arg))
|
|
808 /* We need to do this indirection in case ARG is also a manifest constant.
|
|
809 I don't really understand why. --ben */
|
|
810 #define XETEXT(arg) XETEXT1(arg)
|
|
811 #define XECOPY_TCHAR(ptr, ch) \
|
|
812 (XEUNICODE_P ? (* (LPWSTR) (ptr) = L##ch) : (* (LPSTR) (ptr) = (ch)))
|
2421
|
813 #define qxetcslen(arg) \
|
771
|
814 (XEUNICODE_P ? wcslen ((wchar_t *) arg) : strlen (arg))
|
2421
|
815 #define qxetcsbytelen(arg) \
|
771
|
816 (XEUNICODE_P ? wcslen ((wchar_t *) arg) * XETCHAR_SIZE : strlen (arg))
|
2421
|
817 #define qxetcscmp(s1, s2) \
|
442
|
818 (XEUNICODE_P ? wcscmp ((wchar_t *) s1, (wchar_t *) s2) \
|
|
819 : strcmp (s1, s2))
|
2421
|
820 #define qxetcscpy(s1, s2) \
|
442
|
821 (XEUNICODE_P ? (char *) wcscpy ((wchar_t *) s1, (wchar_t *) s2) \
|
|
822 : strcpy (s1, s2))
|
2421
|
823 #define qxetcsncpy(s1, s2, n) \
|
771
|
824 (XEUNICODE_P ? (char *) wcsncpy ((wchar_t *) s1, (wchar_t *) s2, n) \
|
|
825 : strncpy (s1, s2, n))
|
2421
|
826 #define qxetcschr(s, ch) \
|
442
|
827 (XEUNICODE_P ? (char *) wcschr ((wchar_t *) s, (WCHAR) ch) \
|
|
828 : strchr (s, ch))
|
2421
|
829 #define qxetcsrchr(s, ch) \
|
442
|
830 (XEUNICODE_P ? (char *) wcsrchr ((wchar_t *) s, (WCHAR) ch) \
|
|
831 : strrchr (s, ch))
|
2421
|
832 #define qxetcsdup(s) \
|
771
|
833 (XEUNICODE_P ? (char *) wcsdup ((wchar_t *) s) \
|
|
834 : xstrdup (s))
|
442
|
835
|
771
|
836 #define C_STRING_TO_TSTR(in, out) \
|
|
837 C_STRING_TO_EXTERNAL (in, out, Qmswindows_tstr)
|
|
838 #define LISP_STRING_TO_TSTR(in, out) \
|
|
839 LISP_STRING_TO_EXTERNAL (in, out, Qmswindows_tstr)
|
|
840 #define TSTR_TO_C_STRING(in, out) \
|
|
841 EXTERNAL_TO_C_STRING (in, out, Qmswindows_tstr)
|
|
842 #define TSTR_TO_C_STRING_MALLOC(in, out) \
|
|
843 EXTERNAL_TO_C_STRING_MALLOC (in, out, Qmswindows_tstr)
|
|
844
|
|
845 #define build_tstr_string(in) \
|
2421
|
846 make_ext_string (in, qxetcsbytelen ((Extbyte *) in), Qmswindows_tstr)
|
771
|
847
|
|
848 #define MAX_ANSI_CHAR_LEN 1
|
|
849 #define MAX_UNICODE_CHAR_LEN 2
|
|
850
|
|
851 DECLARE_INLINE_HEADER (int ansi_char_to_text (int ch, Extbyte *t))
|
|
852 {
|
|
853 ch &= 0xFF;
|
|
854 t[0] = ch;
|
|
855 return 1;
|
|
856 }
|
|
857
|
|
858 DECLARE_INLINE_HEADER (int unicode_char_to_text (int ch, Extbyte *t))
|
|
859 {
|
|
860 t[0] = ch & 0xFF;
|
|
861 t[1] = (ch >> 8) & 0xFF;
|
|
862 return 2;
|
|
863 }
|
442
|
864
|
771
|
865 Extbyte *convert_multibyte_to_unicode_malloc (const Extbyte *src,
|
|
866 Bytecount n,
|
|
867 int cp, Bytecount *size_out);
|
2367
|
868 Extbyte *convert_unicode_to_multibyte_malloc (const Extbyte *src,
|
|
869 Bytecount n,
|
|
870 int cp, Bytecount *size_out);
|
867
|
871 Ibyte *convert_multibyte_to_internal_malloc (const Extbyte *src,
|
771
|
872 Bytecount n,
|
|
873 int cp, Bytecount *size_out);
|
|
874 void convert_multibyte_to_unicode_dynarr (const Extbyte *src, Bytecount n,
|
|
875 int cp, unsigned_char_dynarr *dst);
|
2367
|
876 void convert_unicode_to_multibyte_dynarr (const Extbyte *src, Bytecount n,
|
|
877 int cp, unsigned_char_dynarr *dst);
|
|
878
|
|
879 Bytecount unicode_multibyte_convert_size (const char *srctext, const void *src,
|
|
880 Bytecount src_size, int to_unicode,
|
|
881 int cp);
|
|
882 void *unicode_multibyte_convert_copy_data (const char *srctext,
|
|
883 void *alloca_data);
|
|
884
|
|
885 /* NOTE: If you make two invocations of the following functions in the same
|
|
886 subexpression and use the exact same expression for the source in both
|
|
887 cases, you will lose. In this unlikely case, you may get an abort, and
|
|
888 need to rewrite the code.
|
|
889
|
|
890 We need to use ALLOCA_FUNCALL_OK here, see NEW_DFC in text.h.
|
|
891 */
|
|
892
|
|
893 #ifdef WEXTTEXT_IS_WIDE
|
|
894 #define MULTIBYTE_TO_WEXTTEXT(str) \
|
|
895 ((Wexttext *) \
|
|
896 unicode_multibyte_convert_copy_data \
|
|
897 (#str, ALLOCA_FUNCALL_OK (unicode_multibyte_convert_size \
|
|
898 (#str, str, strlen (str) + 1, 1, CP_ACP))))
|
|
899
|
|
900 #define WEXTTEXT_TO_MULTIBYTE(str) \
|
|
901 ((Extbyte *) \
|
|
902 unicode_multibyte_convert_copy_data \
|
|
903 (#str, ALLOCA_FUNCALL_OK (unicode_multibyte_convert_size \
|
|
904 (#str, str, \
|
|
905 (wcslen (str) + 1) * sizeof (WCHAR), 0, \
|
|
906 CP_ACP))))
|
|
907 #else
|
|
908 #define MULTIBYTE_TO_WEXTTEXT(str) ((Wexttext *) (str))
|
|
909 #define WEXTTEXT_TO_MULTIBYTE(str) ((Extbyte *) (str))
|
|
910 #endif
|
|
911
|
|
912 /* #### mbstowcs() uses MB_ERR_INVALID_CHARS in addition to MB_PRECOMPOSED.
|
|
913 Should we do this? But then we have to handle errors.
|
|
914 #### Do we already check for invalid sequences in the coding system? */
|
|
915 #define MBTOWC_OPTIONS MB_PRECOMPOSED /* | MB_ERR_INVALID_CHARS */
|
|
916 /* The following options are what wcstombs() uses in the CRT. It uses
|
|
917 NULL in place of "~". */
|
|
918 #define WCTOMB_OPTIONS WC_COMPOSITECHECK | WC_SEPCHARS
|
|
919 #define WCTOMB_INVALID_STRING "~"
|
771
|
920
|
|
921 /* ------------------------- Other Mule stuff ------------------------- */
|
|
922
|
|
923 LCID mswindows_current_locale (void);
|
|
924 int mswindows_locale_to_code_page (LCID lcid);
|
|
925 int mswindows_locale_to_oem_code_page (LCID lcid);
|
|
926
|
|
927 /* ------------------------- Filename conversion ------------------------- */
|
|
928
|
|
929 #ifdef CYGWIN
|
1743
|
930
|
|
931 BEGIN_C_DECLS
|
|
932
|
771
|
933 void cygwin_win32_to_posix_path_list (const char *, char *);
|
|
934 int cygwin_win32_to_posix_path_list_buf_size (const char *);
|
|
935 void cygwin_posix_to_win32_path_list (const char *, char *);
|
|
936 int cygwin_posix_to_win32_path_list_buf_size (const char *);
|
3728
|
937 extern int cygwin_conv_to_full_win32_path (const char *, char *);
|
1743
|
938
|
|
939 END_C_DECLS
|
|
940
|
771
|
941 #endif
|
|
942
|
|
943 #define LOCAL_FILE_FORMAT_TO_TSTR(path, out) \
|
|
944 do { \
|
2526
|
945 Ibyte *lttff; \
|
771
|
946 \
|
|
947 LOCAL_TO_WIN32_FILE_FORMAT (XSTRING_DATA (path), lttff); \
|
2526
|
948 PATHNAME_CONVERT_OUT (lttff, out); \
|
442
|
949 } while (0)
|
|
950
|
|
951 Lisp_Object tstr_to_local_file_format (Extbyte *pathout);
|
|
952
|
826
|
953 /* Convert from local file format, as used in XEmacs, to valid win32
|
|
954 filenames as can be given to Windows API routines. Under native XEmacs,
|
|
955 this is a no-op, but under Cygwin, the local names look different --
|
|
956 Cygwin mount points, forward slashes, etc. Currently, under Cygwin, we
|
|
957 actually allow local names to be of both formats, i.e. Cygwin or Win32
|
|
958 native. So we check to see if we have Win32 native already (a cheesy
|
|
959 check, look for letter plus colon at beginning of name) and do nothing
|
|
960 in that case. */
|
|
961
|
442
|
962 #ifdef CYGWIN
|
771
|
963 #define LOCAL_TO_WIN32_FILE_FORMAT(path, pathout) \
|
|
964 do { \
|
|
965 /* NOTE: It is a bit evil that here and below we are passing \
|
|
966 internal-format data to a function that (nominally) should work \
|
|
967 with external-format data. But in point of fact, the Cygwin \
|
|
968 conversion functions are *NOT* localized, and will fail if they \
|
|
969 get 7-bit ISO2022-encoded data. We know that our internal format \
|
|
970 is ASCII-compatible, and so these functions will work fine with \
|
|
971 this data. */ \
|
867
|
972 Ibyte *ltwffp = (path); \
|
771
|
973 if (isalpha (ltwffp[0]) && (IS_DEVICE_SEP (ltwffp[1]))) \
|
|
974 pathout = ltwffp; \
|
|
975 else \
|
|
976 { \
|
|
977 int ltwff2 = \
|
|
978 cygwin_posix_to_win32_path_list_buf_size ((char *) ltwffp); \
|
2367
|
979 pathout = alloca_ibytes (ltwff2); \
|
771
|
980 cygwin_posix_to_win32_path_list ((char *) ltwffp, (char *) pathout); \
|
|
981 } \
|
442
|
982 } while (0)
|
|
983 #else
|
|
984 #define LOCAL_TO_WIN32_FILE_FORMAT(path, pathout) \
|
|
985 do { \
|
771
|
986 (pathout) = (path); \
|
442
|
987 } while (0)
|
|
988 #endif
|
|
989
|
|
990 #ifdef CYGWIN
|
593
|
991 #define WIN32_TO_LOCAL_FILE_FORMAT(path, pathout) \
|
|
992 do { \
|
867
|
993 Ibyte *wtlff1 = (path); \
|
593
|
994 int wtlff2 = \
|
|
995 cygwin_win32_to_posix_path_list_buf_size ((char *) wtlff1); \
|
2367
|
996 Ibyte *wtlff3 = alloca_ibytes (wtlff2); \
|
593
|
997 cygwin_win32_to_posix_path_list ((char *) wtlff1, (char *) wtlff3); \
|
771
|
998 (pathout) = wtlff3; \
|
442
|
999 } while (0)
|
|
1000 #else
|
|
1001 #define WIN32_TO_LOCAL_FILE_FORMAT(path, pathout) \
|
|
1002 do { \
|
771
|
1003 (pathout) = (path); \
|
442
|
1004 } while (0)
|
|
1005 #endif
|
|
1006
|
826
|
1007 /* Convert a local-format file name or URL in internal format into a Win32
|
|
1008 file name or URL in tstr format. */
|
|
1009
|
|
1010 #ifdef CYGWIN
|
|
1011
|
2526
|
1012 #define LOCAL_FILE_FORMAT_MAYBE_URL_TO_TSTR(lispstr, pathout) \
|
|
1013 do \
|
|
1014 { \
|
|
1015 Ibyte *lffmutt_fname1; \
|
|
1016 Ibyte *lffmutt_pathint = XSTRING_DATA (lispstr); \
|
|
1017 \
|
|
1018 if ((lffmutt_fname1 = qxestrchr (lffmutt_pathint, ':')) != NULL \
|
|
1019 && *++lffmutt_fname1 == '/' && *++lffmutt_fname1 == '/') \
|
|
1020 { \
|
|
1021 /* If URL style file, the innards may have Cygwin mount points and \
|
|
1022 the like. so separate out the innards, process them, and put back \
|
|
1023 together. */ \
|
|
1024 if (qxestrncasecmp_ascii (lffmutt_pathint, "file://", 7) == 0) \
|
|
1025 { \
|
|
1026 Ibyte *lffmutt_path1, *lffmutt_path2; \
|
|
1027 LOCAL_TO_WIN32_FILE_FORMAT (lffmutt_pathint + 7, lffmutt_path1); \
|
|
1028 if (lffmutt_path1 == lffmutt_pathint + 7) /* Optimization */ \
|
|
1029 lffmutt_path2 = lffmutt_pathint; \
|
|
1030 else \
|
|
1031 { \
|
867
|
1032 lffmutt_path2 = alloca_ibytes (7 + qxestrlen (lffmutt_path1) \
|
2526
|
1033 + 1); \
|
|
1034 qxestrncpy (lffmutt_path2, lffmutt_pathint, 7); \
|
|
1035 qxestrcpy (lffmutt_path2 + 7, lffmutt_path1); \
|
|
1036 } \
|
|
1037 C_STRING_TO_TSTR (lffmutt_path2, pathout); \
|
|
1038 } \
|
|
1039 else \
|
|
1040 /* A straight URL, just convert */ \
|
|
1041 LISP_STRING_TO_TSTR (lispstr, pathout); \
|
|
1042 } \
|
|
1043 else \
|
|
1044 /* Not URL-style, must be a straight filename. */ \
|
|
1045 LOCAL_FILE_FORMAT_TO_TSTR (lispstr, pathout); \
|
826
|
1046 } while (0)
|
|
1047
|
|
1048 #else /* not CYGWIN */
|
|
1049
|
|
1050 /* URL's (and everything else) are already in the right format */
|
|
1051 #define LOCAL_FILE_FORMAT_MAYBE_URL_TO_TSTR(lispstr, pathout) \
|
|
1052 LOCAL_FILE_FORMAT_TO_TSTR (lispstr, pathout)
|
|
1053
|
|
1054 #endif /* not CYGWIN */
|
|
1055
|
|
1056
|
867
|
1057 Ibyte *urlify_filename (Ibyte *filename);
|
|
1058 Ibyte *mswindows_canonicalize_filename (Ibyte *name);
|
771
|
1059 #define MSWINDOWS_NORMALIZE_FILENAME(name) \
|
867
|
1060 IBYTE_STRING_TO_ALLOCA (mswindows_canonicalize_filename (name), name)
|
771
|
1061
|
|
1062 /* ------------------- Functions needed dynamic binding ------------------- */
|
|
1063
|
|
1064 typedef BOOL (WINAPI *pfSwitchToThread_t) (VOID);
|
|
1065
|
|
1066 typedef NET_API_STATUS (NET_API_FUNCTION *pfNetUserEnum_t)
|
|
1067 (LPCWSTR, DWORD, DWORD, LPBYTE *, DWORD, LPDWORD, LPDWORD, LPDWORD);
|
|
1068 typedef NET_API_STATUS (NET_API_FUNCTION *pfNetApiBufferFree_t) (LPVOID);
|
|
1069
|
|
1070 extern pfSwitchToThread_t xSwitchToThread;
|
|
1071
|
|
1072 extern pfNetUserEnum_t xNetUserEnum;
|
|
1073 extern pfNetApiBufferFree_t xNetApiBufferFree;
|
|
1074
|
|
1075 /* --------- Useful routines for manipulating memory-mapped files -------- */
|
|
1076
|
|
1077 typedef struct file_data
|
|
1078 {
|
867
|
1079 const Ibyte *name;
|
771
|
1080 unsigned long size;
|
|
1081 HANDLE file;
|
|
1082 HANDLE file_mapping;
|
|
1083 void *file_base;
|
|
1084 } file_data;
|
|
1085
|
|
1086 #define OFFSET_TO_RVA(var,section) \
|
|
1087 (section->VirtualAddress + \
|
|
1088 ((DWORD)(var) - section->PointerToRawData))
|
|
1089
|
|
1090 #define RVA_TO_OFFSET(var,section) \
|
|
1091 (section->PointerToRawData + \
|
|
1092 ((DWORD)(var) - section->VirtualAddress))
|
442
|
1093
|
771
|
1094 #define RVA_TO_PTR(var,section,filedata) \
|
|
1095 ((void *)(RVA_TO_OFFSET(var,section) + \
|
|
1096 (char *)(filedata).file_base))
|
|
1097
|
867
|
1098 int open_input_file (file_data *p_file, const Ibyte *name);
|
|
1099 int open_output_file (file_data *p_file, const Ibyte *name,
|
771
|
1100 unsigned long size);
|
|
1101 void close_file_data (file_data *p_file);
|
|
1102
|
|
1103 /* ------------------------- Heap related stuff ------------------------- */
|
|
1104
|
|
1105 #ifdef WIN32_NATIVE
|
442
|
1106
|
771
|
1107 #define get_reserved_heap_size() reserved_heap_size
|
|
1108 #define get_committed_heap_size() (get_data_end () - get_data_start ())
|
|
1109 #define get_heap_start() get_data_start ()
|
|
1110 #define get_heap_end() get_data_end ()
|
|
1111 #define get_page_size() sysinfo_cache.dwPageSize
|
|
1112 #define get_allocation_unit() sysinfo_cache.dwAllocationGranularity
|
|
1113 #define get_processor_type() sysinfo_cache.dwProcessorType
|
|
1114 #define get_nt_major_version() nt_major_version
|
|
1115 #define get_nt_minor_version() nt_minor_version
|
|
1116
|
814
|
1117 unsigned char *get_data_start (void);
|
|
1118 unsigned char *get_data_end (void);
|
771
|
1119 extern unsigned long data_region_size;
|
|
1120 extern unsigned long reserved_heap_size;
|
|
1121 extern SYSTEM_INFO sysinfo_cache;
|
|
1122 extern int nt_major_version;
|
|
1123 extern int nt_minor_version;
|
|
1124
|
|
1125 /* To prevent zero-initialized variables from being placed into the bss
|
|
1126 section, use non-zero values to represent an uninitialized state. */
|
|
1127 #define UNINIT_PTR ((unsigned char*) 0xF0A0F0A0)
|
|
1128 #define UNINIT_LONG (0xF0A0F0A0L)
|
|
1129
|
|
1130 /* Recreate the heap created during dumping. */
|
814
|
1131 void recreate_heap (Extbyte *executable_path);
|
771
|
1132
|
|
1133 /* Round the heap to this size. */
|
814
|
1134 void round_heap (unsigned long size);
|
771
|
1135
|
|
1136 /* Load in the dumped .bss section. */
|
814
|
1137 void read_in_bss (Extbyte *name);
|
771
|
1138
|
|
1139 /* Map in the dumped heap. */
|
814
|
1140 void map_in_heap (Extbyte *name);
|
771
|
1141
|
|
1142 /* Cache system info, e.g., the NT page size. */
|
814
|
1143 void cache_system_info (void);
|
771
|
1144
|
|
1145 /* Round ADDRESS up to be aligned with ALIGN. */
|
814
|
1146 unsigned char *round_to_next (unsigned char *address,
|
|
1147 unsigned long align);
|
771
|
1148 #endif /* WIN32_NATIVE */
|
|
1149
|
|
1150 /* ------------------------- Misc prototypes ------------------------- */
|
|
1151
|
|
1152 #ifdef WIN32_NATIVE
|
|
1153 DECLARE_INLINE_HEADER (int strcasecmp (const char *a, const char *b))
|
|
1154 {
|
867
|
1155 return qxestrcasecmp ((const Ibyte *) a, (const Ibyte *) b);
|
771
|
1156 }
|
|
1157 #endif /* WIN32_NATIVE */
|
442
|
1158
|
771
|
1159 /* in nt.c */
|
867
|
1160 int mswindows_access (const Ibyte *path, int mode);
|
3025
|
1161 int mswindows_link (const Ibyte *old, const Ibyte *new_);
|
867
|
1162 int mswindows_rename (const Ibyte *oldname, const Ibyte *newname);
|
|
1163 int mswindows_unlink (const Ibyte *path);
|
|
1164 int mswindows_stat (const Ibyte *path, struct stat *buf);
|
771
|
1165 int mswindows_fstat (int desc, struct stat *buf);
|
|
1166 time_t mswindows_convert_time (FILETIME ft);
|
1204
|
1167 int mswindows_is_executable (const Ibyte *filename);
|
|
1168 void mswindows_executable_type (const Ibyte *filename, int *is_dos_app,
|
|
1169 int *is_cygnus_app);
|
867
|
1170 Ibyte *mswindows_getdcwd (int drivelet);
|
771
|
1171
|
872
|
1172 /* in process-nt.c */
|
771
|
1173 extern int mswindows_compare_env (const void *strp1, const void *strp2);
|
|
1174
|
|
1175 /* in win32.c */
|
814
|
1176 Extbyte *mswindows_get_module_file_name (void);
|
771
|
1177 void mswindows_output_last_error (char *frob);
|
|
1178 DECLARE_DOESNT_RETURN (mswindows_report_process_error (const char *string,
|
|
1179 Lisp_Object data,
|
|
1180 int errnum));
|
|
1181 Lisp_Object mswindows_lisp_error (int errnum);
|
2526
|
1182 Ibyte *mswindows_read_link (const Ibyte *fname);
|
771
|
1183
|
872
|
1184 /* in intl-win32.c */
|
|
1185 extern Lisp_Object Qmswindows_tstr, Qmswindows_unicode;
|
|
1186 extern Lisp_Object Qmswindows_multibyte, Qmswindows_multibyte_to_unicode;
|
|
1187
|
442
|
1188 #endif /* INCLUDED_syswindows_h_ */
|