#ifndef _NTEXAPI_H
#if (PHNT_MODE != PHNT_MODE_KERNEL)
/**
* The NtCreateMutant routine creates a mutant object, sets the initial state of the mutant to the specified value,
* and opens a handle to the object with the specified desired access.
*
* \param MutantHandle A pointer to a variable that receives the mutant object handle.
* \param DesiredAccess The access mask that specifies the requested access to the mutant object.
* \param ObjectAttributes A pointer to an OBJECT_ATTRIBUTES structure that specifies the object attributes.
* \param InitialOwner If TRUE, the calling thread is the initial owner of the mutant object.
* \return NTSTATUS Successful or errant status.
* \remarks A mutant is an ownership-tracked, recursively acquirable mutex. NULL ObjectAttributes
* creates an unnamed object. InitialOwner applies only to a newly created mutant. With
* OBJ_OPENIF, an existing named mutant is returned with STATUS_OBJECT_NAME_EXISTS; TRUE
* InitialOwner does not acquire it. Acquire an existing mutant by waiting instead.
* Release each acquired recursion level with NtReleaseMutant; NtClose closes the handle
* but is not a substitute for releasing ownership.
*/
_Kernel_entry_
NTSYSCALLAPI
NTSTATUS
NTAPI
NtCreateMutant(
_Out_ PHANDLE MutantHandle,
_In_ ACCESS_MASK DesiredAccess,
_In_opt_ PCOBJECT_ATTRIBUTES ObjectAttributes,
_In_ BOOLEAN InitialOwner
);
View code on GitHub#ifndef _NTZWAPI_H
_Kernel_entry_
NTSYSCALLAPI
NTSTATUS
NTAPI
ZwCreateMutant(
_Out_ PHANDLE MutantHandle,
_In_ ACCESS_MASK DesiredAccess,
_In_opt_ PCOBJECT_ATTRIBUTES ObjectAttributes,
_In_ BOOLEAN InitialOwner
);
View code on GitHubNo description available.
Result of function call - handle to newly created Mutant object.
In most cases there's MUTANT_ALL_ACCESS. See <WinNT.h> or <WinBase.h> for other information about Mutant objects access rights.
May be used to creation named Mutant objects. Named Mutant can be used by more then one process.
If TRUE, Mutant is created with non-signaled state. Caller should call NtReleaseMutant after program initialization.
Mutant object live in object namespace as long as at least one handle is still open. To destroy Mutant, just call NtClose with MutantHandle.