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