NTSTATUS
KeReleaseWaitForSemaphore(
  IN  PKSEMAPHORE Server,
  IN  PKSEMAPHORE Client,
  IN  ULONG WaitReason,
  IN  ULONG WaitMode
  );

Routine Description:

    This function releases a semaphore and waits on another semaphore. The
    wait is performed such that an optimal switch to the waiting thread
    occurs if possible. No timeout is associated with the wait, and thus,
    the issuing thread will wait until the semaphore is signaled or an APC
    is delivered.

Arguments:

    Server - Supplies a pointer to a dispatcher object of type semaphore.

    Client - Supplies a pointer to a dispatcher object of type semaphore.

    WaitReason - Supplies the reason for the wait.

    WaitMode  - Supplies the processor mode in which the wait is to occur.

Return Value:

    The wait completion status. A value of STATUS_SUCCESS is returned if
    the specified object satisfied the wait. A value of STATUS_USER_APC is
    returned if the wait was aborted to deliver a user APC to the current
    thread.