Fixed selecting multiple files in common file dialog 95-style
Huw Davies
huw at codeweavers.com
Mon Sep 16 07:00:33 CDT 2002
On Sun, Sep 15, 2002 at 08:31:27PM +0200, Josef Meixner wrote:
> Index: dlls/commdlg/filedlg95.c
> ===================================================================
> RCS file: /home/wine/wine/dlls/commdlg/filedlg95.c,v
> retrieving revision 1.80
> diff -r1.80 filedlg95.c
[snip]
> 1457c1464,1466
> < memcpy( ofn->lpstrFile + nSizePath, lpstrFileList, sizeUsed*sizeof(WCHAR) );
> ---
> > memset( ofn->lpstrFile + nSizePath, 0, sizeof(WCHAR) );
> > memcpy( ofn->lpstrFile + nSizePath + sizeof(WCHAR), lpstrFileList,
> > sizeUsed*sizeof(WCHAR) );
> 1463,1466c1472,1483
> < WideCharToMultiByte(CP_ACP, 0, lpstrPathSpec, -1,
> < ofn->lpstrFile, ofn->nMaxFile, NULL, NULL);
> < WideCharToMultiByte(CP_ACP, 0, lpstrFileList, sizeUsed,
> < &ofn->lpstrFile[nSizePath], ofn->nMaxFile - nSizePath, NULL, NULL);
> ---
> > if (ofn->lpstrFile != NULL)
> > {
> > WideCharToMultiByte(CP_ACP, 0, lpstrPathSpec, -1,
> > ofn->lpstrFile, ofn->nMaxFile, NULL, NULL);
> > if (ofn->nMaxFile > nSizePath + 1)
> > {
> > ofn->lpstrFile[nSizePath] = '\0';
> > WideCharToMultiByte(CP_ACP, 0, lpstrFileList, sizeUsed,
> > ofn->lpstrFile + nSizePath + 1,
> > ofn->nMaxFile - nSizePath, NULL, NULL);
> > }
> > }
>
The last two hunks of this patch aren't right. Alexandre, please use
this one instead.
Huw.
--
Huw Davies
huw at codeweavers.com
-------------- next part --------------
Index: dlls/commdlg/filedlg95.c
===================================================================
RCS file: /home/wine/wine/dlls/commdlg/filedlg95.c,v
retrieving revision 1.80
diff -u -r1.80 filedlg95.c
--- dlls/commdlg/filedlg95.c 12 Sep 2002 22:07:02 -0000 1.80
+++ dlls/commdlg/filedlg95.c 16 Sep 2002 12:01:18 -0000
@@ -1402,12 +1402,12 @@
if(fodInfos->unicode)
{
LPOPENFILENAMEW ofn = (LPOPENFILENAMEW) fodInfos->ofnInfos;
- ofn->lpstrFile = '\0';
+ ofn->lpstrFile[0] = '\0';
}
else
{
LPOPENFILENAMEA ofn = fodInfos->ofnInfos;
- ofn->lpstrFile = '\0';
+ ofn->lpstrFile[0] = '\0';
}
SHGetPathFromIDListW( fodInfos->ShellInfos.pidlAbsCurrent, lpstrPathSpec );
@@ -1450,6 +1450,13 @@
}
nSizePath = strlenW(lpstrPathSpec) + 1;
+ if ( !(fodInfos->ofnInfos->Flags & OFN_EXPLORER) )
+ {
+ /* For "oldstyle" dialog the components have to
+ be spearated by blanks (not '\0'!) and short
+ filenames have to be used! */
+ FIXME("Components have to be separated by blanks");
+ }
if(fodInfos->unicode)
{
LPOPENFILENAMEW ofn = (LPOPENFILENAMEW) fodInfos->ofnInfos;
@@ -1460,13 +1467,20 @@
{
LPOPENFILENAMEA ofn = fodInfos->ofnInfos;
- WideCharToMultiByte(CP_ACP, 0, lpstrPathSpec, -1,
- ofn->lpstrFile, ofn->nMaxFile, NULL, NULL);
- WideCharToMultiByte(CP_ACP, 0, lpstrFileList, sizeUsed,
- &ofn->lpstrFile[nSizePath], ofn->nMaxFile - nSizePath, NULL, NULL);
+ if (ofn->lpstrFile != NULL)
+ {
+ WideCharToMultiByte(CP_ACP, 0, lpstrPathSpec, -1,
+ ofn->lpstrFile, ofn->nMaxFile, NULL, NULL);
+ if (ofn->nMaxFile > nSizePath)
+ {
+ WideCharToMultiByte(CP_ACP, 0, lpstrFileList, sizeUsed,
+ ofn->lpstrFile + nSizePath,
+ ofn->nMaxFile - nSizePath, NULL, NULL);
+ }
+ }
}
- fodInfos->ofnInfos->nFileOffset = nSizePath;
+ fodInfos->ofnInfos->nFileOffset = nSizePath + 1;
fodInfos->ofnInfos->nFileExtension = 0;
/* clean and exit */
More information about the wine-patches
mailing list