NtQueryMutant - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
#ifndef _NTEXAPI_H
#if (PHNT_MODE != PHNT_MODE_KERNEL)

/**
 * The NtQueryMutant routine retrieves information about a mutant object.
 *
 * \param MutantHandle A handle to the mutant object.
 * \param MutantInformationClass The type of information to be retrieved.
 * \param MutantInformation A pointer to a buffer that receives the requested information.
 * \param MutantInformationLength The size of the buffer pointed to by MutantInformation.
 * \param ReturnLength A pointer to a variable that receives the size of the data returned in the buffer.
 * \return NTSTATUS Successful or errant status.
 * \remarks Requires MUTANT_QUERY_STATE (0x1). MutantBasicInformation (0) requires exactly 8 bytes;
 * MutantOwnerInformation (1) requires exactly sizeof(MUTANT_OWNER_INFORMATION), 16 bytes on x64 and 8 bytes
 * for x86 callers. Unsupported classes return STATUS_INVALID_INFO_CLASS; incorrect sizes return
 * STATUS_INFO_LENGTH_MISMATCH. Basic-query wrong-size failures leave ReturnLength unchanged on the native x64
 * and x86/WoW64 paths; success reports the selected structure size. Querying never acquires ownership. The
 * owner IDs and state are snapshots and may change immediately after the query.
 */
_Kernel_entry_
NTSYSCALLAPI
NTSTATUS
NTAPI
NtQueryMutant(
    _In_ HANDLE MutantHandle,
    _In_ MUTANT_INFORMATION_CLASS MutantInformationClass,
    _Out_writes_bytes_(MutantInformationLength) PVOID MutantInformation,
    _In_ ULONG MutantInformationLength,
    _Out_opt_ PULONG ReturnLength
    );

#endif
#endif

View code on GitHub
#ifndef _NTZWAPI_H

_Kernel_entry_
NTSYSCALLAPI
NTSTATUS
NTAPI
ZwQueryMutant(
    _In_ HANDLE MutantHandle,
    _In_ MUTANT_INFORMATION_CLASS MutantInformationClass,
    _Out_writes_bytes_(MutantInformationLength) PVOID MutantInformation,
    _In_ ULONG MutantInformationLength,
    _Out_opt_ PULONG ReturnLength
    );

#endif

View code on GitHub

NtDoc

No description available.

NTinternals.net (undocumented.ntinternals.net)

MutantHandle

Handle to Mutant object.

MutantInformationClass

Is defined as enum:

typedef enum _MUTANT_INFORMATION_CLASS
{
    MutantBasicInformation

} MUTANT_INFORMATION_CLASS, *PMUTANT_INFORMATION_CLASS;

MutantInformation

Buffer for result. As long as only one information type is defined, set MutantInformation as a pointer to MUTANT_BASIC_INFORMATION structure.

MutantInformationLength

Size of buffer.

ResultLength

Number of bytes written to buffer.

Documented by

See also