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