4 #define PUTTY_REG_POS "Software\\SimonTatham\\PuTTY"
11 #endif /* macintosh */
20 #define ATTR_ACTCURS 0x80000000UL /* active cursor (block) */
21 #define ATTR_PASCURS 0x40000000UL /* passive cursor (box) */
22 #define ATTR_INVALID 0x20000000UL
23 #define ATTR_WRAPPED 0x10000000UL
25 #define ATTR_ASCII 0x00000000UL /* normal ASCII charset ESC ( B */
26 #define ATTR_GBCHR 0x00100000UL /* UK variant charset ESC ( A */
27 #define ATTR_LINEDRW 0x00200000UL /* line drawing charset ESC ( 0 */
29 #define ATTR_BOLD 0x00000100UL
30 #define ATTR_UNDER 0x00000200UL
31 #define ATTR_REVERSE 0x00000400UL
32 #define ATTR_FGMASK 0x0000F000UL
33 #define ATTR_BGMASK 0x000F0000UL
34 #define ATTR_FGSHIFT 12
35 #define ATTR_BGSHIFT 16
37 #define ATTR_DEFAULT 0x00098000UL
38 #define ATTR_DEFFG 0x00008000UL
39 #define ATTR_DEFBG 0x00090000UL
40 #define ATTR_CUR_XOR 0x000BA000UL
41 #define ERASE_CHAR (ATTR_DEFAULT | ' ')
42 #define ATTR_MASK 0xFFFFFF00UL
43 #define CHAR_MASK 0x000000FFUL
47 typedef struct mac_session *Context;
48 #else /* not macintosh */
50 #endif /* not macintosh */
52 #define SEL_NL { 13, 10 }
55 * Global variables. Most modules declare these `extern', but
56 * window.c will do `#define PUTTY_DO_GLOBALS' before including this
57 * module, and so will get them properly defined.
59 #ifdef PUTTY_DO_GLOBALS
65 GLOBAL int rows, cols, savelines;
67 GLOBAL int font_width, font_height;
69 #define INBUF_SIZE 2048
70 #define INBUF_MASK (INBUF_SIZE-1)
71 GLOBAL unsigned char inbuf[INBUF_SIZE];
72 GLOBAL int inbuf_head, inbuf_reap;
74 #define OUTBUF_SIZE 2048
75 #define OUTBUF_MASK (OUTBUF_SIZE-1)
76 GLOBAL unsigned char outbuf[OUTBUF_SIZE];
77 GLOBAL int outbuf_head, outbuf_reap;
81 GLOBAL int app_cursor_keys, app_keypad_keys;
83 #define WM_NETEVENT (WM_USER + 1)
86 TS_AYT, TS_BRK, TS_SYNCH, TS_EC, TS_EL, TS_GA, TS_NOP, TS_ABORT,
87 TS_AO, TS_IP, TS_SUSP, TS_EOR, TS_EOF
91 MB_NOTHING, MB_SELECT, MB_EXTEND, MB_PASTE
95 MA_NOTHING, MA_CLICK, MA_2CLK, MA_3CLK, MA_DRAG, MA_RELEASE
99 VT_XWINDOWS, VT_OEMANSI, VT_OEMONLY, VT_POORMAN
104 char *(*init) (char *host, int port, char **realhost);
106 #else /* not macintosh */
107 char *(*init) (HWND hwnd, char *host, int port, char **realhost);
108 int (*msg) (WPARAM wParam, LPARAM lParam);
109 #endif /* not macintosh */
110 void (*send) (char *buf, int len);
112 void (*special) (Telnet_Special code);
115 GLOBAL Backend *back;
121 enum { PROT_TELNET, PROT_SSH } protocol;
128 char environmt[1024]; /* VAR\tvalue\0VAR\tvalue\0\0 */
131 /* Keyboard options */
137 /* Terminal options */
152 PaletteHandle colours;
153 #else /* not macintosh */
154 unsigned char colours[22][3];
155 #endif /* not macintosh */
156 /* Selection options */
167 int rows, cols, savelines;
168 int font_width, font_height;
171 unsigned char inbuf[INBUF_SIZE];
172 int inbuf_head, inbuf_reap;
173 unsigned char outbuf[OUTBUF_SIZE];
174 int outbuf_head, outbuf_reap;
176 int app_cursor_keys, app_keypad_keys;
179 /* Config that created this session */
185 * Exports from window.c.
187 void request_resize (int, int);
188 void do_text (Context, int, int, char *, int, unsigned long);
189 void set_title (char *);
190 void set_icon (char *);
191 void set_sbar (int, int, int);
193 void free_ctx (Context);
194 void palette_set (int, int, int, int);
195 void palette_reset (void);
196 void write_clip (void *, int);
197 void get_clip (void **, int *);
198 void optimised_move (int, int, int);
199 void fatalbox (const char *, ...);
201 #define OPTIMISE_IS_SCROLL 1
204 * Exports from noise.c.
206 void noise_get_heavy(void (*func) (void *, int));
207 void noise_get_light(void (*func) (void *, int));
208 void noise_ultralight(DWORD data);
209 void random_save_seed(void);
213 * Exports from windlg.c.
215 int do_config (void);
216 int do_reconfig (HWND);
217 void do_defaults (char *);
218 void lognegot (char *);
219 void shownegot (HWND);
220 void showabout (HWND);
221 void verify_ssh_host_key(char *host, struct RSAKey *key);
225 * Exports from terminal.c.
228 void term_init (void);
229 void term_size (int, int, int);
230 void term_out (void);
231 void term_paint (Context, int, int, int, int);
232 void term_scroll (int, int);
233 void term_pwron (void);
234 void term_clrsb (void);
235 void term_mouse (Mouse_Button, Mouse_Action, int, int);
236 void term_deselect (void);
237 void term_update (void);
238 void term_invalidate(void);
241 * Exports from telnet.c.
244 Backend telnet_backend;
247 * Exports from ssh.c.
253 * Exports from sshrand.c.
256 void random_add_noise(void *noise, int length);
257 void random_init(void);
258 int random_byte(void);
259 void random_get_savedata(void **data, int *len);
262 * Exports from misc.c.
265 /* #define MALLOC_LOG do this if you suspect putty of leaking memory */
267 #define smalloc(z) (mlog(__FILE__,__LINE__), safemalloc(z))
268 #define srealloc(y,z) (mlog(__FILE__,__LINE__), saferealloc(y,z))
269 #define sfree(z) (mlog(__FILE__,__LINE__), safefree(z))
270 void mlog(char *, int);
272 #define smalloc safemalloc
273 #define srealloc saferealloc
274 #define sfree safefree
277 void *safemalloc(size_t);
278 void *saferealloc(void *, size_t);
279 void safefree(void *);
282 * Exports from version.c.
291 #define debug(x) (dprintf x)
292 static void dprintf(char *fmt, ...) {
296 static int gotconsole = 0;
304 vsprintf(buf, fmt, ap);
305 WriteFile (GetStdHandle(STD_OUTPUT_HANDLE), buf, strlen(buf), &dw, NULL);