Index: /trunk/src/VBox/Runtime/generic/critsectrw-generic.cpp
===================================================================
--- /trunk/src/VBox/Runtime/generic/critsectrw-generic.cpp	(revision 45308)
+++ /trunk/src/VBox/Runtime/generic/critsectrw-generic.cpp	(revision 45309)
@@ -408,5 +408,5 @@
 
             if (   c > 0
-                || (u64State & RTCSRW_CNT_RD_MASK) == 0)
+                || (u64State & RTCSRW_CNT_WR_MASK) == 0)
             {
                 /* Don't change the direction. */
@@ -555,4 +555,22 @@
     {
         /*
+         * If only trying, undo the above writer incrementation and return.
+         */
+        if (fTryOnly)
+        {
+            for (;;)
+            {
+                u64OldState = u64State = ASMAtomicReadU64(&pThis->u64State);
+                uint64_t c = (u64State & RTCSRW_CNT_WR_MASK) >> RTCSRW_CNT_WR_SHIFT; Assert(c > 0);
+                c--;
+                u64State &= ~RTCSRW_CNT_WR_MASK;
+                u64State |= c << RTCSRW_CNT_WR_SHIFT;
+                if (ASMAtomicCmpXchgU64(&pThis->u64State, u64State, u64OldState))
+                    break;
+            }
+            return VERR_SEM_BUSY;
+        }
+
+        /*
          * Wait for our turn.
          */
@@ -561,13 +579,8 @@
             int rc;
 #ifdef RTCRITSECTRW_STRICT
-            if (!fTryOnly)
-            {
-                if (hThreadSelf == NIL_RTTHREAD)
-                    hThreadSelf = RTThreadSelfAutoAdopt();
-                rc = RTLockValidatorRecExclCheckBlocking(pThis->pValidatorWrite, hThreadSelf, pSrcPos, true,
-                                                         RT_INDEFINITE_WAIT, RTTHREADSTATE_RW_WRITE, false);
-            }
-            else
-                rc = VINF_SUCCESS;
+            if (hThreadSelf == NIL_RTTHREAD)
+                hThreadSelf = RTThreadSelfAutoAdopt();
+            rc = RTLockValidatorRecExclCheckBlocking(pThis->pValidatorWrite, hThreadSelf, pSrcPos, true,
+                                                     RT_INDEFINITE_WAIT, RTTHREADSTATE_RW_WRITE, false);
             if (RT_SUCCESS(rc))
 #else
Index: /trunk/src/VBox/Runtime/generic/semrw-lockless-generic.cpp
===================================================================
--- /trunk/src/VBox/Runtime/generic/semrw-lockless-generic.cpp	(revision 45308)
+++ /trunk/src/VBox/Runtime/generic/semrw-lockless-generic.cpp	(revision 45309)
@@ -496,5 +496,5 @@
 
             if (   c > 0
-                || (u64State & RTSEMRW_CNT_RD_MASK) == 0)
+                || (u64State & RTSEMRW_CNT_WD_MASK) == 0)
             {
                 /* Don't change the direction. */
