- NDK 0.98, now with versionned headers. Too many changes to list, see the TinyKRNL...
[reactos.git] / reactos / ntoskrnl / ex / win32k.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Kernel
4 * FILE: ntoskrnl/ex/win32k.c
5 * PURPOSE: Executive Win32 Object Support (Desktop/WinStation)
6 * PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
7 */
8
9 #include <ntoskrnl.h>
10 #define NDEBUG
11 #include <internal/debug.h>
12
13 #if defined (ALLOC_PRAGMA)
14 #pragma alloc_text(INIT, ExpWin32kInit)
15 #endif
16
17 /* DATA **********************************************************************/
18
19 POBJECT_TYPE ExWindowStationObjectType = NULL;
20 POBJECT_TYPE ExDesktopObjectType = NULL;
21
22 static GENERIC_MAPPING ExpWindowStationMapping =
23 {
24 STANDARD_RIGHTS_READ,
25 STANDARD_RIGHTS_WRITE,
26 STANDARD_RIGHTS_EXECUTE,
27 STANDARD_RIGHTS_REQUIRED
28 };
29
30 static GENERIC_MAPPING ExpDesktopMapping =
31 {
32 STANDARD_RIGHTS_READ,
33 STANDARD_RIGHTS_WRITE,
34 STANDARD_RIGHTS_EXECUTE,
35 STANDARD_RIGHTS_REQUIRED
36 };
37
38 OB_OPEN_METHOD ExpWindowStationObjectOpen = NULL;
39 OB_ROS_PARSE_METHOD ExpWindowStationObjectParse = NULL;
40 OB_DELETE_METHOD ExpWindowStationObjectDelete = NULL;
41 OB_ROS_FIND_METHOD ExpWindowStationObjectFind = NULL;
42 OB_ROS_CREATE_METHOD ExpDesktopObjectCreate = NULL;
43 OB_DELETE_METHOD ExpDesktopObjectDelete = NULL;
44
45 /* FUNCTIONS ****************************************************************/
46
47 NTSTATUS
48 STDCALL
49 ExpWinStaObjectOpen(OB_OPEN_REASON Reason,
50 PVOID ObjectBody,
51 PEPROCESS Process,
52 ULONG HandleCount,
53 ACCESS_MASK GrantedAccess)
54 {
55 /* Call the Registered Callback */
56 return ExpWindowStationObjectOpen(Reason,
57 ObjectBody,
58 Process,
59 HandleCount,
60 GrantedAccess);
61 }
62
63 VOID
64 STDCALL
65 ExpWinStaObjectDelete(PVOID DeletedObject)
66 {
67 /* Call the Registered Callback */
68 ExpWindowStationObjectDelete(DeletedObject);
69 }
70
71 PVOID
72 STDCALL
73 ExpWinStaObjectFind(PVOID WinStaObject,
74 PWSTR Name,
75 ULONG Attributes)
76 {
77 /* Call the Registered Callback */
78 return ExpWindowStationObjectFind(WinStaObject,
79 Name,
80 Attributes);
81 }
82
83 NTSTATUS
84 STDCALL
85 ExpWinStaObjectParse(PVOID Object,
86 PVOID *NextObject,
87 PUNICODE_STRING FullPath,
88 PWSTR *Path,
89 ULONG Attributes)
90 {
91 /* Call the Registered Callback */
92 return ExpWindowStationObjectParse(Object,
93 NextObject,
94 FullPath,
95 Path,
96 Attributes);
97 }
98
99 NTSTATUS
100 STDCALL
101 ExpDesktopCreate(PVOID ObjectBody,
102 PVOID Parent,
103 PWSTR RemainingPath,
104 POBJECT_ATTRIBUTES ObjectAttributes)
105 {
106 /* Call the Registered Callback */
107 return ExpDesktopObjectCreate(ObjectBody,
108 Parent,
109 RemainingPath,
110 ObjectAttributes);
111 }
112
113 VOID
114 STDCALL
115 ExpDesktopDelete(PVOID DeletedObject)
116 {
117 /* Call the Registered Callback */
118 ExpDesktopObjectDelete(DeletedObject);
119 }
120
121 VOID
122 INIT_FUNCTION
123 STDCALL
124 ExpWin32kInit(VOID)
125 {
126 OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
127 UNICODE_STRING Name;
128 DPRINT("Creating Win32 Object Types\n");
129
130 /* Create the window station Object Type */
131 RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
132 RtlInitUnicodeString(&Name, L"WindowStation");
133 ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
134 ObjectTypeInitializer.GenericMapping = ExpWindowStationMapping;
135 ObjectTypeInitializer.PoolType = NonPagedPool;
136 ObjectTypeInitializer.OpenProcedure = (OB_OPEN_METHOD)ExpWinStaObjectOpen;
137 ObjectTypeInitializer.DeleteProcedure = ExpWinStaObjectDelete;
138 ObjectTypeInitializer.ParseProcedure = (OB_PARSE_METHOD)ExpWinStaObjectParse;
139 ObpCreateTypeObject(&ObjectTypeInitializer,
140 &Name,
141 &ExWindowStationObjectType);
142
143 /* Create desktop object type */
144 RtlInitUnicodeString(&Name, L"Desktop");
145 ObjectTypeInitializer.GenericMapping = ExpDesktopMapping;
146 ObjectTypeInitializer.OpenProcedure = NULL;
147 ObjectTypeInitializer.DeleteProcedure = ExpDesktopDelete;
148 ObjectTypeInitializer.ParseProcedure = NULL;
149 ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &ExDesktopObjectType);
150 }
151
152 /* EOF */