diff --git a/windows/window.c b/windows/window.c index f8a7447b..5bddff03 100644 --- a/windows/window.c +++ b/windows/window.c @@ -147,6 +147,8 @@ enum { SYSMENU, CTXMENU }; static HMENU savedsess_menu; static Conf *conf; +static LogContext *logctx; +static Terminal *term; struct wm_netevent_params { /* Used to pass data to wm_netevent_callback */ @@ -473,6 +475,8 @@ const unsigned cmdline_tooltype = TOOLTYPE_PORT_ARG | TOOLTYPE_NO_VERBOSE_OPTION; +HINSTANCE hinst; + int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) { MSG msg; diff --git a/windows/winpgen.c b/windows/winpgen.c index bb915810..d11e2758 100644 --- a/windows/winpgen.c +++ b/windows/winpgen.c @@ -1551,6 +1551,8 @@ void cleanup_exit(int code) exit(code); } +HINSTANCE hinst; + int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) { int argc, i; @@ -1561,7 +1563,6 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) init_common_controls(); hinst = inst; - hwnd = NULL; /* * See if we can find our Help file. diff --git a/windows/winpgnt.c b/windows/winpgnt.c index 3c435255..87709caf 100644 --- a/windows/winpgnt.c +++ b/windows/winpgnt.c @@ -1187,6 +1187,8 @@ static const PageantListenerClientVtable winpgnt_vtable = { static struct winpgnt_client wpc[1]; +HINSTANCE hinst; + int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) { MSG msg; diff --git a/windows/winplink.c b/windows/winplink.c index 794aa925..2f4cc043 100644 --- a/windows/winplink.c +++ b/windows/winplink.c @@ -30,6 +30,7 @@ BinarySink *stdout_bs, *stderr_bs; DWORD orig_console_mode; static Backend *backend; +static LogContext *logctx; static Conf *conf; static void plink_echoedit_update(Seat *seat, bool echo, bool edit) diff --git a/windows/winstuff.h b/windows/winstuff.h index c2f65827..0b558c7c 100644 --- a/windows/winstuff.h +++ b/windows/winstuff.h @@ -210,15 +210,11 @@ typedef void *Ssh_gss_name; #endif /* - * Window handles for the windows that can be running during a - * PuTTY session. + * The all-important instance handle, saved from WinMain in every GUI + * program and exported for other GUI code to pass back to the Windows + * API. */ -GLOBAL HWND hwnd; /* the main terminal window */ - -/* - * The all-important instance handle. - */ -GLOBAL HINSTANCE hinst; +extern HINSTANCE hinst; /* * Help file stuff in winhelp.c. @@ -230,15 +226,6 @@ void launch_help(HWND hwnd, const char *topic); void quit_help(HWND hwnd); int has_embedded_chm(void); /* 1 = yes, 0 = no, -1 = N/A */ -/* - * The terminal and logging context are notionally local to the - * Windows front end, but they must be shared between window.c and - * windlg.c. Likewise the Seat structure for the Windows GUI, and the - * Conf for the main session.. - */ -GLOBAL Terminal *term; -GLOBAL LogContext *logctx; - /* * GUI seat methods in windlg.c, so that the vtable definition in * window.c can refer to them. @@ -579,7 +566,7 @@ HWND event_log_window(void); /* * Exports from winmisc.c. */ -GLOBAL DWORD osMajorVersion, osMinorVersion, osPlatformId; +extern DWORD osMajorVersion, osMinorVersion, osPlatformId; void init_winver(void); void dll_hijacking_protection(void); HMODULE load_system32_dll(const char *libname);