ZwQueryObject routine

The ZwQueryObject routine provides information about a supplied object.

Syntax


NTSTATUS ZwQueryObject(
  _In_opt_  HANDLE                   Handle,
  _In_      OBJECT_INFORMATION_CLASS ObjectInformationClass,
  _Out_opt_ PVOID                    ObjectInformation,
  _In_      ULONG                    ObjectInformationLength,
  _Out_opt_ PULONG                   ReturnLength
);

Parameters

Handle [in, optional]

A handle to the object to obtain information about.

ObjectInformationClass [in]

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

ObjectInformation [out, optional]

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

ObjectInformationLength [in]

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

ReturnLength [out, optional]

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 codeDescription
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

Target platform

Universal

Version

Available starting with Windows 2000.

Header

Ntifs.h (include Ntifs.h or 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

 

 

Send comments about this topic to Microsoft

Show: