Hi All,
I have a question regarding the DDK documentation regarding certain
Kernal mode API. I have written a driver a long time back. That time I was
using the DDK version 3790. I have used a ZwCreateFile API in my code. The
documentation of ZwCreateFile in DDK version 3790 specifies
restriction *“Callers
of ZwCreateFile must be running at IRQL = PASSIVE_LEVEL”.* Recently I
discovered that some of my ZwCreateFile calls are hanging because I was
calling them within a creatical region hwich has the APCs disabled. When I
check edthe documentation on the DDK version 6000, I see that they added
info to the restrctions that they originally had in version 3790. The new
restriction is *“Callers of ZwCreateFile must be running at IRQL =
PASSIVE_LEVEL and with APCs enabled”.*
**
My question is, whether this restriction was there all the time and DDK
documentation had the incomplete the restriction added or this restriction
is added later to version 3790? If this restriction was added later on by
Microsoft, how it was emposed on the machines running previous version of
kernel. Is any updates from Microsoft added this restrictions to kernel? if
yes, can anybody tell me which exact update or patch did this?
Server 2003 added something called “guarded regions”, which block special
kernel APCs at IRQL PASSIVE_LEVEL. This means that on S03 and later checking
for > PASSIVE_LEVEL is no longer sufficient to determine if special kernel
APCs are disabled, for that you need the new API KeAreAllApcsDisabled (not
to be confused with KeAreApcsDisabled).
When Server 2003 shipped this was not adequately documented (as in, “not at
all documented”).
“giri jangam” wrote in message news:xxxxx@ntdev… Hi All, I have a question regarding the DDK documentation regarding certain Kernal mode API. I have written a driver a long time back. That time I was using the DDK version 3790. I have used a ZwCreateFile API in my code. The documentation of ZwCreateFile in DDK version 3790 specifies restriction “Callers of ZwCreateFile must be running at IRQL = PASSIVE_LEVEL”. Recently I discovered that some of my ZwCreateFile calls are hanging because I was calling them within a creatical region hwich has the APCs disabled. When I check edthe documentation on the DDK version 6000, I see that they added info to the restrctions that they originally had in version 3790. The new restriction is “Callers of ZwCreateFile must be running at IRQL = PASSIVE_LEVEL and with APCs enabled”.
My question is, whether this restriction was there all the time and DDK documentation had the incomplete the restriction added or this restriction is added later to version 3790? If this restriction was added later on by Microsoft, how it was emposed on the machines running previous version of kernel. Is any updates from Microsoft added this restrictions to kernel? if yes, can anybody tell me which exact update or patch did this?
Think of it this way: system services are (all, universally) designed to be called just after a user mode to kernel mode transition. This means PASSIVE_LEVEL and APCs enabled, no critical regions, etc. In general, holding most locks across system service calls will not work.
? S
From: giri jangam Sent: Thursday, December 18, 2008 08:30 To: Windows System Software Devs Interest List Subject: [ntdev] Question for DDK doc maintainers
Hi All, I have a question regarding the DDK documentation regarding certain Kernal mode API. I have written a driver a long time back. That time I was using the DDK version 3790. I have used a ZwCreateFile API in my code. The documentation of ZwCreateFile in DDK version 3790 specifies restriction “Callers of ZwCreateFile must be running at IRQL = PASSIVE_LEVEL”. Recently I discovered that some of my ZwCreateFile calls are hanging because I was calling them within a creatical region hwich has the APCs disabled. When I check edthe documentation on the DDK version 6000, I see that they added info to the restrctions that they originally had in version 3790. The new restriction is “Callers of ZwCreateFile must be running at IRQL = PASSIVE_LEVEL and with APCs enabled”.
My question is, whether this restriction was there all the time and DDK documentation had the incomplete the restriction added or this restriction is added later to version 3790? If this restriction was added later on by Microsoft, how it was emposed on the machines running previous version of kernel. Is any updates from Microsoft added this restrictions to kernel? if yes, can anybody tell me which exact update or patch did this?
Absolutely holding locks is a bad idea, I debug hangs that are due to that
all of the time.
The real kicker for the system services though is that special kernel APCs
have to be enabled, otherwise the I/O will never complete. Preferable to
also have normal kernel APCs enabled because that would imply no ERESOURCES
held, but things can still work.
“Skywing” wrote in message news:xxxxx@ntdev… Yes, the restriction has always existed.
Think of it this way: system services are (all, universally) designed to be called just after a user mode to kernel mode transition. This means PASSIVE_LEVEL and APCs enabled, no critical regions, etc. In general, holding most locks across system service calls will not work.
– S
From: giri jangam Sent: Thursday, December 18, 2008 08:30 To: Windows System Software Devs Interest List Subject: [ntdev] Question for DDK doc maintainers
Hi All, I have a question regarding the DDK documentation regarding certain Kernal mode API. I have written a driver a long time back. That time I was using the DDK version 3790. I have used a ZwCreateFile API in my code. The documentation of ZwCreateFile in DDK version 3790 specifies restriction “Callers of ZwCreateFile must be running at IRQL = PASSIVE_LEVEL”. Recently I discovered that some of my ZwCreateFile calls are hanging because I was calling them within a creatical region hwich has the APCs disabled. When I check edthe documentation on the DDK version 6000, I see that they added info to the restrctions that they originally had in version 3790. The new restriction is “Callers of ZwCreateFile must be running at IRQL = PASSIVE_LEVEL and with APCs enabled”.
My question is, whether this restriction was there all the time and DDK documentation had the incomplete the restriction added or this restriction is added later to version 3790? If this restriction was added later on by Microsoft, how it was emposed on the machines running previous version of kernel. Is any updates from Microsoft added this restrictions to kernel? if yes, can anybody tell me which exact update or patch did this?