Query ZwOpenFile and ZwCreateFile and ZwWriteFile functions in dispatch routines

File system Driver in Win 2000.

I have used ZwOpenFile and ZwCreateFile and ZwWriteFile in
Write dispatch routine ,
SetInformation dispatch routine and
completion routine of create dispatch routine.

Am I doing a mistake?
If yes what is wrong in doing so ? and
what is the alternative in doing the same ?.

Thanks & Regards,
Anurag

Zw functions have some restrictions on their usage, the most important
of which is that you cannot safely call them with special kernel APCs
disabled (when disabled, asynchronous I/O operations cannot be
completed).

In Windows prior to W2K3, this means IRQL < APC_LEVEL. In Windows
Server 2003, this means KTHREAD->SpecialKernelApcDisable ==0 &&& IRQL <
APC_LEVEL.

In all cases, some calls into your IRP_MJ_READ and IRP_MJ_WRITE handler
will arrive with special kernel APCs disabled. In those instances, you
can’t safely call Zw* functions.

The easiest way to work around this issue (which manifests as deadlock)
is to build IRPs, and is why most people end up using IRPs rather than
Zw functions - even though Zw functions are “easier”.

Regards,

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Anurag Sarin
Sent: Tuesday, January 18, 2005 7:06 AM
To: ntfsd redirect
Subject: [ntfsd] Query ZwOpenFile and ZwCreateFile and ZwWriteFile
functions in dispatch routines

File system Driver in Win 2000.

I have used ZwOpenFile and ZwCreateFile and ZwWriteFile in
Write dispatch routine ,
SetInformation dispatch routine and
completion routine of create dispatch routine.

Am I doing a mistake?
If yes what is wrong in doing so ? and
what is the alternative in doing the same ?.

Thanks & Regards,
Anurag


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com