MSDN states that the pszDisplayName member of BROWSEINFO is assumed to

be MAX_PATH in length. So when doing the A->W conversion in
BrowseForFolderA do not set that member to be the size of the
incoming string, instead make it MAX_PATH.
This commit is contained in:
Aric Stewart 2005-10-17 08:54:53 +00:00 committed by Alexandre Julliard
parent 9577e5e296
commit 5a8d76749a
1 changed files with 2 additions and 3 deletions

View File

@ -627,9 +627,8 @@ LPITEMIDLIST WINAPI SHBrowseForFolderA (LPBROWSEINFOA lpbi)
bi.pidlRoot = lpbi->pidlRoot;
if (lpbi->pszDisplayName)
{
len = MultiByteToWideChar( CP_ACP, 0, lpbi->pszDisplayName, -1, NULL, 0 );
bi.pszDisplayName = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, lpbi->pszDisplayName, -1, bi.pszDisplayName, len );
bi.pszDisplayName = HeapAlloc( GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, lpbi->pszDisplayName, -1, bi.pszDisplayName, MAX_PATH );
}
else
bi.pszDisplayName = NULL;