NtQuerySemaphore - NtDoc

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

NTSYSCALLAPI
NTSTATUS
NTAPI
NtQuerySemaphore(
    _In_ HANDLE SemaphoreHandle,
    _In_ SEMAPHORE_INFORMATION_CLASS SemaphoreInformationClass,
    _Out_writes_bytes_(SemaphoreInformationLength) PVOID SemaphoreInformation,
    _In_ ULONG SemaphoreInformationLength,
    _Out_opt_ PULONG ReturnLength
    );

#endif
#endif

View code on GitHub
#ifndef _NTZWAPI_H

NTSYSCALLAPI
NTSTATUS
NTAPI
ZwQuerySemaphore(
    _In_ HANDLE SemaphoreHandle,
    _In_ SEMAPHORE_INFORMATION_CLASS SemaphoreInformationClass,
    _Out_writes_bytes_(SemaphoreInformationLength) PVOID SemaphoreInformation,
    _In_ ULONG SemaphoreInformationLength,
    _Out_opt_ PULONG ReturnLength
    );

#endif

View code on GitHub

Function NtQuerySemaphore retrieve semaphore's parameters (see SEMAPHORE_BASIC_INFORMATION).

SemaphoreHandle

HANDLE to Semaphore Object opened with SEMAPHORE_QUERY_STATE access.

SemaphoreInformationClass

Information class described in SEMAPHORE_INFORMATION_CLASS section.

SemaphoreInformation

Pointer to user's allocated buffer for result data.

SemaphoreInformationLength

Size of SemaphoreInformation buffer, in bytes.

ReturnLength

Optionally returns required buffer size.

Documented by

See also