Bewerken

Delen via


NtQueryObject function (ntifs.h)

The NtQueryObject routine provides information about a supplied object.

Syntax

__kernel_entry NTSYSCALLAPI NTSTATUS NtQueryObject(
  [in, optional]  HANDLE                   Handle,
  [in]            OBJECT_INFORMATION_CLASS ObjectInformationClass,
  [out, optional] PVOID                    ObjectInformation,
  [in]            ULONG                    ObjectInformationLength,
  [out, optional] PULONG                   ReturnLength
);

Parameters

[in, optional] Handle

A handle to the object to obtain information about.

[in] ObjectInformationClass

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

[out, optional] ObjectInformation

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

[in] ObjectInformationLength

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

[out, optional] ReturnLength

A pointer to a variable that receives the size, in bytes, of the requested key information. If NtQueryObject returns STATUS_SUCCESS, the variable contains the amount of data returned. If NtQueryObject 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

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

Requirement Value
Minimum supported client 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 HwStorPortProhibitedDDIs, PowerIrpDDis

See also

OBJECT_INFORMATION_CLASS

PUBLIC_OBJECT_BASIC_INFORMATION

PUBLIC_OBJECT_TYPE_INFORMATION