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
ObAddObjectToNameSpace(PUNICODE_STRING path
, POBJECT_HEADER Object
);
48 VOID
ObRegisterType(CSHORT id
, OBJECT_TYPE
* type
);
50 VOID
ObInitializeObjectHeader(CSHORT id
, PUNICODE_STRING name
,
54 * FUNCTION: Get the size of an object
57 * RETURNS: The size in bytes
59 ULONG
ObSizeOf(CSHORT Type
);
60 HANDLE
ObAddHandle(PVOID obj
);
62 PVOID
ObGetObjectByHandle(HANDLE h
);
63 PVOID
ObLookupObject(PDIRECTORY_OBJECT root
, PUNICODE_STRING _string
);
64 PVOID
ObGenericCreateObject(PHANDLE Handle
,
65 ACCESS_MASK DesiredAccess
,
66 POBJECT_ATTRIBUTES ObjectAttributes
,
70 * FUNCTION: Creates an entry within a directory
72 * parent = Parent directory
73 * object = Header of the object to add
75 VOID
ObCreateEntry(PDIRECTORY_OBJECT parent
, POBJECT_HEADER object
);
77 extern inline POBJECT_HEADER
BODY_TO_HEADER(PVOID body
)
79 PCOMMON_BODY_HEADER chdr
= (PCOMMON_BODY_HEADER
)body
;
80 return(CONTAINING_RECORD((&(chdr
->Type
)),OBJECT_HEADER
,Type
));
83 extern inline PVOID
HEADER_TO_BODY(POBJECT_HEADER obj
)
85 return(((void *)obj
)+sizeof(OBJECT_HEADER
)-sizeof(COMMON_BODY_HEADER
));
88 #define OBJECT_ALLOC_SIZE(type) (ObSizeOf(type)+sizeof(OBJECT_HEADER)-sizeof(COMMON_BODY_HEADER))
90 #endif /* __INCLUDE_INTERNAL_OBJMGR_H */