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
|
|
58 #include <windows.h>
|
|
59
|
558
|
60 #if defined (WIN32_LEAN_AND_MEAN)
|
|
61 # ifdef HAVE_X_WINDOWS
|
442
|
62 /* Christ almighty. The problems you get when combining two large code bases,
|
|
63 neither with any respect for namespace purity. */
|
558
|
64 # undef Status
|
|
65 # endif
|
|
66 # include <winspool.h>
|
|
67 # ifdef HAVE_X_WINDOWS
|
|
68 # define Status int
|
|
69 # endif
|
|
70 # include <mmsystem.h>
|
|
71 # include <shellapi.h>
|
|
72 # include <ddeml.h>
|
442
|
73 #endif
|
|
74
|
546
|
75 #include <lmaccess.h> /* next three for NetUserEnum and friends */
|
531
|
76 #include <lmapibuf.h>
|
|
77 #include <lmerr.h>
|
546
|
78 #include <lmcons.h> /* for UNLEN and possibly other constants */
|
531
|
79
|
442
|
80 /* mmsystem.h defines. */
|
|
81 #ifndef SND_ASYNC
|
|
82 #define SND_ASYNC 1
|
|
83 #endif
|
|
84 #ifndef SND_NODEFAULT
|
|
85 #define SND_NODEFAULT 2
|
|
86 #endif
|
|
87 #ifndef SND_MEMORY
|
|
88 #define SND_MEMORY 4
|
|
89 #endif
|
|
90 #ifndef SND_FILENAME
|
|
91 #define SND_FILENAME 0x2000L
|
|
92 #endif
|
|
93
|
|
94 /* winspool.h defines. */
|
|
95 #ifndef PHYSICALWIDTH
|
|
96 #define PHYSICALWIDTH 110
|
|
97 #endif
|
|
98 #ifndef PHYSICALHEIGHT
|
|
99 #define PHYSICALHEIGHT 111
|
|
100 #endif
|
|
101 #ifndef PHYSICALOFFSETX
|
|
102 #define PHYSICALOFFSETX 112
|
|
103 #endif
|
|
104 #ifndef PHYSICALOFFSETY
|
|
105 #define PHYSICALOFFSETY 113
|
|
106 #endif
|
|
107
|
|
108 /* windows.h defines. */
|
|
109 #if defined (CYGWIN) && (CYGWIN_VERSION_DLL_MAJOR < 20)
|
|
110 typedef NMHDR *LPNMHDR;
|
|
111 #endif
|
|
112
|
|
113 #ifndef SPI_GETWHEELSCROLLLINES
|
|
114 #define SPI_GETWHEELSCROLLLINES 104
|
|
115 #endif
|
|
116 #ifndef WHEEL_PAGESCROLL
|
|
117 #define WHEEL_PAGESCROLL (UINT_MAX)
|
|
118 #endif
|
|
119 #ifndef WHEEL_DELTA
|
|
120 #define WHEEL_DELTA 120
|
|
121 #endif
|
|
122 #ifndef WM_MOUSEWHEEL
|
|
123 #define WM_MOUSEWHEEL 0x20A
|
|
124 #endif
|
|
125 #ifndef VK_APPS
|
|
126 #define VK_APPS 0x5D
|
|
127 #endif
|
|
128 #ifndef SIF_TRACKPOS
|
|
129 #define SIF_TRACKPOS 0x0010
|
|
130 #endif
|
|
131 #ifndef FW_BLACK
|
|
132 #define FW_BLACK FW_HEAVY
|
|
133 #endif
|
|
134 #ifndef FW_ULTRABOLD
|
|
135 #define FW_ULTRABOLD FW_EXTRABOLD
|
|
136 #endif
|
|
137 #ifndef FW_DEMIBOLD
|
|
138 #define FW_DEMIBOLD FW_SEMIBOLD
|
|
139 #endif
|
|
140 #ifndef FW_ULTRALIGHT
|
|
141 #define FW_ULTRALIGHT FW_EXTRALIGHT
|
|
142 #endif
|
|
143 #ifndef APPCMD_FILTERINITS
|
|
144 #define APPCMD_FILTERINITS 0x20L
|
|
145 #endif
|
|
146 #ifndef CBF_FAIL_SELFCONNECTIONS
|
|
147 #define CBF_FAIL_SELFCONNECTIONS 0x1000
|
|
148 #endif
|
|
149 #ifndef CBF_SKIP_ALLNOTIFICATIONS
|
|
150 #define CBF_SKIP_ALLNOTIFICATIONS 0x3C0000
|
|
151 #endif
|
|
152 #ifndef CBF_FAIL_ADVISES
|
|
153 #define CBF_FAIL_ADVISES 0x4000
|
|
154 #endif
|
|
155 #ifndef CBF_FAIL_POKES
|
|
156 #define CBF_FAIL_POKES 0x10000
|
|
157 #endif
|
|
158 #ifndef CBF_FAIL_REQUESTS
|
|
159 #define CBF_FAIL_REQUESTS 0x20000
|
|
160 #endif
|
|
161 #ifndef SZDDESYS_TOPIC
|
|
162 #define SZDDESYS_TOPIC "System"
|
|
163 #endif
|
|
164 #ifndef JOHAB_CHARSET
|
|
165 #define JOHAB_CHARSET 130
|
|
166 #endif
|
|
167 #ifndef MAC_CHARSET
|
|
168 #define MAC_CHARSET 77
|
|
169 #endif
|
|
170
|
|
171 /***************************************************************/
|
|
172
|
|
173 /* Definitions for Mule under MS Windows */
|
|
174
|
|
175 #include <wchar.h>
|
|
176
|
|
177 #ifdef CYGWIN
|
|
178
|
|
179 /* All but wcscmp and wcslen left out of Cygwin headers -- but present
|
|
180 in /usr/include/mingw32/string.h! */
|
|
181 wchar_t* wcscat (wchar_t*, const wchar_t*);
|
|
182 wchar_t* wcschr (const wchar_t*, wchar_t);
|
|
183 int wcscoll (const wchar_t*, const wchar_t*);
|
|
184 wchar_t* wcscpy (wchar_t*, const wchar_t*);
|
|
185 size_t wcscspn (const wchar_t*, const wchar_t*);
|
|
186 /* Note: No wcserror in CRTDLL. */
|
|
187 wchar_t* wcsncat (wchar_t*, const wchar_t*, size_t);
|
|
188 int wcsncmp(const wchar_t*, const wchar_t*, size_t);
|
|
189 wchar_t* wcsncpy(wchar_t*, const wchar_t*, size_t);
|
|
190 wchar_t* wcspbrk(const wchar_t*, const wchar_t*);
|
|
191 wchar_t* wcsrchr(const wchar_t*, wchar_t);
|
|
192 size_t wcsspn(const wchar_t*, const wchar_t*);
|
|
193 wchar_t* wcsstr(const wchar_t*, const wchar_t*);
|
|
194 wchar_t* wcstok(wchar_t*, const wchar_t*);
|
|
195 size_t wcsxfrm(wchar_t*, const wchar_t*, size_t);
|
|
196
|
|
197 #endif /* CYGWIN */
|
|
198
|
|
199 // extern int mswindows_windows9x_p;
|
|
200 /* #define XEUNICODE_P (!mswindows_windows9x_p) */
|
|
201 #define XEUNICODE_P 0
|
|
202
|
|
203 #define XETCHAR_SIZE (XEUNICODE_P ? sizeof (WCHAR) : sizeof (CHAR))
|
|
204 #define MAX_XETCHAR_SIZE sizeof (WCHAR)
|
|
205 #define XETEXT1(arg) (XEUNICODE_P ? ((char *) (L##arg)) : (arg))
|
|
206 /* We need to do this indirection in case ARG is also a manifest constant.
|
|
207 I don't really understand why. --ben */
|
|
208 #define XETEXT(arg) XETEXT1(arg)
|
|
209 #define XECOPY_TCHAR(ptr, ch) \
|
|
210 (XEUNICODE_P ? (* (LPWSTR) (ptr) = L##ch) : (* (LPSTR) (ptr) = (ch)))
|
|
211 #define xetcslen(arg) (XEUNICODE_P ? wcslen ((wchar_t *) arg) : strlen (arg))
|
|
212 #define xetcscmp(s1, s2) \
|
|
213 (XEUNICODE_P ? wcscmp ((wchar_t *) s1, (wchar_t *) s2) \
|
|
214 : strcmp (s1, s2))
|
|
215 #define xetcscpy(s1, s2) \
|
|
216 (XEUNICODE_P ? (char *) wcscpy ((wchar_t *) s1, (wchar_t *) s2) \
|
|
217 : strcpy (s1, s2))
|
|
218 #define xetcschr(s, ch) \
|
|
219 (XEUNICODE_P ? (char *) wcschr ((wchar_t *) s, (WCHAR) ch) \
|
|
220 : strchr (s, ch))
|
|
221 #define xetcsrchr(s, ch) \
|
|
222 (XEUNICODE_P ? (char *) wcsrchr ((wchar_t *) s, (WCHAR) ch) \
|
|
223 : strrchr (s, ch))
|
|
224
|
|
225
|
|
226 #define LOCAL_FILE_FORMAT_TO_TSTR(path, out) \
|
|
227 do { \
|
|
228 Bufbyte *lttff; \
|
|
229 \
|
|
230 LOCAL_TO_WIN32_FILE_FORMAT (path, lttff); \
|
|
231 C_STRING_TO_EXTERNAL (lttff, out, Qmswindows_tstr); \
|
|
232 } while (0)
|
|
233
|
|
234 Lisp_Object tstr_to_local_file_format (Extbyte *pathout);
|
|
235
|
|
236 #ifdef CYGWIN
|
|
237 #define LOCAL_TO_WIN32_FILE_FORMAT(path, pathout) \
|
|
238 do { \
|
593
|
239 /* NOTE: It is a bit evil that here and below we are passing \
|
|
240 internal-format data to a function that (nominally) should work \
|
|
241 with external-format data. But in point of fact, the Cygwin \
|
|
242 conversion functions are *NOT* localized, and will fail if they \
|
|
243 get 7-bit ISO2022-encoded data. We know that our internal format \
|
|
244 is ASCII-compatible, and so these functions will work fine with \
|
|
245 this data. */ \
|
442
|
246 Lisp_Object ltwff1 = (path); \
|
|
247 int ltwff2 = \
|
593
|
248 cygwin_posix_to_win32_path_list_buf_size ((char *) \
|
|
249 XSTRING_DATA (ltwff1)); \
|
442
|
250 pathout = (Bufbyte *) alloca (ltwff2); \
|
593
|
251 cygwin_posix_to_win32_path_list ((char *) XSTRING_DATA (ltwff1), \
|
|
252 (char *) pathout); \
|
442
|
253 } while (0)
|
|
254 #else
|
|
255 #define LOCAL_TO_WIN32_FILE_FORMAT(path, pathout) \
|
|
256 do { \
|
|
257 (pathout) = XSTRING_DATA (path); \
|
|
258 } while (0)
|
|
259 #endif
|
|
260
|
|
261 #ifdef CYGWIN
|
593
|
262 #define WIN32_TO_LOCAL_FILE_FORMAT(path, pathout) \
|
|
263 do { \
|
|
264 Bufbyte *wtlff1 = (path); \
|
|
265 int wtlff2 = \
|
|
266 cygwin_win32_to_posix_path_list_buf_size ((char *) wtlff1); \
|
|
267 Bufbyte *wtlff3 = (Bufbyte *) alloca (wtlff2); \
|
|
268 cygwin_win32_to_posix_path_list ((char *) wtlff1, (char *) wtlff3); \
|
|
269 (pathout) = build_string ((CBufbyte *) wtlff3); \
|
442
|
270 } while (0)
|
|
271 #else
|
|
272 #define WIN32_TO_LOCAL_FILE_FORMAT(path, pathout) \
|
|
273 do { \
|
593
|
274 (pathout) = build_string ((CBufbyte *) path); \
|
442
|
275 } while (0)
|
|
276 #endif
|
|
277
|
|
278 extern BOOL (WINAPI *xSwitchToThread) (VOID);
|
|
279
|
|
280 extern HKL (WINAPI *xGetKeyboardLayout) (DWORD);
|
|
281 extern BOOL (WINAPI *xSetMenuDefaultItem) (HMENU, UINT, UINT);
|
|
282 extern BOOL (WINAPI *xInsertMenuItemA) (HMENU, UINT, BOOL, LPCMENUITEMINFOA);
|
|
283 extern BOOL (WINAPI *xInsertMenuItemW) (HMENU, UINT, BOOL, LPCMENUITEMINFOW);
|
|
284 extern HANDLE (WINAPI *xLoadImageA) (HINSTANCE, LPCSTR, UINT, int, int, UINT);
|
|
285 extern HANDLE (WINAPI *xLoadImageW) (HINSTANCE, LPCWSTR, UINT, int, int, UINT);
|
|
286 extern ATOM (WINAPI *xRegisterClassExA) (CONST WNDCLASSEXA *);
|
|
287 extern ATOM (WINAPI *xRegisterClassExW) (CONST WNDCLASSEXW *);
|
|
288
|
|
289 extern int (WINAPI *xEnumFontFamiliesExA) (HDC, LPLOGFONTA, FONTENUMPROCA,
|
|
290 LPARAM, DWORD);
|
|
291 extern int (WINAPI *xEnumFontFamiliesExW) (HDC, LPLOGFONTW, FONTENUMPROCW,
|
|
292 LPARAM, DWORD);
|
|
293
|
|
294 extern DWORD (WINAPI *xSHGetFileInfoA) (LPCSTR, DWORD, SHFILEINFOA FAR *, UINT,
|
|
295 UINT);
|
|
296 extern DWORD (WINAPI *xSHGetFileInfoW) (LPCWSTR, DWORD, SHFILEINFOW FAR *,
|
|
297 UINT, UINT);
|
|
298
|
531
|
299 extern NET_API_STATUS (NET_API_FUNCTION *xNetUserEnum)
|
|
300 (
|
|
301 IN LPCWSTR servername OPTIONAL,
|
|
302 IN DWORD level,
|
|
303 IN DWORD filter,
|
|
304 OUT LPBYTE *bufptr,
|
|
305 IN DWORD prefmaxlen,
|
|
306 OUT LPDWORD entriesread,
|
|
307 OUT LPDWORD totalentries,
|
|
308 IN OUT LPDWORD resume_handle OPTIONAL
|
|
309 );
|
|
310
|
|
311 extern NET_API_STATUS (NET_API_FUNCTION *xNetApiBufferFree)
|
|
312 (
|
|
313 IN LPVOID Buffer
|
|
314 );
|
|
315
|
442
|
316 #endif /* INCLUDED_syswindows_h_ */
|