Why the removal of the do/while loop?
This breaks the macro when used without braces :
+#define SepReleaseTokenLock(Token) \
+ ExReleaseResource(((PTOKEN)Token)->TokenLock); \
+ KeLeaveCriticalRegion(); \
+
<snip>
-#define SepReleaseTokenLock(Token) \
- do { \
- ExReleaseResource(((PTOKEN)Token)->TokenLock); \
- KeLeaveCriticalRegion(); \
- while(0)
<snip>
/* Release the lock if we had acquired it */
+ if (!TokenLocked) SepReleaseTokenLock(Token);
Show replies by date