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 #define WM_NETEVENT (WM_USER + 1)
68 TS_AYT, TS_BRK, TS_SYNCH, TS_EC, TS_EL, TS_GA, TS_NOP, TS_ABORT,
69 TS_AO, TS_IP, TS_SUSP, TS_EOR, TS_EOF
73 MB_NOTHING, MB_SELECT, MB_EXTEND, MB_PASTE
77 MA_NOTHING, MA_CLICK, MA_2CLK, MA_3CLK, MA_DRAG, MA_RELEASE
81 VT_XWINDOWS, VT_OEMANSI, VT_OEMONLY, VT_POORMAN
85 char *(*init) (HWND hwnd, char *host, int port, char **realhost);
86 int (*msg) (WPARAM wParam, LPARAM lParam);
87 void (*send) (char *buf, int len);
89 void (*special) (Telnet_Special code);
98 enum { PROT_RAW, PROT_TELNET, PROT_SSH } protocol;
102 enum { CIPHER_3DES, CIPHER_BLOWFISH, CIPHER_DES } cipher;
106 char environmt[1024]; /* VAR\tvalue\0VAR\tvalue\0\0 */
109 /* Keyboard options */
115 /* Terminal options */
129 unsigned char colours[22][3];
130 /* Selection options */
136 * You can compile with -DSSH_DEFAULT to have ssh by default.
139 #define DEFAULT_PROTOCOL PROT_TELNET
140 #define DEFAULT_PORT 23
142 #define DEFAULT_PROTOCOL PROT_SSH
143 #define DEFAULT_PORT 22
147 GLOBAL int default_protocol;
148 GLOBAL int default_port;
151 * Exports from window.c.
153 void request_resize (int, int);
154 void do_text (Context, int, int, char *, int, unsigned long);
155 void set_title (char *);
156 void set_icon (char *);
157 void set_sbar (int, int, int);
158 Context get_ctx(void);
159 void free_ctx (Context);
160 void palette_set (int, int, int, int);
161 void palette_reset (void);
162 void write_clip (void *, int);
163 void get_clip (void **, int *);
164 void optimised_move (int, int, int);
165 void fatalbox (char *, ...);
167 #define OPTIMISE_IS_SCROLL 1
170 * Exports from noise.c.
172 void noise_get_heavy(void (*func) (void *, int));
173 void noise_get_light(void (*func) (void *, int));
174 void noise_ultralight(DWORD data);
175 void random_save_seed(void);
178 * Exports from windlg.c.
180 int do_config (void);
181 int do_reconfig (HWND);
182 void do_defaults (char *);
183 void lognegot (char *);
184 void shownegot (HWND);
185 void showabout (HWND);
186 void verify_ssh_host_key(char *host, struct RSAKey *key);
187 void get_sesslist(int allocate);
189 GLOBAL int nsessions;
190 GLOBAL char **sessions;
193 * Exports from terminal.c.
196 void term_init (void);
197 void term_size (int, int, int);
198 void term_out (void);
199 void term_paint (Context, int, int, int, int);
200 void term_scroll (int, int);
201 void term_pwron (void);
202 void term_clrsb (void);
203 void term_mouse (Mouse_Button, Mouse_Action, int, int);
204 void term_deselect (void);
205 void term_update (void);
206 void term_invalidate(void);
209 * Exports from raw.c.
215 * Exports from telnet.c.
218 extern Backend telnet_backend;
221 * Exports from ssh.c.
224 extern Backend ssh_backend;
227 * Exports from sshrand.c.
230 void random_add_noise(void *noise, int length);
231 void random_init(void);
232 int random_byte(void);
233 void random_get_savedata(void **data, int *len);
236 * Exports from misc.c.
239 /* #define MALLOC_LOG do this if you suspect putty of leaking memory */
241 #define smalloc(z) (mlog(__FILE__,__LINE__), safemalloc(z))
242 #define srealloc(y,z) (mlog(__FILE__,__LINE__), saferealloc(y,z))
243 #define sfree(z) (mlog(__FILE__,__LINE__), safefree(z))
244 void mlog(char *, int);
246 #define smalloc safemalloc
247 #define srealloc saferealloc
248 #define sfree safefree
251 void *safemalloc(size_t);
252 void *saferealloc(void *, size_t);
253 void safefree(void *);
256 * Exports from version.c.
265 #define debug(x) (dprintf x)
266 static void dprintf(char *fmt, ...) {
270 static int gotconsole = 0;
278 vsprintf(buf, fmt, ap);
279 WriteFile (GetStdHandle(STD_OUTPUT_HANDLE), buf, strlen(buf), &dw, NULL);