8c3cd914 |
1 | /* |
2 | * winstuff.h: Windows-specific inter-module stuff. |
3 | */ |
4 | |
f7f27309 |
5 | #ifndef PUTTY_WINSTUFF_H |
6 | #define PUTTY_WINSTUFF_H |
7 | |
7440fd44 |
8 | #ifndef AUTO_WINSOCK |
9 | #include <winsock2.h> |
10 | #endif |
11 | #include <windows.h> |
9a30e26b |
12 | #include <stdio.h> /* for FILENAME_MAX */ |
13 | |
fe8abbf4 |
14 | #include "tree234.h" |
15 | |
16 | #include "winhelp.h" |
17 | |
9a30e26b |
18 | struct Filename { |
19 | char path[FILENAME_MAX]; |
20 | }; |
c6940f12 |
21 | #define f_open(filename, mode, isprivate) ( fopen((filename).path, (mode)) ) |
9a30e26b |
22 | |
23 | struct FontSpec { |
24 | char name[64]; |
25 | int isbold; |
26 | int height; |
27 | int charset; |
28 | }; |
29 | |
17c7fed1 |
30 | #ifndef CLEARTYPE_QUALITY |
31 | #define CLEARTYPE_QUALITY 5 |
32 | #endif |
33 | #define FONT_QUALITY(fq) ( \ |
34 | (fq) == FQ_DEFAULT ? DEFAULT_QUALITY : \ |
35 | (fq) == FQ_ANTIALIASED ? ANTIALIASED_QUALITY : \ |
36 | (fq) == FQ_NONANTIALIASED ? NONANTIALIASED_QUALITY : \ |
37 | CLEARTYPE_QUALITY) |
38 | |
61ef0c16 |
39 | #define PLATFORM_IS_UTF16 /* enable UTF-16 processing when exchanging |
40 | * wchar_t strings with environment */ |
41 | |
158cb9b1 |
42 | /* |
43 | * Where we can, we use GetWindowLongPtr and friends because they're |
44 | * more useful on 64-bit platforms, but they're a relatively recent |
45 | * innovation, missing from VC++ 6 and older MinGW. Degrade nicely. |
46 | * (NB that on some systems, some of these things are available but |
47 | * not others...) |
48 | */ |
17c7fed1 |
49 | |
158cb9b1 |
50 | #ifndef GCLP_HCURSOR |
51 | /* GetClassLongPtr and friends */ |
52 | #undef GetClassLongPtr |
53 | #define GetClassLongPtr GetClassLong |
54 | #undef SetClassLongPtr |
55 | #define SetClassLongPtr SetClassLong |
56 | #define GCLP_HCURSOR GCL_HCURSOR |
57 | /* GetWindowLongPtr and friends */ |
58 | #undef GetWindowLongPtr |
17c7fed1 |
59 | #define GetWindowLongPtr GetWindowLong |
158cb9b1 |
60 | #undef SetWindowLongPtr |
17c7fed1 |
61 | #define SetWindowLongPtr SetWindowLong |
158cb9b1 |
62 | #undef GWLP_USERDATA |
17c7fed1 |
63 | #define GWLP_USERDATA GWL_USERDATA |
158cb9b1 |
64 | #undef DWLP_MSGRESULT |
17c7fed1 |
65 | #define DWLP_MSGRESULT DWL_MSGRESULT |
158cb9b1 |
66 | /* Since we've clobbered the above functions, we should clobber the |
67 | * associated type regardless of whether it's defined. */ |
68 | #undef LONG_PTR |
69 | #define LONG_PTR LONG |
17c7fed1 |
70 | #endif |
71 | |
2979718a |
72 | #define BOXFLAGS DLGWINDOWEXTRA |
1e5eefb6 |
73 | #define BOXRESULT (DLGWINDOWEXTRA + sizeof(LONG_PTR)) |
8ee3ff16 |
74 | #define DF_END 0x0001 |
75 | |
8c3cd914 |
76 | /* |
d0f67860 |
77 | * Dynamically linked functions. These come in two flavours: |
78 | * |
79 | * - GET_WINDOWS_FUNCTION does not expose "name" to the preprocessor, |
80 | * so will always dynamically link against exactly what is specified |
81 | * in "name". If you're not sure, use this one. |
82 | * |
83 | * - GET_WINDOWS_FUNCTION_PP allows "name" to be redirected via |
84 | * preprocessor definitions like "#define foo bar"; this is principally |
85 | * intended for the ANSI/Unicode DoSomething/DoSomethingA/DoSomethingW. |
86 | * If your function has an argument of type "LPTSTR" or similar, this |
87 | * is the variant to use. |
88 | * (However, it can't always be used, as it trips over more complicated |
89 | * macro trickery such as the WspiapiGetAddrInfo wrapper for getaddrinfo.) |
90 | * |
91 | * (DECL_WINDOWS_FUNCTION works with both these variants.) |
65d1432e |
92 | */ |
93 | #define DECL_WINDOWS_FUNCTION(linkage, rettype, name, params) \ |
94 | typedef rettype (WINAPI *t_##name) params; \ |
95 | linkage t_##name p_##name |
96 | #define STR1(x) #x |
97 | #define STR(x) STR1(x) |
d0f67860 |
98 | #define GET_WINDOWS_FUNCTION_PP(module, name) \ |
a197b711 |
99 | (p_##name = module ? (t_##name) GetProcAddress(module, STR(name)) : NULL) |
d0f67860 |
100 | #define GET_WINDOWS_FUNCTION(module, name) \ |
a197b711 |
101 | (p_##name = module ? (t_##name) GetProcAddress(module, #name) : NULL) |
65d1432e |
102 | |
103 | /* |
8c3cd914 |
104 | * Global variables. Most modules declare these `extern', but |
105 | * window.c will do `#define PUTTY_DO_GLOBALS' before including this |
106 | * module, and so will get them properly defined. |
2979718a |
107 | */ |
f7f27309 |
108 | #ifndef GLOBAL |
8c3cd914 |
109 | #ifdef PUTTY_DO_GLOBALS |
110 | #define GLOBAL |
111 | #else |
112 | #define GLOBAL extern |
113 | #endif |
f7f27309 |
114 | #endif |
115 | |
a8327734 |
116 | #ifndef DONE_TYPEDEFS |
117 | #define DONE_TYPEDEFS |
4a693cfc |
118 | typedef struct conf_tag Conf; |
a8327734 |
119 | typedef struct backend_tag Backend; |
120 | typedef struct terminal_tag Terminal; |
121 | #endif |
122 | |
f7f27309 |
123 | #define PUTTY_REG_POS "Software\\SimonTatham\\PuTTY" |
124 | #define PUTTY_REG_PARENT "Software\\SimonTatham" |
125 | #define PUTTY_REG_PARENT_CHILD "PuTTY" |
126 | #define PUTTY_REG_GPARENT "Software" |
127 | #define PUTTY_REG_GPARENT_CHILD "SimonTatham" |
128 | |
073e9f42 |
129 | /* Result values for the jumplist registry functions. */ |
130 | #define JUMPLISTREG_OK 0 |
131 | #define JUMPLISTREG_ERROR_INVALID_PARAMETER 1 |
132 | #define JUMPLISTREG_ERROR_KEYOPENCREATE_FAILURE 2 |
133 | #define JUMPLISTREG_ERROR_VALUEREAD_FAILURE 3 |
134 | #define JUMPLISTREG_ERROR_VALUEWRITE_FAILURE 4 |
135 | #define JUMPLISTREG_ERROR_INVALID_VALUE 5 |
136 | |
a9dc49af |
137 | #define PUTTY_HELP_FILE "putty.hlp" |
cb2708d3 |
138 | #define PUTTY_CHM_FILE "putty.chm" |
a9dc49af |
139 | #define PUTTY_HELP_CONTENTS "putty.cnt" |
140 | |
f7f27309 |
141 | #define GETTICKCOUNT GetTickCount |
142 | #define CURSORBLINK GetCaretBlinkTime() |
143 | #define TICKSPERSEC 1000 /* GetTickCount returns milliseconds */ |
144 | |
145 | #define DEFAULT_CODEPAGE CP_ACP |
146 | |
147 | typedef HDC Context; |
8c3cd914 |
148 | |
b3d375b2 |
149 | typedef unsigned int uint32; /* int is 32-bits on Win32 and Win64. */ |
150 | #define PUTTY_UINT32_DEFINED |
151 | |
86557057 |
152 | #ifndef NO_GSSAPI |
153 | /* |
154 | * GSS-API stuff |
155 | */ |
b3d375b2 |
156 | #define GSS_CC CALLBACK |
157 | /* |
86557057 |
158 | typedef struct Ssh_gss_buf { |
b3d375b2 |
159 | size_t length; |
86557057 |
160 | char *value; |
161 | } Ssh_gss_buf; |
162 | |
163 | #define SSH_GSS_EMPTY_BUF (Ssh_gss_buf) {0,NULL} |
2c2bce14 |
164 | typedef void *Ssh_gss_name; |
b3d375b2 |
165 | */ |
86557057 |
166 | #endif |
167 | |
f7f27309 |
168 | /* |
5321c0c6 |
169 | * Window handles for the windows that can be running during a |
f7f27309 |
170 | * PuTTY session. |
171 | */ |
5321c0c6 |
172 | GLOBAL HWND hwnd; /* the main terminal window */ |
f7f27309 |
173 | GLOBAL HWND logbox; |
174 | |
175 | /* |
176 | * The all-important instance handle. |
177 | */ |
8c3cd914 |
178 | GLOBAL HINSTANCE hinst; |
179 | |
180 | /* |
cb2708d3 |
181 | * Help file stuff in winhelp.c. |
6b78788a |
182 | */ |
cb2708d3 |
183 | void init_help(void); |
184 | void shutdown_help(void); |
185 | int has_help(void); |
186 | void launch_help(HWND hwnd, const char *topic); |
187 | void quit_help(HWND hwnd); |
6b78788a |
188 | |
189 | /* |
a8327734 |
190 | * The terminal and logging context are notionally local to the |
191 | * Windows front end, but they must be shared between window.c and |
0b4f0bc0 |
192 | * windlg.c. Likewise the saved-sessions list. |
a8327734 |
193 | */ |
194 | GLOBAL Terminal *term; |
195 | GLOBAL void *logctx; |
196 | |
604fab0c |
197 | #define WM_NETEVENT (WM_APP + 5) |
f7f27309 |
198 | |
199 | /* |
e6346999 |
200 | * On Windows, we send MA_2CLK as the only event marking the second |
201 | * press of a mouse button. Compare unix.h. |
202 | */ |
203 | #define MULTICLICK_ONLY_EVENT 1 |
204 | |
205 | /* |
206 | * On Windows, data written to the clipboard must be NUL-terminated. |
207 | */ |
208 | #define SELECTION_NUL_TERMINATED 1 |
209 | |
210 | /* |
0f351587 |
211 | * On Windows, copying to the clipboard terminates lines with CRLF. |
212 | */ |
213 | #define SEL_NL { 13, 10 } |
214 | |
215 | /* |
2f92b717 |
216 | * sk_getxdmdata() does not exist under Windows (not that I |
217 | * couldn't write it if I wanted to, but I haven't bothered), so |
0a4022a1 |
218 | * it's a macro which always returns NULL. With any luck this will |
2f92b717 |
219 | * cause the compiler to notice it can optimise away the |
220 | * implementation of XDM-AUTHORIZATION-1 in x11fwd.c :-) |
221 | */ |
0a4022a1 |
222 | #define sk_getxdmdata(socket, lenp) (NULL) |
2f92b717 |
223 | |
224 | /* |
fe8abbf4 |
225 | * File-selector filter strings used in the config box. On Windows, |
226 | * these strings are of exactly the type needed to go in |
227 | * `lpstrFilter' in an OPENFILENAME structure. |
228 | */ |
229 | #define FILTER_KEY_FILES ("PuTTY Private Key Files (*.ppk)\0*.ppk\0" \ |
230 | "All Files (*.*)\0*\0\0\0") |
231 | #define FILTER_WAVE_FILES ("Wave Files (*.wav)\0*.WAV\0" \ |
232 | "All Files (*.*)\0*\0\0\0") |
1e00c92b |
233 | #define FILTER_DYNLIB_FILES ("Dynamic Library Files (*.dll)\0*.dll\0" \ |
234 | "All Files (*.*)\0*\0\0\0") |
fe8abbf4 |
235 | |
236 | /* |
2ac3322e |
237 | * On some versions of Windows, it has been known for WM_TIMER to |
238 | * occasionally get its callback time simply wrong, and call us |
239 | * back several minutes early. Defining these symbols enables |
240 | * compensation code in timing.c. |
241 | */ |
242 | #define TIMING_SYNC |
243 | #define TIMING_SYNC_TICKCOUNT |
244 | |
245 | /* |
7440fd44 |
246 | * winnet.c dynamically loads WinSock 2 or WinSock 1 depending on |
247 | * what it can get, which means any WinSock routines used outside |
248 | * that module must be exported from it as function pointers. So |
249 | * here they are. |
250 | */ |
65d1432e |
251 | DECL_WINDOWS_FUNCTION(GLOBAL, int, WSAAsyncSelect, |
252 | (SOCKET, HWND, u_int, long)); |
253 | DECL_WINDOWS_FUNCTION(GLOBAL, int, WSAEventSelect, |
254 | (SOCKET, WSAEVENT, long)); |
255 | DECL_WINDOWS_FUNCTION(GLOBAL, int, select, |
256 | (int, fd_set FAR *, fd_set FAR *, |
257 | fd_set FAR *, const struct timeval FAR *)); |
258 | DECL_WINDOWS_FUNCTION(GLOBAL, int, WSAGetLastError, (void)); |
259 | DECL_WINDOWS_FUNCTION(GLOBAL, int, WSAEnumNetworkEvents, |
260 | (SOCKET, WSAEVENT, LPWSANETWORKEVENTS)); |
7440fd44 |
261 | |
39934deb |
262 | extern int socket_writable(SOCKET skt); |
263 | |
9f7ebadc |
264 | extern void socket_reselect_all(void); |
265 | |
7440fd44 |
266 | /* |
8c3cd914 |
267 | * Exports from winctrls.c. |
268 | */ |
269 | |
270 | struct ctlpos { |
271 | HWND hwnd; |
272 | WPARAM font; |
273 | int dlu4inpix; |
274 | int ypos, width; |
275 | int xoff; |
3ac9cd9f |
276 | int boxystart, boxid; |
8c3cd914 |
277 | char *boxtext; |
278 | }; |
279 | |
ca20bfcf |
280 | /* |
c0a81592 |
281 | * Exports from winutils.c. |
282 | */ |
9754e5ca |
283 | typedef struct filereq_tag filereq; /* cwd for file requester */ |
284 | BOOL request_file(filereq *state, OPENFILENAME *of, int preserve, int save); |
285 | filereq *filereq_new(void); |
286 | void filereq_free(filereq *state); |
690695e0 |
287 | int message_box(LPCTSTR text, LPCTSTR caption, DWORD style, DWORD helpctxid); |
d3a1a808 |
288 | void split_into_argv(char *, int *, char ***, char ***); |
c0a81592 |
289 | |
290 | /* |
ca20bfcf |
291 | * Private structure for prefslist state. Only in the header file |
292 | * so that we can delegate allocation to callers. |
293 | */ |
294 | struct prefslist { |
295 | int listid, upbid, dnbid; |
296 | int srcitem; |
297 | int dummyitem; |
298 | int dragging; |
299 | }; |
300 | |
f7f27309 |
301 | /* |
fe8abbf4 |
302 | * This structure is passed to event handler functions as the `dlg' |
303 | * parameter, and hence is passed back to winctrls access functions. |
304 | */ |
305 | struct dlgparam { |
306 | HWND hwnd; /* the hwnd of the dialog box */ |
307 | struct winctrls *controltrees[8]; /* can have several of these */ |
308 | int nctrltrees; |
f6f450e2 |
309 | char *wintitle; /* title of actual window */ |
fe8abbf4 |
310 | char *errtitle; /* title of error sub-messageboxes */ |
311 | void *data; /* data to pass in refresh events */ |
312 | union control *focused, *lastfocused; /* which ctrl has focus now/before */ |
4e6d4091 |
313 | char shortcuts[128]; /* track which shortcuts in use */ |
fe8abbf4 |
314 | int coloursel_wanted; /* has an event handler asked for |
315 | * a colour selector? */ |
fe8abbf4 |
316 | struct { unsigned char r, g, b, ok; } coloursel_result; /* 0-255 */ |
4e6d4091 |
317 | tree234 *privdata; /* stores per-control private data */ |
fe8abbf4 |
318 | int ended, endresult; /* has the dialog been ended? */ |
14ce9887 |
319 | int fixed_pitch_fonts; /* are we constrained to fixed fonts? */ |
fe8abbf4 |
320 | }; |
321 | |
322 | /* |
f7f27309 |
323 | * Exports from winctrls.c. |
324 | */ |
8c3cd914 |
325 | void ctlposinit(struct ctlpos *cp, HWND hwnd, |
32874aea |
326 | int leftborder, int rightborder, int topborder); |
ca20bfcf |
327 | HWND doctl(struct ctlpos *cp, RECT r, |
32874aea |
328 | char *wclass, int wstyle, int exstyle, char *wtext, int wid); |
8c3cd914 |
329 | void bartitle(struct ctlpos *cp, char *name, int id); |
3ac9cd9f |
330 | void beginbox(struct ctlpos *cp, char *name, int idbox); |
8c3cd914 |
331 | void endbox(struct ctlpos *cp); |
e73667f3 |
332 | void editboxfw(struct ctlpos *cp, int password, char *text, |
333 | int staticid, int editid); |
32874aea |
334 | void radioline(struct ctlpos *cp, char *text, int id, int nacross, ...); |
d74d141c |
335 | void bareradioline(struct ctlpos *cp, int nacross, ...); |
8c3cd914 |
336 | void radiobig(struct ctlpos *cp, char *text, int id, ...); |
337 | void checkbox(struct ctlpos *cp, char *text, int id); |
66ee282a |
338 | void statictext(struct ctlpos *cp, char *text, int lines, int id); |
8c3cd914 |
339 | void staticbtn(struct ctlpos *cp, char *stext, int sid, |
32874aea |
340 | char *btext, int bid); |
af282e3b |
341 | void static2btn(struct ctlpos *cp, char *stext, int sid, |
342 | char *btext1, int bid1, char *btext2, int bid2); |
8c3cd914 |
343 | void staticedit(struct ctlpos *cp, char *stext, |
32874aea |
344 | int sid, int eid, int percentedit); |
2c9c6388 |
345 | void staticddl(struct ctlpos *cp, char *stext, |
346 | int sid, int lid, int percentlist); |
b8ae1f0f |
347 | void combobox(struct ctlpos *cp, char *text, int staticid, int listid); |
6e522441 |
348 | void staticpassedit(struct ctlpos *cp, char *stext, |
32874aea |
349 | int sid, int eid, int percentedit); |
6e522441 |
350 | void bigeditctrl(struct ctlpos *cp, char *stext, |
32874aea |
351 | int sid, int eid, int lines); |
352 | void ersatztab(struct ctlpos *cp, char *stext, int sid, int lid, int s2id); |
8c3cd914 |
353 | void editbutton(struct ctlpos *cp, char *stext, int sid, |
32874aea |
354 | int eid, char *btext, int bid); |
8c3cd914 |
355 | void sesssaver(struct ctlpos *cp, char *text, |
32874aea |
356 | int staticid, int editid, int listid, ...); |
8c3cd914 |
357 | void envsetter(struct ctlpos *cp, char *stext, int sid, |
32874aea |
358 | char *e1stext, int e1sid, int e1id, |
359 | char *e2stext, int e2sid, int e2id, |
360 | int listid, char *b1text, int b1id, char *b2text, int b2id); |
8c3cd914 |
361 | void charclass(struct ctlpos *cp, char *stext, int sid, int listid, |
32874aea |
362 | char *btext, int bid, int eid, char *s2text, int s2id); |
8c3cd914 |
363 | void colouredit(struct ctlpos *cp, char *stext, int sid, int listid, |
32874aea |
364 | char *btext, int bid, ...); |
fe8abbf4 |
365 | void prefslist(struct prefslist *hdl, struct ctlpos *cp, int lines, |
366 | char *stext, int sid, int listid, int upbid, int dnbid); |
ca20bfcf |
367 | int handle_prefslist(struct prefslist *hdl, |
368 | int *array, int maxmemb, |
369 | int is_dlmsg, HWND hwnd, |
370 | WPARAM wParam, LPARAM lParam); |
6e522441 |
371 | void progressbar(struct ctlpos *cp, int id); |
d74d141c |
372 | void fwdsetter(struct ctlpos *cp, int listid, char *stext, int sid, |
373 | char *e1stext, int e1sid, int e1id, |
374 | char *e2stext, int e2sid, int e2id, |
a4b92c62 |
375 | char *btext, int bid, |
376 | char *r1text, int r1id, char *r2text, int r2id); |
f7f27309 |
377 | |
14ce9887 |
378 | void dlg_auto_set_fixed_pitch_flag(void *dlg); |
379 | int dlg_get_fixed_pitch_flag(void *dlg); |
380 | void dlg_set_fixed_pitch_flag(void *dlg, int flag); |
381 | |
fe8abbf4 |
382 | #define MAX_SHORTCUTS_PER_CTRL 16 |
383 | |
384 | /* |
385 | * This structure is what's stored for each `union control' in the |
386 | * portable-dialog interface. |
387 | */ |
388 | struct winctrl { |
389 | union control *ctrl; |
390 | /* |
391 | * The control may have several components at the Windows |
392 | * level, with different dialog IDs. To avoid needing N |
393 | * separate platformsidectrl structures (which could be stored |
394 | * separately in a tree234 so that lookup by ID worked), we |
395 | * impose the constraint that those IDs must be in a contiguous |
396 | * block. |
397 | */ |
398 | int base_id; |
399 | int num_ids; |
400 | /* |
401 | * Remember what keyboard shortcuts were used by this control, |
402 | * so that when we remove it again we can take them out of the |
403 | * list in the dlgparam. |
404 | */ |
405 | char shortcuts[MAX_SHORTCUTS_PER_CTRL]; |
406 | /* |
407 | * Some controls need a piece of allocated memory in which to |
408 | * store temporary data about the control. |
409 | */ |
410 | void *data; |
411 | }; |
412 | /* |
413 | * And this structure holds a set of the above, in two separate |
414 | * tree234s so that it can find an item by `union control' or by |
415 | * dialog ID. |
416 | */ |
417 | struct winctrls { |
418 | tree234 *byctrl, *byid; |
419 | }; |
d1582b2e |
420 | struct controlset; |
421 | struct controlbox; |
422 | |
fe8abbf4 |
423 | void winctrl_init(struct winctrls *); |
424 | void winctrl_cleanup(struct winctrls *); |
425 | void winctrl_add(struct winctrls *, struct winctrl *); |
426 | void winctrl_remove(struct winctrls *, struct winctrl *); |
427 | struct winctrl *winctrl_findbyctrl(struct winctrls *, union control *); |
428 | struct winctrl *winctrl_findbyid(struct winctrls *, int); |
429 | struct winctrl *winctrl_findbyindex(struct winctrls *, int); |
430 | void winctrl_layout(struct dlgparam *dp, struct winctrls *wc, |
431 | struct ctlpos *cp, struct controlset *s, int *id); |
432 | int winctrl_handle_command(struct dlgparam *dp, UINT msg, |
433 | WPARAM wParam, LPARAM lParam); |
d1582b2e |
434 | void winctrl_rem_shortcuts(struct dlgparam *dp, struct winctrl *c); |
435 | int winctrl_context_help(struct dlgparam *dp, HWND hwnd, int id); |
436 | |
4e6d4091 |
437 | void dp_init(struct dlgparam *dp); |
438 | void dp_add_tree(struct dlgparam *dp, struct winctrls *tree); |
439 | void dp_cleanup(struct dlgparam *dp); |
440 | |
d1582b2e |
441 | /* |
442 | * Exports from wincfg.c. |
443 | */ |
444 | void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help, |
8a7f1392 |
445 | int midsession, int protocol); |
fe8abbf4 |
446 | |
f7f27309 |
447 | /* |
448 | * Exports from windlg.c. |
449 | */ |
450 | void defuse_showwindow(void); |
451 | int do_config(void); |
f89c3294 |
452 | int do_reconfig(HWND, int); |
f7f27309 |
453 | void showeventlog(HWND); |
454 | void showabout(HWND); |
f7f27309 |
455 | void force_normal(HWND hwnd); |
d1582b2e |
456 | void modal_about_box(HWND hwnd); |
457 | void show_help(HWND hwnd); |
f7f27309 |
458 | |
f7f27309 |
459 | /* |
8ee3ff16 |
460 | * Exports from winmisc.c. |
461 | */ |
4c48c989 |
462 | extern OSVERSIONINFO osVersion; |
463 | BOOL init_winver(void); |
bda368a5 |
464 | HMODULE load_system32_dll(const char *libname); |
4c48c989 |
465 | |
8ee3ff16 |
466 | /* |
f7f27309 |
467 | * Exports from sizetip.c. |
468 | */ |
469 | void UpdateSizeTip(HWND src, int cx, int cy); |
470 | void EnableSizeTip(int bEnable); |
471 | |
facd762c |
472 | /* |
473 | * Exports from unicode.c. |
474 | */ |
07b2a9cd |
475 | struct unicode_data; |
4a693cfc |
476 | void init_ucs(Conf *, struct unicode_data *); |
facd762c |
477 | |
c44bf5bd |
478 | /* |
34292b1d |
479 | * Exports from winhandl.c. |
480 | */ |
bdebd7e9 |
481 | #define HANDLE_FLAG_OVERLAPPED 1 |
482 | #define HANDLE_FLAG_IGNOREEOF 2 |
799e067e |
483 | #define HANDLE_FLAG_UNITBUFFER 4 |
34292b1d |
484 | struct handle; |
485 | typedef int (*handle_inputfn_t)(struct handle *h, void *data, int len); |
486 | typedef void (*handle_outputfn_t)(struct handle *h, int new_backlog); |
0e03ceff |
487 | struct handle *handle_input_new(HANDLE handle, handle_inputfn_t gotdata, |
bdebd7e9 |
488 | void *privdata, int flags); |
0e03ceff |
489 | struct handle *handle_output_new(HANDLE handle, handle_outputfn_t sentdata, |
bdebd7e9 |
490 | void *privdata, int flags); |
34292b1d |
491 | int handle_write(struct handle *h, const void *data, int len); |
492 | HANDLE *handle_get_events(int *nevents); |
493 | void handle_free(struct handle *h); |
494 | void handle_got_event(HANDLE event); |
495 | void handle_unthrottle(struct handle *h, int backlog); |
496 | int handle_backlog(struct handle *h); |
0e03ceff |
497 | void *handle_get_privdata(struct handle *h); |
34292b1d |
498 | |
499 | /* |
ac3337f6 |
500 | * winpgntc.c needs to schedule callbacks for asynchronous agent |
c44bf5bd |
501 | * requests. This has to be done differently in GUI and console, so |
502 | * there's an exported function used for the purpose. |
503 | * |
504 | * Also, we supply FLAG_SYNCAGENT to force agent requests to be |
505 | * synchronous in pscp and psftp. |
506 | */ |
507 | void agent_schedule_callback(void (*callback)(void *, void *, int), |
508 | void *callback_ctx, void *data, int len); |
509 | #define FLAG_SYNCAGENT 0x1000 |
510 | |
7374c779 |
511 | /* |
ac3337f6 |
512 | * winpgntc.c also exports these two functions which are used by the |
513 | * server side of Pageant as well, to get the user SID for comparing |
514 | * with clients'. |
515 | */ |
516 | int init_advapi(void); /* initialises everything needed by get_user_sid */ |
517 | PSID get_user_sid(void); |
518 | |
519 | /* |
7374c779 |
520 | * Exports from winser.c. |
521 | */ |
522 | extern Backend serial_backend; |
523 | |
073e9f42 |
524 | /* |
525 | * Exports from winjump.c. |
526 | */ |
527 | #define JUMPLIST_SUPPORTED /* suppress #defines in putty.h */ |
528 | void add_session_to_jumplist(const char * const sessionname); |
529 | void remove_session_from_jumplist(const char * const sessionname); |
21cdf8c2 |
530 | void clear_jumplist(void); |
073e9f42 |
531 | |
532 | /* |
533 | * Extra functions in winstore.c over and above the interface in |
534 | * storage.h. |
535 | * |
536 | * These functions manipulate the Registry section which mirrors the |
537 | * current Windows 7 jump list. (Because the real jump list storage is |
538 | * write-only, we need to keep another copy of whatever we put in it, |
539 | * so that we can put in a slightly modified version the next time.) |
540 | */ |
541 | |
542 | /* Adds a saved session to the registry jump list mirror. 'item' is a |
543 | * string naming a saved session. */ |
544 | int add_to_jumplist_registry(const char *item); |
545 | |
546 | /* Removes an item from the registry jump list mirror. */ |
547 | int remove_from_jumplist_registry(const char *item); |
548 | |
549 | /* Returns the current jump list entries from the registry. Caller |
550 | * must free the returned pointer, which points to a contiguous |
551 | * sequence of NUL-terminated strings in memory, terminated with an |
552 | * empty one. */ |
553 | char *get_jumplist_registry_entries(void); |
554 | |
f7f27309 |
555 | #endif |