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_BLINK 0x00000800UL
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
46 #define SEL_NL { 13, 10 }
48 GLOBAL
int rows
, cols
, savelines
;
50 GLOBAL
int font_width
, font_height
;
52 #define INBUF_SIZE 2048
53 #define INBUF_MASK (INBUF_SIZE-1)
54 GLOBAL
unsigned char inbuf
[INBUF_SIZE
];
55 GLOBAL
int inbuf_head
, inbuf_reap
;
57 #define OUTBUF_SIZE 2048
58 #define OUTBUF_MASK (OUTBUF_SIZE-1)
59 GLOBAL
unsigned char outbuf
[OUTBUF_SIZE
];
60 GLOBAL
int outbuf_head
, outbuf_reap
;
64 GLOBAL
int app_cursor_keys
, app_keypad_keys
;
66 GLOBAL
int seen_key_event
;
67 GLOBAL
int seen_disp_event
;
69 GLOBAL
int session_closed
;
72 US_NONE
= 0, US_KEY
= 1, US_DISP
= 2, US_BOTH
= 3
75 GLOBAL Unscroll_Trigger unscroll_event
;
80 * I've just looked in the windows standard headr files for WM_USER, there
81 * are hundreds of flags defined using the form WM_USER+123 so I've
82 * renumbered this NETEVENT value and the two in window.c
84 #define WM_XUSER (WM_USER + 0x2000)
85 #define WM_NETEVENT (WM_XUSER + 5)
88 TS_AYT
, TS_BRK
, TS_SYNCH
, TS_EC
, TS_EL
, TS_GA
, TS_NOP
, TS_ABORT
,
89 TS_AO
, TS_IP
, TS_SUSP
, TS_EOR
, TS_EOF
, TS_LECHO
, TS_RECHO
93 MB_NOTHING
, MB_SELECT
, MB_EXTEND
, MB_PASTE
97 MA_NOTHING
, MA_CLICK
, MA_2CLK
, MA_3CLK
, MA_DRAG
, MA_RELEASE
101 VT_XWINDOWS
, VT_OEMANSI
, VT_OEMONLY
, VT_POORMAN
105 char *(*init
) (HWND hwnd
, char *host
, int port
, char **realhost
);
106 int (*msg
) (WPARAM wParam
, LPARAM lParam
);
107 void (*send
) (char *buf
, int len
);
109 void (*special
) (Telnet_Special code
);
112 GLOBAL Backend
*back
;
114 GLOBAL
struct backend_list
{
121 void (*send
) (char *buf
, int len
);
130 enum { PROT_RAW
, PROT_TELNET
, PROT_SSH
} protocol
;
135 enum { CIPHER_3DES
, CIPHER_BLOWFISH
, CIPHER_DES
} cipher
;
140 char environmt
[1024]; /* VAR\tvalue\0VAR\tvalue\0\0 */
143 /* Keyboard options */
150 int alt_f4
; /* is it special? */
151 int alt_space
; /* is it special? */
154 /* Terminal options */
169 unsigned char colours
[22][3];
170 /* Selection options */
173 /* russian language translation */
174 int xlat_enablekoiwin
;
176 int xlat_capslockcyr
;
180 * You can compile with -DSSH_DEFAULT to have ssh by default.
183 #define DEFAULT_PROTOCOL PROT_TELNET
184 #define DEFAULT_PORT 23
186 #define DEFAULT_PROTOCOL PROT_SSH
187 #define DEFAULT_PORT 22
191 GLOBAL
int default_protocol
;
192 GLOBAL
int default_port
;
194 struct RSAKey
; /* be a little careful of scope */
197 * Exports from window.c.
199 void request_resize (int, int, int);
200 void do_text (Context
, int, int, char *, int, unsigned long);
201 void set_title (char *);
202 void set_icon (char *);
203 void set_sbar (int, int, int);
204 Context
get_ctx(void);
205 void free_ctx (Context
);
206 void palette_set (int, int, int, int);
207 void palette_reset (void);
208 void write_clip (void *, int);
209 void get_clip (void **, int *);
210 void optimised_move (int, int, int);
211 void fatalbox (char *, ...);
213 #define OPTIMISE_IS_SCROLL 1
216 * Exports from noise.c.
218 void noise_get_heavy(void (*func
) (void *, int));
219 void noise_get_light(void (*func
) (void *, int));
220 void noise_ultralight(DWORD data
);
221 void random_save_seed(void);
224 * Exports from windlg.c.
226 int do_config (void);
227 int do_reconfig (HWND
);
228 void do_defaults (char *);
229 void logevent (char *);
230 void showeventlog (HWND
);
231 void showabout (HWND
);
232 void verify_ssh_host_key(char *host
, char *keystr
);
233 void get_sesslist(int allocate
);
235 GLOBAL
int nsessions
;
236 GLOBAL
char **sessions
;
239 * Exports from terminal.c.
242 void term_init (void);
243 void term_size (int, int, int);
244 void term_out (void);
245 void term_paint (Context
, int, int, int, int);
246 void term_scroll (int, int);
247 void term_pwron (void);
248 void term_clrsb (void);
249 void term_mouse (Mouse_Button
, Mouse_Action
, int, int);
250 void term_deselect (void);
251 void term_update (void);
252 void term_invalidate(void);
253 void term_blink(int set_cursor
);
256 * Exports from raw.c.
259 extern Backend raw_backend
;
262 * Exports from telnet.c.
265 extern Backend telnet_backend
;
268 * Exports from ssh.c.
271 extern Backend ssh_backend
;
274 * Exports from ldisc.c.
277 extern Ldisc ldisc_term
, ldisc_simple
;
280 * Exports from sshrand.c.
283 void random_add_noise(void *noise
, int length
);
284 void random_init(void);
285 int random_byte(void);
286 void random_get_savedata(void **data
, int *len
);
289 * Exports from misc.c.
292 /* #define MALLOC_LOG do this if you suspect putty of leaking memory */
294 #define smalloc(z) (mlog(__FILE__,__LINE__), safemalloc(z))
295 #define srealloc(y,z) (mlog(__FILE__,__LINE__), saferealloc(y,z))
296 #define sfree(z) (mlog(__FILE__,__LINE__), safefree(z))
297 void mlog(char *, int);
299 #define smalloc safemalloc
300 #define srealloc saferealloc
301 #define sfree safefree
304 void *safemalloc(size_t);
305 void *saferealloc(void *, size_t);
306 void safefree(void *);
309 * Exports from version.c.
314 * Exports from sizetip.c.
316 void UpdateSizeTip(HWND src
, int cx
, int cy
);
317 void EnableSizeTip(int bEnable
);
320 * Exports from xlat.c.
322 unsigned char xlat_kbd2tty(unsigned char c
);
323 unsigned char xlat_tty2scr(unsigned char c
);
324 unsigned char xlat_latkbd2win(unsigned char c
);
327 * Exports from mscrypto.c
330 int crypto_startup();
331 void crypto_wrapup();
339 #define debug(x) (dprintf x)
340 static void dprintf(char *fmt
, ...) {
344 static int gotconsole
= 0;
352 vsprintf(buf
, fmt
, ap
);
353 WriteFile (GetStdHandle(STD_OUTPUT_HANDLE
), buf
, strlen(buf
), &dw
, NULL
);