What's the standard way to call routines that are documented to
require passive level inside code that needs to be mutually exclusive
with some other code? A spin lock is out because it raises to DPC
level, and I suppose dispatcher and fast mutexes are out because they
raise to APC level.
This APC level thing is what bugs me. It's sort of like passive level
(preemptive) but sort of not, so maybe it's safe to call passive level
code and maybe it's not. So, does this leave that trick with fast
mutexes of combining KeEnterCriticalRegion and
ExAcquireFastMutexUnsafe, or should I use a worker thread? (which
seems kind of cumbersome)
I wrote a bunch of code that very carefully holds a lock for as short
as possible, grabs some information, does choice parts of its
operations outside, then finally grabs the lock to store the result,
but when I look at it I see it could be so much simpler if there was a
safe way to make the whole large set of operations mutually exclusive.