version: Check the Windows directory first in VerFindFileA/W.

This commit is contained in:
Alexandre Julliard 2011-09-09 13:23:16 +02:00
parent c8d912376f
commit 702941eae1
2 changed files with 28 additions and 22 deletions

View File

@ -89,7 +89,7 @@ static void test_find_file(void)
"got %d(%s) expected MAX_PATH\n", dwOut, outBuf);
break;
default:
todo_wine ok(0, "Got unexpected return value %x\n", ret);
ok(0, "Got unexpected return value %x\n", ret);
}
dwCur=MAX_PATH;
@ -111,7 +111,7 @@ static void test_find_file(void)
"got %d(%s) expected MAX_PATH\n", dwOut, outBuf);
break;
default:
todo_wine ok(0, "Got unexpected return value %x\n", ret);
ok(0, "Got unexpected return value %x\n", ret);
}
}
}

View File

@ -1101,7 +1101,7 @@ DWORD WINAPI VerFindFileA(
const char *destDir;
unsigned int curDirSizeReq;
unsigned int destDirSizeReq;
char systemDir[MAX_PATH];
char winDir[MAX_PATH], systemDir[MAX_PATH];
/* Print out debugging information */
TRACE("flags = %x filename=%s windir=%s appdir=%s curdirlen=%p(%u) destdirlen=%p(%u)\n",
@ -1132,17 +1132,20 @@ DWORD WINAPI VerFindFileA(
}
else /* not a shared file */
{
if(lpszAppDir)
destDir = lpszAppDir ? lpszAppDir : "";
if(lpszFilename)
{
destDir = lpszAppDir;
if(lpszFilename)
GetWindowsDirectoryA( winDir, MAX_PATH );
if(testFileExistenceA(destDir, lpszFilename, FALSE)) curDir = destDir;
else if(testFileExistenceA(winDir, lpszFilename, FALSE))
{
if(testFileExistenceA(destDir, lpszFilename, FALSE)) curDir = destDir;
else if(testFileExistenceA(systemDir, lpszFilename, FALSE))
{
curDir = systemDir;
retval |= VFF_CURNEDEST;
}
curDir = winDir;
retval |= VFF_CURNEDEST;
}
else if(testFileExistenceA(systemDir, lpszFilename, FALSE))
{
curDir = systemDir;
retval |= VFF_CURNEDEST;
}
}
}
@ -1195,7 +1198,7 @@ DWORD WINAPI VerFindFileW( DWORD flags,LPCWSTR lpszFilename,LPCWSTR lpszWinDir,
const WCHAR *destDir;
unsigned int curDirSizeReq;
unsigned int destDirSizeReq;
WCHAR systemDir[MAX_PATH];
WCHAR winDir[MAX_PATH], systemDir[MAX_PATH];
/* Print out debugging information */
TRACE("flags = %x filename=%s windir=%s appdir=%s curdirlen=%p(%u) destdirlen=%p(%u)\n",
@ -1226,17 +1229,20 @@ DWORD WINAPI VerFindFileW( DWORD flags,LPCWSTR lpszFilename,LPCWSTR lpszWinDir,
}
else /* not a shared file */
{
if(lpszAppDir)
destDir = lpszAppDir ? lpszAppDir : &emptyW;
if(lpszFilename)
{
destDir = lpszAppDir;
if(lpszFilename)
GetWindowsDirectoryW( winDir, MAX_PATH );
if(testFileExistenceW(destDir, lpszFilename, FALSE)) curDir = destDir;
else if(testFileExistenceW(winDir, lpszFilename, FALSE))
{
if(testFileExistenceW(destDir, lpszFilename, FALSE)) curDir = destDir;
else if(testFileExistenceW(systemDir, lpszFilename, FALSE))
{
curDir = systemDir;
retval |= VFF_CURNEDEST;
}
curDir = winDir;
retval |= VFF_CURNEDEST;
}
else if(testFileExistenceW(systemDir, lpszFilename, FALSE))
{
curDir = systemDir;
retval |= VFF_CURNEDEST;
}
}
}