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
|
|
413 #endif /* not BFFM_VALIDATEFAILED */
|
442
|
414
|
800
|
415 /* winnls.h defines */
|
|
416 #ifndef LOCALE_RETURN_NUMBER
|
|
417 #define LOCALE_RETURN_NUMBER 0x20000000
|
|
418 #endif
|
|
419
|
771
|
420 /* OEM resources */
|
|
421 #ifndef OCR_ICOCUR
|
|
422 #define OCR_ICOCUR 32647
|
|
423 #define OIC_SAMPLE 32512
|
|
424 #define OIC_HAND 32513
|
|
425 #define OIC_QUES 32514
|
|
426 #define OIC_BANG 32515
|
|
427 #define OIC_NOTE 32516
|
|
428 #define OIC_WINLOGO 32517
|
|
429 #endif
|
|
430
|
|
431 /* More Cygwin stupidity: Current w32api's winuser.h has IME message
|
|
432 constants and they conflict with imm.h. (NOTE: Currently fixed, but
|
|
433 I'm sure the problems were present post 1.0.) */
|
|
434 #undef WM_IME_STARTCOMPOSITION
|
|
435 #undef WM_IME_ENDCOMPOSITION
|
|
436 #undef WM_IME_COMPOSITION
|
|
437 #undef WM_IME_KEYLAST
|
|
438 #undef WM_IME_SETCONTEXT
|
|
439 #undef WM_IME_NOTIFY
|
|
440 #undef WM_IME_CONTROL
|
|
441 #undef WM_IME_COMPOSITIONFULL
|
|
442 #undef WM_IME_SELECT
|
|
443 #undef WM_IME_CHAR
|
|
444 #undef WM_IME_KEYDOWN
|
|
445 #undef WM_IME_KEYUP
|
|
446
|
|
447 #include <imm.h>
|
|
448
|
|
449 typedef struct _SHQUERYRBINFO
|
|
450 {
|
|
451 DWORD cbSize;
|
|
452 __int64 i64Size;
|
|
453 __int64 i64NumItems;
|
|
454 } SHQUERYRBINFO, *LPSHQUERYRBINFO;
|
|
455
|
|
456 typedef LPCDLGTEMPLATE LPCDLGTEMPLATEW;
|
|
457 typedef LPCDLGTEMPLATE LPCDLGTEMPLATEA;
|
|
458
|
|
459 #endif /* CYGWIN_HEADERS */
|
|
460
|
|
461 /* Not in VC 6 */
|
|
462 #ifndef BIF_NEWDIALOGSTYLE
|
|
463 #define BIF_NEWDIALOGSTYLE 64
|
|
464 #endif
|
442
|
465
|
|
466 #ifdef CYGWIN
|
|
467
|
|
468 /* All but wcscmp and wcslen left out of Cygwin headers -- but present
|
771
|
469 in /usr/include/mingw/string.h! */
|
442
|
470 wchar_t* wcscat (wchar_t*, const wchar_t*);
|
|
471 wchar_t* wcschr (const wchar_t*, wchar_t);
|
|
472 int wcscoll (const wchar_t*, const wchar_t*);
|
|
473 wchar_t* wcscpy (wchar_t*, const wchar_t*);
|
771
|
474 wchar_t* wcsdup (const wchar_t*);
|
442
|
475 size_t wcscspn (const wchar_t*, const wchar_t*);
|
|
476 /* Note: No wcserror in CRTDLL. */
|
|
477 wchar_t* wcsncat (wchar_t*, const wchar_t*, size_t);
|
771
|
478 int wcsncmp (const wchar_t*, const wchar_t*, size_t);
|
|
479 wchar_t* wcsncpy (wchar_t*, const wchar_t*, size_t);
|
|
480 wchar_t* wcspbrk (const wchar_t*, const wchar_t*);
|
|
481 wchar_t* wcsrchr (const wchar_t*, wchar_t);
|
|
482 size_t wcsspn (const wchar_t*, const wchar_t*);
|
|
483 wchar_t* wcsstr (const wchar_t*, const wchar_t*);
|
|
484 wchar_t* wcstok (wchar_t*, const wchar_t*);
|
|
485 size_t wcsxfrm (wchar_t*, const wchar_t*, size_t);
|
442
|
486
|
|
487 #endif /* CYGWIN */
|
|
488
|
771
|
489 /* ------------------------- Unicode encapsulation ------------------------- */
|
|
490
|
|
491 /* See intl-encap-win32.c for more information about Unicode-encapsulation */
|
|
492
|
800
|
493 #define ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
494
|
771
|
495 #include "intl-auto-encap-win32.h"
|
|
496
|
|
497 /* would be encapsulatable but for parsing problems */
|
800
|
498
|
|
499 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
500 #undef DefWindowProc
|
|
501 #define DefWindowProc error use qxeDefWindowProc or DefWindowProcA/DefWindowProcW
|
|
502 #endif
|
771
|
503 LRESULT qxeDefWindowProc (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
800
|
504
|
|
505 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
506 #undef CallWindowProc
|
|
507 #define CallWindowProc error use qxeCallWindowProc or CallWindowProcA/CallWindowProcW
|
|
508 #endif
|
771
|
509 LRESULT qxeCallWindowProc (WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg,
|
|
510 WPARAM wParam, LPARAM lParam);
|
800
|
511
|
|
512 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
513 #undef DefDlgProc
|
|
514 #define DefDlgProc error use qxeDefDlgProc or DefDlgProcA/DefDlgProcW
|
|
515 #endif
|
771
|
516 LRESULT qxeDefDlgProc (HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam);
|
800
|
517
|
|
518 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
519 #undef SetWindowsHook
|
|
520 #define SetWindowsHook error use qxeSetWindowsHook or SetWindowsHookA/SetWindowsHookW
|
|
521 #endif
|
771
|
522 HHOOK qxeSetWindowsHook (int nFilterType, HOOKPROC pfnFilterProc);
|
800
|
523
|
|
524 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
525 #undef DefMDIChildProc
|
|
526 #define DefMDIChildProc error use qxeDefMDIChildProc or DefMDIChildProcA/DefMDIChildProcW
|
|
527 #endif
|
771
|
528 LRESULT qxeDefMDIChildProc (HWND hWnd, UINT uMsg, WPARAM wParam,
|
|
529 LPARAM lParam);
|
|
530
|
800
|
531 #undef GetEnvironmentStrings
|
|
532 #undef GetEnvironmentStringsA
|
|
533 #define GetEnvironmentStringsA GetEnvironmentStrings
|
|
534 Extbyte * qxeGetEnvironmentStrings (void);
|
|
535
|
771
|
536 /* would be encapsulatable but for Cygwin problems */
|
800
|
537
|
|
538 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
539 #undef RegConnectRegistry
|
|
540 #define RegConnectRegistry error use qxeRegConnectRegistry or RegConnectRegistryA/RegConnectRegistryW
|
|
541 #endif
|
771
|
542 LONG qxeRegConnectRegistry (const Extbyte * lpMachineName, HKEY hKey, PHKEY phkResult);
|
800
|
543
|
|
544 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
545 #undef ExtractIconEx
|
|
546 #define ExtractIconEx error use qxeExtractIconEx or ExtractIconExA/ExtractIconExW
|
|
547 #endif
|
771
|
548 UINT qxeExtractIconEx (const Extbyte * lpszFile, int nIconIndex, HICON FAR * phiconLarge, HICON FAR * phiconSmall, UINT nIcons);
|
800
|
549
|
|
550 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
551 #undef GetICMProfile
|
|
552 #define GetICMProfile error use qxeGetICMProfile or GetICMProfileA/GetICMProfileW
|
|
553 #endif
|
771
|
554 BOOL qxeGetICMProfile (HDC arg1, LPDWORD arg2, Extbyte * arg3);
|
800
|
555
|
|
556 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
557 #undef UpdateICMRegKey
|
|
558 #define UpdateICMRegKey error use qxeUpdateICMRegKey or UpdateICMRegKeyA/UpdateICMRegKeyW
|
|
559 #endif
|
771
|
560 BOOL qxeUpdateICMRegKey (DWORD arg1, Extbyte * arg2, Extbyte * arg3, UINT arg4);
|
|
561
|
|
562 /* files */
|
800
|
563 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
564 #undef FindFirstFile
|
|
565 #define FindFirstFile error use qxeFindFirstFile or FindFirstFileA/FindFirstFileW
|
|
566 #endif
|
771
|
567 HANDLE qxeFindFirstFile (const Extbyte *lpFileName,
|
|
568 WIN32_FIND_DATAW *lpFindFileData);
|
800
|
569
|
|
570 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
571 #undef FindNextFile
|
|
572 #define FindNextFile error use qxeFindNextFile or FindNextFileA/FindNextFileW
|
|
573 #endif
|
771
|
574 BOOL qxeFindNextFile (HANDLE hFindFile, WIN32_FIND_DATAW *lpFindFileData);
|
|
575
|
|
576 /* shell */
|
800
|
577 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
578 #undef SHGetFileInfo
|
|
579 #define SHGetFileInfo error use qxeSHGetFileInfo or SHGetFileInfoA/SHGetFileInfoW
|
|
580 #endif
|
771
|
581 DWORD qxeSHGetFileInfo (const Extbyte *pszPath, DWORD dwFileAttributes,
|
|
582 SHFILEINFOW *psfi, UINT cbFileInfo, UINT uFlags);
|
800
|
583
|
|
584 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
585 #undef SHBrowseForFolder
|
|
586 #define SHBrowseForFolder error use qxeSHBrowseForFolder or SHBrowseForFolderA/SHBrowseForFolderW
|
|
587 #endif
|
771
|
588 LPITEMIDLIST qxeSHBrowseForFolder (LPBROWSEINFOW lpbi);
|
800
|
589
|
|
590 /* Not Unicode-split */
|
771
|
591 VOID qxeSHAddToRecentDocs (UINT uFlags, LPCVOID pv);
|
800
|
592
|
|
593 /* Not Unicode-split */
|
771
|
594 VOID qxeSHChangeNotify (LONG wEventId, UINT uFlags, LPCVOID dwItem1,
|
|
595 LPCVOID dwItem2);
|
800
|
596
|
|
597 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
598 #undef SHGetDataFromIDList
|
|
599 #define SHGetDataFromIDList error use qxeSHGetDataFromIDList or SHGetDataFromIDListA/SHGetDataFromIDListW
|
|
600 #endif
|
771
|
601 HRESULT qxeSHGetDataFromIDList (IShellFolder *psf, LPCITEMIDLIST pidl,
|
|
602 int nFormat, PVOID pv, int cb);
|
|
603
|
|
604 /* devmode */
|
800
|
605 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
606 #undef CreateDC
|
|
607 #define CreateDC error use qxeCreateDC or CreateDCA/CreateDCW
|
|
608 #endif
|
771
|
609 HDC qxeCreateDC (const Extbyte *lpszDriver, const Extbyte *lpszDevice,
|
|
610 const Extbyte *lpszOutput, CONST DEVMODEW *lpInitData);
|
800
|
611
|
|
612 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
613 #undef ResetDC
|
|
614 #define ResetDC error use qxeResetDC or ResetDCA/ResetDCW
|
|
615 #endif
|
771
|
616 HDC qxeResetDC (HDC hdc, CONST DEVMODEW *lpInitData);
|
800
|
617
|
|
618 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
619 #undef OpenPrinter
|
|
620 #define OpenPrinter error use qxeOpenPrinter or OpenPrinterA/OpenPrinterW
|
|
621 #endif
|
771
|
622 DWORD qxeOpenPrinter (Extbyte *pPrinterName, LPHANDLE phPrinter,
|
|
623 LPPRINTER_DEFAULTSW pDefaultconst);
|
800
|
624
|
|
625 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
626 #undef DocumentProperties
|
|
627 #define DocumentProperties error use qxeDocumentProperties or DocumentPropertiesA/DocumentPropertiesW
|
|
628 #endif
|
771
|
629 LONG qxeDocumentProperties (HWND hWnd, HANDLE hPrinter, Extbyte *pDeviceName,
|
|
630 DEVMODEW *pDevModeOutput, DEVMODEW *pDevModeInput,
|
|
631 DWORD fMode);
|
800
|
632
|
|
633 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
634 #undef PrintDlg
|
|
635 #define PrintDlg error use qxePrintDlg or PrintDlgA/PrintDlgW
|
|
636 #endif
|
771
|
637 BOOL qxePrintDlg (PRINTDLGW *lppd);
|
800
|
638
|
|
639 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
640 #undef PageSetupDlg
|
|
641 #define PageSetupDlg error use qxePageSetupDlg or PageSetupDlgA/PageSetupDlgW
|
|
642 #endif
|
771
|
643 BOOL qxePageSetupDlg (PAGESETUPDLGW *lppd);
|
|
644
|
|
645 /* fonts */
|
800
|
646
|
|
647 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
648 #undef EnumFontFamiliesEx
|
|
649 #define EnumFontFamiliesEx error use qxeEnumFontFamiliesEx or EnumFontFamiliesExA/EnumFontFamiliesExW
|
|
650 #endif
|
771
|
651 int qxeEnumFontFamiliesEx (HDC hdc, LOGFONTW *lpLogfont,
|
|
652 FONTENUMPROCW lpEnumFontFamProc, LPARAM lParam,
|
|
653 DWORD dwFlags);
|
800
|
654
|
|
655 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
656 #undef CreateFontIndirect
|
|
657 #define CreateFontIndirect error use qxeCreateFontIndirect or CreateFontIndirectA/CreateFontIndirectW
|
|
658 #endif
|
771
|
659 HFONT qxeCreateFontIndirect (CONST LOGFONTW *lplf);
|
800
|
660
|
|
661 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
662 #undef ImmSetCompositionFont
|
|
663 #define ImmSetCompositionFont error use qxeImmSetCompositionFont or ImmSetCompositionFontA/ImmSetCompositionFontW
|
|
664 #endif
|
771
|
665 BOOL qxeImmSetCompositionFont (HIMC imc, LOGFONTW *lplf);
|
800
|
666
|
|
667 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
668 #undef ImmGetCompositionFont
|
|
669 #define ImmGetCompositionFont error use qxeImmGetCompositionFont or ImmGetCompositionFontA/ImmGetCompositionFontW
|
|
670 #endif
|
771
|
671 BOOL qxeImmGetCompositionFont (HIMC imc, LOGFONTW *lplf);
|
800
|
672
|
|
673 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
674 #undef GetObject
|
|
675 #define GetObject error use qxeGetObject or GetObjectA/GetObjectW
|
|
676 #endif
|
771
|
677 int qxeGetObject (HGDIOBJ hgdiobj, int cbBuffer, LPVOID lpvObject);
|
800
|
678
|
|
679 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
680 #undef GetTextMetrics
|
|
681 #define GetTextMetrics error use qxeGetTextMetrics or GetTextMetricsA/GetTextMetricsW
|
|
682 #endif
|
771
|
683 BOOL qxeGetTextMetrics (HDC hdc, LPTEXTMETRICW lptm);
|
|
684
|
|
685 /* COMMCTRL.H */
|
800
|
686
|
|
687 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
688 #undef SendMessage
|
|
689 #define SendMessage error use qxeSendMessage or SendMessageA/SendMessageW
|
|
690 #endif
|
771
|
691 LRESULT qxeSendMessage (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
|
692
|
|
693 /* windows */
|
800
|
694
|
|
695 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
696 #undef RegisterClass
|
|
697 #define RegisterClass error use qxeRegisterClass or RegisterClassA/RegisterClassW
|
|
698 #endif
|
771
|
699 ATOM qxeRegisterClass (CONST WNDCLASSW * lpWndClass);
|
800
|
700
|
|
701 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
702 #undef UnregisterClass
|
|
703 #define UnregisterClass error use qxeUnregisterClass or UnregisterClassA/UnregisterClassW
|
|
704 #endif
|
771
|
705 BOOL qxeUnregisterClass (const Extbyte * lpClassName, HINSTANCE hInstance);
|
800
|
706
|
|
707 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
708 #undef RegisterClassEx
|
|
709 #define RegisterClassEx error use qxeRegisterClassEx or RegisterClassExA/RegisterClassExW
|
|
710 #endif
|
771
|
711 ATOM qxeRegisterClassEx (CONST WNDCLASSEXW * arg1);
|
800
|
712
|
|
713 #ifdef ERROR_WHEN_NONINTERCEPTED_FUNS_USED
|
|
714 #undef CreateWindow
|
|
715 #define CreateWindow error use qxeCreateWindow or CreateWindowA/CreateWindowW
|
|
716 #endif
|
771
|
717 #define qxeCreateWindow(lpClassName, lpWindowName, dwStyle, x, y, \
|
|
718 nWidth, nHeight, hWndParent, hMenu, hInstance, \
|
|
719 lpParam) \
|
|
720 qxeCreateWindowEx (0L, lpClassName, lpWindowName, dwStyle, x, y, \
|
|
721 nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)
|
|
722
|
|
723 /* ------------------------- Unicode conversion ------------------------- */
|
|
724
|
|
725 /* Set early in command-line processing, when -nuni or
|
|
726 --no-unicode-lib-calls is seen. */
|
|
727 extern int no_mswin_unicode_lib_calls;
|
|
728 /* Set early, in init_win32_very_early(). */
|
|
729 extern int mswindows_windows9x_p;
|
|
730 #define XEUNICODE_P (!mswindows_windows9x_p && !no_mswin_unicode_lib_calls)
|
|
731
|
|
732 #define XELPTSTR LPWSTR
|
|
733 #define XELPCTSTR LPCWSTR
|
442
|
734
|
|
735 #define XETCHAR_SIZE (XEUNICODE_P ? sizeof (WCHAR) : sizeof (CHAR))
|
|
736 #define MAX_XETCHAR_SIZE sizeof (WCHAR)
|
|
737 #define XETEXT1(arg) (XEUNICODE_P ? ((char *) (L##arg)) : (arg))
|
|
738 /* We need to do this indirection in case ARG is also a manifest constant.
|
|
739 I don't really understand why. --ben */
|
|
740 #define XETEXT(arg) XETEXT1(arg)
|
|
741 #define XECOPY_TCHAR(ptr, ch) \
|
|
742 (XEUNICODE_P ? (* (LPWSTR) (ptr) = L##ch) : (* (LPSTR) (ptr) = (ch)))
|
771
|
743 #define xetcslen(arg) \
|
|
744 (XEUNICODE_P ? wcslen ((wchar_t *) arg) : strlen (arg))
|
|
745 #define xetcsbytelen(arg) \
|
|
746 (XEUNICODE_P ? wcslen ((wchar_t *) arg) * XETCHAR_SIZE : strlen (arg))
|
442
|
747 #define xetcscmp(s1, s2) \
|
|
748 (XEUNICODE_P ? wcscmp ((wchar_t *) s1, (wchar_t *) s2) \
|
|
749 : strcmp (s1, s2))
|
|
750 #define xetcscpy(s1, s2) \
|
|
751 (XEUNICODE_P ? (char *) wcscpy ((wchar_t *) s1, (wchar_t *) s2) \
|
|
752 : strcpy (s1, s2))
|
771
|
753 #define xetcsncpy(s1, s2, n) \
|
|
754 (XEUNICODE_P ? (char *) wcsncpy ((wchar_t *) s1, (wchar_t *) s2, n) \
|
|
755 : strncpy (s1, s2, n))
|
442
|
756 #define xetcschr(s, ch) \
|
|
757 (XEUNICODE_P ? (char *) wcschr ((wchar_t *) s, (WCHAR) ch) \
|
|
758 : strchr (s, ch))
|
|
759 #define xetcsrchr(s, ch) \
|
|
760 (XEUNICODE_P ? (char *) wcsrchr ((wchar_t *) s, (WCHAR) ch) \
|
|
761 : strrchr (s, ch))
|
771
|
762 #define xetcsdup(s) \
|
|
763 (XEUNICODE_P ? (char *) wcsdup ((wchar_t *) s) \
|
|
764 : xstrdup (s))
|
442
|
765
|
771
|
766 #define C_STRING_TO_TSTR(in, out) \
|
|
767 C_STRING_TO_EXTERNAL (in, out, Qmswindows_tstr)
|
|
768 #define LISP_STRING_TO_TSTR(in, out) \
|
|
769 LISP_STRING_TO_EXTERNAL (in, out, Qmswindows_tstr)
|
|
770 #define TSTR_TO_C_STRING(in, out) \
|
|
771 EXTERNAL_TO_C_STRING (in, out, Qmswindows_tstr)
|
|
772 #define TSTR_TO_C_STRING_MALLOC(in, out) \
|
|
773 EXTERNAL_TO_C_STRING_MALLOC (in, out, Qmswindows_tstr)
|
|
774
|
|
775 #define build_tstr_string(in) \
|
|
776 make_ext_string (in, xetcsbytelen ((Extbyte *) in), Qmswindows_tstr)
|
|
777
|
|
778 #define MAX_ANSI_CHAR_LEN 1
|
|
779 #define MAX_UNICODE_CHAR_LEN 2
|
|
780
|
|
781 DECLARE_INLINE_HEADER (int ansi_char_to_text (int ch, Extbyte *t))
|
|
782 {
|
|
783 ch &= 0xFF;
|
|
784 t[0] = ch;
|
|
785 return 1;
|
|
786 }
|
|
787
|
|
788 DECLARE_INLINE_HEADER (int unicode_char_to_text (int ch, Extbyte *t))
|
|
789 {
|
|
790 t[0] = ch & 0xFF;
|
|
791 t[1] = (ch >> 8) & 0xFF;
|
|
792 return 2;
|
|
793 }
|
442
|
794
|
771
|
795 Extbyte *convert_multibyte_to_unicode_malloc (const Extbyte *src,
|
|
796 Bytecount n,
|
|
797 int cp, Bytecount *size_out);
|
|
798 Intbyte *convert_multibyte_to_internal_malloc (const Extbyte *src,
|
|
799 Bytecount n,
|
|
800 int cp, Bytecount *size_out);
|
|
801 void convert_multibyte_to_unicode_dynarr (const Extbyte *src, Bytecount n,
|
|
802 int cp, unsigned_char_dynarr *dst);
|
|
803
|
|
804 /* ------------------------- Other Mule stuff ------------------------- */
|
|
805
|
|
806 LCID mswindows_current_locale (void);
|
|
807 int mswindows_locale_to_code_page (LCID lcid);
|
|
808 int mswindows_locale_to_oem_code_page (LCID lcid);
|
|
809
|
|
810 /* ------------------------- Filename conversion ------------------------- */
|
|
811
|
|
812 #ifdef CYGWIN
|
|
813 #ifdef __cplusplus
|
|
814 extern "C" {
|
|
815 #endif
|
|
816 void cygwin_win32_to_posix_path_list (const char *, char *);
|
|
817 int cygwin_win32_to_posix_path_list_buf_size (const char *);
|
|
818 void cygwin_posix_to_win32_path_list (const char *, char *);
|
|
819 int cygwin_posix_to_win32_path_list_buf_size (const char *);
|
|
820 #ifdef __cplusplus
|
|
821 }
|
|
822 #endif
|
|
823 #endif
|
|
824
|
|
825 #define LOCAL_FILE_FORMAT_TO_TSTR(path, out) \
|
|
826 do { \
|
|
827 Intbyte *lttff; \
|
|
828 \
|
|
829 LOCAL_TO_WIN32_FILE_FORMAT (XSTRING_DATA (path), lttff); \
|
|
830 C_STRING_TO_TSTR (lttff, out); \
|
442
|
831 } while (0)
|
|
832
|
|
833 Lisp_Object tstr_to_local_file_format (Extbyte *pathout);
|
|
834
|
|
835 #ifdef CYGWIN
|
771
|
836 #define LOCAL_TO_WIN32_FILE_FORMAT(path, pathout) \
|
|
837 do { \
|
|
838 /* NOTE: It is a bit evil that here and below we are passing \
|
|
839 internal-format data to a function that (nominally) should work \
|
|
840 with external-format data. But in point of fact, the Cygwin \
|
|
841 conversion functions are *NOT* localized, and will fail if they \
|
|
842 get 7-bit ISO2022-encoded data. We know that our internal format \
|
|
843 is ASCII-compatible, and so these functions will work fine with \
|
|
844 this data. */ \
|
|
845 Intbyte *ltwffp = (path); \
|
|
846 if (isalpha (ltwffp[0]) && (IS_DEVICE_SEP (ltwffp[1]))) \
|
|
847 pathout = ltwffp; \
|
|
848 else \
|
|
849 { \
|
|
850 int ltwff2 = \
|
|
851 cygwin_posix_to_win32_path_list_buf_size ((char *) ltwffp); \
|
|
852 pathout = (Intbyte *) alloca (ltwff2); \
|
|
853 cygwin_posix_to_win32_path_list ((char *) ltwffp, (char *) pathout); \
|
|
854 } \
|
442
|
855 } while (0)
|
|
856 #else
|
|
857 #define LOCAL_TO_WIN32_FILE_FORMAT(path, pathout) \
|
|
858 do { \
|
771
|
859 (pathout) = (path); \
|
442
|
860 } while (0)
|
|
861 #endif
|
|
862
|
|
863 #ifdef CYGWIN
|
593
|
864 #define WIN32_TO_LOCAL_FILE_FORMAT(path, pathout) \
|
|
865 do { \
|
665
|
866 Intbyte *wtlff1 = (path); \
|
593
|
867 int wtlff2 = \
|
|
868 cygwin_win32_to_posix_path_list_buf_size ((char *) wtlff1); \
|
665
|
869 Intbyte *wtlff3 = (Intbyte *) alloca (wtlff2); \
|
593
|
870 cygwin_win32_to_posix_path_list ((char *) wtlff1, (char *) wtlff3); \
|
771
|
871 (pathout) = wtlff3; \
|
442
|
872 } while (0)
|
|
873 #else
|
|
874 #define WIN32_TO_LOCAL_FILE_FORMAT(path, pathout) \
|
|
875 do { \
|
771
|
876 (pathout) = (path); \
|
442
|
877 } while (0)
|
|
878 #endif
|
|
879
|
771
|
880 Intbyte *urlify_filename (Intbyte *filename);
|
|
881 Intbyte *mswindows_canonicalize_filename (Intbyte *name);
|
|
882 #define MSWINDOWS_NORMALIZE_FILENAME(name) \
|
|
883 INTBYTE_STRING_TO_ALLOCA (mswindows_canonicalize_filename (name), name)
|
|
884
|
|
885 /* ------------------- Functions needed dynamic binding ------------------- */
|
|
886
|
|
887 typedef BOOL (WINAPI *pfSwitchToThread_t) (VOID);
|
|
888
|
|
889 typedef NET_API_STATUS (NET_API_FUNCTION *pfNetUserEnum_t)
|
|
890 (LPCWSTR, DWORD, DWORD, LPBYTE *, DWORD, LPDWORD, LPDWORD, LPDWORD);
|
|
891 typedef NET_API_STATUS (NET_API_FUNCTION *pfNetApiBufferFree_t) (LPVOID);
|
|
892
|
|
893 extern pfSwitchToThread_t xSwitchToThread;
|
|
894
|
|
895 extern pfNetUserEnum_t xNetUserEnum;
|
|
896 extern pfNetApiBufferFree_t xNetApiBufferFree;
|
|
897
|
|
898 /* --------- Useful routines for manipulating memory-mapped files -------- */
|
|
899
|
|
900 typedef struct file_data
|
|
901 {
|
|
902 const Intbyte *name;
|
|
903 unsigned long size;
|
|
904 HANDLE file;
|
|
905 HANDLE file_mapping;
|
|
906 void *file_base;
|
|
907 } file_data;
|
|
908
|
|
909 #define OFFSET_TO_RVA(var,section) \
|
|
910 (section->VirtualAddress + \
|
|
911 ((DWORD)(var) - section->PointerToRawData))
|
|
912
|
|
913 #define RVA_TO_OFFSET(var,section) \
|
|
914 (section->PointerToRawData + \
|
|
915 ((DWORD)(var) - section->VirtualAddress))
|
442
|
916
|
771
|
917 #define RVA_TO_PTR(var,section,filedata) \
|
|
918 ((void *)(RVA_TO_OFFSET(var,section) + \
|
|
919 (char *)(filedata).file_base))
|
|
920
|
|
921 int open_input_file (file_data *p_file, const Intbyte *name);
|
|
922 int open_output_file (file_data *p_file, const Intbyte *name,
|
|
923 unsigned long size);
|
|
924 void close_file_data (file_data *p_file);
|
|
925
|
|
926 /* ------------------------- Heap related stuff ------------------------- */
|
|
927
|
|
928 #ifdef WIN32_NATIVE
|
442
|
929
|
771
|
930 #define get_reserved_heap_size() reserved_heap_size
|
|
931 #define get_committed_heap_size() (get_data_end () - get_data_start ())
|
|
932 #define get_heap_start() get_data_start ()
|
|
933 #define get_heap_end() get_data_end ()
|
|
934 #define get_page_size() sysinfo_cache.dwPageSize
|
|
935 #define get_allocation_unit() sysinfo_cache.dwAllocationGranularity
|
|
936 #define get_processor_type() sysinfo_cache.dwProcessorType
|
|
937 #define get_nt_major_version() nt_major_version
|
|
938 #define get_nt_minor_version() nt_minor_version
|
|
939
|
814
|
940 unsigned char *get_data_start (void);
|
|
941 unsigned char *get_data_end (void);
|
771
|
942 extern unsigned long data_region_size;
|
|
943 extern unsigned long reserved_heap_size;
|
|
944 extern SYSTEM_INFO sysinfo_cache;
|
|
945 extern int nt_major_version;
|
|
946 extern int nt_minor_version;
|
|
947
|
|
948 /* To prevent zero-initialized variables from being placed into the bss
|
|
949 section, use non-zero values to represent an uninitialized state. */
|
|
950 #define UNINIT_PTR ((unsigned char*) 0xF0A0F0A0)
|
|
951 #define UNINIT_LONG (0xF0A0F0A0L)
|
|
952
|
|
953 /* Recreate the heap created during dumping. */
|
814
|
954 void recreate_heap (Extbyte *executable_path);
|
771
|
955
|
|
956 /* Round the heap to this size. */
|
814
|
957 void round_heap (unsigned long size);
|
771
|
958
|
|
959 /* Load in the dumped .bss section. */
|
814
|
960 void read_in_bss (Extbyte *name);
|
771
|
961
|
|
962 /* Map in the dumped heap. */
|
814
|
963 void map_in_heap (Extbyte *name);
|
771
|
964
|
|
965 /* Cache system info, e.g., the NT page size. */
|
814
|
966 void cache_system_info (void);
|
771
|
967
|
|
968 /* Round ADDRESS up to be aligned with ALIGN. */
|
814
|
969 unsigned char *round_to_next (unsigned char *address,
|
|
970 unsigned long align);
|
771
|
971 #endif /* WIN32_NATIVE */
|
|
972
|
|
973 /* ------------------------- Misc prototypes ------------------------- */
|
|
974
|
|
975 #ifdef WIN32_NATIVE
|
|
976 DECLARE_INLINE_HEADER (int strcasecmp (const char *a, const char *b))
|
|
977 {
|
|
978 return qxestrcasecmp ((const Intbyte *) a, (const Intbyte *) b);
|
|
979 }
|
|
980 #endif /* WIN32_NATIVE */
|
442
|
981
|
771
|
982 /* in nt.c */
|
|
983 int mswindows_access (const Intbyte *path, int mode);
|
|
984 int mswindows_link (const Intbyte *old, const Intbyte *new);
|
|
985 int mswindows_rename (const Intbyte *oldname, const Intbyte *newname);
|
|
986 int mswindows_unlink (const Intbyte *path);
|
|
987 int mswindows_stat (const Intbyte *path, struct stat *buf);
|
|
988 int mswindows_fstat (int desc, struct stat *buf);
|
|
989 time_t mswindows_convert_time (FILETIME ft);
|
|
990 void mswindows_executable_type (const Intbyte * filename, int * is_dos_app,
|
|
991 int * is_cygnus_app);
|
|
992 Intbyte *mswindows_getdcwd (int drivelet);
|
|
993
|
|
994 /* In process-nt.c */
|
|
995 extern int mswindows_compare_env (const void *strp1, const void *strp2);
|
|
996
|
|
997 /* in win32.c */
|
814
|
998 Extbyte *mswindows_get_module_file_name (void);
|
771
|
999 void mswindows_output_last_error (char *frob);
|
|
1000 DECLARE_DOESNT_RETURN (mswindows_report_process_error (const char *string,
|
|
1001 Lisp_Object data,
|
|
1002 int errnum));
|
|
1003 Lisp_Object mswindows_lisp_error (int errnum);
|
|
1004
|
442
|
1005 #endif /* INCLUDED_syswindows_h_ */
|