- Remove unused ldr/userldr.c
[reactos.git] / reactos / ntoskrnl / ex / win32k.c
1 /* $Id$
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/ex/win32k.c
6 * PURPOSE: Executive Win32 subsystem support
7 *
8 * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) - Moved callbacks to win32k and cleanup.
9 * Casper S. Hornstrup (chorns@users.sourceforge.net)
10 */
11
12 #include <ntoskrnl.h>
13 #define NDEBUG
14 #include <internal/debug.h>
15
16 /* DATA **********************************************************************/
17
18 POBJECT_TYPE EXPORTED ExWindowStationObjectType = NULL;
19 POBJECT_TYPE EXPORTED ExDesktopObjectType = NULL;
20
21 static GENERIC_MAPPING ExpWindowStationMapping =
22 {
23 STANDARD_RIGHTS_READ,
24 STANDARD_RIGHTS_WRITE,
25 STANDARD_RIGHTS_EXECUTE,
26 STANDARD_RIGHTS_REQUIRED
27 };
28
29 static GENERIC_MAPPING ExpDesktopMapping =
30 {
31 STANDARD_RIGHTS_READ,
32 STANDARD_RIGHTS_WRITE,
33 STANDARD_RIGHTS_EXECUTE,
34 STANDARD_RIGHTS_REQUIRED
35 };
36
37 OB_OPEN_METHOD ExpWindowStationObjectOpen = NULL;
38 OB_PARSE_METHOD ExpWindowStationObjectParse = NULL;
39 OB_DELETE_METHOD ExpWindowStationObjectDelete = NULL;
40 OB_FIND_METHOD ExpWindowStationObjectFind = NULL;
41 OB_CREATE_METHOD ExpDesktopObjectCreate = NULL;
42 OB_DELETE_METHOD ExpDesktopObjectDelete = NULL;
43
44 /* FUNCTIONS ****************************************************************/
45
46 NTSTATUS
47 STDCALL
48 ExpWinStaObjectOpen(OB_OPEN_REASON Reason,
49 PVOID ObjectBody,
50 PEPROCESS Process,
51 ULONG HandleCount,
52 ACCESS_MASK GrantedAccess)
53 {
54 /* Call the Registered Callback */
55 return ExpWindowStationObjectOpen(Reason,
56 ObjectBody,
57 Process,
58 HandleCount,
59 GrantedAccess);
60 }
61
62 VOID
63 STDCALL
64 ExpWinStaObjectDelete(PVOID DeletedObject)
65 {
66 /* Call the Registered Callback */
67 ExpWindowStationObjectDelete(DeletedObject);
68 }
69
70 PVOID
71 STDCALL
72 ExpWinStaObjectFind(PVOID WinStaObject,
73 PWSTR Name,
74 ULONG Attributes)
75 {
76 /* Call the Registered Callback */
77 return ExpWindowStationObjectFind(WinStaObject,
78 Name,
79 Attributes);
80 }
81
82 NTSTATUS
83 STDCALL
84 ExpWinStaObjectParse(PVOID Object,
85 PVOID *NextObject,
86 PUNICODE_STRING FullPath,
87 PWSTR *Path,
88 ULONG Attributes)
89 {
90 /* Call the Registered Callback */
91 return ExpWindowStationObjectParse(Object,
92 NextObject,
93 FullPath,
94 Path,
95 Attributes);
96 }
97
98 NTSTATUS
99 STDCALL
100 ExpDesktopCreate(PVOID ObjectBody,
101 PVOID Parent,
102 PWSTR RemainingPath,
103 struct _OBJECT_ATTRIBUTES* ObjectAttributes)
104 {
105 /* Call the Registered Callback */
106 return ExpDesktopObjectCreate(ObjectBody,
107 Parent,
108 RemainingPath,
109 ObjectAttributes);
110 }
111
112 VOID
113 STDCALL
114 ExpDesktopDelete(PVOID DeletedObject)
115 {
116 /* Call the Registered Callback */
117 ExpDesktopObjectDelete(DeletedObject);
118 }
119
120 VOID
121 INIT_FUNCTION
122 STDCALL
123 ExpWin32kInit(VOID)
124 {
125 OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
126 UNICODE_STRING Name;
127
128 DPRINT("Creating window station Object Type\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.UseDefaultObject = TRUE;
137 ObjectTypeInitializer.OpenProcedure = ExpWinStaObjectOpen;
138 ObjectTypeInitializer.DeleteProcedure = ExpWinStaObjectDelete;
139 ObjectTypeInitializer.ParseProcedure = ExpWinStaObjectParse;
140 ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &ExWindowStationObjectType);
141
142 /* Create desktop object type */
143 RtlInitUnicodeString(&Name, L"Desktop");
144 ObjectTypeInitializer.GenericMapping = ExpDesktopMapping;
145 ObjectTypeInitializer.OpenProcedure = NULL;
146 ObjectTypeInitializer.DeleteProcedure = ExpDesktopDelete;
147 ObjectTypeInitializer.ParseProcedure = NULL;
148
149 ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &ExDesktopObjectType);
150 }
151
152 /* EOF */