:pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS reactos
[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 (*Dump)(VOID);
66   
67   /*
68    * PURPOSE: Opens the object
69    * NOTE: To be defined
70    */
71   VOID STDCALL (*Open)(VOID);
72   
73    /*
74     * PURPOSE: Called to close an object if OkayToClose returns true
75     */
76   VOID STDCALL (*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 (*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 (*Parse)(PVOID ParsedObject,
93                              PVOID *NextObject,
94                              PUNICODE_STRING FullPath,
95                              PWSTR *Path,
96                              ULONG Attributes);
97   
98    /*
99     */
100   NTSTATUS STDCALL (*Security)(PVOID Object,
101                                ULONG InfoClass,
102                                PVOID Info,
103                                PULONG InfoLength);
104   
105   /*
106    */
107   VOID STDCALL (*QueryName)(VOID);
108    
109   /*
110    * PURPOSE: Called when a process asks to close the object
111    */
112   VOID STDCALL (*OkayToClose)(VOID);
113   
114   NTSTATUS STDCALL (*Create)(PVOID ObjectBody,
115                              PVOID Parent,
116                              PWSTR RemainingPath,
117                              struct _OBJECT_ATTRIBUTES* ObjectAttributes);
118
119   VOID STDCALL (*DuplicationNotify)(PEPROCESS DuplicateTo,
120                                     PEPROCESS DuplicateFrom,
121                                     PVOID Object);
122 } OBJECT_TYPE, *POBJECT_TYPE;
123
124
125 typedef struct _OBJECT_HEADER
126 /*
127  * PURPOSE: Header for every object managed by the object manager
128  */
129 {
130    UNICODE_STRING Name;
131    LIST_ENTRY Entry;
132    LONG RefCount;
133    LONG HandleCount;
134    BOOLEAN CloseInProcess;
135    BOOLEAN Permanent;
136    struct _DIRECTORY_OBJECT* Parent;
137    POBJECT_TYPE ObjectType;
138    
139    /*
140     * PURPOSE: Object type
141     * NOTE: This overlaps the first member of the object body
142     */
143    CSHORT Type;
144    
145    /*
146     * PURPOSE: Object size
147     * NOTE: This overlaps the second member of the object body
148     */
149    CSHORT Size;
150    
151    
152 } OBJECT_HEADER, *POBJECT_HEADER;
153
154 typedef struct _OBJECT_ATTRIBUTES
155 {
156    ULONG Length;
157    HANDLE RootDirectory;
158    PUNICODE_STRING ObjectName;
159    ULONG Attributes;
160    SECURITY_DESCRIPTOR *SecurityDescriptor;
161    SECURITY_QUALITY_OF_SERVICE *SecurityQualityOfService;
162 } OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
163
164 typedef struct _HANDLE_TABLE
165 {
166    LIST_ENTRY ListHead;
167    KSPIN_LOCK ListLock;
168 } HANDLE_TABLE, *PHANDLE_TABLE;
169
170 extern POBJECT_TYPE ObDirectoryType;
171
172 #if 0 
173 #define OBJECT_TYPE_0                   0
174 #define OBJECT_TYPE_1                   1
175 #define OBJECT_TYPE_DIRECTORY           2
176 #define OBJECT_TYPE_SYMBOLICLINK        3
177 #define OBJECT_TYPE_TOKEN               4
178 #define OBJECT_TYPE_PROCESS             5
179 #define OBJECT_TYPE_THREAD              6
180 #define OBJECT_TYPE_EVENT               7
181 #define OBJECT_TYPE_8                   8
182 #define OBJECT_TYPE_MUTANT              9
183 #define OBJECT_TYPE_SEMAPHORE           10
184 #define OBJECT_TYPE_TIMER               11
185 #define OBJECT_TYPE_12                  12
186 #define OBJECT_TYPE_WINDOWSTATION       13
187 #define OBJECT_TYPE_DESKTOP             14
188 #define OBJECT_TYPE_SECTION             15
189 #define OBJECT_TYPE_KEY                 16
190 #define OBJECT_TYPE_PORT                17
191 #define OBJECT_TYPE_18                  18
192 #define OBJECT_TYPE_19                  19
193 #define OBJECT_TYPE_20                  20
194 #define OBJECT_TYPE_21                  21
195 #define OBJECT_TYPE_IOCOMPLETION        22
196 #define OBJECT_TYPE_FILE                23
197 #endif
198
199 #endif /* ndef _INCLUDE_DDK_OBTYPES_H */