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