//
// Identifies a Kernel Handle
//
-#define KERNEL_HANDLE_FLAG \
- (1 << ((sizeof(HANDLE) * 8) - 1))
-#define ObIsKernelHandle(Handle, ProcessorMode) \
- (((ULONG_PTR)(Handle) & KERNEL_HANDLE_FLAG) && \
- ((ProcessorMode) == KernelMode))
+#ifdef _WIN64
+#define KERNEL_HANDLE_FLAG 0xFFFFFFFF80000000ULL
+#else
+#define KERNEL_HANDLE_FLAG 0x80000000
+#endif
+#define ObpIsKernelHandle(Handle, ProcessorMode) \
+ ((((ULONG_PTR)(Handle) & KERNEL_HANDLE_FLAG) == KERNEL_HANDLE_FLAG) && \
+ ((ProcessorMode) == KernelMode) && \
+ ((Handle) != NtCurrentProcess()) && \
+ ((Handle) != NtCurrentThread()))
//
// Converts to and from a Kernel Handle to a normal handle
ObpCaptureObjectCreateInformation(
IN POBJECT_ATTRIBUTES ObjectAttributes,
IN KPROCESSOR_MODE AccessMode,
+ IN KPROCESSOR_MODE CreatorMode,
IN BOOLEAN AllocateFromLookaside,
IN POBJECT_CREATE_INFORMATION ObjectCreateInfo,
OUT PUNICODE_STRING ObjectName