Using KeAcquireSpinLockAtDpcLevel is only a perf gain if you know you are DISPATCH_LEVEL

Well, that is certainly a long title ;). First, let us look at an approximate implementation of KeAcquireSpinLock and KeRaiseIrql (and yes I know that KeRaiseIrql is really a #define to KfRaiseIrql, but it is the same thing that happens in the end…) KIRQL KeAcquireSpinLock(PKSPIN_LOCK SpinLock, PKIRQL PreviousIrql) { KeRaiseIrql(DISPATCH_LEVEL, PreviousIrql); [spin on the lock…

1

Inconceivableable

I have no idea who created the name for PNP_DEVICE_NOT_DISABLEABLE, but I probably have the same reaction as you … “seriously?  that is what they named?”  I mean come on, I think it could have at least been named PNP_DEVICE_CANNOT_BE_DISABLED.  I am sure you can think of some better names too. If so, please leave…

1

Once not disableable, forever not disableable

One interesting quirk about the PNP_DEVICE_NOT_DISABLEABLE state is that once it has been set and the PnP manager has processed it, the state is sticky.  By sticky I mean that even if you attempt to clear this bit on a subsequent IRP_MN_QUERY_PNP_DEVICE_STATE IRP, the PnP manager ignores your changes to this state.  This state remains…

1

Returning failure from DriverEntry

One thing that is easily overlooked about implementing DriverEntry is that upon return !NT_SUCCESS, DriverUnload is not called.  I mentioned this anecdotally in a previous post, but it is worth expanding on.  I was bit by this oversight when I was working on the Bluetooth stack.  Driver verifier  correctly identified that my driver had leaked…

0

one of the books that started it all…

During my sophomore year at Cal Poly, I decided that I wanted to learn about threads, synchronization techniques and other topics associated modern operating systems.  Windows 95 had made its debut (yes, it is not a modern OS, but I didn’t know that at the time!) and I had heard about Windows NT, but had…

1

Getting 64 bit Vista to open my Inbox the way I want it to

A bit over a year ago I had to figure out why my Mail key started behaving differently on Vista vs XP and wrote about how I fixed it.  Well, my dev box was so slow that I was able to employ enough sympathy that I got a new one.  While my old box was…

1