update for HEAD-2003091401
[reactos.git] / include / ntos / obtypes.h
1 #ifndef _INCLUDE_DDK_OBTYPES_H
2 #define _INCLUDE_DDK_OBTYPES_H
3 /* $Id$ */
4 struct _DIRECTORY_OBJECT;
5 struct _OBJECT_ATTRIBUTES;
6
7 #ifndef __USE_W32API
8
9 typedef ULONG ACCESS_STATE, *PACCESS_STATE;
10
11 typedef struct _OBJECT_NAME_INFORMATION
12 {
13   UNICODE_STRING Name;
14 } OBJECT_NAME_INFORMATION, *POBJECT_NAME_INFORMATION;
15
16 typedef struct _OBJECT_HANDLE_INFORMATION
17 {
18   ULONG HandleAttributes;
19   ACCESS_MASK GrantedAccess;
20 } OBJECT_HANDLE_INFORMATION, *POBJECT_HANDLE_INFORMATION;
21
22 #endif /* __USE_W32API */
23
24 typedef struct _OBJECT_TYPE
25 {
26   /*
27    * PURPOSE: Tag to be used when allocating objects of this type
28    */
29   ULONG Tag;
30
31   /*
32    * PURPOSE: Name of the type
33    */
34   UNICODE_STRING TypeName;
35   
36   /*
37    * PURPOSE: Total number of objects of this type
38    */
39   ULONG TotalObjects;
40   
41   /*
42    * PURPOSE: Total number of handles of this type
43    */
44   ULONG TotalHandles;
45   
46   /*
47    * PURPOSE: Maximum objects of this type
48    */
49   ULONG MaxObjects;
50   
51    /*
52     * PURPOSE: Maximum handles of this type
53     */
54   ULONG MaxHandles;
55   
56   /*
57    * PURPOSE: Paged pool charge
58    */
59    ULONG PagedPoolCharge;
60   
61   /*
62    * PURPOSE: Nonpaged pool charge
63    */
64   ULONG NonpagedPoolCharge;
65   
66   /*
67    * PURPOSE: Mapping of generic access rights
68    */
69   PGENERIC_MAPPING Mapping;
70   
71   /*
72    * PURPOSE: Dumps the object
73    * NOTE: To be defined
74    */
75   VOID STDCALL_FUNC (*Dump)(VOID);
76   
77   /*
78    * PURPOSE: Opens the object
79    * NOTE: To be defined
80    */
81   VOID STDCALL_FUNC (*Open)(VOID);
82   
83    /*
84     * PURPOSE: Called to close an object if OkayToClose returns true
85     */
86   VOID STDCALL_FUNC (*Close)(PVOID ObjectBody,
87                         ULONG HandleCount);
88   
89   /*
90    * PURPOSE: Called to delete an object when the last reference is removed
91    */
92   VOID STDCALL_FUNC (*Delete)(PVOID ObjectBody);
93   
94   /*
95    * PURPOSE: Called when an open attempts to open a file apparently
96    * residing within the object
97    * RETURNS
98    *     STATUS_SUCCESS       NextObject was found
99    *     STATUS_UNSUCCESSFUL  NextObject not found
100    *     STATUS_REPARSE       Path changed, restart parsing the path
101    */
102    NTSTATUS STDCALL_FUNC (*Parse)(PVOID ParsedObject,
103                              PVOID *NextObject,
104                              PUNICODE_STRING FullPath,
105                              PWSTR *Path,
106                              ULONG Attributes);
107
108   /*
109    * PURPOSE: Called to set, query, delete or assign a security-descriptor
110    * to the object
111    * RETURNS
112    *     STATUS_SUCCESS       NextObject was found
113    */
114   NTSTATUS STDCALL_FUNC (*Security)(PVOID ObjectBody,
115                                     SECURITY_OPERATION_CODE OperationCode,
116                                     SECURITY_INFORMATION SecurityInformation,
117                                     PSECURITY_DESCRIPTOR SecurityDescriptor,
118                                     PULONG BufferLength);
119
120   /*
121    * PURPOSE: Called to query the name of the object
122    * RETURNS
123    *     STATUS_SUCCESS       NextObject was found
124    */
125   NTSTATUS STDCALL_FUNC (*QueryName)(PVOID ObjectBody,
126                                      POBJECT_NAME_INFORMATION ObjectNameInfo,
127                                      ULONG Length,
128                                      PULONG ReturnLength);
129
130   /*
131    * PURPOSE: Called when a process asks to close the object
132    */
133   VOID STDCALL_FUNC (*OkayToClose)(VOID);
134
135   NTSTATUS STDCALL_FUNC (*Create)(PVOID ObjectBody,
136                              PVOID Parent,
137                              PWSTR RemainingPath,
138                              struct _OBJECT_ATTRIBUTES* ObjectAttributes);
139
140   VOID STDCALL_FUNC (*DuplicationNotify)(PEPROCESS DuplicateTo,
141                                     PEPROCESS DuplicateFrom,
142                                     PVOID Object);
143 } OBJECT_TYPE;
144
145 #ifndef __USE_W32API
146
147 typedef struct _OBJECT_TYPE *POBJECT_TYPE;
148
149 #endif /* __USE_W32API */
150
151
152 typedef struct _OBJECT_HEADER
153 /*
154  * PURPOSE: Header for every object managed by the object manager
155  */
156 {
157    UNICODE_STRING Name;
158    LIST_ENTRY Entry;
159    LONG RefCount;
160    LONG HandleCount;
161    BOOLEAN CloseInProcess;
162    BOOLEAN Permanent;
163    struct _DIRECTORY_OBJECT* Parent;
164    POBJECT_TYPE ObjectType;
165    
166    /*
167     * PURPOSE: Object type
168     * NOTE: This overlaps the first member of the object body
169     */
170    CSHORT Type;
171    
172    /*
173     * PURPOSE: Object size
174     * NOTE: This overlaps the second member of the object body
175     */
176    CSHORT Size;
177    
178    
179 } OBJECT_HEADER, *POBJECT_HEADER;
180
181 #ifndef __USE_W32API
182
183 typedef struct _OBJECT_ATTRIBUTES
184 {
185    ULONG Length;
186    HANDLE RootDirectory;
187    PUNICODE_STRING ObjectName;
188    ULONG Attributes;
189    SECURITY_DESCRIPTOR *SecurityDescriptor;
190    SECURITY_QUALITY_OF_SERVICE *SecurityQualityOfService;
191 } OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
192
193 #endif /* __USE_W32API */
194
195 typedef struct _HANDLE_TABLE
196 {
197    LIST_ENTRY ListHead;
198    KSPIN_LOCK ListLock;
199 } HANDLE_TABLE;
200
201 #ifndef __USE_W32API
202
203 typedef struct _HANDLE_TABLE *PHANDLE_TABLE;
204
205 #endif /* __USE_W32API */
206
207 extern POBJECT_TYPE ObDirectoryType;
208
209 #endif /* ndef _INCLUDE_DDK_OBTYPES_H */