Author: tkreuzer
Date: Tue Nov 19 23:09:13 2013
New Revision: 61052
URL:
http://svn.reactos.org/svn/reactos?rev=61052&view=rev
Log:
[NTOSKRNK]
Implement ExpWin32SessionCallout, which attaches to the session that the object (desktop
or window station) belongs to before invoking any callbacks. The session side of support
for this is currently hardcoded to support only a single session. To make this properly
work, all callbacks that go through this function have the same function pointer type now,
fix this in win32k accordingly.
Modified:
trunk/reactos/include/ndk/pstypes.h
trunk/reactos/ntoskrnl/ex/win32k.c
trunk/reactos/ntoskrnl/include/internal/mm.h
trunk/reactos/ntoskrnl/mm/ARM3/session.c
trunk/reactos/ntoskrnl/ps/win32.c
trunk/reactos/win32ss/user/ntuser/desktop.c
trunk/reactos/win32ss/user/ntuser/desktop.h
trunk/reactos/win32ss/user/ntuser/winsta.c
trunk/reactos/win32ss/user/ntuser/winsta.h
Modified: trunk/reactos/include/ndk/pstypes.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/pstypes.h?rev=…
==============================================================================
--- trunk/reactos/include/ndk/pstypes.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/pstypes.h [iso-8859-1] Tue Nov 19 23:09:13 2013
@@ -559,7 +559,7 @@
);
typedef
-VOID
+NTSTATUS
(NTAPI *PKWIN32_DELETEMETHOD_CALLOUT)(
_In_ struct _WIN32_DELETEMETHOD_PARAMETERS *Parameters
);
@@ -568,6 +568,12 @@
NTSTATUS
(NTAPI *PKWIN32_PARSEMETHOD_CALLOUT)(
_In_ struct _WIN32_PARSEMETHOD_PARAMETERS *Parameters
+);
+
+typedef
+NTSTATUS
+(NTAPI *PKWIN32_SESSION_CALLOUT)(
+ _In_ PVOID Parameter
);
typedef
@@ -1406,15 +1412,15 @@
PKWIN32_POWERSTATE_CALLOUT PowerStateCallout;
PKWIN32_JOB_CALLOUT JobCallout;
PGDI_BATCHFLUSH_ROUTINE BatchFlushRoutine;
- PKWIN32_OPENMETHOD_CALLOUT DesktopOpenProcedure;
- PKWIN32_OKTOCLOSEMETHOD_CALLOUT DesktopOkToCloseProcedure;
- PKWIN32_CLOSEMETHOD_CALLOUT DesktopCloseProcedure;
- PKWIN32_DELETEMETHOD_CALLOUT DesktopDeleteProcedure;
- PKWIN32_OKTOCLOSEMETHOD_CALLOUT WindowStationOkToCloseProcedure;
- PKWIN32_CLOSEMETHOD_CALLOUT WindowStationCloseProcedure;
- PKWIN32_DELETEMETHOD_CALLOUT WindowStationDeleteProcedure;
- PKWIN32_PARSEMETHOD_CALLOUT WindowStationParseProcedure;
- PKWIN32_OPENMETHOD_CALLOUT WindowStationOpenProcedure;
+ PKWIN32_SESSION_CALLOUT DesktopOpenProcedure;
+ PKWIN32_SESSION_CALLOUT DesktopOkToCloseProcedure;
+ PKWIN32_SESSION_CALLOUT DesktopCloseProcedure;
+ PKWIN32_SESSION_CALLOUT DesktopDeleteProcedure;
+ PKWIN32_SESSION_CALLOUT WindowStationOkToCloseProcedure;
+ PKWIN32_SESSION_CALLOUT WindowStationCloseProcedure;
+ PKWIN32_SESSION_CALLOUT WindowStationDeleteProcedure;
+ PKWIN32_SESSION_CALLOUT WindowStationParseProcedure;
+ PKWIN32_SESSION_CALLOUT WindowStationOpenProcedure;
PKWIN32_WIN32DATACOLLECTION_CALLOUT Win32DataCollectionProcedure;
} WIN32_CALLOUTS_FPNS, *PWIN32_CALLOUTS_FPNS;
Modified: trunk/reactos/ntoskrnl/ex/win32k.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/win32k.c?rev=6…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/win32k.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/win32k.c [iso-8859-1] Tue Nov 19 23:09:13 2013
@@ -14,6 +14,12 @@
#pragma alloc_text(INIT, ExpWin32kInit)
#endif
+typedef struct _WIN32_KERNEL_OBJECT_HEADER
+{
+ ULONG SessionId;
+} WIN32_KERNEL_OBJECT_HEADER, *PWIN32_KERNEL_OBJECT_HEADER;
+
+
/* DATA **********************************************************************/
POBJECT_TYPE ExWindowStationObjectType = NULL;
@@ -35,15 +41,76 @@
STANDARD_RIGHTS_REQUIRED
};
-PKWIN32_PARSEMETHOD_CALLOUT ExpWindowStationObjectParse = NULL;
-PKWIN32_DELETEMETHOD_CALLOUT ExpWindowStationObjectDelete = NULL;
-PKWIN32_OKTOCLOSEMETHOD_CALLOUT ExpWindowStationObjectOkToClose = NULL;
-PKWIN32_OKTOCLOSEMETHOD_CALLOUT ExpDesktopObjectOkToClose = NULL;
-PKWIN32_DELETEMETHOD_CALLOUT ExpDesktopObjectDelete = NULL;
-PKWIN32_OPENMETHOD_CALLOUT ExpDesktopObjectOpen = NULL;
-PKWIN32_CLOSEMETHOD_CALLOUT ExpDesktopObjectClose = NULL;
+PKWIN32_SESSION_CALLOUT ExpWindowStationObjectParse = NULL;
+PKWIN32_SESSION_CALLOUT ExpWindowStationObjectDelete = NULL;
+PKWIN32_SESSION_CALLOUT ExpWindowStationObjectOkToClose = NULL;
+PKWIN32_SESSION_CALLOUT ExpDesktopObjectOkToClose = NULL;
+PKWIN32_SESSION_CALLOUT ExpDesktopObjectDelete = NULL;
+PKWIN32_SESSION_CALLOUT ExpDesktopObjectOpen = NULL;
+PKWIN32_SESSION_CALLOUT ExpDesktopObjectClose = NULL;
/* FUNCTIONS ****************************************************************/
+
+NTSTATUS
+NTAPI
+ExpWin32SessionCallout(
+ _In_ PVOID Object,
+ _In_ PKWIN32_SESSION_CALLOUT CalloutProcedure,
+ _Inout_opt_ PVOID Parameter)
+{
+ PWIN32_KERNEL_OBJECT_HEADER Win32ObjectHeader;
+ PVOID SessionEntry = NULL;
+ KAPC_STATE ApcState;
+ NTSTATUS Status;
+
+ /* The objects have a common header. And the kernel accesses it!
+ Thanks MS for this kind of retarded "design"! */
+ Win32ObjectHeader = Object;
+
+ /* Check if we are not already in the correct session */
+ if (!PsGetCurrentProcess()->ProcessInSession ||
+ (PsGetCurrentProcessSessionId() != Win32ObjectHeader->SessionId))
+ {
+ /* Get the session from the objects session Id */
+ DPRINT1("SessionId == %d\n", Win32ObjectHeader->SessionId);
+ SessionEntry = MmGetSessionById(Win32ObjectHeader->SessionId);
+ if (SessionEntry == NULL)
+ {
+ /* The requested session does not even exist! */
+ NT_ASSERT(FALSE);
+ return STATUS_NOT_FOUND;
+ }
+
+ /* Attach to the session */
+ Status = MmAttachSession(SessionEntry, &ApcState);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("Could not attach to 0x%p, object %p, callout 0x%p\n",
+ SessionEntry,
+ Win32ObjectHeader,
+ CalloutProcedure);
+
+ /* Cleanup and return */
+ MmQuitNextSession(SessionEntry);
+ NT_ASSERT(FALSE);
+ return Status;
+ }
+ }
+
+ /* Call the callout routine */
+ Status = CalloutProcedure(Parameter);
+
+ /* Check if we have a session */
+ if (SessionEntry != NULL)
+ {
+ /* Detach from the session and quit using it */
+ MmDetachSession(SessionEntry, &ApcState);
+ MmQuitNextSession(SessionEntry);
+ }
+
+ /* Return the callback status */
+ return Status;
+}
BOOLEAN
NTAPI
@@ -53,13 +120,18 @@
IN KPROCESSOR_MODE AccessMode)
{
WIN32_OKAYTOCLOSEMETHOD_PARAMETERS Parameters;
+ NTSTATUS Status;
Parameters.Process = Process;
Parameters.Object = Object;
Parameters.Handle = Handle;
Parameters.PreviousMode = AccessMode;
- return NT_SUCCESS(ExpDesktopObjectOkToClose(&Parameters));
+ Status = ExpWin32SessionCallout(Object,
+ ExpDesktopObjectOkToClose,
+ &Parameters);
+
+ return NT_SUCCESS(Status);
}
BOOLEAN
@@ -70,13 +142,18 @@
IN KPROCESSOR_MODE AccessMode)
{
WIN32_OKAYTOCLOSEMETHOD_PARAMETERS Parameters;
+ NTSTATUS Status;
Parameters.Process = Process;
Parameters.Object = Object;
Parameters.Handle = Handle;
Parameters.PreviousMode = AccessMode;
- return NT_SUCCESS(ExpWindowStationObjectOkToClose(&Parameters));
+ Status = ExpWin32SessionCallout(Object,
+ ExpWindowStationObjectOkToClose,
+ &Parameters);
+
+ return NT_SUCCESS(Status);
}
VOID
@@ -88,8 +165,9 @@
/* Fill out the callback structure */
Parameters.Object = DeletedObject;
- /* Call the Registered Callback */
- ExpWindowStationObjectDelete(&Parameters);
+ ExpWin32SessionCallout(DeletedObject,
+ ExpWindowStationObjectDelete,
+ &Parameters);
}
NTSTATUS
@@ -119,8 +197,9 @@
Parameters.SecurityQos = SecurityQos;
Parameters.Object = Object;
- /* Call the Registered Callback */
- return ExpWindowStationObjectParse(&Parameters);
+ return ExpWin32SessionCallout(ParseObject,
+ ExpWindowStationObjectParse,
+ &Parameters);
}
VOID
NTAPI
@@ -131,12 +210,13 @@
/* Fill out the callback structure */
Parameters.Object = DeletedObject;
- /* Call the Registered Callback */
- ExpDesktopObjectDelete(&Parameters);
+ ExpWin32SessionCallout(DeletedObject,
+ ExpDesktopObjectDelete,
+ &Parameters);
}
NTSTATUS
-NTAPI
+NTAPI
ExpDesktopOpen(IN OB_OPEN_REASON Reason,
IN PEPROCESS Process OPTIONAL,
IN PVOID ObjectBody,
@@ -151,11 +231,13 @@
Parameters.GrantedAccess = GrantedAccess;
Parameters.HandleCount = HandleCount;
- return ExpDesktopObjectOpen(&Parameters);
+ return ExpWin32SessionCallout(ObjectBody,
+ ExpDesktopObjectOpen,
+ &Parameters);
}
VOID
-NTAPI
+NTAPI
ExpDesktopClose(IN PEPROCESS Process OPTIONAL,
IN PVOID Object,
IN ACCESS_MASK GrantedAccess,
@@ -170,7 +252,9 @@
Parameters.ProcessHandleCount = ProcessHandleCount;
Parameters.SystemHandleCount = SystemHandleCount;
- ExpDesktopObjectClose(&Parameters);
+ ExpWin32SessionCallout(Object,
+ ExpDesktopObjectClose,
+ &Parameters);
}
BOOLEAN
@@ -202,7 +286,7 @@
NULL,
&ExWindowStationObjectType);
if (!NT_SUCCESS(Status)) return FALSE;
-
+
/* Create desktop object type */
RtlInitUnicodeString(&Name, L"Desktop");
ObjectTypeInitializer.GenericMapping = ExpDesktopMapping;
@@ -216,7 +300,7 @@
NULL,
&ExDesktopObjectType);
if (!NT_SUCCESS(Status)) return FALSE;
-
+
return TRUE;
}
Modified: trunk/reactos/ntoskrnl/include/internal/mm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] Tue Nov 19 23:09:13 2013
@@ -1770,3 +1770,31 @@
PVOID P,
POOL_TYPE PoolType,
ULONG Tag);
+
+
+/* session.c *****************************************************************/
+
+_IRQL_requires_max_(APC_LEVEL)
+NTSTATUS
+NTAPI
+MmAttachSession(
+ _Inout_ PVOID SessionEntry,
+ _Out_ PKAPC_STATE ApcState);
+
+_IRQL_requires_max_(APC_LEVEL)
+VOID
+NTAPI
+MmDetachSession(
+ _Inout_ PVOID SessionEntry,
+ _Out_ PKAPC_STATE ApcState);
+
+VOID
+NTAPI
+MmQuitNextSession(
+ _Inout_ PVOID SessionEntry);
+
+PVOID
+NTAPI
+MmGetSessionById(
+ _In_ ULONG SessionId);
+
Modified: trunk/reactos/ntoskrnl/mm/ARM3/session.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/session.c…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/session.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/session.c [iso-8859-1] Tue Nov 19 23:09:13 2013
@@ -24,6 +24,9 @@
LONG MmSessionDataPages;
PRTL_BITMAP MiSessionIdBitmap;
volatile LONG MiSessionLeaderExists;
+
+// HACK: we support only one process. The creator is CSRSS and that lives!
+PEPROCESS Session0CreatorProcess;
/* PRIVATE FUNCTIONS **********************************************************/
@@ -607,6 +610,10 @@
ASSERT(SessionGlobal->ProcessReferenceToSession == 0);
SessionGlobal->ProcessReferenceToSession = 1;
+ // HACK: we only support 1 session and save the creator process
+ NT_ASSERT(Session0CreatorProcess == NULL);
+ Session0CreatorProcess = PsGetCurrentProcess();
+
/* We're done */
InterlockedIncrement(&MmSessionDataPages);
return STATUS_SUCCESS;
@@ -700,3 +707,74 @@
/* All done */
return STATUS_SUCCESS;
}
+
+_IRQL_requires_max_(APC_LEVEL)
+NTSTATUS
+NTAPI
+MmAttachSession(
+ _Inout_ PVOID SessionEntry,
+ _Out_ PKAPC_STATE ApcState)
+{
+ PEPROCESS EntryProcess;
+
+ /* The parameter is the actual process! */
+ EntryProcess = SessionEntry;
+ NT_ASSERT(EntryProcess != NULL);
+
+ /* HACK: for now we only support 1 session! */
+ NT_ASSERT(((PMM_SESSION_SPACE)EntryProcess->Session)->SessionId == 1);
+
+ /* Very simple for now: just attach to the process we have */
+ KeStackAttachProcess(&EntryProcess->Pcb, ApcState);
+ return STATUS_SUCCESS;
+}
+
+_IRQL_requires_max_(APC_LEVEL)
+VOID
+NTAPI
+MmDetachSession(
+ _Inout_ PVOID SessionEntry,
+ _In_ PKAPC_STATE ApcState)
+{
+ PEPROCESS EntryProcess;
+
+ /* The parameter is the actual process! */
+ EntryProcess = SessionEntry;
+ NT_ASSERT(EntryProcess != NULL);
+
+ /* HACK: for now we only support 1 session! */
+ NT_ASSERT(((PMM_SESSION_SPACE)EntryProcess->Session)->SessionId == 0);
+
+ /* Very simple for now: just detach */
+ KeUnstackDetachProcess(ApcState);
+}
+
+VOID
+NTAPI
+MmQuitNextSession(
+ _Inout_ PVOID SessionEntry)
+{
+ PEPROCESS EntryProcess;
+
+ /* The parameter is the actual process! */
+ EntryProcess = SessionEntry;
+ NT_ASSERT(EntryProcess != NULL);
+
+ /* HACK: for now we only support 1 session! */
+ NT_ASSERT(((PMM_SESSION_SPACE)EntryProcess->Session)->SessionId == 0);
+
+ /* Get rid of the reference we got */
+ ObDereferenceObject(SessionEntry);
+}
+
+PVOID
+NTAPI
+MmGetSessionById(
+ _In_ ULONG SessionId)
+{
+ /* HACK: for now we only support 1 session! */
+ NT_ASSERT(SessionId == 0);
+
+ /* Just return the sessions creator process, which is csrss and still alive. */
+ return Session0CreatorProcess;
+}
Modified: trunk/reactos/ntoskrnl/ps/win32.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/win32.c?rev=61…
==============================================================================
--- trunk/reactos/ntoskrnl/ps/win32.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ps/win32.c [iso-8859-1] Tue Nov 19 23:09:13 2013
@@ -18,13 +18,13 @@
PKWIN32_PROCESS_CALLOUT PspW32ProcessCallout = NULL;
PKWIN32_THREAD_CALLOUT PspW32ThreadCallout = NULL;
PGDI_BATCHFLUSH_ROUTINE KeGdiFlushUserBatch = NULL;
-extern PKWIN32_PARSEMETHOD_CALLOUT ExpWindowStationObjectParse;
-extern PKWIN32_DELETEMETHOD_CALLOUT ExpWindowStationObjectDelete;
-extern PKWIN32_OKTOCLOSEMETHOD_CALLOUT ExpWindowStationObjectOkToClose;
-extern PKWIN32_OKTOCLOSEMETHOD_CALLOUT ExpDesktopObjectOkToClose;
-extern PKWIN32_DELETEMETHOD_CALLOUT ExpDesktopObjectDelete;
-extern PKWIN32_OPENMETHOD_CALLOUT ExpDesktopObjectOpen;
-extern PKWIN32_CLOSEMETHOD_CALLOUT ExpDesktopObjectClose;
+extern PKWIN32_SESSION_CALLOUT ExpWindowStationObjectParse;
+extern PKWIN32_SESSION_CALLOUT ExpWindowStationObjectDelete;
+extern PKWIN32_SESSION_CALLOUT ExpWindowStationObjectOkToClose;
+extern PKWIN32_SESSION_CALLOUT ExpDesktopObjectOkToClose;
+extern PKWIN32_SESSION_CALLOUT ExpDesktopObjectDelete;
+extern PKWIN32_SESSION_CALLOUT ExpDesktopObjectOpen;
+extern PKWIN32_SESSION_CALLOUT ExpDesktopObjectClose;
extern PKWIN32_POWEREVENT_CALLOUT PopEventCallout;
/* PRIVATE FUNCTIONS *********************************************************/
Modified: trunk/reactos/win32ss/user/ntuser/desktop.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/deskto…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/desktop.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/desktop.c [iso-8859-1] Tue Nov 19 23:09:13 2013
@@ -138,10 +138,13 @@
return STATUS_SUCCESS;
}
-VOID APIENTRY
-IntDesktopObjectDelete(PWIN32_DELETEMETHOD_PARAMETERS Parameters)
-{
- PDESKTOP pdesk = (PDESKTOP)Parameters->Object;
+NTSTATUS
+NTAPI
+IntDesktopObjectDelete(
+ _In_ PVOID Parameters)
+{
+ PWIN32_DELETEMETHOD_PARAMETERS DeleteParameters = Parameters;
+ PDESKTOP pdesk = (PDESKTOP)DeleteParameters->Object;
TRACE("Deleting desktop object 0x%p\n", pdesk);
@@ -158,11 +161,15 @@
/* Free the heap */
IntFreeDesktopHeap(pdesk);
-}
-
-NTSTATUS NTAPI
-IntDesktopOkToClose(PWIN32_OKAYTOCLOSEMETHOD_PARAMETERS Parameters)
-{
+ return STATUS_SUCCESS;
+}
+
+NTSTATUS
+NTAPI
+IntDesktopOkToClose(
+ _In_ PVOID Parameters)
+{
+ PWIN32_OKAYTOCLOSEMETHOD_PARAMETERS OkToCloseParameters = Parameters;
PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
if( pti == NULL)
@@ -172,8 +179,8 @@
}
/* Do not allow the current desktop or the initial desktop to be closed */
- if( Parameters->Handle == pti->ppi->hdeskStartup ||
- Parameters->Handle == pti->hdesk)
+ if( OkToCloseParameters->Handle == pti->ppi->hdeskStartup ||
+ OkToCloseParameters->Handle == pti->hdesk)
{
return STATUS_ACCESS_DENIED;
}
@@ -181,18 +188,26 @@
return STATUS_SUCCESS;
}
-NTSTATUS NTAPI IntDesktopObjectOpen(PWIN32_OPENMETHOD_PARAMETERS Parameters)
-{
- PPROCESSINFO ppi = PsGetProcessWin32Process(Parameters->Process);
+NTSTATUS
+NTAPI
+IntDesktopObjectOpen(
+ _In_ PVOID Parameters)
+{
+ PWIN32_OPENMETHOD_PARAMETERS OpenParameters = Parameters;
+ PPROCESSINFO ppi = PsGetProcessWin32Process(OpenParameters->Process);
if (ppi == NULL)
return STATUS_SUCCESS;
- return IntMapDesktopView((PDESKTOP)Parameters->Object);
-}
-
-NTSTATUS NTAPI IntDesktopObjectClose(PWIN32_CLOSEMETHOD_PARAMETERS Parameters)
-{
- PPROCESSINFO ppi = PsGetProcessWin32Process(Parameters->Process);
+ return IntMapDesktopView((PDESKTOP)OpenParameters->Object);
+}
+
+NTSTATUS
+NTAPI
+IntDesktopObjectClose(
+ _In_ PVOID Parameters)
+{
+ PWIN32_CLOSEMETHOD_PARAMETERS CloseParameters = Parameters;
+ PPROCESSINFO ppi = PsGetProcessWin32Process(CloseParameters->Process);
if (ppi == NULL)
{
/* This happens when the process leaks desktop handles.
@@ -200,7 +215,7 @@
return STATUS_SUCCESS;
}
- return IntUnmapDesktopView((PDESKTOP)Parameters->Object);
+ return IntUnmapDesktopView((PDESKTOP)CloseParameters->Object);
}
@@ -1341,6 +1356,7 @@
RETURN(NULL);
}
+ pdesk->dwSessionId = PsGetCurrentProcessSessionId();
pdesk->DesktopWindow = pWnd->head.h;
pdesk->pDeskInfo->spwnd = pWnd;
pWnd->fnid = FNID_DESKTOP;
@@ -1638,7 +1654,7 @@
if (PsGetCurrentProcessSessionId() != pdesk->rpwinstaParent->dwSessionId)
{
ERR("NtUserSwitchDesktop called for a desktop of a different
session\n");
- RETURN(FALSE);
+ RETURN(FALSE);
}
if(pdesk == gpdeskInputDesktop)
Modified: trunk/reactos/win32ss/user/ntuser/desktop.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/deskto…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/desktop.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/desktop.h [iso-8859-1] Tue Nov 19 23:09:13 2013
@@ -2,6 +2,9 @@
typedef struct _DESKTOP
{
+ /* Must be the first member */
+ DWORD dwSessionId;
+
PDESKTOPINFO pDeskInfo;
LIST_ENTRY ListEntry;
/* Pointer to the associated window station. */
@@ -99,17 +102,25 @@
IN PSECURITY_QUALITY_OF_SERVICE SecurityQos OPTIONAL,
OUT PVOID *Object);
-VOID APIENTRY
-IntDesktopObjectDelete(PWIN32_DELETEMETHOD_PARAMETERS Parameters);
-
-NTSTATUS NTAPI
-IntDesktopOkToClose(PWIN32_OKAYTOCLOSEMETHOD_PARAMETERS Parameters);
-
-NTSTATUS NTAPI
-IntDesktopObjectOpen(PWIN32_OPENMETHOD_PARAMETERS Parameters);
-
-NTSTATUS NTAPI
-IntDesktopObjectClose(PWIN32_CLOSEMETHOD_PARAMETERS Parameters);
+NTSTATUS
+NTAPI
+IntDesktopObjectDelete(
+ _In_ PVOID Parameters);
+
+NTSTATUS
+NTAPI
+IntDesktopOkToClose(
+ _In_ PVOID Parameters);
+
+NTSTATUS
+NTAPI
+IntDesktopObjectOpen(
+ _In_ PVOID Parameters);
+
+NTSTATUS
+NTAPI
+IntDesktopObjectClose(
+ _In_ PVOID Parameters);
HDC FASTCALL
IntGetScreenDC(VOID);
Modified: trunk/reactos/win32ss/user/ntuser/winsta.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/winsta…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/winsta.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/winsta.c [iso-8859-1] Tue Nov 19 23:09:13 2013
@@ -95,42 +95,49 @@
/* OBJECT CALLBACKS **********************************************************/
-VOID APIENTRY
-IntWinStaObjectDelete(PWIN32_DELETEMETHOD_PARAMETERS Parameters)
-{
- PWINSTATION_OBJECT WinSta = (PWINSTATION_OBJECT)Parameters->Object;
-
- TRACE("Deleting window station (0x%p)\n", WinSta);
-
- UserEmptyClipboardData(WinSta);
-
- RtlDestroyAtomTable(WinSta->AtomTable);
-
- RtlFreeUnicodeString(&WinSta->Name);
-}
-
NTSTATUS
APIENTRY
-IntWinStaObjectParse(PWIN32_PARSEMETHOD_PARAMETERS Parameters)
-{
- PUNICODE_STRING RemainingName = Parameters->RemainingName;
+IntWinStaObjectDelete(
+ _In_ PVOID Parameters)
+{
+ PWIN32_DELETEMETHOD_PARAMETERS DeleteParameters = Parameters;
+ PWINSTATION_OBJECT WinSta = (PWINSTATION_OBJECT)DeleteParameters->Object;
+
+ TRACE("Deleting window station (0x%p)\n", WinSta);
+
+ UserEmptyClipboardData(WinSta);
+
+ RtlDestroyAtomTable(WinSta->AtomTable);
+
+ RtlFreeUnicodeString(&WinSta->Name);
+
+ return STATUS_SUCCESS;
+}
+
+NTSTATUS
+APIENTRY
+IntWinStaObjectParse(
+ _In_ PVOID Parameters)
+{
+ PWIN32_PARSEMETHOD_PARAMETERS ParseParameters = Parameters;
+ PUNICODE_STRING RemainingName = ParseParameters->RemainingName;
/* Assume we don't find anything */
- *Parameters->Object = NULL;
+ *ParseParameters->Object = NULL;
/* Check for an empty name */
if (!RemainingName->Length)
{
/* Make sure this is a window station, can't parse a desktop now */
- if (Parameters->ObjectType != ExWindowStationObjectType)
+ if (ParseParameters->ObjectType != ExWindowStationObjectType)
{
/* Fail */
return STATUS_OBJECT_TYPE_MISMATCH;
}
/* Reference the window station and return */
- ObReferenceObject(Parameters->ParseObject);
- *Parameters->Object = Parameters->ParseObject;
+ ObReferenceObject(ParseParameters->ParseObject);
+ *ParseParameters->Object = ParseParameters->ParseObject;
return STATUS_SUCCESS;
}
@@ -153,19 +160,19 @@
/*
* Check if we are parsing a desktop.
*/
- if (Parameters->ObjectType == ExDesktopObjectType)
+ if (ParseParameters->ObjectType == ExDesktopObjectType)
{
/* Then call the desktop parse routine */
- return IntDesktopObjectParse(Parameters->ParseObject,
- Parameters->ObjectType,
- Parameters->AccessState,
- Parameters->AccessMode,
- Parameters->Attributes,
- Parameters->CompleteName,
+ return IntDesktopObjectParse(ParseParameters->ParseObject,
+ ParseParameters->ObjectType,
+ ParseParameters->AccessState,
+ ParseParameters->AccessMode,
+ ParseParameters->Attributes,
+ ParseParameters->CompleteName,
RemainingName,
- Parameters->Context,
- Parameters->SecurityQos,
- Parameters->Object);
+ ParseParameters->Context,
+ ParseParameters->SecurityQos,
+ ParseParameters->Object);
}
/* Should hopefully never get here */
@@ -174,13 +181,15 @@
NTSTATUS
NTAPI
-IntWinstaOkToClose(PWIN32_OKAYTOCLOSEMETHOD_PARAMETERS Parameters)
-{
+IntWinstaOkToClose(
+ _In_ PVOID Parameters)
+{
+ PWIN32_OKAYTOCLOSEMETHOD_PARAMETERS OkToCloseParameters = Parameters;
PPROCESSINFO ppi;
ppi = PsGetCurrentProcessWin32Process();
- if(ppi && (Parameters->Handle == ppi->hwinsta))
+ if(ppi && (OkToCloseParameters->Handle == ppi->hwinsta))
{
return STATUS_ACCESS_DENIED;
}
Modified: trunk/reactos/win32ss/user/ntuser/winsta.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/winsta…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/winsta.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/winsta.h [iso-8859-1] Tue Nov 19 23:09:13 2013
@@ -71,18 +71,34 @@
NTSTATUS
NTAPI
InitWindowStationImpl(VOID);
-NTSTATUS NTAPI UserCreateWinstaDirectory();
-VOID APIENTRY IntWinStaObjectDelete(PWIN32_DELETEMETHOD_PARAMETERS Parameters);
-NTSTATUS APIENTRY IntWinStaObjectParse(PWIN32_PARSEMETHOD_PARAMETERS Parameters);
-NTSTATUS NTAPI IntWinstaOkToClose(PWIN32_OKAYTOCLOSEMETHOD_PARAMETERS Parameters);
+NTSTATUS
+NTAPI
+UserCreateWinstaDirectory();
-NTSTATUS FASTCALL
+NTSTATUS
+APIENTRY
+IntWinStaObjectDelete(
+ _In_ PVOID Parameters);
+
+NTSTATUS
+APIENTRY
+IntWinStaObjectParse(
+ _In_ PVOID Parameters);
+
+NTSTATUS
+NTAPI
+IntWinstaOkToClose(
+ _In_ PVOID Parameters);
+
+NTSTATUS
+FASTCALL
IntValidateWindowStationHandle(
HWINSTA WindowStation,
KPROCESSOR_MODE AccessMode,
ACCESS_MASK DesiredAccess,
PWINSTATION_OBJECT *Object);
+
BOOL FASTCALL UserSetProcessWindowStation(HWINSTA hWindowStation);
BOOL FASTCALL co_IntInitializeDesktopGraphics(VOID);