4 #define PUTTY_REG_POS "Software\\SimonTatham\\PuTTY"
18 #define ATTR_ACTCURS 0x80000000UL /* active cursor (block) */
19 #define ATTR_PASCURS 0x40000000UL /* passive cursor (box) */
20 #define ATTR_INVALID 0x20000000UL
21 #define ATTR_WRAPPED 0x10000000UL
23 #define ATTR_ASCII 0x00000000UL /* normal ASCII charset ESC ( B */
24 #define ATTR_GBCHR 0x00100000UL /* UK variant charset ESC ( A */
25 #define ATTR_LINEDRW 0x00200000UL /* line drawing charset ESC ( 0 */
27 #define ATTR_BOLD 0x00000100UL
28 #define ATTR_UNDER 0x00000200UL
29 #define ATTR_REVERSE 0x00000400UL
30 #define ATTR_FGMASK 0x0000F000UL
31 #define ATTR_BGMASK 0x000F0000UL
32 #define ATTR_FGSHIFT 12
33 #define ATTR_BGSHIFT 16
35 #define ATTR_DEFAULT 0x00098000UL
36 #define ATTR_DEFFG 0x00008000UL
37 #define ATTR_DEFBG 0x00090000UL
38 #define ATTR_CUR_XOR 0x000BA000UL
39 #define ERASE_CHAR (ATTR_DEFAULT | ' ')
40 #define ATTR_MASK 0xFFFFFF00UL
41 #define CHAR_MASK 0x000000FFUL
44 typedef void *Context; /* Temporarily until I work out what it should really be */
45 #else /* not macintosh */
47 #endif /* not macintosh */
49 #define SEL_NL { 13, 10 }
52 * Global variables. Most modules declare these `extern', but
53 * window.c will do `#define PUTTY_DO_GLOBALS' before including this
54 * module, and so will get them properly defined.
56 #ifdef PUTTY_DO_GLOBALS
64 int rows, cols, savelines;
65 int font_width, font_height;
68 unsigned char inbuf[INBUF_SIZE];
69 int inbuf_head, inbuf_reap;
70 unsigned char outbuf[OUTBUF_SIZE];
71 int outbuf_head, outbuf_reap;
73 int app_cursor_keys, app_keypad_keys;
76 /* Config that created this session */
80 GLOBAL int rows, cols, savelines;
82 GLOBAL int font_width, font_height;
84 #define INBUF_SIZE 2048
85 #define INBUF_MASK (INBUF_SIZE-1)
86 GLOBAL unsigned char inbuf[INBUF_SIZE];
87 GLOBAL int inbuf_head, inbuf_reap;
89 #define OUTBUF_SIZE 2048
90 #define OUTBUF_MASK (OUTBUF_SIZE-1)
91 GLOBAL unsigned char outbuf[OUTBUF_SIZE];
92 GLOBAL int outbuf_head, outbuf_reap;
96 GLOBAL int app_cursor_keys, app_keypad_keys;
98 #define WM_NETEVENT (WM_USER + 1)
101 TS_AYT, TS_BRK, TS_SYNCH, TS_EC, TS_EL, TS_GA, TS_NOP, TS_ABORT,
102 TS_AO, TS_IP, TS_SUSP, TS_EOR, TS_EOF
106 MB_NOTHING, MB_SELECT, MB_EXTEND, MB_PASTE
110 MA_NOTHING, MA_CLICK, MA_2CLK, MA_3CLK, MA_DRAG, MA_RELEASE
114 VT_XWINDOWS, VT_OEMANSI, VT_OEMONLY, VT_POORMAN
119 char *(*init) (char *host, int port, char **realhost);
121 #else /* not macintosh */
122 char *(*init) (HWND hwnd, char *host, int port, char **realhost);
123 int (*msg) (WPARAM wParam, LPARAM lParam);
124 #endif /* not macintosh */
125 void (*send) (char *buf, int len);
127 void (*special) (Telnet_Special code);
130 GLOBAL Backend *back;
136 enum { PROT_TELNET, PROT_SSH } protocol;
143 char environmt[1024]; /* VAR\tvalue\0VAR\tvalue\0\0 */
146 /* Keyboard options */
152 /* Terminal options */
166 unsigned char colours[22][3];
167 /* Selection options */
175 * Exports from window.c.
177 void request_resize (int, int);
178 void do_text (Context, int, int, char *, int, unsigned long);
179 void set_title (char *);
180 void set_icon (char *);
181 void set_sbar (int, int, int);
183 void free_ctx (Context);
184 void palette_set (int, int, int, int);
185 void palette_reset (void);
186 void write_clip (void *, int);
187 void get_clip (void **, int *);
188 void optimised_move (int, int, int);
189 void fatalbox (const char *, ...);
191 #define OPTIMISE_IS_SCROLL 1
194 * Exports from noise.c.
196 void noise_get_heavy(void (*func) (void *, int));
197 void noise_get_light(void (*func) (void *, int));
198 void noise_ultralight(DWORD data);
199 void random_save_seed(void);
203 * Exports from windlg.c.
205 int do_config (void);
206 int do_reconfig (HWND);
207 void do_defaults (char *);
208 void lognegot (char *);
209 void shownegot (HWND);
210 void showabout (HWND);
211 void verify_ssh_host_key(char *host, struct RSAKey *key);
215 * Exports from terminal.c.
218 void term_init (void);
219 void term_size (int, int, int);
220 void term_out (void);
221 void term_paint (Context, int, int, int, int);
222 void term_scroll (int, int);
223 void term_pwron (void);
224 void term_clrsb (void);
225 void term_mouse (Mouse_Button, Mouse_Action, int, int);
226 void term_deselect (void);
227 void term_update (void);
228 void term_invalidate(void);
231 * Exports from telnet.c.
234 Backend telnet_backend;
237 * Exports from ssh.c.
243 * Exports from sshrand.c.
246 void random_add_noise(void *noise, int length);
247 void random_init(void);
248 int random_byte(void);
249 void random_get_savedata(void **data, int *len);
252 * Exports from misc.c.
255 /* #define MALLOC_LOG do this if you suspect putty of leaking memory */
257 #define smalloc(z) (mlog(__FILE__,__LINE__), safemalloc(z))
258 #define srealloc(y,z) (mlog(__FILE__,__LINE__), saferealloc(y,z))
259 #define sfree(z) (mlog(__FILE__,__LINE__), safefree(z))
260 void mlog(char *, int);
262 #define smalloc safemalloc
263 #define srealloc saferealloc
264 #define sfree safefree
267 void *safemalloc(size_t);
268 void *saferealloc(void *, size_t);
269 void safefree(void *);
272 * Exports from version.c.
281 #define debug(x) (dprintf x)
282 static void dprintf(char *fmt, ...) {
286 static int gotconsole = 0;
294 vsprintf(buf, fmt, ap);
295 WriteFile (GetStdHandle(STD_OUTPUT_HANDLE), buf, strlen(buf), &dw, NULL);