hello all
i am writng file system filter and i am using ExAcquireResourceExclusiveLite
and ExReleaseResourceLite without initializing the ERESOURCE and it is
working without problem.
so what is the purpose of ExInitializeResourceLite.
is ExInitializeResourceLite mandatory.
Warning standard lecture #? starting:
Right now you think it works, but have you tested all circumstances? Even
if it does, you are violating the defined semantics of ERESOURCE’s, so how
do you know it will work tommorrow. I have worked on OS’es in the past,
and have seen people say I don’t need follow the rules. This can be things
like I don’t need to do this call, or this structure field is unused I’ll
stick my data in it, or any other of a multiple of stupid ideas. In every
case, when the OS changes things to take advantage of the defined
semantics, the flaming idiots who did not follow the rules are the ones who
scream the OS broke my code!!! No designing things so you do not follow
the rules broke the code.
Lecture finished.
Not using the ExInitializeResourceLite call is just stupid and asking for
problems. Sooner of later the OS will change things and you will need it,
or one of the tools like SDV or verifier will start catching it, and
complain. That you ask such a question when dealing with file system
code, means you are not doing a decent job. File system code needs serious
design and development, so you do not mess up the users system or data.
–
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply
“Mani” wrote in message news:xxxxx@ntfsd…
> hello all
>
> i am writng file system filter and i am using
> ExAcquireResourceExclusiveLite and ExReleaseResourceLite without
> initializing the ERESOURCE and it is working without problem.
> so what is the purpose of ExInitializeResourceLite.
>
> is ExInitializeResourceLite mandatory.
>
>
>
> is ExInitializeResourceLite mandatory.
Yes
–
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
Apart for what others said, what’s the point of it ?
Docs say you need to initialize, so is there something
why you don’t want to do it ?
L.
actually by mistake i just missed the ExInitializeResourceLite and it still
worked. i understand that it must be used and I have my code using it.
but then does it do anything useful or what exactly does it do?
“Ladislav Zezula” wrote in message news:xxxxx@ntfsd…
> Apart for what others said, what’s the point of it ?
> Docs say you need to initialize, so is there something
> why you don’t want to do it ?
>
> L.
>
>
>
Mani wrote:
actually by mistake i just missed the ExInitializeResourceLite and it still
worked. i understand that it must be used and I have my code using it.
but then does it do anything useful or what exactly does it do?
It may actually do nothing at all at the moment… you may find it’s a
stub. Doesn’t matter - call in anyway, because the docs say so and you
want your driver to keep working on later versions of windows.
Tony
It initializes the data structure. One of the key benefits of that is
you can now track it, you get extra verifier checks for proper use and
it becomes easy to debug. If you don’t want ease-of-debugging, use a
push lock instead (a “fast implementation without contention but
impossible to debug” variant.)
Look at the data structure sometime in the debugger - “dt nt!_ERESOURCE”
and you can see that it is not a simple structure.
Tony
Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com