Uwe Bonnes wrote:
> 
> you hack seems valid (if it checks OFN_ALLOWMULTISELECT), but I think
> the original code did miss one character...
> 

My code doesn't check for OFN_ALLOWMULTISELECT.  (I didn't know about it
when I wrote it.)

Attached is a patch that does the check.

-- 
========================================================================
Ian Pilcher                                       [EMAIL PROTECTED]
========================================================================
--- dlls/commdlg/filedlg95.c-20001026   Fri Nov  3 08:31:45 2000
+++ dlls/commdlg/filedlg95.c    Fri Nov  3 08:55:36 2000
@@ -1406,13 +1406,18 @@
          }
        }
 
-        /* Check that size size of the file does not exceed buffer size */
-        if(strlen(lpstrPathAndFile) < fodInfos->ofnInfos->nMaxFile)
+        /* Check that size size of the file does not exceed buffer size.
+             (Allow for extra \0 if OFN_MULTISELECT is set.) */
+        if(strlen(lpstrPathAndFile) < fodInfos->ofnInfos->nMaxFile -
+            ((fodInfos->ofnInfos->Flags & OFN_ALLOWMULTISELECT) ? 1 : 0))
         {
           LPSTR lpszTemp;
          
           /* fill destination buffer */
           strcpy(fodInfos->ofnInfos->lpstrFile, lpstrPathAndFile);
+          if (fodInfos->ofnInfos->Flags & OFN_ALLOWMULTISELECT)
+            fodInfos->ofnInfos->lpstrFile[strlen(fodInfos->ofnInfos->lpstrFile)
+                + 1] = '\0';
 
           /* set filename offset */
           lpszTemp = COMDLG32_PathFindFileNameA(lpstrPathAndFile);

Reply via email to