NtQueryObject function

The ZwQueryObject routine provides information about a supplied object.

Syntax

__kernel_entry NTSYSCALLAPI NTSTATUS NtQueryObject(
  HANDLE                   Handle,
  OBJECT_INFORMATION_CLASS ObjectInformationClass,
  PVOID                    ObjectInformation,
  ULONG                    ObjectInformationLength,
  PULONG                   ReturnLength
);

Parameters

Handle

A handle to the object to obtain information about.

ObjectInformationClass

Specifies an OBJECT_INFORMATION_CLASS value that determines the type of information returned in the ObjectInformation buffer.

ObjectInformation

A pointer to a caller-allocated buffer that receives the requested information.

ObjectInformationLength

Specifies the size, in bytes, of the ObjectInformation buffer.

ReturnLength

A pointer to a variable that receives the size, in bytes, of the requested key information. If ZwQueryObject returns STATUS_SUCCESS, the variable contains the amount of data returned. If ZwQueryObject returns STATUS_BUFFER_OVERFLOW or STATUS_BUFFER_TOO_SMALL, you can use the value of the variable to determine the required buffer size.

Return Value

ZwQueryObject returns STATUS_SUCCESS or an appropriate error status. Possible error status codes include the following:

Return code Description
STATUS_ACCESS_DENIED
There were insufficient permissions to perform this query.
STATUS_INVALID_HANDLE
The supplied object handle is invalid.
STATUS_INFO_LENGTH_MISMATCH
The info length is not sufficient to hold the data.

Remarks

If the call to the ZwQueryObject function occurs in user mode, you should use the name "NtQueryObject" instead of "ZwQueryObject".

For calls from kernel-mode drivers, the NtXxx and ZwXxx versions of a Windows Native System Services routine can behave differently in the way that they handle and interpret input parameters. For more information about the relationship between the NtXxx and ZwXxx versions of a routine, see Using Nt and Zw Versions of the Native System Services Routines.

Requirements

   
Windows version Available starting with Windows 2000.
Target Platform Universal
Header ntifs.h (include Ntifs.h, FltKernel.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL PASSIVE_LEVEL
DDI compliance rules PowerIrpDDis, HwStorPortProhibitedDDIs

See Also

OBJECT_INFORMATION_CLASS

PUBLIC_OBJECT_BASIC_INFORMATION

PUBLIC_OBJECT_TYPE_INFORMATION

Using Nt and Zw Versions of the Native System Services Routines