// 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 within the requested timeout. // Zero performs a nonblocking probe; KE_WAIT_INFINITE waits without a timeout. __declspec(dllexport) KSTATUS KeWaitSemaphore(SEMAPHORE* semaphore, uint64_t timeoutMilliseconds); // Releases one semaphore count. __declspec(dllexport) void KeSignalSemaphore(SEMAPHORE* semaphore);