// Public nt-lite DDK semaphore declarations. #pragma once #include #include #include #include #include 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);