30 lines
815 B
C
30 lines
815 B
C
// Public nt-lite DDK semaphore declarations.
|
|
|
|
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include <ntlite/status.h>
|
|
#include <ntlite/ddk/list.h>
|
|
#include <ntlite/ddk/object.h>
|
|
#include <ntlite/ddk/sync.h>
|
|
|
|
typedef struct SEMAPHORE {
|
|
OBJECT Header;
|
|
SPINLOCK Lock;
|
|
int32_t Count;
|
|
int32_t MaxCount;
|
|
LIST_ENTRY WaitList;
|
|
} SEMAPHORE;
|
|
|
|
// Creates a counting semaphore.
|
|
__declspec(dllexport) KSTATUS KeSemaphoreCreate(int32_t initial, int32_t max, SEMAPHORE** out);
|
|
|
|
// Waits for a semaphore count to become available.
|
|
__declspec(dllexport) KSTATUS KeWaitSemaphore(SEMAPHORE* semaphore);
|
|
|
|
// Attempts to take a semaphore without blocking.
|
|
__declspec(dllexport) KSTATUS KeTrySemaphore(SEMAPHORE* semaphore);
|
|
|
|
// Releases one semaphore count.
|
|
__declspec(dllexport) void KeSignalSemaphore(SEMAPHORE* semaphore);
|