[NTOSKRNL_VISTA]
authorPierre Schweitzer <pierre@reactos.org>
Mon, 25 Jul 2016 20:45:48 +0000 (20:45 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Mon, 25 Jul 2016 20:45:48 +0000 (20:45 +0000)
Implement KeQueryActiveProcessorCount().

CORE-11674

svn path=/trunk/; revision=72001

reactos/sdk/lib/drivers/ntoskrnl_vista/CMakeLists.txt
reactos/sdk/lib/drivers/ntoskrnl_vista/ke.c [new file with mode: 0644]

index 39d9d12..0fdafab 100644 (file)
@@ -5,6 +5,7 @@ add_definitions(-DUNICODE -D_UNICODE -D__NTOSKRNL__ -D_NTOSKRNL_ -D_NTSYSTEM_)
 
 list(APPEND SOURCE
     fsrtl.c
+    ke.c
     rtl.c)
 
 add_library(ntoskrnl_vista ${SOURCE})
diff --git a/reactos/sdk/lib/drivers/ntoskrnl_vista/ke.c b/reactos/sdk/lib/drivers/ntoskrnl_vista/ke.c
new file mode 100644 (file)
index 0000000..638af49
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * PROJECT:         ReactOS Kernel - Vista+ APIs
+ * LICENSE:         GPL v2 - See COPYING in the top level directory
+ * FILE:            lib/drivers/ntoskrnl_vista/ke.c
+ * PURPOSE:         Ke functions of Vista+
+ * PROGRAMMERS:     Pierre Schweitzer <pierre@reactos.org>
+ */
+
+#include <ntdef.h>
+#include <ntifs.h>
+
+NTKERNELAPI
+ULONG
+NTAPI
+KeQueryActiveProcessorCount(OUT PKAFFINITY ActiveProcessors OPTIONAL)
+{
+    RTL_BITMAP Bitmap;
+    KAFFINITY ActiveMap = KeQueryActiveProcessors();
+
+    if (ActiveProcessors != NULL)
+    {
+        *ActiveProcessors = ActiveMap;
+    }
+
+    RtlInitializeBitMap(&Bitmap, &ActiveMap,  sizeof(ActiveMap) * 8);
+    return RtlNumberOfSetBits(&Bitmap);
+}