4 #define PUTTY_REG_POS "Software\\SimonTatham\\PuTTY"
7 #define OPTIMISE_SCROLL
15 #endif /* macintosh */
24 #define ATTR_ACTCURS 0x80000000UL /* active cursor (block) */
25 #define ATTR_PASCURS 0x40000000UL /* passive cursor (box) */
26 #define ATTR_INVALID 0x20000000UL
27 #define ATTR_WRAPPED 0x10000000UL
29 #define ATTR_ASCII 0x00000000UL /* normal ASCII charset ESC ( B */
30 #define ATTR_GBCHR 0x00100000UL /* UK variant charset ESC ( A */
31 #define ATTR_LINEDRW 0x00200000UL /* line drawing charset ESC ( 0 */
33 #define ATTR_BOLD 0x00000100UL
34 #define ATTR_UNDER 0x00000200UL
35 #define ATTR_REVERSE 0x00000400UL
36 #define ATTR_FGMASK 0x0000F000UL
37 #define ATTR_BGMASK 0x000F0000UL
38 #define ATTR_FGSHIFT 12
39 #define ATTR_BGSHIFT 16
41 #define ATTR_DEFAULT 0x00098000UL
42 #define ATTR_DEFFG 0x00008000UL
43 #define ATTR_DEFBG 0x00090000UL
44 #define ATTR_CUR_XOR 0x000BA000UL
45 #define ERASE_CHAR (ATTR_DEFAULT | ' ')
46 #define ATTR_MASK 0xFFFFFF00UL
47 #define CHAR_MASK 0x000000FFUL
51 typedef struct mac_session *Context;
52 #else /* not macintosh */
54 #endif /* not macintosh */
59 #define SEL_NL { 13, 10 }
63 * Global variables. Most modules declare these `extern', but
64 * window.c will do `#define PUTTY_DO_GLOBALS' before including this
65 * module, and so will get them properly defined.
67 #ifdef PUTTY_DO_GLOBALS
73 GLOBAL unsigned long attr_mask;
75 GLOBAL int rows, cols, savelines;
77 GLOBAL int font_width, font_height;
79 #define INBUF_SIZE 2048
80 #define INBUF_MASK (INBUF_SIZE-1)
81 GLOBAL unsigned char inbuf[INBUF_SIZE];
82 GLOBAL int inbuf_head, inbuf_reap;
84 #define OUTBUF_SIZE 2048
85 #define OUTBUF_MASK (OUTBUF_SIZE-1)
86 GLOBAL unsigned char outbuf[OUTBUF_SIZE];
87 GLOBAL int outbuf_head, outbuf_reap;
91 GLOBAL int app_cursor_keys, app_keypad_keys;
93 #define WM_NETEVENT (WM_USER + 1)
96 TS_AYT, TS_BRK, TS_SYNCH, TS_EC, TS_EL, TS_GA, TS_NOP, TS_ABORT,
97 TS_AO, TS_IP, TS_SUSP, TS_EOR, TS_EOF
101 MB_NOTHING, MB_SELECT, MB_EXTEND, MB_PASTE
105 MA_NOTHING, MA_CLICK, MA_2CLK, MA_3CLK, MA_DRAG, MA_RELEASE
109 VT_XWINDOWS, VT_OEMANSI, VT_OEMONLY, VT_POORMAN
114 char *(*init) (char *host, int port, char **realhost);
116 #else /* not macintosh */
117 char *(*init) (HWND hwnd, char *host, int port, char **realhost);
118 int (*msg) (WPARAM wParam, LPARAM lParam);
119 #endif /* not macintosh */
120 void (*send) (char *buf, int len);
122 void (*special) (Telnet_Special code);
125 GLOBAL Backend *back;
131 enum { PROT_TELNET, PROT_SSH } protocol;
138 char environmt[1024]; /* VAR\tvalue\0VAR\tvalue\0\0 */
141 /* Keyboard options */
148 /* Terminal options */
163 PaletteHandle colours;
164 #else /* not macintosh */
165 unsigned char colours[22][3];
166 #endif /* not macintosh */
167 /* Selection options */
179 int rows, cols, savelines;
180 int font_width, font_height;
183 unsigned char inbuf[INBUF_SIZE];
184 int inbuf_head, inbuf_reap;
185 unsigned char outbuf[OUTBUF_SIZE];
186 int outbuf_head, outbuf_reap;
188 int app_cursor_keys, app_keypad_keys;
191 /* Config that created this session */
197 * Exports from window.c.
199 void request_resize (int, int);
200 void do_text (Context, int, int, char *, int, unsigned long);
201 void set_title (char *);
202 void set_icon (char *);
203 void set_sbar (int, int, int);
205 void free_ctx (Context);
206 void palette_set (int, int, int, int);
207 void palette_reset (void);
208 void write_clip (void *, int);
209 void get_clip (void **, int *);
210 void optimised_move (int, int, int);
211 void do_scroll(int, int, int);
212 void fatalbox (const char *, ...);
214 #pragma noreturn (fatalbox)
217 #define OPTIMISE_IS_SCROLL 1
220 * Exports from noise.c.
222 void noise_get_heavy(void (*func) (void *, int));
223 void noise_get_light(void (*func) (void *, int));
224 void noise_ultralight(DWORD data);
225 void random_save_seed(void);
229 * Exports from windlg.c.
231 int do_config (void);
232 int do_reconfig (HWND);
233 void do_defaults (char *);
234 void lognegot (char *);
235 void shownegot (HWND);
236 void showabout (HWND);
237 void verify_ssh_host_key(char *host, struct RSAKey *key);
241 * Exports from terminal.c.
244 void term_init (void);
245 void term_size (int, int, int);
246 void term_out (void);
247 void term_paint (Context, int, int, int, int);
248 void term_scroll (int, int);
249 void term_pwron (void);
250 void term_clrsb (void);
251 void term_mouse (Mouse_Button, Mouse_Action, int, int);
252 void term_copy(void);
253 void term_paste(void);
254 int term_hasselection(void);
255 void term_deselect (void);
256 void term_update (void);
257 void term_invalidate(void);
260 * Exports from telnet.c.
263 extern Backend telnet_backend;
266 * Exports from ssh.c.
269 extern Backend ssh_backend;
272 * Exports from sshrand.c.
275 void random_add_noise(void *noise, int length);
276 void random_init(void);
277 int random_byte(void);
278 void random_get_savedata(void **data, int *len);
281 * Exports from misc.c.
284 /* #define MALLOC_LOG do this if you suspect putty of leaking memory */
286 #define smalloc(z) (mlog(__FILE__,__LINE__), safemalloc(z))
287 #define srealloc(y,z) (mlog(__FILE__,__LINE__), saferealloc(y,z))
288 #define sfree(z) (mlog(__FILE__,__LINE__), safefree(z))
289 void mlog(char *, int);
291 #define smalloc safemalloc
292 #define srealloc saferealloc
293 #define sfree safefree
296 void *safemalloc(size_t);
297 void *saferealloc(void *, size_t);
298 void safefree(void *);
301 * Exports from testback.c
304 extern Backend null_backend;
305 extern Backend loop_backend;
306 extern Backend hexdump_backend;
309 * Exports from version.c.
318 #define debug(x) (dprintf x)
319 static void dprintf(char *fmt, ...) {
323 static int gotconsole = 0;
331 vsprintf(buf, fmt, ap);
332 WriteFile (GetStdHandle(STD_OUTPUT_HANDLE), buf, strlen(buf), &dw, NULL);