#define PUTTY_DO_GLOBALS /* actually _define_ globals */
#include "putty.h"
#include "win_res.h"
+#include "sizetip.h"
#define IDM_SHOWLOG 0x0010
#define IDM_NEWSESS 0x0020
MSG msg;
int guess_width, guess_height;
+ putty_inst = inst;
+
winsock_ver = MAKEWORD(1, 1);
if (WSAStartup(winsock_ver, &wsadata)) {
MessageBox(NULL, "Unable to initialise WinSock", "WinSock Error",
{
char b[2048];
char c[30], *cl;
+ int freecl = FALSE;
STARTUPINFO si;
PROCESS_INFORMATION pi;
HANDLE filemap = NULL;
sprintf(c, "putty &%08x", filemap);
cl = c;
} else if (wParam == IDM_SAVEDSESS) {
- sprintf(c, "putty @%s",
- sessions[(lParam - IDM_SAVED_MIN) / 16]);
- cl = c;
+ char *session = sessions[(lParam - IDM_SAVED_MIN) / 16];
+ cl = malloc(16 + strlen(session)); /* 8, but play safe */
+ if (!cl)
+ cl = NULL; /* not a very important failure mode */
+ sprintf(cl, "putty @%s", session);
+ freecl = TRUE;
} else
cl = NULL;
if (filemap)
CloseHandle(filemap);
+ if (freecl)
+ free(cl);
}
break;
case IDM_RECONF:
case WM_IGNORE_SIZE:
ignore_size = TRUE; /* don't panic on next WM_SIZE msg */
break;
+ case WM_ENTERSIZEMOVE:
+ EnableSizeTip(1);
+ break;
+ case WM_EXITSIZEMOVE:
+ EnableSizeTip(0);
+ break;
case WM_SIZING:
{
int width, height, w, h, ew, eh;
height = r->bottom - r->top - extra_height;
w = (width + font_width/2) / font_width; if (w < 1) w = 1;
h = (height + font_height/2) / font_height; if (h < 1) h = 1;
+ UpdateSizeTip(hwnd, w, h);
ew = width - w * font_width;
eh = height - h * font_height;
if (ew != 0) {