Authors: Josef Meixner <Josef.Meixner@t-online.de>, Huw Davies <huw@codeweavers.com>

- Initializing the return-string shouldn't change the pointer.
- Added "FIXME" for case not handled.
- Directory and the filenames have to be separated by "\0".
- Added check to handle possible signed/unsigned overflow.
This commit is contained in:
Alexandre Julliard 2002-09-17 18:33:55 +00:00
parent 94638aa276
commit cc3a74d949

View file

@ -1402,12 +1402,12 @@ BOOL FILEDLG95_OnOpenMultipleFiles(HWND hwnd, LPWSTR lpstrFileList, UINT nFileCo
if(fodInfos->unicode) if(fodInfos->unicode)
{ {
LPOPENFILENAMEW ofn = (LPOPENFILENAMEW) fodInfos->ofnInfos; LPOPENFILENAMEW ofn = (LPOPENFILENAMEW) fodInfos->ofnInfos;
ofn->lpstrFile = '\0'; ofn->lpstrFile[0] = '\0';
} }
else else
{ {
LPOPENFILENAMEA ofn = fodInfos->ofnInfos; LPOPENFILENAMEA ofn = fodInfos->ofnInfos;
ofn->lpstrFile = '\0'; ofn->lpstrFile[0] = '\0';
} }
SHGetPathFromIDListW( fodInfos->ShellInfos.pidlAbsCurrent, lpstrPathSpec ); SHGetPathFromIDListW( fodInfos->ShellInfos.pidlAbsCurrent, lpstrPathSpec );
@ -1450,6 +1450,13 @@ BOOL FILEDLG95_OnOpenMultipleFiles(HWND hwnd, LPWSTR lpstrFileList, UINT nFileCo
} }
nSizePath = strlenW(lpstrPathSpec) + 1; 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) if(fodInfos->unicode)
{ {
LPOPENFILENAMEW ofn = (LPOPENFILENAMEW) fodInfos->ofnInfos; LPOPENFILENAMEW ofn = (LPOPENFILENAMEW) fodInfos->ofnInfos;
@ -1460,13 +1467,20 @@ BOOL FILEDLG95_OnOpenMultipleFiles(HWND hwnd, LPWSTR lpstrFileList, UINT nFileCo
{ {
LPOPENFILENAMEA ofn = fodInfos->ofnInfos; LPOPENFILENAMEA ofn = fodInfos->ofnInfos;
WideCharToMultiByte(CP_ACP, 0, lpstrPathSpec, -1, if (ofn->lpstrFile != NULL)
ofn->lpstrFile, ofn->nMaxFile, NULL, NULL); {
WideCharToMultiByte(CP_ACP, 0, lpstrFileList, sizeUsed, WideCharToMultiByte(CP_ACP, 0, lpstrPathSpec, -1,
&ofn->lpstrFile[nSizePath], ofn->nMaxFile - nSizePath, NULL, NULL); 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; fodInfos->ofnInfos->nFileExtension = 0;
/* clean and exit */ /* clean and exit */