stos: ob: Add helper to create object directory
Signed-off-by: Chloe M. <chloe@mensia.org>
This commit is contained in:
@@ -10,6 +10,45 @@
|
||||
#include <ex/pool.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
|
||||
ObCreateObject(const CHAR *Name, OBJECT_TYPE Type, VOID *Data, ST_OBJECT **Result)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user