2005-12-29 17:57:11 +00:00
|
|
|
/*
|
2005-01-26 13:58:37 +00:00
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
2005-12-29 17:57:11 +00:00
|
|
|
* PROJECT: ReactOS Kernel
|
2005-01-26 13:58:37 +00:00
|
|
|
* FILE: ntoskrnl/ex/win32k.c
|
2005-12-29 17:57:11 +00:00
|
|
|
* PURPOSE: Executive Win32 Object Support (Desktop/WinStation)
|
|
|
|
* PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
|
2001-06-12 17:51:51 +00:00
|
|
|
*/
|
|
|
|
|
2004-08-15 16:39:12 +00:00
|
|
|
#include <ntoskrnl.h>
|
2001-06-12 17:51:51 +00:00
|
|
|
#define NDEBUG
|
2008-08-30 16:31:06 +00:00
|
|
|
#include <debug.h>
|
2001-06-12 17:51:51 +00:00
|
|
|
|
2005-11-28 23:25:31 +00:00
|
|
|
#if defined (ALLOC_PRAGMA)
|
|
|
|
#pragma alloc_text(INIT, ExpWin32kInit)
|
|
|
|
#endif
|
|
|
|
|
2001-06-12 17:51:51 +00:00
|
|
|
/* DATA **********************************************************************/
|
|
|
|
|
2005-11-22 02:30:18 +00:00
|
|
|
POBJECT_TYPE ExWindowStationObjectType = NULL;
|
|
|
|
POBJECT_TYPE ExDesktopObjectType = NULL;
|
2001-06-12 17:51:51 +00:00
|
|
|
|
2007-10-19 23:21:45 +00:00
|
|
|
GENERIC_MAPPING ExpWindowStationMapping =
|
2005-06-25 14:04:56 +00:00
|
|
|
{
|
|
|
|
STANDARD_RIGHTS_READ,
|
|
|
|
STANDARD_RIGHTS_WRITE,
|
|
|
|
STANDARD_RIGHTS_EXECUTE,
|
|
|
|
STANDARD_RIGHTS_REQUIRED
|
2004-11-20 16:46:06 +00:00
|
|
|
};
|
2001-06-12 17:51:51 +00:00
|
|
|
|
2006-05-25 20:03:13 +00:00
|
|
|
GENERIC_MAPPING ExpDesktopMapping =
|
2005-06-25 14:04:56 +00:00
|
|
|
{
|
|
|
|
STANDARD_RIGHTS_READ,
|
|
|
|
STANDARD_RIGHTS_WRITE,
|
|
|
|
STANDARD_RIGHTS_EXECUTE,
|
|
|
|
STANDARD_RIGHTS_REQUIRED
|
2004-11-20 16:46:06 +00:00
|
|
|
};
|
2001-06-12 17:51:51 +00:00
|
|
|
|
2006-05-25 20:03:13 +00:00
|
|
|
PKWIN32_PARSEMETHOD_CALLOUT ExpWindowStationObjectParse = NULL;
|
|
|
|
PKWIN32_DELETEMETHOD_CALLOUT ExpWindowStationObjectDelete = NULL;
|
2011-03-22 09:19:26 +00:00
|
|
|
PKWIN32_OKTOCLOSEMETHOD_CALLOUT ExpWindowStationObjectOkToClose = NULL;
|
|
|
|
PKWIN32_OKTOCLOSEMETHOD_CALLOUT ExpDesktopObjectOkToClose = NULL;
|
2006-05-25 20:03:13 +00:00
|
|
|
PKWIN32_DELETEMETHOD_CALLOUT ExpDesktopObjectDelete = NULL;
|
2001-06-12 17:51:51 +00:00
|
|
|
|
2005-03-12 14:15:49 +00:00
|
|
|
/* FUNCTIONS ****************************************************************/
|
2001-06-12 17:51:51 +00:00
|
|
|
|
2011-03-22 09:19:26 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ExpDesktopOkToClose( IN PEPROCESS Process OPTIONAL,
|
|
|
|
IN PVOID Object,
|
|
|
|
IN HANDLE Handle,
|
|
|
|
IN KPROCESSOR_MODE AccessMode)
|
|
|
|
{
|
|
|
|
WIN32_OKAYTOCLOSEMETHOD_PARAMETERS Parameters;
|
|
|
|
|
|
|
|
Parameters.Process = Process;
|
|
|
|
Parameters.Object = Object;
|
|
|
|
Parameters.Handle = Handle;
|
|
|
|
Parameters.PreviousMode = AccessMode;
|
|
|
|
|
|
|
|
return ExpDesktopObjectOkToClose(&Parameters);
|
|
|
|
}
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ExpWindowStationOkToClose( IN PEPROCESS Process OPTIONAL,
|
|
|
|
IN PVOID Object,
|
|
|
|
IN HANDLE Handle,
|
|
|
|
IN KPROCESSOR_MODE AccessMode)
|
|
|
|
{
|
|
|
|
WIN32_OKAYTOCLOSEMETHOD_PARAMETERS Parameters;
|
|
|
|
|
|
|
|
Parameters.Process = Process;
|
|
|
|
Parameters.Object = Object;
|
|
|
|
Parameters.Handle = Handle;
|
|
|
|
Parameters.PreviousMode = AccessMode;
|
|
|
|
|
|
|
|
return ExpWindowStationObjectOkToClose(&Parameters);
|
|
|
|
}
|
|
|
|
|
2005-05-09 01:38:29 +00:00
|
|
|
VOID
|
2008-11-29 20:47:48 +00:00
|
|
|
NTAPI
|
2001-08-26 17:30:21 +00:00
|
|
|
ExpWinStaObjectDelete(PVOID DeletedObject)
|
2001-06-12 17:51:51 +00:00
|
|
|
{
|
2006-05-25 20:03:13 +00:00
|
|
|
WIN32_DELETEMETHOD_PARAMETERS Parameters;
|
|
|
|
|
|
|
|
/* Fill out the callback structure */
|
|
|
|
Parameters.Object = DeletedObject;
|
|
|
|
|
2005-03-12 14:15:49 +00:00
|
|
|
/* Call the Registered Callback */
|
2006-05-25 20:03:13 +00:00
|
|
|
ExpWindowStationObjectDelete(&Parameters);
|
2001-06-12 17:51:51 +00:00
|
|
|
}
|
|
|
|
|
2005-05-09 01:38:29 +00:00
|
|
|
NTSTATUS
|
2008-11-29 20:47:48 +00:00
|
|
|
NTAPI
|
2006-05-25 01:18:31 +00:00
|
|
|
ExpWinStaObjectParse(IN PVOID ParseObject,
|
|
|
|
IN PVOID ObjectType,
|
|
|
|
IN OUT PACCESS_STATE AccessState,
|
|
|
|
IN KPROCESSOR_MODE AccessMode,
|
|
|
|
IN ULONG Attributes,
|
|
|
|
IN OUT PUNICODE_STRING CompleteName,
|
|
|
|
IN OUT PUNICODE_STRING RemainingName,
|
|
|
|
IN OUT PVOID Context OPTIONAL,
|
|
|
|
IN PSECURITY_QUALITY_OF_SERVICE SecurityQos OPTIONAL,
|
|
|
|
OUT PVOID *Object)
|
2001-06-12 17:51:51 +00:00
|
|
|
{
|
2006-05-25 20:03:13 +00:00
|
|
|
WIN32_PARSEMETHOD_PARAMETERS Parameters;
|
|
|
|
|
|
|
|
/* Fill out the callback structure */
|
|
|
|
Parameters.ParseObject = ParseObject;
|
|
|
|
Parameters.ObjectType = ObjectType;
|
|
|
|
Parameters.AccessState = AccessState;
|
|
|
|
Parameters.AccessMode = AccessMode;
|
|
|
|
Parameters.Attributes = Attributes;
|
|
|
|
Parameters.CompleteName = CompleteName;
|
|
|
|
Parameters.RemainingName = RemainingName;
|
|
|
|
Parameters.Context = Context;
|
|
|
|
Parameters.SecurityQos = SecurityQos;
|
|
|
|
Parameters.Object = Object;
|
|
|
|
|
2005-03-12 14:15:49 +00:00
|
|
|
/* Call the Registered Callback */
|
2006-05-25 20:03:13 +00:00
|
|
|
return ExpWindowStationObjectParse(&Parameters);
|
2001-06-12 17:51:51 +00:00
|
|
|
}
|
2005-05-09 01:38:29 +00:00
|
|
|
VOID
|
2008-11-29 20:47:48 +00:00
|
|
|
NTAPI
|
2005-03-12 14:15:49 +00:00
|
|
|
ExpDesktopDelete(PVOID DeletedObject)
|
2001-06-12 17:51:51 +00:00
|
|
|
{
|
2006-05-25 20:03:13 +00:00
|
|
|
WIN32_DELETEMETHOD_PARAMETERS Parameters;
|
|
|
|
|
|
|
|
/* Fill out the callback structure */
|
|
|
|
Parameters.Object = DeletedObject;
|
|
|
|
|
2005-03-12 14:15:49 +00:00
|
|
|
/* Call the Registered Callback */
|
2006-05-25 20:03:13 +00:00
|
|
|
ExpDesktopObjectDelete(&Parameters);
|
2001-06-12 17:51:51 +00:00
|
|
|
}
|
|
|
|
|
2005-05-09 01:38:29 +00:00
|
|
|
VOID
|
2005-03-12 14:15:49 +00:00
|
|
|
INIT_FUNCTION
|
2008-11-29 20:47:48 +00:00
|
|
|
NTAPI
|
2001-06-12 17:51:51 +00:00
|
|
|
ExpWin32kInit(VOID)
|
|
|
|
{
|
2005-05-15 17:59:33 +00:00
|
|
|
OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
|
|
|
|
UNICODE_STRING Name;
|
2005-12-29 17:57:11 +00:00
|
|
|
DPRINT("Creating Win32 Object Types\n");
|
2005-05-15 17:59:33 +00:00
|
|
|
|
|
|
|
/* Create the window station Object Type */
|
|
|
|
RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
|
|
|
|
RtlInitUnicodeString(&Name, L"WindowStation");
|
|
|
|
ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
|
|
|
|
ObjectTypeInitializer.GenericMapping = ExpWindowStationMapping;
|
|
|
|
ObjectTypeInitializer.PoolType = NonPagedPool;
|
|
|
|
ObjectTypeInitializer.DeleteProcedure = ExpWinStaObjectDelete;
|
2006-05-25 19:30:09 +00:00
|
|
|
ObjectTypeInitializer.ParseProcedure = ExpWinStaObjectParse;
|
2011-03-22 09:19:26 +00:00
|
|
|
ObjectTypeInitializer.OkayToCloseProcedure = ExpWindowStationOkToClose;
|
2006-06-05 06:31:42 +00:00
|
|
|
ObCreateObjectType(&Name,
|
|
|
|
&ObjectTypeInitializer,
|
|
|
|
NULL,
|
|
|
|
&ExWindowStationObjectType);
|
2005-03-12 14:15:49 +00:00
|
|
|
|
|
|
|
/* Create desktop object type */
|
2005-05-15 17:59:33 +00:00
|
|
|
RtlInitUnicodeString(&Name, L"Desktop");
|
|
|
|
ObjectTypeInitializer.GenericMapping = ExpDesktopMapping;
|
|
|
|
ObjectTypeInitializer.DeleteProcedure = ExpDesktopDelete;
|
|
|
|
ObjectTypeInitializer.ParseProcedure = NULL;
|
2011-03-22 09:19:26 +00:00
|
|
|
ObjectTypeInitializer.OkayToCloseProcedure = ExpDesktopOkToClose;
|
2006-06-05 06:31:42 +00:00
|
|
|
ObCreateObjectType(&Name,
|
|
|
|
&ObjectTypeInitializer,
|
|
|
|
NULL,
|
|
|
|
&ExDesktopObjectType);
|
2001-06-12 17:51:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* EOF */
|