From 4f399576a0d7c1fe167ab4f9b4eb0da62dc8d833 Mon Sep 17 00:00:00 2001 From: "Chloe M." Date: Thu, 25 Jun 2026 00:49:13 +0000 Subject: [PATCH] stos: ob: Add helper to create object directory Signed-off-by: Chloe M. --- paw/stos/head/ob/object.h | 8 ++++++++ paw/stos/ob/ob.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/paw/stos/head/ob/object.h b/paw/stos/head/ob/object.h index 668b3bc..7a0d2e9 100644 --- a/paw/stos/head/ob/object.h +++ b/paw/stos/head/ob/object.h @@ -56,6 +56,14 @@ typedef struct { USIZE EntryCount; } OBJECT_DIRECTORY; +/* + * Create a new object directory + * + * @Name: Name of object + * @Result: Resulting object is written here + */ +ST_STATUS ObCreateDirectory(const CHAR *Name, ST_OBJECT **Result); + /* * Allocate and create a new objec * diff --git a/paw/stos/ob/ob.c b/paw/stos/ob/ob.c index 40c0d1b..3deb169 100644 --- a/paw/stos/ob/ob.c +++ b/paw/stos/ob/ob.c @@ -10,6 +10,45 @@ #include #include +ST_STATUS +ObCreateDirectory(const CHAR *Name, ST_OBJECT **Result) +{ + ST_STATUS Status; + ST_OBJECT *DirecObj; + OBJECT_DIRECTORY *Direc; + + if (Name == NULL || Result == NULL) { + return STATUS_INVALID_PARAM; + } + + Status = ObCreateObject( + Name, + OBJECT_TYPE_DIRECTORY, + NULL, + &DirecObj + ); + + if (Status != STATUS_SUCCESS) { + return Status; + } + + Direc = ExAllocatePoolWithTag( + POOL_NON_PAGED, + sizeof(*Direc), + OBJECT_POOL_TAG + ); + + /* FIXME: Free DirecObj */ + if (Direc == NULL) { + return STATUS_NO_MEMORY; + } + + RtlMemSet(Direc, 0, sizeof(*Direc)); + DirecObj->Data = Direc; + *Result = DirecObj; + return STATUS_SUCCESS; +} + ST_STATUS ObCreateObject(const CHAR *Name, OBJECT_TYPE Type, VOID *Data, ST_OBJECT **Result) {