if (error) {
char *str = dupprintf("%s Error", appname);
sprintf(msg, "Unable to open connection to\n"
- "%.800s\n" "%s", cfg.host, error);
+ "%.800s\n" "%s", cfg_dest(&cfg), error);
MessageBox(NULL, msg, str, MB_ICONERROR | MB_OK);
sfree(str);
exit(0);
i--;
p[i] = '\0';
do_defaults(p + 1, &cfg);
- if (!*cfg.host && !do_config()) {
+ if (!cfg_launchable(&cfg) && !do_config()) {
cleanup_exit(0);
}
} else if (*p == '&') {
cmdline_run_saved(&cfg);
- if (!*cfg.host && !do_config()) {
+ if (!cfg_launchable(&cfg) && !do_config()) {
cleanup_exit(0);
}
sfree(handles);
- if (GetMessage(&msg, NULL, 0, 0) != 1)
- break;
- do {
+ while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
if (msg.message == WM_QUIT)
goto finished; /* two-level break */
*/
if (must_close_session)
close_session();
- } while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE));
+ }
/* The messages seem unreliable; especially if we're being tricky */
term_set_focus(term, GetForegroundWindow() == hwnd);
sa.nLength = sizeof(sa);
sa.lpSecurityDescriptor = NULL;
sa.bInheritHandle = TRUE;
- filemap = CreateFileMapping((HANDLE) 0xFFFFFFFF,
+ filemap = CreateFileMapping(INVALID_HANDLE_VALUE,
&sa,
PAGE_READWRITE,
0, sizeof(Config), NULL);
- if (filemap) {
+ if (filemap && filemap != INVALID_HANDLE_VALUE) {
p = (Config *) MapViewOfFile(filemap,
FILE_MAP_WRITE,
0, 0, sizeof(Config));