- Convert all Win32k Object callback functions to the correct NT prototypes.

- Get rid of ROS-internal WIN32_CALLOUT_DATA and use the real WIN32_CALLOUTS_FPNS type.
- Get rid of the callout.h hack.

svn path=/trunk/; revision=22044
This commit is contained in:
Alex Ionescu 2006-05-25 20:03:13 +00:00
parent b0f84fadf3
commit 3a9bdc8cf4
9 changed files with 115 additions and 140 deletions

View file

@ -334,7 +334,7 @@ struct _WIN32_POWEREVENT_PARAMETERS;
struct _WIN32_POWERSTATE_PARAMETERS;
struct _WIN32_JOBCALLOUT_PARAMETERS;
struct _WIN32_OPENMETHOD_PARAMETERS;
struct _WIN32_OKTOCLOSEMETHOD_PARAMETERS;
struct _WIN32_OKAYTOCLOSEMETHOD_PARAMETERS;
struct _WIN32_CLOSEMETHOD_PARAMETERS;
struct _WIN32_DELETEMETHOD_PARAMETERS;
struct _WIN32_PARSEMETHOD_PARAMETERS;
@ -342,69 +342,82 @@ struct _WIN32_PARSEMETHOD_PARAMETERS;
//
// Win32K Process and Thread Callbacks
//
typedef NTSTATUS
typedef
NTSTATUS
(NTAPI *PKWIN32_PROCESS_CALLOUT)(
struct _EPROCESS *Process,
BOOLEAN Create
);
typedef NTSTATUS
typedef
NTSTATUS
(NTAPI *PKWIN32_THREAD_CALLOUT)(
struct _ETHREAD *Thread,
PSW32THREADCALLOUTTYPE Type
);
typedef NTSTATUS
typedef
NTSTATUS
(NTAPI *PKWIN32_GLOBALATOMTABLE_CALLOUT)(
VOID
);
typedef NTSTATUS
typedef
NTSTATUS
(NTAPI *PKWIN32_POWEREVENT_CALLOUT)(
struct _WIN32_POWEREVENT_PARAMETERS *Parameters
);
typedef NTSTATUS
typedef
NTSTATUS
(NTAPI *PKWIN32_POWERSTATE_CALLOUT)(
struct _WIN32_POWERSTATE_PARAMETERS *Parameters
);
typedef NTSTATUS
typedef
NTSTATUS
(NTAPI *PKWIN32_JOB_CALLOUT)(
struct _WIN32_JOBCALLOUT_PARAMETERS *Parameters
);
typedef NTSTATUS
typedef
NTSTATUS
(NTAPI *PGDI_BATCHFLUSH_ROUTINE)(
VOID
);
typedef NTSTATUS
typedef
NTSTATUS
(NTAPI *PKWIN32_OPENMETHOD_CALLOUT)(
struct _WIN32_OPENMETHOD_PARAMETERS *Parameters
);
typedef NTSTATUS
typedef
NTSTATUS
(NTAPI *PKWIN32_OKTOCLOSEMETHOD_CALLOUT)(
struct _WIN32_OKTOCLOSEMETHOD_PARAMETERS *Parameters
struct _WIN32_OKAYTOCLOSEMETHOD_PARAMETERS *Parameters
);
typedef NTSTATUS
typedef
NTSTATUS
(NTAPI *PKWIN32_CLOSEMETHOD_CALLOUT)(
struct _WIN32_CLOSEMETHOD_PARAMETERS *Parameters
);
typedef NTSTATUS
typedef
VOID
(NTAPI *PKWIN32_DELETEMETHOD_CALLOUT)(
struct _WIN32_DELETEMETHOD_PARAMETERS *Parameters
);
typedef NTSTATUS
typedef
NTSTATUS
(NTAPI *PKWIN32_PARSEMETHOD_CALLOUT)(
struct _WIN32_PARSEMETHOD_PARAMETERS *Parameters
);
typedef NTSTATUS
typedef
NTSTATUS
(NTAPI *PKWIN32_WIN32DATACOLLECTION_CALLOUT)(
struct _EPROCESS *Process,
PVOID Callback,

View file

@ -1,18 +0,0 @@
#ifndef _CALLOUT_
#define _CALLOUT_
#include <internal/ob.h>
typedef struct _W32_CALLOUT_DATA
{
PKWIN32_PROCESS_CALLOUT W32ProcessCallout;
PKWIN32_THREAD_CALLOUT W32ThreadCallout;
OB_OPEN_METHOD DesktopOpen;
OB_DELETE_METHOD DesktopDelete;
OB_DELETE_METHOD WinStaDelete;
OB_PARSE_METHOD WinStaParse;
OB_OPEN_METHOD WinStaOpen;
OB_PARSE_METHOD DesktopParse;
} W32_CALLOUT_DATA, *PW32_CALLOUT_DATA;
#endif

View file

@ -19,7 +19,7 @@
POBJECT_TYPE ExWindowStationObjectType = NULL;
POBJECT_TYPE ExDesktopObjectType = NULL;
static GENERIC_MAPPING ExpWindowStationMapping =
GENERIC_MAPPING ExpWindowStationMapping =
{
STANDARD_RIGHTS_READ,
STANDARD_RIGHTS_WRITE,
@ -27,7 +27,7 @@ static GENERIC_MAPPING ExpWindowStationMapping =
STANDARD_RIGHTS_REQUIRED
};
static GENERIC_MAPPING ExpDesktopMapping =
GENERIC_MAPPING ExpDesktopMapping =
{
STANDARD_RIGHTS_READ,
STANDARD_RIGHTS_WRITE,
@ -35,11 +35,10 @@ static GENERIC_MAPPING ExpDesktopMapping =
STANDARD_RIGHTS_REQUIRED
};
OB_OPEN_METHOD ExpWindowStationObjectOpen = NULL;
OB_PARSE_METHOD ExpWindowStationObjectParse = NULL;
OB_DELETE_METHOD ExpWindowStationObjectDelete = NULL;
OB_PARSE_METHOD ExpDesktopObjectParse = NULL;
OB_DELETE_METHOD ExpDesktopObjectDelete = NULL;
PKWIN32_OPENMETHOD_CALLOUT ExpWindowStationObjectOpen = NULL;
PKWIN32_PARSEMETHOD_CALLOUT ExpWindowStationObjectParse = NULL;
PKWIN32_DELETEMETHOD_CALLOUT ExpWindowStationObjectDelete = NULL;
PKWIN32_DELETEMETHOD_CALLOUT ExpDesktopObjectDelete = NULL;
/* FUNCTIONS ****************************************************************/
@ -51,20 +50,30 @@ ExpWinStaObjectOpen(OB_OPEN_REASON Reason,
ACCESS_MASK GrantedAccess,
ULONG HandleCount)
{
WIN32_OPENMETHOD_PARAMETERS Parameters;
/* Fill out the callback structure */
Parameters.OpenReason = Reason;
Parameters.Process = Process;
Parameters.Object = ObjectBody;
Parameters.GrantedAccess = GrantedAccess;
Parameters.HandleCount = HandleCount;
/* Call the Registered Callback */
return ExpWindowStationObjectOpen(Reason,
Process,
ObjectBody,
GrantedAccess,
HandleCount);
return ExpWindowStationObjectOpen(&Parameters);
}
VOID
STDCALL
ExpWinStaObjectDelete(PVOID DeletedObject)
{
WIN32_DELETEMETHOD_PARAMETERS Parameters;
/* Fill out the callback structure */
Parameters.Object = DeletedObject;
/* Call the Registered Callback */
ExpWindowStationObjectDelete(DeletedObject);
ExpWindowStationObjectDelete(&Parameters);
}
NTSTATUS
@ -80,24 +89,34 @@ ExpWinStaObjectParse(IN PVOID ParseObject,
IN PSECURITY_QUALITY_OF_SERVICE SecurityQos OPTIONAL,
OUT PVOID *Object)
{
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;
/* Call the Registered Callback */
return ExpWindowStationObjectParse(ParseObject,
ObjectType,
AccessState,
AccessMode,
Attributes,
CompleteName,
RemainingName,
Context,
SecurityQos,
Object);
return ExpWindowStationObjectParse(&Parameters);
}
VOID
STDCALL
ExpDesktopDelete(PVOID DeletedObject)
{
WIN32_DELETEMETHOD_PARAMETERS Parameters;
/* Fill out the callback structure */
Parameters.Object = DeletedObject;
/* Call the Registered Callback */
ExpDesktopObjectDelete(DeletedObject);
ExpDesktopObjectDelete(&Parameters);
}
VOID

View file

@ -13,18 +13,15 @@
#include <ntoskrnl.h>
#define NDEBUG
#include <internal/debug.h>
#include <win32k/callout.h>
/* GLOBALS ******************************************************************/
static PKWIN32_PROCESS_CALLOUT PspWin32ProcessCallback = NULL;
static PKWIN32_THREAD_CALLOUT PspWin32ThreadCallback = NULL;
extern OB_OPEN_METHOD ExpWindowStationObjectOpen;
extern OB_PARSE_METHOD ExpWindowStationObjectParse;
extern OB_DELETE_METHOD ExpWindowStationObjectDelete;
extern OB_PARSE_METHOD ExpDesktopObjectParse;
extern OB_DELETE_METHOD ExpDesktopObjectDelete;
extern PKWIN32_OPENMETHOD_CALLOUT ExpWindowStationObjectOpen;
extern PKWIN32_PARSEMETHOD_CALLOUT ExpWindowStationObjectParse;
extern PKWIN32_DELETEMETHOD_CALLOUT ExpWindowStationObjectDelete;
extern PKWIN32_DELETEMETHOD_CALLOUT ExpDesktopObjectDelete;
#ifndef ALEX_CB_REWRITE
typedef struct _NTW32CALL_SAVED_STATE
@ -55,16 +52,14 @@ KeSwitchKernelStack(
*/
VOID
STDCALL
PsEstablishWin32Callouts(PWIN32_CALLOUTS_FPNS calloutData)
PsEstablishWin32Callouts(PWIN32_CALLOUTS_FPNS CalloutData)
{
PW32_CALLOUT_DATA CalloutData = (PW32_CALLOUT_DATA)calloutData;
PspWin32ProcessCallback = CalloutData->W32ProcessCallout;
PspWin32ThreadCallback = CalloutData->W32ThreadCallout;
ExpWindowStationObjectOpen = CalloutData->WinStaOpen;
ExpWindowStationObjectParse = CalloutData->WinStaParse;
ExpWindowStationObjectDelete = CalloutData->WinStaDelete;
ExpDesktopObjectParse = CalloutData->DesktopParse;
ExpDesktopObjectDelete = CalloutData->DesktopDelete;
PspWin32ProcessCallback = CalloutData->ProcessCallout;
PspWin32ThreadCallback = CalloutData->ThreadCallout;
ExpWindowStationObjectOpen = CalloutData->WindowStationOpenProcedure;
ExpWindowStationObjectParse = CalloutData->WindowStationParseProcedure;
ExpWindowStationObjectDelete = CalloutData->WindowStationDeleteProcedure;
ExpDesktopObjectDelete = CalloutData->DesktopDeleteProcedure;
}
NTSTATUS

View file

@ -61,7 +61,7 @@ IntDesktopObjectParse(IN PVOID ParseObject,
OUT PVOID *Object);
VOID STDCALL
IntDesktopObjectDelete(PVOID DeletedObject);
IntDesktopObjectDelete(PWIN32_DELETEMETHOD_PARAMETERS Parameters);
VOID FASTCALL
IntGetDesktopWorkArea(PDESKTOP_OBJECT Desktop, PRECT Rect);

View file

@ -54,32 +54,14 @@ CleanupWindowStationImpl(VOID);
NTSTATUS
STDCALL
IntWinStaObjectOpen(IN OB_OPEN_REASON Reason,
IN PEPROCESS Process OPTIONAL,
IN PVOID ObjectBody,
IN ACCESS_MASK GrantedAccess,
IN ULONG HandleCount);
IntWinStaObjectOpen(PWIN32_OPENMETHOD_PARAMETERS Parameters);
VOID STDCALL
IntWinStaObjectDelete(PVOID DeletedObject);
PVOID STDCALL
IntWinStaObjectFind(PVOID Object,
PWSTR Name,
ULONG Attributes);
IntWinStaObjectDelete(PWIN32_DELETEMETHOD_PARAMETERS Parameters);
NTSTATUS
STDCALL
IntWinStaObjectParse(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);
IntWinStaObjectParse(PWIN32_PARSEMETHOD_PARAMETERS Parameters);
NTSTATUS FASTCALL
IntValidateWindowStationHandle(

View file

@ -23,7 +23,6 @@
#include <w32k.h>
#include <include/napi.h>
#include <win32k/callout.h>
#define NDEBUG
#include <debug.h>
@ -360,7 +359,7 @@ DriverEntry (
{
NTSTATUS Status;
BOOLEAN Result;
W32_CALLOUT_DATA CalloutData;
WIN32_CALLOUTS_FPNS CalloutData;
PVOID GlobalUserHeapBase = NULL;
/*
@ -381,13 +380,12 @@ DriverEntry (
/*
* Register Object Manager Callbacks
*/
CalloutData.WinStaOpen = IntWinStaObjectOpen;
CalloutData.WinStaParse = IntWinStaObjectParse;
CalloutData.WinStaDelete = IntWinStaObjectDelete;
CalloutData.DesktopParse = IntDesktopObjectParse;
CalloutData.DesktopDelete = IntDesktopObjectDelete;
CalloutData.W32ProcessCallout = Win32kProcessCallback;
CalloutData.W32ThreadCallout = Win32kThreadCallback;
CalloutData.WindowStationOpenProcedure = IntWinStaObjectOpen;
CalloutData.WindowStationParseProcedure = IntWinStaObjectParse;
CalloutData.WindowStationDeleteProcedure = IntWinStaObjectDelete;
CalloutData.DesktopDeleteProcedure = IntDesktopObjectDelete;
CalloutData.ProcessCallout = Win32kProcessCallback;
CalloutData.ThreadCallout = Win32kThreadCallback;
/*
* Register our per-process and per-thread structures.

View file

@ -93,7 +93,6 @@ IntDesktopObjectParse(IN PVOID ParseObject,
PUNICODE_STRING DesktopName;
/* Set the list pointers and loop the window station */
DPRINT1("Creating desktop(%wZ)\n", RemainingName);
ListHead = &WinStaObject->DesktopListHead;
NextEntry = ListHead->Flink;
while (NextEntry != ListHead)
@ -174,9 +173,9 @@ IntDesktopObjectParse(IN PVOID ParseObject,
}
VOID STDCALL
IntDesktopObjectDelete(PVOID DeletedObject)
IntDesktopObjectDelete(PWIN32_DELETEMETHOD_PARAMETERS Parameters)
{
PDESKTOP_OBJECT Desktop = (PDESKTOP_OBJECT)DeletedObject;
PDESKTOP_OBJECT Desktop = (PDESKTOP_OBJECT)Parameters->Object;
DPRINT("Deleting desktop (0x%X)\n", Desktop);

View file

@ -96,15 +96,11 @@ CleanupWindowStationImpl(VOID)
NTSTATUS
STDCALL
IntWinStaObjectOpen(OB_OPEN_REASON Reason,
PEPROCESS Process,
PVOID ObjectBody,
ACCESS_MASK GrantedAccess,
ULONG HandleCount)
IntWinStaObjectOpen(PWIN32_OPENMETHOD_PARAMETERS Parameters)
{
PWINSTATION_OBJECT WinSta = (PWINSTATION_OBJECT)ObjectBody;
NTSTATUS Status;
PWINSTATION_OBJECT WinSta = (PWINSTATION_OBJECT)Parameters->Object;
OB_OPEN_REASON Reason = Parameters->OpenReason;
NTSTATUS Status;
if (Reason == ObCreateHandle)
{
@ -125,9 +121,9 @@ IntWinStaObjectOpen(OB_OPEN_REASON Reason,
}
VOID STDCALL
IntWinStaObjectDelete(PVOID DeletedObject)
IntWinStaObjectDelete(PWIN32_DELETEMETHOD_PARAMETERS Parameters)
{
PWINSTATION_OBJECT WinSta = (PWINSTATION_OBJECT)DeletedObject;
PWINSTATION_OBJECT WinSta = (PWINSTATION_OBJECT)Parameters->Object;
DPRINT("Deleting window station (0x%X)\n", WinSta);
@ -138,27 +134,18 @@ IntWinStaObjectDelete(PVOID DeletedObject)
NTSTATUS
STDCALL
IntWinStaObjectParse(IN PVOID Object,
IN PVOID ObjectType,
IN OUT PACCESS_STATE AccessState,
IN KPROCESSOR_MODE AccessMode,
IN ULONG Attributes,
IN OUT PUNICODE_STRING FullPath,
IN OUT PUNICODE_STRING RemainingName,
IN OUT PVOID Context OPTIONAL,
IN PSECURITY_QUALITY_OF_SERVICE SecurityQos OPTIONAL,
OUT PVOID *NextObject)
IntWinStaObjectParse(PWIN32_PARSEMETHOD_PARAMETERS Parameters)
{
DPRINT("Object (0x%X) Path (0x%X) *Path (%wZ)\n", Object, RemainingName, RemainingName);
PUNICODE_STRING RemainingName = Parameters->RemainingName;
/* Assume we don't find anything */
*NextObject = NULL;
*Parameters->Object = NULL;
/* Check for an empty name */
if (!RemainingName->Length)
{
/* Make sure this is a window station, can't parse a desktop now */
if (ObjectType != ExWindowStationObjectType)
if (Parameters->ObjectType != ExWindowStationObjectType)
{
/* Fail */
return STATUS_OBJECT_TYPE_MISMATCH;
@ -191,19 +178,19 @@ IntWinStaObjectParse(IN PVOID Object,
* FIXME: ROS Sends the wrong Object Type. The parsed object's type
* should be sent, not the parsed parent's.
*/
if (ObjectType == ExWindowStationObjectType)
if (Parameters->ObjectType == ExWindowStationObjectType)
{
/* Then call the desktop parse routine */
return IntDesktopObjectParse(Object,
ObjectType,
AccessState,
AccessMode,
Attributes,
FullPath,
return IntDesktopObjectParse(Parameters->ParseObject,
Parameters->ObjectType,
Parameters->AccessState,
Parameters->AccessMode,
Parameters->Attributes,
Parameters->CompleteName,
RemainingName,
Context,
SecurityQos,
NextObject);
Parameters->Context,
Parameters->SecurityQos,
Parameters->Object);
}
/* Should hopefully never get here */