mirror of
https://github.com/reactos/reactos.git
synced 2025-08-07 01:43:02 +00:00
[win32k]
- Fix and simplify retrieving the current process window station. All processes that enter win32k have a window station (including csrss) svn path=/trunk/; revision=54124
This commit is contained in:
parent
1f28d5c2e2
commit
b4721b55d7
1 changed files with 15 additions and 55 deletions
|
@ -242,7 +242,7 @@ IntValidateWindowStationHandle(
|
||||||
|
|
||||||
if (WindowStation == NULL)
|
if (WindowStation == NULL)
|
||||||
{
|
{
|
||||||
// ERR("Invalid window station handle\n");
|
WARN("Invalid window station handle\n");
|
||||||
EngSetLastError(ERROR_INVALID_HANDLE);
|
EngSetLastError(ERROR_INVALID_HANDLE);
|
||||||
return STATUS_INVALID_HANDLE;
|
return STATUS_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
@ -802,34 +802,11 @@ NtUserSetObjectInformation(
|
||||||
HWINSTA FASTCALL
|
HWINSTA FASTCALL
|
||||||
UserGetProcessWindowStation(VOID)
|
UserGetProcessWindowStation(VOID)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
PPROCESSINFO ppi = PsGetCurrentProcessWin32Process();
|
||||||
PTHREADINFO pti;
|
|
||||||
HWINSTA WinSta;
|
|
||||||
|
|
||||||
if(PsGetCurrentProcess() != CsrProcess)
|
//ASSERT(ppi->hwinsta);
|
||||||
{
|
|
||||||
return PsGetCurrentProcess()->Win32WindowStation;
|
return ppi->hwinsta;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ERR("Should use ObFindHandleForObject\n");
|
|
||||||
pti = PsGetCurrentThreadWin32Thread();
|
|
||||||
Status = ObOpenObjectByPointer(pti->rpdesk->rpwinstaParent,
|
|
||||||
0,
|
|
||||||
NULL,
|
|
||||||
WINSTA_ALL_ACCESS,
|
|
||||||
ExWindowStationObjectType,
|
|
||||||
UserMode,
|
|
||||||
(PHANDLE) &WinSta);
|
|
||||||
if (! NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
SetLastNtError(Status);
|
|
||||||
ERR("Unable to open handle for CSRSSs winsta, status 0x%08x\n",
|
|
||||||
Status);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return WinSta;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -856,36 +833,19 @@ NtUserGetProcessWindowStation(VOID)
|
||||||
PWINSTATION_OBJECT FASTCALL
|
PWINSTATION_OBJECT FASTCALL
|
||||||
IntGetWinStaObj(VOID)
|
IntGetWinStaObj(VOID)
|
||||||
{
|
{
|
||||||
PWINSTATION_OBJECT WinStaObj;
|
PWINSTATION_OBJECT WinStaObj;
|
||||||
PTHREADINFO Win32Thread;
|
NTSTATUS Status;
|
||||||
PEPROCESS CurrentProcess;
|
|
||||||
|
|
||||||
/*
|
Status = IntValidateWindowStationHandle(
|
||||||
* just a temporary hack, this will be gone soon
|
UserGetProcessWindowStation(),
|
||||||
*/
|
|
||||||
|
|
||||||
Win32Thread = PsGetCurrentThreadWin32Thread();
|
|
||||||
if(Win32Thread != NULL && Win32Thread->rpdesk != NULL)
|
|
||||||
{
|
|
||||||
WinStaObj = Win32Thread->rpdesk->rpwinstaParent;
|
|
||||||
ObReferenceObjectByPointer(WinStaObj, KernelMode, ExWindowStationObjectType, 0);
|
|
||||||
}
|
|
||||||
else if((CurrentProcess = PsGetCurrentProcess()) != CsrProcess)
|
|
||||||
{
|
|
||||||
NTSTATUS Status = IntValidateWindowStationHandle(CurrentProcess->Win32WindowStation,
|
|
||||||
KernelMode,
|
KernelMode,
|
||||||
0,
|
0,
|
||||||
&WinStaObj);
|
&WinStaObj);
|
||||||
if(!NT_SUCCESS(Status))
|
if(!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
WinStaObj = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return WinStaObj;
|
return WinStaObj;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue