]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Cast return value of ShellExecute to INT_PTR.
authorTim Kosse <tim.kosse@filezilla-project.org>
Tue, 11 Aug 2015 12:30:14 +0000 (14:30 +0200)
committerSimon Tatham <anakin@pobox.com>
Sat, 15 Aug 2015 12:54:53 +0000 (13:54 +0100)
ShellExecute returns HINSTANCE which is a typedef for void*. Cast the
return value to INT_PTR instead of int to avoid truncation on 64bit
builds.

windows/winpgnt.c

index 2d6917c2ea01d72553a63a2597cbabad9c45a109..fa4d1d101c33c6113fad3353967ee7911ca292be 100644 (file)
@@ -789,7 +789,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
       case WM_SYSCOMMAND:
        switch (wParam & ~0xF) {       /* low 4 bits reserved to Windows */
          case IDM_PUTTY:
-           if((int)ShellExecute(hwnd, NULL, putty_path, _T(""), _T(""),
+           if((INT_PTR)ShellExecute(hwnd, NULL, putty_path, _T(""), _T(""),
                                 SW_SHOW) <= 32) {
                MessageBox(NULL, "Unable to execute PuTTY!",
                           "Error", MB_OK | MB_ICONERROR);
@@ -856,7 +856,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
                    GetMenuItemInfo(session_menu, wParam, FALSE, &mii);
                    strcpy(param, "@");
                    strcat(param, mii.dwTypeData);
-                   if((int)ShellExecute(hwnd, NULL, putty_path, param,
+                   if((INT_PTR)ShellExecute(hwnd, NULL, putty_path, param,
                                         _T(""), SW_SHOW) <= 32) {
                        MessageBox(NULL, "Unable to execute PuTTY!", "Error",
                                   MB_OK | MB_ICONERROR);