2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: include/internal/objmgr.h
5 * PURPOSE: Object manager definitions
6 * PROGRAMMER: David Welch (welch@mcmail.com)
9 #ifndef __INCLUDE_INTERNAL_OBJMGR_H
10 #define __INCLUDE_INTERNAL_OBJMGR_H
12 #include <ddk/types.h>
18 } COMMON_BODY_HEADER
, *PCOMMON_BODY_HEADER
;
20 typedef struct _DIRECTORY_OBJECT
26 * PURPOSE: Head of the list of our subdirectories
29 } DIRECTORY_OBJECT
, *PDIRECTORY_OBJECT
;
33 * Enumeration of object types
46 BOOL
ObjAddObjectToNameSpace(const char* path
, POBJECT_HEADER Object
);
48 VOID
ObRegisterType(CSHORT id
, OBJECT_TYPE
* type
);
50 VOID
ObInitializeObjectHeader(CSHORT id
, LPCSTR name
, POBJECT_HEADER obj
);
53 * FUNCTION: Get the size of an object
56 * RETURNS: The size in bytes
58 ULONG
ObSizeOf(CSHORT Type
);
59 HANDLE
ObAddHandle(PVOID obj
);
61 PVOID
ObGetObjectByHandle(HANDLE h
);
62 PVOID
ObLookupObject(PDIRECTORY_OBJECT root
, const char* _string
);
63 PVOID
ObGenericCreateObject(PHANDLE Handle
,
64 ACCESS_MASK DesiredAccess
,
65 POBJECT_ATTRIBUTES ObjectAttributes
,
69 * FUNCTION: Creates an entry within a directory
71 * parent = Parent directory
72 * object = Header of the object to add
74 VOID
ObCreateEntry(PDIRECTORY_OBJECT parent
, POBJECT_HEADER object
);
76 extern inline POBJECT_HEADER
BODY_TO_HEADER(PVOID body
)
78 PCOMMON_BODY_HEADER chdr
= (PCOMMON_BODY_HEADER
)body
;
79 return(CONTAINING_RECORD((&(chdr
->Type
)),OBJECT_HEADER
,Type
));
82 extern inline PVOID
HEADER_TO_BODY(POBJECT_HEADER obj
)
84 return(((void *)obj
)+sizeof(OBJECT_HEADER
)-sizeof(COMMON_BODY_HEADER
));
87 #define OBJECT_ALLOC_SIZE(type) (ObSizeOf(type)+sizeof(OBJECT_HEADER)-sizeof(COMMON_BODY_HEADER))
89 #endif /* __INCLUDE_INTERNAL_OBJMGR_H */