Files
nt-lite/code/public/ntlite/ddk/object.h
T

47 lines
1.4 KiB
C

// Public nt-lite DDK object declarations.
#pragma once
#include <stddef.h>
#include <stdint.h>
// Kernel object type identifiers used by the legacy object header.
typedef enum OBJECT_TYPE {
ObjectTypeProcess = 1,
ObjectTypeThread = 2,
ObjectTypeMutex = 3,
ObjectTypeSemaphore = 4,
ObjectTypeEvent = 5,
ObjectTypeQueue = 6,
ObjectTypeFile = 7,
ObjectTypeDir = 8,
ObjectTypeAsyncIo = 9,
ObjectTypeSocket = 10,
ObjectTypeDevice = 11,
ObjectTypeDriver = 12,
ObjectTypeUsbDevice = 13,
ObjectTypeUsbPipe = 14,
ObjectTypeFileMapping = 15,
ObjectTypeSurface = 16,
ObjectTypeInputQueue = 17,
ObjectTypeImageSection = 18,
ObjectTypeTimer = 19,
ObjectTypeModule = 20,
} OBJECT_TYPE;
// Legacy object header embedded by current driver/device objects.
typedef struct OBJECT {
OBJECT_TYPE Type;
volatile long RefCount;
void (*Destroy)(struct OBJECT* self);
} OBJECT;
// Increments an object's reference count.
__declspec(dllexport) void ObReferenceObject(OBJECT* object);
// Decrements an object's reference count and destroys it when it reaches zero.
__declspec(dllexport) void ObDereferenceObject(OBJECT* object);
// Allocates a zeroed object of the given size.
__declspec(dllexport) OBJECT* ObAllocateObject(OBJECT_TYPE type, size_t size);