Maybe it'd be better to add some symbols for all these magic numbers? They are at least used twice in this functions, didn't look at others.
Maybe. I think the reason that didn't occur to me is that their layout is important, and symbols would obscure that. For instance, the priority ranges are right next to the commit and check locks, so it's possible to lock that entire range in one command.
Then again, having some symbols you could look up (and correct when we learn more) is probably better than a block comment of what I think the layout looks like.
Also it looks like it's possible to collapse it a bit, for example STGM_SHARE_EXCLUSIVE could check whole 0x93-0xba range with a single code, if I'm reading this right.
Maybe, but we can't collapse the LockOne stuff, and I like having parallels between the CheckLockRange and LockOne parts.