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 */
165 int rows, cols, savelines;
166 int font_width, font_height;
169 unsigned char inbuf[INBUF_SIZE];
170 int inbuf_head, inbuf_reap;
171 unsigned char outbuf[OUTBUF_SIZE];
172 int outbuf_head, outbuf_reap;
174 int app_cursor_keys, app_keypad_keys;
177 /* Config that created this session */
183 * Exports from window.c.
185 void request_resize (int, int);
186 void do_text (Context, int, int, char *, int, unsigned long);
187 void set_title (char *);
188 void set_icon (char *);
189 void set_sbar (int, int, int);
191 void free_ctx (Context);
192 void palette_set (int, int, int, int);
193 void palette_reset (void);
194 void write_clip (void *, int);
195 void get_clip (void **, int *);
196 void optimised_move (int, int, int);
197 void fatalbox (const char *, ...);
199 #define OPTIMISE_IS_SCROLL 1
202 * Exports from noise.c.
204 void noise_get_heavy(void (*func) (void *, int));
205 void noise_get_light(void (*func) (void *, int));
206 void noise_ultralight(DWORD data);
207 void random_save_seed(void);
211 * Exports from windlg.c.
213 int do_config (void);
214 int do_reconfig (HWND);
215 void do_defaults (char *);
216 void lognegot (char *);
217 void shownegot (HWND);
218 void showabout (HWND);
219 void verify_ssh_host_key(char *host, struct RSAKey *key);
223 * Exports from terminal.c.
226 void term_init (void);
227 void term_size (int, int, int);
228 void term_out (void);
229 void term_paint (Context, int, int, int, int);
230 void term_scroll (int, int);
231 void term_pwron (void);
232 void term_clrsb (void);
233 void term_mouse (Mouse_Button, Mouse_Action, int, int);
234 void term_deselect (void);
235 void term_update (void);
236 void term_invalidate(void);
239 * Exports from telnet.c.
242 Backend telnet_backend;
245 * Exports from ssh.c.
251 * Exports from sshrand.c.
254 void random_add_noise(void *noise, int length);
255 void random_init(void);
256 int random_byte(void);
257 void random_get_savedata(void **data, int *len);
260 * Exports from misc.c.
263 /* #define MALLOC_LOG do this if you suspect putty of leaking memory */
265 #define smalloc(z) (mlog(__FILE__,__LINE__), safemalloc(z))
266 #define srealloc(y,z) (mlog(__FILE__,__LINE__), saferealloc(y,z))
267 #define sfree(z) (mlog(__FILE__,__LINE__), safefree(z))
268 void mlog(char *, int);
270 #define smalloc safemalloc
271 #define srealloc saferealloc
272 #define sfree safefree
275 void *safemalloc(size_t);
276 void *saferealloc(void *, size_t);
277 void safefree(void *);
280 * Exports from version.c.
289 #define debug(x) (dprintf x)
290 static void dprintf(char *fmt, ...) {
294 static int gotconsole = 0;
302 vsprintf(buf, fmt, ap);
303 WriteFile (GetStdHandle(STD_OUTPUT_HANDLE), buf, strlen(buf), &dw, NULL);