Author: tkreuzer
Date: Sun Jun 24 18:33:08 2012
New Revision: 56799
URL: 
http://svn.reactos.org/svn/reactos?rev=56799&view=rev
Log:
[RTL]
Fix remainung RtlBitmapApi tests
Modified:
    trunk/reactos/lib/rtl/bitmap.c
Modified: trunk/reactos/lib/rtl/bitmap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/bitmap.c?rev=56799…
==============================================================================
--- trunk/reactos/lib/rtl/bitmap.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/bitmap.c [iso-8859-1] Sun Jun 24 18:33:08 2012
@@ -450,10 +450,14 @@
         return MAXULONG;
     }
+    /* Check if the hint is outside the bitmap */
+    if (HintIndex >= BitMapHeader->SizeOfBitMap) HintIndex = 0;
+
     /* Check for trivial case */
     if (NumberToFind == 0)
     {
-        return HintIndex;
+        /* Return hint rounded down to byte margin */
+        return HintIndex & ~7;
     }
     /* First margin is end of bitmap */
@@ -514,10 +518,14 @@
         return MAXULONG;
     }
+    /* Check if the hint is outside the bitmap */
+    if (HintIndex >= BitMapHeader->SizeOfBitMap) HintIndex = 0;
+
     /* Check for trivial case */
     if (NumberToFind == 0)
     {
-        return HintIndex;
+        /* Return hint rounded down to byte margin */
+        return HintIndex & ~7;
     }
     /* First margin is end of bitmap */