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