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