From 924dc4d4eff3bb060e3011a6b88bdda18ae4a351 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Sat, 17 May 2014 14:22:31 +0000 Subject: [PATCH] [BUG_FIXED] (Author: Andreas Jonsson) Fix a bug in NppShell when trying to open many files. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1239 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/bin/NppShell.dll | Bin 260096 -> 260608 bytes PowerEditor/bin/NppShell64.dll | Bin 222720 -> 222720 bytes PowerEditor/installer/nppSetup.nsi | 16 ++-- .../src/tools/NppShell/src/NppShell.cpp | 78 +++++++++++------- PowerEditor/src/tools/NppShell/src/NppShell.h | 1 + 5 files changed, 60 insertions(+), 35 deletions(-) diff --git a/PowerEditor/bin/NppShell.dll b/PowerEditor/bin/NppShell.dll index 9c1ece20c16dc32275a1f4bafc144ceb30751dbb..d34d3eac952725a955dc0b26cdca5bd25450b6eb 100644 GIT binary patch delta 2239 zcmah~e@qj16#w2)pdvpGp$ck9QKEk!TcI$xyS5kx88Z@Frsx(7EK_n4mN12B{M9b? z)XVJ>w_6?R%!-K9XcVpDM#feY*J<45uPs}qS*LRxLX2@ZYr=MW-)~{avTRN6-Fx?a z?|t6;ymwd6gA~t5il3UEx~KUiH1-Q4I(sTL1)(l=I>phRC2BRbh+dea=HHm32C0&S z#^d10z}2PFbS`yTeTJS-4XZUEN7b$L%;b_xI5Zm&nhE!C;1FFwQzrw%h6IY9w_lCK zW~IjMN9Z#7d7E+!iG#lf=EqITpld!0@L7Aex^t2c3W>G9={f}&gp4?Z8j&LIe5~tE zZP6NC_x2}-#CkY~WAJPO%>b@KIEi9}kz0sSl*51Mx=S~8^&tkl6`vpMY9SNRBo#h& z3J~nkO~xQ%Byknw@b+Sf+$}SND?cGd^FP5*hL2+xBF~^X79mB!psq&9(TIeb03=5f z>n7%(Sz0q>QlhNjMwF!#E%~rElp`=uc6o$QDJ!^Jn9D@BmtqjIUXw{s zgT%mG-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`5p? z$<{Az(p9yZYFbzA&{YrWDvPE%qpP-(%3Hbtgtf0!ym_Uv2IC>jA=I%R@ z%FC+S#3Um>Ta_i;;~!M*6yp*C`PCLd{9!zAs`LDD>q7(Bqe>t0W~VpaxkCSn?~mm-olY?(mRoDz5S0>sr*@|(#Bpa` zQRPT6IpNO^l?3M&Rr;+V0$VjWAWuW9N^MAhK_6sCW9duOIG;!!jjD9mz^CdqiOv!J zb)8v!^I^W$WfNZ;;f=1`^o2iQN4(?aC&sKh74N^yitn@Y_&sBxLnDEct|tUOcsTgG zM?LXt8f%$HfFe0xr-PexI_%`HG-T$m3Z1ov#lbwC_tfdsWe@zN;ZAIdxt_5ds~Ky> zMc)nTs^_0HZxLJT`I^1?;;DLGy*E>wsprq^-7GHD^H=vyh+nfn%f5yL{r~vHAz7TQ z4Sas+fq1vo&RAnRVu0Sp+X9R_*j0QF4g$}D{sjAc1lR+53Li=j@GxjiEn|JaI2L;k z?;zQOw%0NC64`^+;4k_RunY7i-XJi0jIrnNPPF5nmj_@R?=%$CpvNC)>>BV8=o`Bb z5I6`rvl|Tso&_D=!`K4JK~vF;yTH_x?Rd>?)DSc$jESBKW1=%*Omw~;J5CM@U`!2! ZdDr24-28O3*Vx%>>=e!#JH;>l`9HWU)o}m- diff --git a/PowerEditor/installer/nppSetup.nsi b/PowerEditor/installer/nppSetup.nsi index 83ccb090..3667ddd7 100644 --- a/PowerEditor/installer/nppSetup.nsi +++ b/PowerEditor/installer/nppSetup.nsi @@ -28,10 +28,10 @@ ; Define the application name !define APPNAME "Notepad++" -!define APPVERSION "6.6.2" +!define APPVERSION "6.6.3" !define APPNAMEANDVERSION "${APPNAME} v${APPVERSION}" !define VERSION_MAJOR 6 -!define VERSION_MINOR 62 +!define VERSION_MINOR 63 !define APPWEBSITE "http://notepad-plus-plus.org/" @@ -606,6 +606,10 @@ Section -"Notepad++" mainSection Exec 'regsvr32 /u /s "$INSTDIR\NppShell_04.dll"' Delete "$INSTDIR\NppShell_04.dll" + IfFileExists "$INSTDIR\NppShell_05.dll" 0 +3 + Exec 'regsvr32 /u /s "$INSTDIR\NppShell_05.dll"' + Delete "$INSTDIR\NppShell_05.dll" + ; detect the right of UserInfo::GetAccountType Pop $1 @@ -635,12 +639,12 @@ Section "Context Menu Entry" explorerContextMenu SetOverwrite try SetOutPath "$INSTDIR\" ${If} ${RunningX64} - File /oname=$INSTDIR\NppShell_05.dll "..\bin\NppShell64_05.dll" + File /oname=$INSTDIR\NppShell_06.dll "..\bin\NppShell64_06.dll" ${Else} - File "..\bin\NppShell_05.dll" + File "..\bin\NppShell_06.dll" ${EndIf} - Exec 'regsvr32 /s "$INSTDIR\NppShell_05.dll"' + Exec 'regsvr32 /s "$INSTDIR\NppShell_06.dll"' SectionEnd SectionGroup "Auto-completion Files" autoCompletionComponent @@ -1768,11 +1772,13 @@ Section un.explorerContextMenu Exec 'regsvr32 /u /s "$INSTDIR\NppShell_03.dll"' Exec 'regsvr32 /u /s "$INSTDIR\NppShell_04.dll"' Exec 'regsvr32 /u /s "$INSTDIR\NppShell_05.dll"' + Exec 'regsvr32 /u /s "$INSTDIR\NppShell_06.dll"' Delete "$INSTDIR\NppShell_01.dll" Delete "$INSTDIR\NppShell_02.dll" Delete "$INSTDIR\NppShell_03.dll" Delete "$INSTDIR\NppShell_04.dll" Delete "$INSTDIR\NppShell_05.dll" + Delete "$INSTDIR\NppShell_06.dll" SectionEnd Section un.UnregisterFileExt diff --git a/PowerEditor/src/tools/NppShell/src/NppShell.cpp b/PowerEditor/src/tools/NppShell/src/NppShell.cpp index df4627b1..60239f8d 100644 --- a/PowerEditor/src/tools/NppShell/src/NppShell.cpp +++ b/PowerEditor/src/tools/NppShell/src/NppShell.cpp @@ -955,9 +955,12 @@ void InvalidateIcon(HICON * iconSmall, HICON * iconLarge) { STDMETHODIMP CShellExt::InvokeNPP(HWND /*hParent*/, LPCSTR /*pszWorkingDir*/, LPCSTR /*pszCmd*/, LPCSTR /*pszParam*/, int iShowCmd) { TCHAR szFilename[MAX_PATH]; TCHAR szCustom[MAX_PATH]; + TCHAR szNotepadExecutableFilename[3 * MAX_PATH]; // Should be able to contain szFilename plus szCustom plus some additional characters. LPTSTR pszCommand; size_t bytesRequired = 1; + memset(szNotepadExecutableFilename, 0, sizeof(TCHAR) * 3 * MAX_PATH); + TCHAR szKeyTemp[MAX_PATH + GUID_STRING_SIZE]; DWORD regSize = 0; DWORD pathSize = MAX_PATH; @@ -1002,46 +1005,61 @@ STDMETHODIMP CShellExt::InvokeNPP(HWND /*hParent*/, LPCSTR /*pszWorkingDir*/, LP regSize = (DWORD)MAX_PATH*sizeof(TCHAR); result = RegQueryValueEx(settingKey, TEXT("Path"), NULL, NULL, (LPBYTE)(szFilename), ®Size); szFilename[MAX_PATH-1] = 0; - lstrcat(pszCommand, TEXT("\"")); - lstrcat(pszCommand, szFilename); - lstrcat(pszCommand, TEXT("\"")); + lstrcat(szNotepadExecutableFilename, TEXT("\"")); + lstrcat(szNotepadExecutableFilename, szFilename); + lstrcat(szNotepadExecutableFilename, TEXT("\"")); result = RegQueryValueEx(settingKey, TEXT("Custom"), NULL, NULL, (LPBYTE)(szCustom), &pathSize); if (result == ERROR_SUCCESS) { - lstrcat(pszCommand, TEXT(" ")); - lstrcat(pszCommand, szCustom); + lstrcat(szNotepadExecutableFilename, TEXT(" ")); + lstrcat(szNotepadExecutableFilename, szCustom); } RegCloseKey(settingKey); - for (UINT i = 0; i < m_cbFiles; i++) { - DragQueryFile((HDROP)m_stgMedium.hGlobal, i, szFilename, MAX_PATH); - lstrcat(pszCommand, TEXT(" \"")); - lstrcat(pszCommand, szFilename); - lstrcat(pszCommand, TEXT("\"")); - } + // We have to open the files in batches. A command on the command-line can be at most + // 2048 characters in XP and 32768 characters in Win7. In the degenerate case where all + // paths are of length MAX_PATH, we can open at most x files at once, where: + // 260 * (x + 2) = 2048 or 32768 <=> x = 5 or x = 124. + // Note the +2 to account for the path to notepad++.exe. + // http://stackoverflow.com/questions/3205027/maximum-length-of-command-line-string - STARTUPINFO si; - PROCESS_INFORMATION pi; - ZeroMemory(&si, sizeof(si)); - si.cb = sizeof(si); - si.dwFlags = STARTF_USESHOWWINDOW; - si.wShowWindow = (WORD)iShowCmd; //SW_RESTORE; - if (!CreateProcess (NULL, pszCommand, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) { - DWORD errorCode = GetLastError(); - if (errorCode == ERROR_ELEVATION_REQUIRED) { //Fallback to shellexecute - CoInitializeEx(NULL, 0); - HINSTANCE execVal = ShellExecute(NULL, TEXT("runas"), pszCommand, NULL, NULL, iShowCmd); - CoUninitialize(); - if (execVal <= (HINSTANCE)32) { + const UINT kiBatchSize = m_winVer > WINVER_XP ? 100 : 4; + + UINT iFileIndex = 0; + while(iFileIndex < m_cbFiles) { + memset(pszCommand, 0, bytesRequired); + lstrcat(pszCommand, szNotepadExecutableFilename); + for (UINT iBatchSizeCounter = 0; iFileIndex < m_cbFiles && iBatchSizeCounter < kiBatchSize; iBatchSizeCounter++) { + DragQueryFile((HDROP)m_stgMedium.hGlobal, iFileIndex, szFilename, MAX_PATH); + lstrcat(pszCommand, TEXT(" \"")); + lstrcat(pszCommand, szFilename); + lstrcat(pszCommand, TEXT("\"")); + iFileIndex++; + } + + STARTUPINFO si; + PROCESS_INFORMATION pi; + ZeroMemory(&si, sizeof(si)); + si.cb = sizeof(si); + si.dwFlags = STARTF_USESHOWWINDOW; + si.wShowWindow = (WORD)iShowCmd; //SW_RESTORE; + if (!CreateProcess (NULL, pszCommand, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) { + DWORD errorCode = GetLastError(); + if (errorCode == ERROR_ELEVATION_REQUIRED) { //Fallback to shellexecute + CoInitializeEx(NULL, 0); + HINSTANCE execVal = ShellExecute(NULL, TEXT("runas"), pszCommand, NULL, NULL, iShowCmd); + CoUninitialize(); + if (execVal <= (HINSTANCE)32) { + TCHAR * message = new TCHAR[512+bytesRequired]; + wsprintf(message, TEXT("ShellExecute failed (%d): Is this command correct?\r\n%s"), execVal, pszCommand); + MsgBoxError(message); + delete [] message; + } + } else { TCHAR * message = new TCHAR[512+bytesRequired]; - wsprintf(message, TEXT("ShellExecute failed (%d): Is this command correct?\r\n%s"), execVal, pszCommand); + wsprintf(message, TEXT("Error in CreateProcess (%d): Is this command correct?\r\n%s"), errorCode, pszCommand); MsgBoxError(message); delete [] message; } - } else { - TCHAR * message = new TCHAR[512+bytesRequired]; - wsprintf(message, TEXT("Error in CreateProcess (%d): Is this command correct?\r\n%s"), errorCode, pszCommand); - MsgBoxError(message); - delete [] message; } } diff --git a/PowerEditor/src/tools/NppShell/src/NppShell.h b/PowerEditor/src/tools/NppShell/src/NppShell.h index aa915856..a98bdd48 100644 --- a/PowerEditor/src/tools/NppShell/src/NppShell.h +++ b/PowerEditor/src/tools/NppShell/src/NppShell.h @@ -17,6 +17,7 @@ #include #define WINVER_VISTA 0x600 +#define WINVER_XP 0x0501 //This is not ideal, but missing from current mingw #ifndef ERROR_ELEVATION_REQUIRED