ZwReadFile() must be called at passive level. You need to check for this
case and act accordingly. You also need to make sure the open is called at
passive level too.
Jamey
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@lenovo.com
Sent: Tuesday, January 18, 2005 10:24 PM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] ???: Re: [ntfsd] Why ZwReadFile implement failure? But the
ZwOpenFile implement success.
Oh, It’s very low-grade error.
Thanks Lu0
I have another question. Is ZwReadFile generate IRP_MJ_READ ? For instance,
I implement ZwReadFile in my read dispatch routine, the operation whether
result in IRP re-coming?
Best Regards
Ken Wang
“lu0”
?ռ??ˣ? “Windows
File Systems Devs Interest List”
???ˣ?
xxxxx@lis ???ͣ?
ts.osr.com ???⣺ Re: [ntfsd] Why
ZwReadFile implement failure? But the ZwOpenFile
implement success.
2005-01-19 10:40
??? ?? “Windows File
Systems Devs Interest
List”
ntStatusOfFile = ZwReadFile( &hFile, NULL, NULL, NULL, &IoStatusBlock,
pDataBuf, uFileSize, NULL, NULL );
You are using the invalid handle for this call. ZwReadFile wants a handle,
not a handle pointer.
Best regards,
lu0
TTC Senior Engineer
http://ttcone.com
Inside Programming
http://lu0.126.com
----- Original Message -----
From:
To: “Windows File Systems Devs Interest List”
Sent: Wednesday, January 19, 2005 10:18 AM
Subject: [ntfsd] Why ZwReadFile implement failure? But the ZwOpenFile
implement success.
> Hi,
>
> I want to read file Test.log by implement ZwReadFile function, but failed
> always.
>
> Why ZwReadFile implement failure? But the ZwOpenFile implement success.
>
>
>
> ANDLE hFile = NULL;
> NTSTATUS ntStatusOfFile;
> WCHAR logFileNameBuffer = L"
> \DosDevices\C:\Test.log";
> UNICODE_STRING logFileUnicodeString;
> OBJECT_ATTRIBUTES objectAttributes;
> IO_STATUS_BLOCK IoStatusBlock;
> CHAR chBuf[1024] = {0};
> PCHAR pDataBuf = NULL;
> ULONG uFileSize = 0;
>
> RtlInitUnicodeString( &logFileUnicodeString, logFileNameBuffer );
> InitializeObjectAttributes( &objectAttributes, &logFileUnicodeString,
> OBJ_CASE_INSENSITIVE, NULL, NULL );
>
> ntStatusOfFile = ZwOpenFile( &hFile, SYNCHRONIZE | GENERIC_READ,
> &objectAttributes, &IoStatusBlock ,0, FILE_SYNCHRONOUS_IO_ALERT );
>
> if( !NT_SUCCESS(ntStatusOfFile))
> {
>
> DbgPrint((“ZwOpenFile failed.\n”)); // failed
> return;
>
> }
>
> uFileSize = 2048;
>
> pDataBuf = (char*)ExAllocatePool( NonPagedPool, uFileSize + 1);
>
>
> if ( pDataBuf == NULL )
> {
> DbgPrint((“pDataBuf == NULL \n”));
> return;
>
> }
>
> ntStatusOfFile = ZwReadFile( &hFile, NULL, NULL, NULL, &IoStatusBlock,
> pDataBuf, uFileSize, NULL, NULL );
> if( !NT_SUCCESS(ntStatusOfFile))
> {
>
> DbgPrint((“ZwReadFile failed.\n”));
> ZwClose( hFile );
> hFile = NULL;
> break;
>
> }
>
> ZwClose( hFile );
> hFile = NULL;
> ExFreePool( pDataBuf );
> pDataBuf = NULL;
>
>
> Best Regards
>
> Ken Wang
>
>
>
>
>
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: lulinsha@163.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
—
Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17
You are currently subscribed to ntfsd as: xxxxx@lenovo.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
—
Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17
You are currently subscribed to $subst(‘List.Name’) as:
$subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to $subst(‘Email.UnSub’)
NOD32 1.975 (20050118) Information
This message was checked by NOD32 antivirus system.
http://www.nod32.com