It is generally considered a bad idea to dereference an object after the reference failed..... this fixes another wine test and avoids a bugcheck
Modified: trunk/reactos/ntoskrnl/ps/query.c

Modified: trunk/reactos/ntoskrnl/ps/query.c
--- trunk/reactos/ntoskrnl/ps/query.c	2005-08-09 06:23:16 UTC (rev 17231)
+++ trunk/reactos/ntoskrnl/ps/query.c	2005-08-09 06:28:23 UTC (rev 17232)
@@ -1233,9 +1233,9 @@
 	     /* Shoult never occure if the data table is correct */
 	     KEBUGCHECK(0);
 	 }
+       ObDereferenceObject (Thread);
      }
-  ObDereferenceObject (Thread);
-
+  
   return Status;
 }