#ifndef _NTOBAPI_H
//
// Objects, handles
//
#if (PHNT_MODE != PHNT_MODE_KERNEL)
#if (PHNT_VERSION >= PHNT_WINDOWS_10)
/**
* Compares two object handles to determine if they refer to the same underlying kernel object.
*
* @param FirstObjectHandle The first object handle to compare.
* @param SecondObjectHandle The second object handle to compare.
* @return NTSTATUS Successful or errant status.
* @sa https://learn.microsoft.com/en-us/windows/win32/api/handleapi/nf-handleapi-compareobjecthandles
*/
NTSYSCALLAPI
NTSTATUS
NTAPI
NtCompareObjects(
_In_ HANDLE FirstObjectHandle,
_In_ HANDLE SecondObjectHandle
);
View code on GitHub
#ifndef _NTZWAPI_H
NTSYSCALLAPI
NTSTATUS
NTAPI
ZwCompareObjects(
_In_ HANDLE FirstObjectHandle,
_In_ HANDLE SecondObjectHandle
);
View code on GitHub
Determines whether two handles point to the same kernel object.
FirstObjectHandle
- a handle to the first object.SecondObjectHandle
- a handle to the second object.The handles do not need to grant any specific access. Any of the handles can be a pseudo-handle to the current thread (NtCurrentThread
) or the current process (NtCurrentProcess
).
STATUS_SUCCESS
- the two handles point to the same underlying kernel object.STATUS_NOT_SAME_OBJECT
- the handles point toward different objects.This function was introduced in Windows 10 TH1 (1507).