NtCreateSemaphore - 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
NtCreateSemaphore(
    _Out_ PHANDLE SemaphoreHandle,
    _In_ ACCESS_MASK DesiredAccess,
    _In_opt_ POBJECT_ATTRIBUTES ObjectAttributes,
    _In_ LONG InitialCount,
    _In_ LONG MaximumCount
    );

#endif
#endif

View code on GitHub
#ifndef _NTZWAPI_H

NTSYSCALLAPI
NTSTATUS
NTAPI
ZwCreateSemaphore(
    _Out_ PHANDLE SemaphoreHandle,
    _In_ ACCESS_MASK DesiredAccess,
    _In_opt_ POBJECT_ATTRIBUTES ObjectAttributes,
    _In_ LONG InitialCount,
    _In_ LONG MaximumCount
    );

#endif

View code on GitHub

Function NtCreateSemaphore creates Semaphore Object with or without name in Object Namespace, and sets initial and maximum releases number.

SemaphoreHandle

Result of call - pointer to HANDLE to Semaphore Object.

DesiredAccess

Access rights to Semaphore Object. Can be one of:

ObjectAttributes

Optional pointer to OBJECT_ATTRIBUTES structure containing semaphore's name.

InitialCount

Initial state of semaphore. Typically the same as MaximumCount.

MaximumCount

Maximum releases number.

Documented by

See also