4 #define PUTTY_REG_POS "Software\\SimonTatham\\PuTTY"
7 * Global variables. Most modules declare these `extern', but
8 * window.c will do `#define PUTTY_DO_GLOBALS' before including this
9 * module, and so will get them properly defined.
11 #ifdef PUTTY_DO_GLOBALS
17 GLOBAL HINSTANCE putty_inst;
19 #define ATTR_ACTCURS 0x80000000UL /* active cursor (block) */
20 #define ATTR_PASCURS 0x40000000UL /* passive cursor (box) */
21 #define ATTR_INVALID 0x20000000UL
22 #define ATTR_WRAPPED 0x10000000UL
24 #define ATTR_ASCII 0x00000000UL /* normal ASCII charset ESC ( B */
25 #define ATTR_GBCHR 0x00100000UL /* UK variant charset ESC ( A */
26 #define ATTR_LINEDRW 0x00200000UL /* line drawing charset ESC ( 0 */
28 #define ATTR_BOLD 0x00000100UL
29 #define ATTR_UNDER 0x00000200UL
30 #define ATTR_REVERSE 0x00000400UL
31 #define ATTR_FGMASK 0x0000F000UL
32 #define ATTR_BGMASK 0x000F0000UL
33 #define ATTR_FGSHIFT 12
34 #define ATTR_BGSHIFT 16
36 #define ATTR_DEFAULT 0x00098000UL
37 #define ATTR_DEFFG 0x00008000UL
38 #define ATTR_DEFBG 0x00090000UL
39 #define ATTR_CUR_XOR 0x000BA000UL
40 #define ERASE_CHAR (ATTR_DEFAULT | ' ')
41 #define ATTR_MASK 0xFFFFFF00UL
42 #define CHAR_MASK 0x000000FFUL
45 #define SEL_NL { 13, 10 }
47 GLOBAL int rows, cols, savelines;
49 GLOBAL int font_width, font_height;
51 #define INBUF_SIZE 2048
52 #define INBUF_MASK (INBUF_SIZE-1)
53 GLOBAL unsigned char inbuf[INBUF_SIZE];
54 GLOBAL int inbuf_head, inbuf_reap;
56 #define OUTBUF_SIZE 2048
57 #define OUTBUF_MASK (OUTBUF_SIZE-1)
58 GLOBAL unsigned char outbuf[OUTBUF_SIZE];
59 GLOBAL int outbuf_head, outbuf_reap;
63 GLOBAL int app_cursor_keys, app_keypad_keys;
65 GLOBAL int seen_key_event;
66 GLOBAL int seen_disp_event;
69 US_NONE = 0, US_KEY = 1, US_DISP = 2, US_BOTH = 3
72 GLOBAL Unscroll_Trigger unscroll_event;
74 #define WM_NETEVENT (WM_USER + 1)
77 TS_AYT, TS_BRK, TS_SYNCH, TS_EC, TS_EL, TS_GA, TS_NOP, TS_ABORT,
78 TS_AO, TS_IP, TS_SUSP, TS_EOR, TS_EOF
82 MB_NOTHING, MB_SELECT, MB_EXTEND, MB_PASTE
86 MA_NOTHING, MA_CLICK, MA_2CLK, MA_3CLK, MA_DRAG, MA_RELEASE
90 VT_XWINDOWS, VT_OEMANSI, VT_OEMONLY, VT_POORMAN
94 char *(*init) (HWND hwnd, char *host, int port, char **realhost);
95 int (*msg) (WPARAM wParam, LPARAM lParam);
96 void (*send) (char *buf, int len);
98 void (*special) (Telnet_Special code);
101 GLOBAL Backend *back;
104 void (*send) (char *buf, int len);
113 enum { PROT_RAW, PROT_TELNET, PROT_SSH } protocol;
118 enum { CIPHER_3DES, CIPHER_BLOWFISH, CIPHER_DES } cipher;
123 char environmt[1024]; /* VAR\tvalue\0VAR\tvalue\0\0 */
126 /* Keyboard options */
133 int alt_f4; /* is it special? */
134 int alt_space; /* is it special? */
136 /* Terminal options */
151 unsigned char colours[22][3];
152 /* Selection options */
155 /* russian language translation */
156 int xlat_enablekoiwin;
158 int xlat_capslockcyr;
162 * You can compile with -DSSH_DEFAULT to have ssh by default.
165 #define DEFAULT_PROTOCOL PROT_TELNET
166 #define DEFAULT_PORT 23
168 #define DEFAULT_PROTOCOL PROT_SSH
169 #define DEFAULT_PORT 22
173 GLOBAL int default_protocol;
174 GLOBAL int default_port;
176 struct RSAKey; /* be a little careful of scope */
179 * Exports from window.c.
181 void request_resize (int, int);
182 void do_text (Context, int, int, char *, int, unsigned long);
183 void set_title (char *);
184 void set_icon (char *);
185 void set_sbar (int, int, int);
186 Context get_ctx(void);
187 void free_ctx (Context);
188 void palette_set (int, int, int, int);
189 void palette_reset (void);
190 void write_clip (void *, int);
191 void get_clip (void **, int *);
192 void optimised_move (int, int, int);
193 void fatalbox (char *, ...);
195 #define OPTIMISE_IS_SCROLL 1
198 * Exports from noise.c.
200 void noise_get_heavy(void (*func) (void *, int));
201 void noise_get_light(void (*func) (void *, int));
202 void noise_ultralight(DWORD data);
203 void random_save_seed(void);
206 * Exports from windlg.c.
208 int do_config (void);
209 int do_reconfig (HWND);
210 void do_defaults (char *);
211 void logevent (char *);
212 void showeventlog (HWND);
213 void showabout (HWND);
214 void verify_ssh_host_key(char *host, struct RSAKey *key);
215 void get_sesslist(int allocate);
217 GLOBAL int nsessions;
218 GLOBAL char **sessions;
221 * Exports from terminal.c.
224 void term_init (void);
225 void term_size (int, int, int);
226 void term_out (void);
227 void term_paint (Context, int, int, int, int);
228 void term_scroll (int, int);
229 void term_pwron (void);
230 void term_clrsb (void);
231 void term_mouse (Mouse_Button, Mouse_Action, int, int);
232 void term_deselect (void);
233 void term_update (void);
234 void term_invalidate(void);
237 * Exports from raw.c.
240 extern Backend raw_backend;
243 * Exports from telnet.c.
246 extern Backend telnet_backend;
249 * Exports from ssh.c.
252 extern Backend ssh_backend;
255 * Exports from ldisc.c.
258 extern Ldisc ldisc_term, ldisc_simple;
261 * Exports from sshrand.c.
264 void random_add_noise(void *noise, int length);
265 void random_init(void);
266 int random_byte(void);
267 void random_get_savedata(void **data, int *len);
270 * Exports from misc.c.
273 /* #define MALLOC_LOG do this if you suspect putty of leaking memory */
275 #define smalloc(z) (mlog(__FILE__,__LINE__), safemalloc(z))
276 #define srealloc(y,z) (mlog(__FILE__,__LINE__), saferealloc(y,z))
277 #define sfree(z) (mlog(__FILE__,__LINE__), safefree(z))
278 void mlog(char *, int);
280 #define smalloc safemalloc
281 #define srealloc saferealloc
282 #define sfree safefree
285 void *safemalloc(size_t);
286 void *saferealloc(void *, size_t);
287 void safefree(void *);
290 * Exports from version.c.
295 * Exports from sizetip.c.
297 void UpdateSizeTip(HWND src, int cx, int cy);
298 void EnableSizeTip(int bEnable);
301 * Exports from xlat.c.
303 unsigned char xlat_kbd2tty(unsigned char c);
304 unsigned char xlat_tty2scr(unsigned char c);
305 unsigned char xlat_latkbd2win(unsigned char c);
312 #define debug(x) (dprintf x)
313 static void dprintf(char *fmt, ...) {
317 static int gotconsole = 0;
325 vsprintf(buf, fmt, ap);
326 WriteFile (GetStdHandle(STD_OUTPUT_HANDLE), buf, strlen(buf), &dw, NULL);