* GetSystemPowerStatus function.
*/
typedef BOOL (WINAPI *gsps_t)(LPSYSTEM_POWER_STATUS);
-gsps_t gsps;
+static gsps_t gsps;
/*
* This function is called once, at PuTTY startup, and will do some
extern char ver[];
-HINSTANCE instance;
-HWND hwnd;
-HWND keylist;
-HWND aboutbox;
-HMENU systray_menu;
+static HINSTANCE instance;
+static HWND hwnd;
+static HWND keylist;
+static HWND aboutbox;
+static HMENU systray_menu;
-tree234 *rsakeys;
+static tree234 *rsakeys;
-int has_security;
+static int has_security;
typedef DWORD (WINAPI *gsi_fn_t)
(HANDLE, SE_OBJECT_TYPE, SECURITY_INFORMATION,
PSID *, PSID *, PACL *, PACL *,
PSECURITY_DESCRIPTOR *);
-gsi_fn_t getsecurityinfo;
+static gsi_fn_t getsecurityinfo;
/*
* We need this to link with the RSA code, because rsaencrypt()
/*
* Update the visible key list.
*/
-void keylist_update(void) {
+static void keylist_update(void) {
struct RSAKey *key;
enum234 e;
/*
* This function loads a key from a file and adds it.
*/
-void add_keyfile(char *filename) {
+static void add_keyfile(char *filename) {
char passphrase[PASSPHRASE_MAXLEN];
struct RSAKey *key;
int needs_pass;
/*
* This is the main agent function that answers messages.
*/
-void answer_msg(void *msg) {
+static void answer_msg(void *msg) {
unsigned char *p = msg;
unsigned char *ret = msg;
int type;
/*
* Key comparison function for the 2-3-4 tree of RSA keys.
*/
-int cmpkeys(void *av, void *bv) {
+static int cmpkeys(void *av, void *bv) {
struct RSAKey *a = (struct RSAKey *)av;
struct RSAKey *b = (struct RSAKey *)bv;
Bignum am, bm;
void term_deselect(void) { }
/* GUI Adaptation - Sept 2000 */
-void send_msg(HWND h, UINT message, WPARAM wParam)
+static void send_msg(HWND h, UINT message, WPARAM wParam)
{
while (!PostMessage( h, message, wParam, 0))
SleepEx(1000,TRUE);
}
-void tell_char(FILE *stream, char c)
+static void tell_char(FILE *stream, char c)
{
if (!gui_mode)
fputc(c, stream);
}
}
-void tell_str(FILE *stream, char *str)
+static void tell_str(FILE *stream, char *str)
{
unsigned int i;
tell_char(stream, str[i]);
}
-void tell_user(FILE *stream, char *fmt, ...)
+static void tell_user(FILE *stream, char *fmt, ...)
{
char str[0x100]; /* Make the size big enough */
va_list ap;
tell_str(stream, str);
}
-void gui_update_stats(char *name, unsigned long size, int percentage, time_t elapsed)
+static void gui_update_stats(char *name, unsigned long size, int percentage, time_t elapsed)
{
unsigned int i;
#include "putty.h"
-ATOM tip_class = 0;
+static ATOM tip_class = 0;
-HFONT tip_font;
-COLORREF tip_bg;
-COLORREF tip_text;
+static HFONT tip_font;
+static COLORREF tip_bg;
+static COLORREF tip_text;
-LRESULT CALLBACK SizeTipWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
+static LRESULT CALLBACK SizeTipWndProc(HWND hWnd, UINT nMsg,
+ WPARAM wParam, LPARAM lParam)
{
switch (nMsg) {
return DefWindowProc(hWnd, nMsg, wParam, lParam);
}
-HWND tip_wnd = NULL;
-int tip_enabled = 0;
+static HWND tip_wnd = NULL;
+static int tip_enabled = 0;
void UpdateSizeTip(HWND src, int cx, int cy)
{
* state.
*/
#include <stdio.h>
-void sha_string(SHA_State *s, void *str, int len) {
+static void sha_string(SHA_State *s, void *str, int len) {
unsigned char lenblk[4];
PUT_32BIT(lenblk, len);
SHA_Bytes(s, lenblk, 4);
/*
* SSH2 packet construction functions.
*/
-void ssh2_pkt_adddata(void *data, int len) {
+static void ssh2_pkt_adddata(void *data, int len) {
pktout.length += len;
if (pktout.maxlen < pktout.length) {
pktout.maxlen = pktout.length + 256;
}
memcpy(pktout.data+pktout.length-len, data, len);
}
-void ssh2_pkt_addbyte(unsigned char byte) {
+static void ssh2_pkt_addbyte(unsigned char byte) {
ssh2_pkt_adddata(&byte, 1);
}
-void ssh2_pkt_init(int pkt_type) {
+static void ssh2_pkt_init(int pkt_type) {
pktout.length = 5;
ssh2_pkt_addbyte((unsigned char)pkt_type);
}
-void ssh2_pkt_addbool(unsigned char value) {
+static void ssh2_pkt_addbool(unsigned char value) {
ssh2_pkt_adddata(&value, 1);
}
-void ssh2_pkt_adduint32(unsigned long value) {
+static void ssh2_pkt_adduint32(unsigned long value) {
unsigned char x[4];
PUT_32BIT(x, value);
ssh2_pkt_adddata(x, 4);
}
-void ssh2_pkt_addstring_start(void) {
+static void ssh2_pkt_addstring_start(void) {
ssh2_pkt_adduint32(0);
pktout.savedpos = pktout.length;
}
-void ssh2_pkt_addstring_str(char *data) {
+static void ssh2_pkt_addstring_str(char *data) {
ssh2_pkt_adddata(data, strlen(data));
PUT_32BIT(pktout.data + pktout.savedpos - 4,
pktout.length - pktout.savedpos);
}
-void ssh2_pkt_addstring_data(char *data, int len) {
+static void ssh2_pkt_addstring_data(char *data, int len) {
ssh2_pkt_adddata(data, len);
PUT_32BIT(pktout.data + pktout.savedpos - 4,
pktout.length - pktout.savedpos);
}
-void ssh2_pkt_addstring(char *data) {
+static void ssh2_pkt_addstring(char *data) {
ssh2_pkt_addstring_start();
ssh2_pkt_addstring_str(data);
}
-char *ssh2_mpint_fmt(Bignum b, int *len) {
+static char *ssh2_mpint_fmt(Bignum b, int *len) {
unsigned char *p;
int i, n = b[0];
p = malloc(n * 2 + 1);
*len = n*2+1-i;
return p;
}
-void ssh2_pkt_addmp(Bignum b) {
+static void ssh2_pkt_addmp(Bignum b) {
unsigned char *p;
int len;
p = ssh2_mpint_fmt(b, &len);
ssh2_pkt_addstring_data(p, len);
free(p);
}
-void ssh2_pkt_send(void) {
+static void ssh2_pkt_send(void) {
int cipherblk, maclen, padding, i;
static unsigned long outgoing_sequence = 0;
}
#endif
-void sha_mpint(SHA_State *s, Bignum b) {
+static void sha_mpint(SHA_State *s, Bignum b) {
unsigned char *p;
int len;
p = ssh2_mpint_fmt(b, &len);
/*
* SSH2 packet decode functions.
*/
-unsigned long ssh2_pkt_getuint32(void) {
+static unsigned long ssh2_pkt_getuint32(void) {
unsigned long value;
if (pktin.length - pktin.savedpos < 4)
return 0; /* arrgh, no way to decline (FIXME?) */
pktin.savedpos += 4;
return value;
}
-void ssh2_pkt_getstring(char **p, int *length) {
+static void ssh2_pkt_getstring(char **p, int *length) {
*p = NULL;
if (pktin.length - pktin.savedpos < 4)
return;
*p = pktin.data+pktin.savedpos;
pktin.savedpos += *length;
}
-Bignum ssh2_pkt_getmp(void) {
+static Bignum ssh2_pkt_getmp(void) {
char *p;
int i, j, length;
Bignum b;
/*
* Utility routine for decoding comma-separated strings in KEXINIT.
*/
-int in_commasep_string(char *needle, char *haystack, int haylen) {
+static int in_commasep_string(char *needle, char *haystack, int haylen) {
int needlen = strlen(needle);
while (1) {
/*
/*
* SSH2 key creation method.
*/
-void ssh2_mkkey(Bignum K, char *H, char chr, char *keyspace) {
+static void ssh2_mkkey(Bignum K, char *H, char chr, char *keyspace) {
SHA_State s;
/* First 20 bytes. */
SHA_Init(&s);
};
/* Used on self-constructed dialogs. */
-void ctlposinit(struct ctlpos *cp, HWND hwnd) {
+static void ctlposinit(struct ctlpos *cp, HWND hwnd) {
RECT r;
cp->hwnd = hwnd;
cp->units = GetWindowLong(hwnd, GWL_USERDATA);
}
/* Used on kosher dialogs. */
-void ctlposinit2(struct ctlpos *cp, HWND hwnd) {
+static void ctlposinit2(struct ctlpos *cp, HWND hwnd) {
RECT r;
cp->hwnd = hwnd;
r.left = r.top = 0;
cp->width = (r.right * 4) / (cp->units & 0xFFFF) - 2*GAPBETWEEN;
}
-void doctl(struct ctlpos *cp, RECT r, char *wclass, int wstyle, int exstyle,
- char *wtext, int wid) {
+static void doctl(struct ctlpos *cp, RECT r,
+ char *wclass, int wstyle, int exstyle,
+ char *wtext, int wid) {
HWND ctl;
/*
* Note nonstandard use of RECT. This is deliberate: by
* Some edit boxes. Each one has a static above it. The percentages
* of the horizontal space are provided.
*/
-void multiedit(struct ctlpos *cp, ...) {
+static void multiedit(struct ctlpos *cp, ...) {
RECT r;
va_list ap;
int percent, xpos;
* needed to line up some 2s and some 3s to look good in the same
* panel).
*/
-void radioline(struct ctlpos *cp, char *text, int id, int nacross, ...) {
+static void radioline(struct ctlpos *cp,
+ char *text, int id, int nacross, ...) {
RECT r;
va_list ap;
int group;
* A set of radio buttons on multiple lines, with a static above
* them.
*/
-void radiobig(struct ctlpos *cp, char *text, int id, ...) {
+static void radiobig(struct ctlpos *cp, char *text, int id, ...) {
RECT r;
va_list ap;
int group;
/*
* A single standalone checkbox.
*/
-void checkbox(struct ctlpos *cp, char *text, int id) {
+static void checkbox(struct ctlpos *cp, char *text, int id) {
RECT r;
r.left = GAPBETWEEN; r.top = cp->ypos;
/*
* A button on the right hand side, with a static to its left.
*/
-void staticbtn(struct ctlpos *cp, char *stext, int sid, char *btext, int bid) {
+static void staticbtn(struct ctlpos *cp, char *stext, int sid,
+ char *btext, int bid) {
const int height = (PUSHBTNHEIGHT > STATICHEIGHT ?
PUSHBTNHEIGHT : STATICHEIGHT);
RECT r;
/*
* An edit control on the right hand side, with a static to its left.
*/
-void staticedit(struct ctlpos *cp, char *stext, int sid, int eid) {
+static void staticedit(struct ctlpos *cp, char *stext, int sid, int eid) {
const int height = (EDITHEIGHT > STATICHEIGHT ?
EDITHEIGHT : STATICHEIGHT);
RECT r;
/*
* A tab-control substitute when a real tab control is unavailable.
*/
-void ersatztab(struct ctlpos *cp, char *stext, int sid, int lid, int s2id) {
+static void ersatztab(struct ctlpos *cp, char *stext, int sid,
+ int lid, int s2id) {
const int height = (COMBOHEIGHT > STATICHEIGHT ?
COMBOHEIGHT : STATICHEIGHT);
RECT r;
* A static line, followed by an edit control on the left hand side
* and a button on the right.
*/
-void editbutton(struct ctlpos *cp, char *stext, int sid,
- int eid, char *btext, int bid) {
+static void editbutton(struct ctlpos *cp, char *stext, int sid,
+ int eid, char *btext, int bid) {
const int height = (EDITHEIGHT > PUSHBTNHEIGHT ?
EDITHEIGHT : PUSHBTNHEIGHT);
RECT r;
* that a list box. To the right of the list box, a column of
* buttons.
*/
-void sesssaver(struct ctlpos *cp, char *text,
- int staticid, int editid, int listid, ...) {
+static void sesssaver(struct ctlpos *cp, char *text,
+ int staticid, int editid, int listid, ...) {
RECT r;
va_list ap;
int lwid, rwid, rpos;
* static line first; then a pair of edit boxes with associated
* statics, and two buttons; then a list box.
*/
-void envsetter(struct ctlpos *cp, char *stext, int sid,
- char *e1stext, int e1sid, int e1id,
- char *e2stext, int e2sid, int e2id,
- int listid, char *b1text, int b1id, char *b2text, int b2id) {
+static void envsetter(struct ctlpos *cp, char *stext, int sid,
+ char *e1stext, int e1sid, int e1id,
+ char *e2stext, int e2sid, int e2id,
+ int listid,
+ char *b1text, int b1id, char *b2text, int b2id) {
RECT r;
const int height = (STATICHEIGHT > EDITHEIGHT && STATICHEIGHT > PUSHBTNHEIGHT ?
STATICHEIGHT :
* static, then a list, then a line containing a
* button-and-static-and-edit.
*/
-void charclass(struct ctlpos *cp, char *stext, int sid, int listid,
- char *btext, int bid, int eid, char *s2text, int s2id) {
+static void charclass(struct ctlpos *cp, char *stext, int sid, int listid,
+ char *btext, int bid, int eid, char *s2text, int s2id) {
RECT r;
const int height = (STATICHEIGHT > EDITHEIGHT && STATICHEIGHT > PUSHBTNHEIGHT ?
STATICHEIGHT :
* then on the left, a list box, and on the right, a sequence of
* two-part statics followed by a button.
*/
-void colouredit(struct ctlpos *cp, char *stext, int sid, int listid,
- char *btext, int bid, ...) {
+static void colouredit(struct ctlpos *cp, char *stext, int sid, int listid,
+ char *btext, int bid, ...) {
RECT r;
int y;
va_list ap;