stos: ob: Add helper to create object directory
Signed-off-by: Chloe M. <chloe@mensia.org>
This commit is contained in:
@@ -56,6 +56,14 @@ typedef struct {
|
|||||||
USIZE EntryCount;
|
USIZE EntryCount;
|
||||||
} OBJECT_DIRECTORY;
|
} 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
|
* Allocate and create a new objec
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -10,6 +10,45 @@
|
|||||||
#include <ex/pool.h>
|
#include <ex/pool.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
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
|
ST_STATUS
|
||||||
ObCreateObject(const CHAR *Name, OBJECT_TYPE Type, VOID *Data, ST_OBJECT **Result)
|
ObCreateObject(const CHAR *Name, OBJECT_TYPE Type, VOID *Data, ST_OBJECT **Result)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user