Resent(2): Filedialog support FNERR_BUFFERTOSMALL

Wolfgang Schwotzer wolfgang.schwotzer at gmx.net
Mon May 3 09:11:27 CDT 2004


Description: if buffer for lpstrFile is too small
  set first two bytes to needed buffer size and
  return FNERR_BUFFERTOSMALL.
ChangeLog: Filedialog support FNERR_BUFFERTOSMALL if buffer too small
-------------- next part --------------
Index: dlls/commdlg/filedlg.c
===================================================================
RCS file: /home/wine/wine/dlls/commdlg/filedlg.c,v
retrieving revision 1.75
diff -u -r1.75 filedlg.c
--- dlls/commdlg/filedlg.c	20 Mar 2004 19:22:17 -0000	1.75
+++ dlls/commdlg/filedlg.c	10 Apr 2004 22:56:50 -0000
@@ -34,9 +34,6 @@
  *
  * FIXME: lpstrCustomFilter not handled
  *
- * FIXME: if the size of lpstrFile (nMaxFile) is too small the first
- * two bytes of lpstrFile should contain the needed size
- *
  * FIXME: algorithm for selecting the initial directory is too simple
  *
  * FIXME: add to recent docs
@@ -1985,9 +1982,16 @@
 	}
 	else
         {
-          /* FIXME set error FNERR_BUFFERTOSMALL */
+          WORD size;
+
+          size = strlenW(lpstrPathAndFile) + 1;
+          if (fodInfos->ofnInfos->Flags & OFN_ALLOWMULTISELECT)
+             size += 1;
+          /* return needed size in first two bytes of lpstrFile */
+          *(WORD *)(fodInfos->ofnInfos->lpstrFile) = size;
           FILEDLG95_Clean(hwnd);
           ret = EndDialog(hwnd, FALSE);
+          COMDLG32_SetCommDlgExtendedError(FNERR_BUFFERTOOSMALL);
         }
         goto ret;
       }


More information about the wine-patches mailing list