Changed allocation of arguments in SearchPathA so path is not limited

by size of TEB static buffer.
This commit is contained in:
Alexander Yaworsky 2004-11-22 18:25:05 +00:00 committed by Alexandre Julliard
parent 578f9f5a3d
commit 6d9d114303

View File

@ -819,17 +819,17 @@ DWORD WINAPI SearchPathA( LPCSTR path, LPCSTR name, LPCSTR ext,
WCHAR bufferW[MAX_PATH];
DWORD ret;
if (!(pathW = FILE_name_AtoW( path, FALSE ))) return 0;
if (name && !(nameW = FILE_name_AtoW( name, TRUE ))) return 0;
if (name && !(nameW = FILE_name_AtoW( name, FALSE ))) return 0;
if (!(pathW = FILE_name_AtoW( path, TRUE ))) return 0;
if (ext && !(extW = FILE_name_AtoW( ext, TRUE )))
{
if (nameW) HeapFree( GetProcessHeap(), 0, nameW );
HeapFree( GetProcessHeap(), 0, pathW );
return 0;
}
ret = SearchPathW(pathW, nameW, extW, MAX_PATH, bufferW, NULL);
if (nameW) HeapFree( GetProcessHeap(), 0, nameW );
HeapFree( GetProcessHeap(), 0, pathW );
if (extW) HeapFree( GetProcessHeap(), 0, extW );
if (!ret) return 0;