i think it works

This commit is contained in:
maksw committed 2026-04-30 23:52:46 +02:00
commit 0e1479b168
167 files changed
+27008

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
#pragma once
// ob_object.h - executive object model
// Every resource the kernel tracks is a typed, reference-counted OBJECT.
// The OBJECT header must be the first member of any derived struct.
#include <stdint.h>
#include <stddef.h>
#include "ke_status.h"
typedef enum OBJECT_TYPE {
ObjectTypeProcess = 1,
ObjectTypeThread = 2,
ObjectTypeMutex = 3,
ObjectTypeSemaphore = 4,
ObjectTypeEvent = 5,
ObjectTypeQueue = 6,
ObjectTypeFile = 7,
} OBJECT_TYPE;
typedef struct OBJECT {
OBJECT_TYPE Type;
volatile long RefCount; /* interlocked; long = 4 bytes on MSVC x64 */
void (*Destroy)(struct OBJECT* self);
} OBJECT;
// Increment the reference count. Call whenever ownership is shared.
void ObReferenceObject(OBJECT* object);
// Decrement. Calls Destroy() and frees the object when count reaches zero.
void ObDereferenceObject(OBJECT* object);
// Allocate a zeroed object of the given size from kernel pool.
// Caller must fill Type and Destroy before publishing the pointer.
OBJECT* ObAllocateObject(OBJECT_TYPE type, size_t size);