442
|
1 /* Copyright (C) 2000 Free Software Foundation, Inc.
|
558
|
2 Copyright (C) 2000, 2001 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
|
|
25 Created May 2000 by Andy Piper.
|
|
26 Windows-Mule stuff added by Ben Wing.
|
|
27 */
|
|
28
|
|
29 #ifndef INCLUDED_syswindows_h_
|
|
30 #define INCLUDED_syswindows_h_
|
|
31
|
|
32 /* Note that there are currently FOUR different general
|
|
33 Windows-related include files in src!
|
|
34
|
|
35 Uses are approximately:
|
|
36
|
|
37 syswindows.h: Mostly a wrapper around <windows.h>, including missing
|
|
38 defines as necessary. Also includes stuff needed on both Cygwin and
|
|
39 native Windows, regardless of window system chosen.
|
|
40
|
|
41 console-msw.h: Used on both Cygwin and native Windows, but only when
|
|
42 native window system (as opposed to X) chosen.
|
|
43
|
|
44 nt.h: [will be renamed to win32.h] Used only on native Windows, and
|
|
45 regardless of window system chosen -- but used on both purely native
|
|
46 Windows (s/windowsnt.h) and MinGW (s/mingw32.h).
|
|
47
|
|
48 ntheap.h: Used only on native Windows and only when standard dumping
|
|
49 mechanism (unexnt.c) used.
|
|
50
|
|
51 All of the last three files include the first.
|
|
52 */
|
|
53
|
|
54 #ifndef WIN32_LEAN_AND_MEAN
|
|
55 #define WIN32_LEAN_AND_MEAN
|
|
56 #endif
|
|
57
|
665
|
58 #if defined (CYGWIN) || defined (MINGW)
|
|
59
|
|
60 #ifdef __cplusplus
|
|
61 extern "C" {
|
|
62 #endif
|
|
63
|
|
64 /* Fucking GCC complains about "no previous prototype" for inline
|
|
65 functions. DUH! See DECLARE_INLINE_HEADER. */
|
|
66 extern __inline void *GetCurrentFiber (void);
|
|
67 extern __inline void *GetFiberData (void);
|
|
68
|
|
69 #ifdef __cplusplus
|
|
70 }
|
|
71 #endif
|
|
72
|
|
73 #endif
|
|
74
|
442
|
75 #include <windows.h>
|
|
76
|
558
|
77 #if defined (WIN32_LEAN_AND_MEAN)
|
|
78 # ifdef HAVE_X_WINDOWS
|
442
|
79 /* Christ almighty. The problems you get when combining two large code bases,
|
|
80 neither with any respect for namespace purity. */
|
558
|
81 # undef Status
|
|
82 # endif
|
|
83 # include <winspool.h>
|
|
84 # ifdef HAVE_X_WINDOWS
|
|
85 # define Status int
|
|
86 # endif
|
|
87 # include <mmsystem.h>
|
673
|
88 # include <shlobj.h>
|
558
|
89 # include <shellapi.h>
|
|
90 # include <ddeml.h>
|
442
|
91 #endif
|
|
92
|
546
|
93 #include <lmaccess.h> /* next three for NetUserEnum and friends */
|
531
|
94 #include <lmapibuf.h>
|
|
95 #include <lmerr.h>
|
546
|
96 #include <lmcons.h> /* for UNLEN and possibly other constants */
|
531
|
97
|
442
|
98 /* mmsystem.h defines. */
|
|
99 #ifndef SND_ASYNC
|
|
100 #define SND_ASYNC 1
|
|
101 #endif
|
|
102 #ifndef SND_NODEFAULT
|
|
103 #define SND_NODEFAULT 2
|
|
104 #endif
|
|
105 #ifndef SND_MEMORY
|
|
106 #define SND_MEMORY 4
|
|
107 #endif
|
|
108 #ifndef SND_FILENAME
|
|
109 #define SND_FILENAME 0x2000L
|
|
110 #endif
|
|
111
|
|
112 /* winspool.h defines. */
|
|
113 #ifndef PHYSICALWIDTH
|
|
114 #define PHYSICALWIDTH 110
|
|
115 #endif
|
|
116 #ifndef PHYSICALHEIGHT
|
|
117 #define PHYSICALHEIGHT 111
|
|
118 #endif
|
|
119 #ifndef PHYSICALOFFSETX
|
|
120 #define PHYSICALOFFSETX 112
|
|
121 #endif
|
|
122 #ifndef PHYSICALOFFSETY
|
|
123 #define PHYSICALOFFSETY 113
|
|
124 #endif
|
|
125
|
673
|
126 /* shlobj.h defines. */
|
|
127 #ifndef BIF_EDITBOX
|
|
128 #define BIF_EDITBOX 0x10
|
|
129 #endif
|
|
130 #ifndef BIF_VALIDATE
|
|
131 #define BIF_VALIDATE 0x20
|
|
132 #endif
|
|
133 #ifndef BFFM_VALIDATEFAILED
|
|
134 #define BFFM_VALIDATEFAILED 3
|
|
135 #endif
|
|
136
|
442
|
137 /* windows.h defines. */
|
|
138 #if defined (CYGWIN) && (CYGWIN_VERSION_DLL_MAJOR < 20)
|
|
139 typedef NMHDR *LPNMHDR;
|
|
140 #endif
|
|
141
|
|
142 #ifndef SPI_GETWHEELSCROLLLINES
|
|
143 #define SPI_GETWHEELSCROLLLINES 104
|
|
144 #endif
|
|
145 #ifndef WHEEL_PAGESCROLL
|
|
146 #define WHEEL_PAGESCROLL (UINT_MAX)
|
|
147 #endif
|
|
148 #ifndef WHEEL_DELTA
|
|
149 #define WHEEL_DELTA 120
|
|
150 #endif
|
|
151 #ifndef WM_MOUSEWHEEL
|
|
152 #define WM_MOUSEWHEEL 0x20A
|
|
153 #endif
|
|
154 #ifndef VK_APPS
|
|
155 #define VK_APPS 0x5D
|
|
156 #endif
|
|
157 #ifndef SIF_TRACKPOS
|
|
158 #define SIF_TRACKPOS 0x0010
|
|
159 #endif
|
|
160 #ifndef FW_BLACK
|
|
161 #define FW_BLACK FW_HEAVY
|
|
162 #endif
|
|
163 #ifndef FW_ULTRABOLD
|
|
164 #define FW_ULTRABOLD FW_EXTRABOLD
|
|
165 #endif
|
|
166 #ifndef FW_DEMIBOLD
|
|
167 #define FW_DEMIBOLD FW_SEMIBOLD
|
|
168 #endif
|
|
169 #ifndef FW_ULTRALIGHT
|
|
170 #define FW_ULTRALIGHT FW_EXTRALIGHT
|
|
171 #endif
|
|
172 #ifndef APPCMD_FILTERINITS
|
|
173 #define APPCMD_FILTERINITS 0x20L
|
|
174 #endif
|
|
175 #ifndef CBF_FAIL_SELFCONNECTIONS
|
|
176 #define CBF_FAIL_SELFCONNECTIONS 0x1000
|
|
177 #endif
|
|
178 #ifndef CBF_SKIP_ALLNOTIFICATIONS
|
|
179 #define CBF_SKIP_ALLNOTIFICATIONS 0x3C0000
|
|
180 #endif
|
|
181 #ifndef CBF_FAIL_ADVISES
|
|
182 #define CBF_FAIL_ADVISES 0x4000
|
|
183 #endif
|
|
184 #ifndef CBF_FAIL_POKES
|
|
185 #define CBF_FAIL_POKES 0x10000
|
|
186 #endif
|
|
187 #ifndef CBF_FAIL_REQUESTS
|
|
188 #define CBF_FAIL_REQUESTS 0x20000
|
|
189 #endif
|
|
190 #ifndef SZDDESYS_TOPIC
|
|
191 #define SZDDESYS_TOPIC "System"
|
|
192 #endif
|
|
193 #ifndef JOHAB_CHARSET
|
|
194 #define JOHAB_CHARSET 130
|
|
195 #endif
|
|
196 #ifndef MAC_CHARSET
|
|
197 #define MAC_CHARSET 77
|
|
198 #endif
|
|
199
|
|
200 /***************************************************************/
|
|
201
|
|
202 /* Definitions for Mule under MS Windows */
|
|
203
|
|
204 #include <wchar.h>
|
|
205
|
|
206 #ifdef CYGWIN
|
|
207
|
|
208 /* All but wcscmp and wcslen left out of Cygwin headers -- but present
|
|
209 in /usr/include/mingw32/string.h! */
|
|
210 wchar_t* wcscat (wchar_t*, const wchar_t*);
|
|
211 wchar_t* wcschr (const wchar_t*, wchar_t);
|
|
212 int wcscoll (const wchar_t*, const wchar_t*);
|
|
213 wchar_t* wcscpy (wchar_t*, const wchar_t*);
|
|
214 size_t wcscspn (const wchar_t*, const wchar_t*);
|
|
215 /* Note: No wcserror in CRTDLL. */
|
|
216 wchar_t* wcsncat (wchar_t*, const wchar_t*, size_t);
|
|
217 int wcsncmp(const wchar_t*, const wchar_t*, size_t);
|
|
218 wchar_t* wcsncpy(wchar_t*, const wchar_t*, size_t);
|
|
219 wchar_t* wcspbrk(const wchar_t*, const wchar_t*);
|
|
220 wchar_t* wcsrchr(const wchar_t*, wchar_t);
|
|
221 size_t wcsspn(const wchar_t*, const wchar_t*);
|
|
222 wchar_t* wcsstr(const wchar_t*, const wchar_t*);
|
|
223 wchar_t* wcstok(wchar_t*, const wchar_t*);
|
|
224 size_t wcsxfrm(wchar_t*, const wchar_t*, size_t);
|
|
225
|
|
226 #endif /* CYGWIN */
|
|
227
|
|
228 // extern int mswindows_windows9x_p;
|
|
229 /* #define XEUNICODE_P (!mswindows_windows9x_p) */
|
|
230 #define XEUNICODE_P 0
|
|
231
|
|
232 #define XETCHAR_SIZE (XEUNICODE_P ? sizeof (WCHAR) : sizeof (CHAR))
|
|
233 #define MAX_XETCHAR_SIZE sizeof (WCHAR)
|
|
234 #define XETEXT1(arg) (XEUNICODE_P ? ((char *) (L##arg)) : (arg))
|
|
235 /* We need to do this indirection in case ARG is also a manifest constant.
|
|
236 I don't really understand why. --ben */
|
|
237 #define XETEXT(arg) XETEXT1(arg)
|
|
238 #define XECOPY_TCHAR(ptr, ch) \
|
|
239 (XEUNICODE_P ? (* (LPWSTR) (ptr) = L##ch) : (* (LPSTR) (ptr) = (ch)))
|
|
240 #define xetcslen(arg) (XEUNICODE_P ? wcslen ((wchar_t *) arg) : strlen (arg))
|
|
241 #define xetcscmp(s1, s2) \
|
|
242 (XEUNICODE_P ? wcscmp ((wchar_t *) s1, (wchar_t *) s2) \
|
|
243 : strcmp (s1, s2))
|
|
244 #define xetcscpy(s1, s2) \
|
|
245 (XEUNICODE_P ? (char *) wcscpy ((wchar_t *) s1, (wchar_t *) s2) \
|
|
246 : strcpy (s1, s2))
|
|
247 #define xetcschr(s, ch) \
|
|
248 (XEUNICODE_P ? (char *) wcschr ((wchar_t *) s, (WCHAR) ch) \
|
|
249 : strchr (s, ch))
|
|
250 #define xetcsrchr(s, ch) \
|
|
251 (XEUNICODE_P ? (char *) wcsrchr ((wchar_t *) s, (WCHAR) ch) \
|
|
252 : strrchr (s, ch))
|
|
253
|
|
254
|
|
255 #define LOCAL_FILE_FORMAT_TO_TSTR(path, out) \
|
|
256 do { \
|
665
|
257 Intbyte *lttff; \
|
442
|
258 \
|
|
259 LOCAL_TO_WIN32_FILE_FORMAT (path, lttff); \
|
|
260 C_STRING_TO_EXTERNAL (lttff, out, Qmswindows_tstr); \
|
|
261 } while (0)
|
|
262
|
|
263 Lisp_Object tstr_to_local_file_format (Extbyte *pathout);
|
|
264
|
|
265 #ifdef CYGWIN
|
|
266 #define LOCAL_TO_WIN32_FILE_FORMAT(path, pathout) \
|
|
267 do { \
|
593
|
268 /* NOTE: It is a bit evil that here and below we are passing \
|
|
269 internal-format data to a function that (nominally) should work \
|
|
270 with external-format data. But in point of fact, the Cygwin \
|
|
271 conversion functions are *NOT* localized, and will fail if they \
|
|
272 get 7-bit ISO2022-encoded data. We know that our internal format \
|
|
273 is ASCII-compatible, and so these functions will work fine with \
|
|
274 this data. */ \
|
442
|
275 Lisp_Object ltwff1 = (path); \
|
673
|
276 Intbyte* ltwffp = XSTRING_DATA (ltwff1); \
|
|
277 if (isalpha (ltwffp[0]) && (IS_DEVICE_SEP (ltwffp[1]))) \
|
|
278 pathout = ltwffp; \
|
|
279 else { \
|
|
280 int ltwff2 = \
|
|
281 cygwin_posix_to_win32_path_list_buf_size ((char*)ltwffp); \
|
|
282 pathout = (Intbyte *) alloca (ltwff2); \
|
|
283 cygwin_posix_to_win32_path_list ((char*) ltwffp, (char*) pathout); \
|
|
284 } \
|
442
|
285 } while (0)
|
|
286 #else
|
|
287 #define LOCAL_TO_WIN32_FILE_FORMAT(path, pathout) \
|
|
288 do { \
|
|
289 (pathout) = XSTRING_DATA (path); \
|
|
290 } while (0)
|
|
291 #endif
|
|
292
|
|
293 #ifdef CYGWIN
|
593
|
294 #define WIN32_TO_LOCAL_FILE_FORMAT(path, pathout) \
|
|
295 do { \
|
665
|
296 Intbyte *wtlff1 = (path); \
|
593
|
297 int wtlff2 = \
|
|
298 cygwin_win32_to_posix_path_list_buf_size ((char *) wtlff1); \
|
665
|
299 Intbyte *wtlff3 = (Intbyte *) alloca (wtlff2); \
|
593
|
300 cygwin_win32_to_posix_path_list ((char *) wtlff1, (char *) wtlff3); \
|
665
|
301 (pathout) = build_string ((CIntbyte *) wtlff3); \
|
442
|
302 } while (0)
|
|
303 #else
|
|
304 #define WIN32_TO_LOCAL_FILE_FORMAT(path, pathout) \
|
|
305 do { \
|
665
|
306 (pathout) = build_string ((CIntbyte *) path); \
|
442
|
307 } while (0)
|
|
308 #endif
|
|
309
|
|
310 extern BOOL (WINAPI *xSwitchToThread) (VOID);
|
|
311
|
|
312 extern HKL (WINAPI *xGetKeyboardLayout) (DWORD);
|
|
313 extern BOOL (WINAPI *xSetMenuDefaultItem) (HMENU, UINT, UINT);
|
|
314 extern BOOL (WINAPI *xInsertMenuItemA) (HMENU, UINT, BOOL, LPCMENUITEMINFOA);
|
|
315 extern BOOL (WINAPI *xInsertMenuItemW) (HMENU, UINT, BOOL, LPCMENUITEMINFOW);
|
|
316 extern HANDLE (WINAPI *xLoadImageA) (HINSTANCE, LPCSTR, UINT, int, int, UINT);
|
|
317 extern HANDLE (WINAPI *xLoadImageW) (HINSTANCE, LPCWSTR, UINT, int, int, UINT);
|
|
318 extern ATOM (WINAPI *xRegisterClassExA) (CONST WNDCLASSEXA *);
|
|
319 extern ATOM (WINAPI *xRegisterClassExW) (CONST WNDCLASSEXW *);
|
|
320
|
|
321 extern int (WINAPI *xEnumFontFamiliesExA) (HDC, LPLOGFONTA, FONTENUMPROCA,
|
|
322 LPARAM, DWORD);
|
|
323 extern int (WINAPI *xEnumFontFamiliesExW) (HDC, LPLOGFONTW, FONTENUMPROCW,
|
|
324 LPARAM, DWORD);
|
|
325
|
|
326 extern DWORD (WINAPI *xSHGetFileInfoA) (LPCSTR, DWORD, SHFILEINFOA FAR *, UINT,
|
|
327 UINT);
|
|
328 extern DWORD (WINAPI *xSHGetFileInfoW) (LPCWSTR, DWORD, SHFILEINFOW FAR *,
|
|
329 UINT, UINT);
|
|
330
|
531
|
331 extern NET_API_STATUS (NET_API_FUNCTION *xNetUserEnum)
|
|
332 (
|
|
333 IN LPCWSTR servername OPTIONAL,
|
|
334 IN DWORD level,
|
|
335 IN DWORD filter,
|
|
336 OUT LPBYTE *bufptr,
|
|
337 IN DWORD prefmaxlen,
|
|
338 OUT LPDWORD entriesread,
|
|
339 OUT LPDWORD totalentries,
|
|
340 IN OUT LPDWORD resume_handle OPTIONAL
|
|
341 );
|
|
342
|
|
343 extern NET_API_STATUS (NET_API_FUNCTION *xNetApiBufferFree)
|
|
344 (
|
|
345 IN LPVOID Buffer
|
|
346 );
|
|
347
|
442
|
348 #endif /* INCLUDED_syswindows_h_ */
|