[MKHIVE]
[reactos.git] / reactos / tools / mkhive / rtl.c
index 85fc04b..a68d7a0 100644 (file)
@@ -185,3 +185,54 @@ RtlAssert(PVOID FailedAssertion,
 
    //DbgBreakPoint();
 }
+
+unsigned char BitScanForward(ULONG * Index, unsigned long Mask)
+{
+    *Index = 0;
+    while (Mask && ((Mask & 1) == 0))
+    {
+        Mask >>= 1;
+        ++(*Index);
+    }
+    return Mask ? 1 : 0;
+}
+
+unsigned char BitScanReverse(ULONG * const Index, unsigned long Mask)
+{
+    *Index = 0;
+    while (Mask && ((Mask & (1 << 31)) == 0))
+    {
+        Mask <<= 1;
+        ++(*Index);
+    }
+    return Mask ? 1 : 0;
+}
+
+#undef tolower
+WCHAR towlower(WCHAR ch)
+{
+    if (ch < L'A')
+    {
+        return ch;
+    }
+    else if (ch <= L'Z')
+    {
+        return ch + (L'a' - L'A');
+    }
+
+    return ch;
+}
+
+int _wcsicmp(PCWSTR cs, PCWSTR ct)
+{
+    while (towlower(*cs) == towlower(*ct))
+    {
+        if (*cs == 0)
+            return 0;
+
+        cs++;
+        ct++;
+    }
+
+    return towlower(*cs) - towlower(*ct);
+}