mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-22 08:23:05 -05:00
tst: ntptfs: workaround for NtQueryDirectoryFile on WOW64
This commit is contained in:
parent
83e59f33fc
commit
1ad13aebdb
@ -160,6 +160,20 @@ static NTSTATUS CreateEx(FSP_FILE_SYSTEM *FileSystem,
|
||||
FILE_NON_DIRECTORY_FILE |
|
||||
FILE_NO_EA_KNOWLEDGE;
|
||||
|
||||
/* WORKAROUND:
|
||||
*
|
||||
* WOW64 appears to have a bug in some versions of the OS, where NtQueryDirectoryFile may fail
|
||||
* if called on a directory that has been opened without FILE_SYNCHRONOUS_IO_NONALERT.
|
||||
*
|
||||
* So make sure to always open directories in a synchronous manner.
|
||||
*/
|
||||
if (IsDirectory)
|
||||
{
|
||||
MaximumAccess |= SYNCHRONIZE;
|
||||
//GrantedAccess |= SYNCHRONIZE;
|
||||
CreateOptions |= FILE_SYNCHRONOUS_IO_NONALERT;
|
||||
}
|
||||
|
||||
Result = LfsCreateFile(
|
||||
&Handle,
|
||||
MaximumAccess |
|
||||
@ -257,6 +271,20 @@ static NTSTATUS Open(FSP_FILE_SYSTEM *FileSystem,
|
||||
FILE_NON_DIRECTORY_FILE |
|
||||
FILE_NO_EA_KNOWLEDGE;
|
||||
|
||||
/* WORKAROUND:
|
||||
*
|
||||
* WOW64 appears to have a bug in some versions of the OS, where NtQueryDirectoryFile may fail
|
||||
* if called on a directory that has been opened without FILE_SYNCHRONOUS_IO_NONALERT.
|
||||
*
|
||||
* So make sure to always open directories in a synchronous manner.
|
||||
*/
|
||||
if (IsDirectory)
|
||||
{
|
||||
MaximumAccess |= SYNCHRONIZE;
|
||||
//GrantedAccess |= SYNCHRONIZE;
|
||||
CreateOptions |= FILE_SYNCHRONOUS_IO_NONALERT;
|
||||
}
|
||||
|
||||
Result = LfsOpenFile(
|
||||
&Handle,
|
||||
MaximumAccess |
|
||||
@ -787,6 +815,10 @@ static NTSTATUS BufferedReadDirectory(FSP_FILE_SYSTEM *FileSystem,
|
||||
;
|
||||
QueryInfo = (FILE_ID_BOTH_DIR_INFORMATION *)((PUINT8)QueryInfo + QueryNext))
|
||||
{
|
||||
if (QueryBuffer + BytesTransferred <
|
||||
(PUINT8)QueryInfo + FIELD_OFFSET(FILE_ID_BOTH_DIR_INFORMATION, FileName))
|
||||
break;
|
||||
|
||||
QueryNext = QueryInfo->NextEntryOffset;
|
||||
|
||||
CopyQueryInfoToDirInfo(QueryInfo, &DirInfo.V);
|
||||
@ -993,7 +1025,8 @@ static NTSTATUS GetStreamInfo(FSP_FILE_SYSTEM *FileSystem,
|
||||
;
|
||||
QueryInfo = (FILE_STREAM_INFORMATION *)((PUINT8)QueryInfo + QueryNext))
|
||||
{
|
||||
if (Iosb.Information <= (ULONG)((PUINT8)QueryInfo - QueryBuffer))
|
||||
if (QueryBuffer + Iosb.Information <
|
||||
(PUINT8)QueryInfo + FIELD_OFFSET(FILE_STREAM_INFORMATION, StreamName))
|
||||
break;
|
||||
|
||||
QueryNext = QueryInfo->NextEntryOffset;
|
||||
|
Loading…
x
Reference in New Issue
Block a user