MSDN Documentation

Kernel Services API Reference

The Windows Kernel Services provide low‑level system functionality accessible to drivers and system components. Below are the most commonly used kernel‑mode APIs, grouped by category.

Categories

Process & Thread Management

// Example: Creating a system thread
VOID WorkerThread(PVOID StartContext) {
    UNREFERENCED_PARAMETER(StartContext);
    DbgPrint("Worker thread started\n");
    PsTerminateSystemThread(STATUS_SUCCESS);
}

NTSTATUS CreateWorkerThread() {
    HANDLE threadHandle;
    NTSTATUS status = PsCreateSystemThread(&threadHandle,
                                           THREAD_ALL_ACCESS,
                                           NULL,
                                           NULL,
                                           NULL,
                                           WorkerThread,
                                           NULL);
    if (NT_SUCCESS(status)) {
        ZwClose(threadHandle);
    }
    return status;
}

Memory Management

// Allocate non‑paged pool memory
PVOID buffer = ExAllocatePoolWithTag(NonPagedPoolNx, 256, 'mytg');
if (buffer) {
    RtlZeroMemory(buffer, 256);
    // ... use buffer ...
    ExFreePoolWithTag(buffer, 'mytg');
}

Synchronization Primitives

IRQL & Interrupts

Device I/O

Debugging & Diagnostics