Hi all,
When I open a file using ZwCreateFile and then do a file read using
ZwReadFile I soetimes get a STATUS_PENDING result from the read operation,
typically when the file is on the network.
Now, according to the DDK, if I opened the file with the ‘SYNCHRONIZE’ flag
I can ‘Wait on the file handle’ for the operation to be completed.
However, when I do the ‘KeWaitForSingleObject’ on the file handle I get a
bug check.
I know I can specify ‘FILE_SYNCHRONOUS_IO_NONALERT’ during file creation so
the system would wait automatically but I’m still curious.
Here is a code sample:
ZwCreateFile(&fileHandle,
GENERIC_READ | SYNCHRONIZE,
&ObjectAttributes,&IoStatusBlock, NULL, 0,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
FILE_OPEN,
FILE_NON_DIRECTORY_FILE | FILE_COMPLETE_IF_OPLOCKED,
NULL, 0);
if(ZwReadFile(fileHandle,NULL,NULL,NULL,&IoStatusBlock,
buffer,FILE_COPY_BUFFER_SIZE,&offsetSrc,NULL) == STATUS_PENDING)
KeWaitForSingleObject(&fileHandle, Executive, KernelMode, FALSE,
NULL);
Rami
You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com