NtReleaseSemaphore - 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 NtReleaseSemaphore routine increases the count of the specified semaphore object by a specified amount.
 *
 * @param SemaphoreHandle A handle to the semaphore object.
 * @param ReleaseCount The amount by which the semaphore object's count is to be increased.
 * @param PreviousCount A pointer to a variable that receives the previous count of the semaphore object.
 * @return NTSTATUS Successful or errant status.
 */
NTSYSCALLAPI
NTSTATUS
NTAPI
NtReleaseSemaphore(
    _In_ HANDLE SemaphoreHandle,
    _In_ LONG ReleaseCount,
    _Out_opt_ PLONG PreviousCount
    );

#endif
#endif

View code on GitHub
#ifndef _NTZWAPI_H

NTSYSCALLAPI
NTSTATUS
NTAPI
ZwReleaseSemaphore(
    _In_ HANDLE SemaphoreHandle,
    _In_ LONG ReleaseCount,
    _Out_opt_ PLONG PreviousCount
    );

#endif

View code on GitHub

Function NtReleaseSemaphore increments semaphore's counter, opposite to any waiting function (semaphore is signaled when semaphore's counter is greater then zero).

SemaphoreHandle

HANDLE to Semaphore Object opened with SEMAPHORE_MODIFY_STATE access.

ReleaseCount

Number of increments, typically set to 1.

PreviousCount

Optional pointer to ULONG value receiving semaphore's counter state before call.

Documented by

See also