1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-15 11:41:13 +03:00

Modify the VFS xAccess() method on winNT so that it returns false for

an exists test of a zero-length file.  This makes the windows VFS work
the same as the unix VFS.

FossilOrigin-Name: ec35f25403744f7441ac5ae1486b84d8ebc13e98
This commit is contained in:
drh
2010-07-05 21:00:43 +00:00
parent db10f08282
commit 722a7e9ab3
3 changed files with 29 additions and 9 deletions

View File

@@ -2078,7 +2078,17 @@ static int winAccess(
return SQLITE_NOMEM;
}
if( isNT() ){
attr = GetFileAttributesW((WCHAR*)zConverted);
WIN32_FILE_ATTRIBUTE_DATA sAttrData;
memset(&sAttrData, 0, sizeof(sAttrData));
attr = GetFileAttributesExW((WCHAR*)zConverted,
GetFileExInfoStandard, &sAttrData);
/* For an SQLITE_ACCESS_EXISTS query, treat a zero-length file
** as if it does not exist.
*/
if( flags==SQLITE_ACCESS_EXISTS && attr!=INVALID_FILE_ATTRIBUTES
&& sAttrData.nFileSizeHigh==0 && sAttrData.nFileSizeLow==0 ){
attr = INVALID_FILE_ATTRIBUTES;
}
/* isNT() is 1 if SQLITE_OS_WINCE==1, so this else is never executed.
** Since the ASCII version of these Windows API do not exist for WINCE,
** it's important to not reference them for WINCE builds.