From 20e8482e6ed517ea1398a620ff5579f2e97d2970 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sat, 10 Nov 2018 16:37:12 -0800 Subject: [PATCH] Fix crash that can occur when panic is called early. --- win/win32/winhack.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/win/win32/winhack.c b/win/win32/winhack.c index a85bdc478..e9f83b1ea 100644 --- a/win/win32/winhack.c +++ b/win/win32/winhack.c @@ -88,11 +88,19 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, UNREFERENCED_PARAMETER(lpCmdLine); UNREFERENCED_PARAMETER(nCmdShow); - sys_early_init(); + // + // We need to support DPI awareness. + // + // BOOL result = SetProcessDpiAwarenessContext( + // DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); + // - /* ensure that we don't access violate on a panic() */ + /* We must initialize state sufficiently to support calls to panic */ windowprocs.win_raw_print = mswin_raw_print; windowprocs.win_raw_print_bold = mswin_raw_print_bold; + windowprocs.win_wait_synch = mswin_wait_synch; + + sys_early_init(); /* init applicatio structure */ _nethack_app.hApp = hInstance;