Add a nonfatal() function everywhere, to be used for reporting things
[u/mdw/putty] / windows / window.c
index 5fe2178..38270e6 100644 (file)
@@ -2156,6 +2156,8 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
                si.lpReserved2 = NULL;
                CreateProcess(b, cl, NULL, NULL, inherit_handles,
                              NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi);
+                CloseHandle(pi.hProcess);
+                CloseHandle(pi.hThread);
 
                if (filemap)
                    CloseHandle(filemap);
@@ -2992,7 +2994,19 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
            break;
          case SB_THUMBPOSITION:
          case SB_THUMBTRACK:
-           term_scroll(term, 1, HIWORD(wParam));
+           /*
+            * Use GetScrollInfo instead of HIWORD(wParam) to get
+            * 32-bit scroll position.
+            */
+           {
+               SCROLLINFO si;
+
+               si.cbSize = sizeof(si);
+               si.fMask = SIF_TRACKPOS;
+               if (GetScrollInfo(hwnd, SB_VERT, &si) == 0)
+                   si.nTrackPos = HIWORD(wParam);
+               term_scroll(term, 1, si.nTrackPos);
+           }
            break;
        }
        break;
@@ -3221,8 +3235,9 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
                } else
                    break;
 
-               if (send_raw_mouse && shift_pressed &&
-                   !(conf_get_int(conf, CONF_mouse_override))) {
+               if (send_raw_mouse &&
+                   !(conf_get_int(conf, CONF_mouse_override) &&
+                      shift_pressed)) {
                    /* Mouse wheel position is in screen coordinates for
                     * some reason */
                    POINT p;
@@ -5327,6 +5342,22 @@ void modalfatalbox(char *fmt, ...)
     cleanup_exit(1);
 }
 
+/*
+ * Print a message box and don't close the connection.
+ */
+void nonfatal(char *fmt, ...)
+{
+    va_list ap;
+    char *stuff, morestuff[100];
+
+    va_start(ap, fmt);
+    stuff = dupvprintf(fmt, ap);
+    va_end(ap);
+    sprintf(morestuff, "%.70s Error", appname);
+    MessageBox(hwnd, stuff, morestuff, MB_ICONERROR | MB_OK);
+    sfree(stuff);
+}
+
 DECL_WINDOWS_FUNCTION(static, BOOL, FlashWindowEx, (PFLASHWINFO));
 
 static void init_flashwindow(void)