NtReleaseMutant - 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 NtReleaseMutant routine releases ownership of a mutant object.
 *
 * \param MutantHandle A handle to the mutant object.
 * \param PreviousCount A pointer to a variable that receives the previous count of the mutant object.
 * \return NTSTATUS Successful or errant status.
 * \remarks For ordinary mutants no specific handle access right is required
 * (the handle is referenced with desired access 0), but the calling thread must own it.
 * Each release removes one recursion level. PreviousCount receives the prior dispatcher
 * signal count, not a positive recursion depth: 0 for the final release and negative
 * values for recursive ownership. A nonowner normally receives STATUS_MUTANT_NOT_OWNED.
 * If the mutant is abandoned, a nonowner release returns STATUS_ABANDONED (0x80) without
 * releasing/acquiring it or writing PreviousCount. This status is nonnegative: test for
 * STATUS_SUCCESS, not merely NT_SUCCESS, when deciding whether a release occurred.
 */
_Kernel_entry_
NTSYSCALLAPI
NTSTATUS
NTAPI
NtReleaseMutant(
    _In_ HANDLE MutantHandle,
    _Out_opt_ PLONG PreviousCount
    );

#endif
#endif

View code on GitHub
#ifndef _NTZWAPI_H

_Kernel_entry_
NTSYSCALLAPI
NTSTATUS
NTAPI
ZwReleaseMutant(
    _In_ HANDLE MutantHandle,
    _Out_opt_ PLONG PreviousCount
    );

#endif

View code on GitHub

NtDoc

No description available.

NTinternals.net (undocumented.ntinternals.net)

PreviousCount

Internal mutant counter state before call NtReleaseMutant.

Documented by

See also