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