mirror of
https://github.com/reactos/reactos.git
synced 2024-11-04 22:00:55 +00:00
[WIN32K]: Use the logon process ID instead of a full win32k process object, it simplifies code in some parts.
svn path=/trunk/; revision=65465
This commit is contained in:
parent
72074af697
commit
60205c7b0b
5 changed files with 34 additions and 36 deletions
|
@ -1701,7 +1701,7 @@ NtUserSwitchDesktop(HDESK hdesk)
|
||||||
* is the logon application itself
|
* is the logon application itself
|
||||||
*/
|
*/
|
||||||
if((pdesk->rpwinstaParent->Flags & WSS_LOCKED) &&
|
if((pdesk->rpwinstaParent->Flags & WSS_LOCKED) &&
|
||||||
LogonProcess != PsGetCurrentProcessWin32Process())
|
gpidLogon != PsGetCurrentProcessId())
|
||||||
{
|
{
|
||||||
ObDereferenceObject(pdesk);
|
ObDereferenceObject(pdesk);
|
||||||
ERR("Switching desktop 0x%p denied because the window station is locked!\n", hdesk);
|
ERR("Switching desktop 0x%p denied because the window station is locked!\n", hdesk);
|
||||||
|
|
|
@ -213,10 +213,8 @@ DestroyProcessInfo(PEPROCESS Process)
|
||||||
/*
|
/*
|
||||||
* Deregister logon application automatically
|
* Deregister logon application automatically
|
||||||
*/
|
*/
|
||||||
if(LogonProcess == ppiCurrent)
|
if (gpidLogon == ppiCurrent->peProcess->UniqueProcessId)
|
||||||
{
|
gpidLogon = 0;
|
||||||
LogonProcess = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Close the current window station */
|
/* Close the current window station */
|
||||||
UserSetProcessWindowStation(NULL);
|
UserSetProcessWindowStation(NULL);
|
||||||
|
@ -409,7 +407,7 @@ UserCreateThreadInfo(struct _ETHREAD *Thread)
|
||||||
|
|
||||||
/* Assign a default window station and desktop to the process */
|
/* Assign a default window station and desktop to the process */
|
||||||
/* Do not try to open a desktop or window station before winlogon initializes */
|
/* Do not try to open a desktop or window station before winlogon initializes */
|
||||||
if(ptiCurrent->ppi->hdeskStartup == NULL && LogonProcess != NULL)
|
if (ptiCurrent->ppi->hdeskStartup == NULL && gpidLogon != 0)
|
||||||
{
|
{
|
||||||
HWINSTA hWinSta = NULL;
|
HWINSTA hWinSta = NULL;
|
||||||
HDESK hDesk = NULL;
|
HDESK hDesk = NULL;
|
||||||
|
@ -749,17 +747,23 @@ DriverEntry(
|
||||||
/* Register Object Manager Callbacks */
|
/* Register Object Manager Callbacks */
|
||||||
CalloutData.ProcessCallout = Win32kProcessCallback;
|
CalloutData.ProcessCallout = Win32kProcessCallback;
|
||||||
CalloutData.ThreadCallout = Win32kThreadCallback;
|
CalloutData.ThreadCallout = Win32kThreadCallback;
|
||||||
CalloutData.WindowStationParseProcedure = IntWinStaObjectParse;
|
// CalloutData.GlobalAtomTableCallout = NULL;
|
||||||
CalloutData.WindowStationDeleteProcedure = IntWinStaObjectDelete;
|
// CalloutData.PowerEventCallout = NULL;
|
||||||
CalloutData.WindowStationOkToCloseProcedure = IntWinstaOkToClose;
|
// CalloutData.PowerStateCallout = NULL;
|
||||||
CalloutData.DesktopOkToCloseProcedure = IntDesktopOkToClose;
|
// CalloutData.JobCallout = NULL;
|
||||||
CalloutData.DesktopDeleteProcedure = IntDesktopObjectDelete;
|
|
||||||
CalloutData.DesktopCloseProcedure = IntDesktopObjectClose;
|
|
||||||
CalloutData.DesktopOpenProcedure = IntDesktopObjectOpen;
|
|
||||||
CalloutData.BatchFlushRoutine = NtGdiFlushUserBatch;
|
CalloutData.BatchFlushRoutine = NtGdiFlushUserBatch;
|
||||||
|
CalloutData.DesktopOpenProcedure = IntDesktopObjectOpen;
|
||||||
|
CalloutData.DesktopOkToCloseProcedure = IntDesktopOkToClose;
|
||||||
|
CalloutData.DesktopCloseProcedure = IntDesktopObjectClose;
|
||||||
|
CalloutData.DesktopDeleteProcedure = IntDesktopObjectDelete;
|
||||||
|
CalloutData.WindowStationOkToCloseProcedure = IntWinstaOkToClose;
|
||||||
|
// CalloutData.WindowStationCloseProcedure = NULL;
|
||||||
|
CalloutData.WindowStationDeleteProcedure = IntWinStaObjectDelete;
|
||||||
|
CalloutData.WindowStationParseProcedure = IntWinStaObjectParse;
|
||||||
|
// CalloutData.WindowStationOpenProcedure = NULL;
|
||||||
|
|
||||||
/* Register our per-process and per-thread structures. */
|
/* Register our per-process and per-thread structures. */
|
||||||
PsEstablishWin32Callouts((PWIN32_CALLOUTS_FPNS)&CalloutData);
|
PsEstablishWin32Callouts(&CalloutData);
|
||||||
|
|
||||||
/* Register service hook callbacks */
|
/* Register service hook callbacks */
|
||||||
#if DBG
|
#if DBG
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
|
|
||||||
DBG_DEFAULT_CHANNEL(UserMisc);
|
DBG_DEFAULT_CHANNEL(UserMisc);
|
||||||
|
|
||||||
/* registered Logon process */
|
/* Registered logon process ID */
|
||||||
PPROCESSINFO LogonProcess = NULL;
|
HANDLE gpidLogon = 0;
|
||||||
|
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
co_IntRegisterLogonProcess(HANDLE ProcessId, BOOL Register)
|
co_IntRegisterLogonProcess(HANDLE ProcessId, BOOL Register)
|
||||||
|
@ -21,39 +21,34 @@ co_IntRegisterLogonProcess(HANDLE ProcessId, BOOL Register)
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PEPROCESS Process;
|
PEPROCESS Process;
|
||||||
|
|
||||||
Status = PsLookupProcessByProcessId(ProcessId,
|
Status = PsLookupProcessByProcessId(ProcessId, &Process);
|
||||||
&Process);
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
EngSetLastError(RtlNtStatusToDosError(Status));
|
EngSetLastError(RtlNtStatusToDosError(Status));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProcessId = Process->UniqueProcessId;
|
||||||
|
|
||||||
|
ObDereferenceObject(Process);
|
||||||
|
|
||||||
if (Register)
|
if (Register)
|
||||||
{
|
{
|
||||||
/* Register the logon process */
|
/* Register the logon process */
|
||||||
if (LogonProcess != NULL)
|
if (gpidLogon != 0)
|
||||||
{
|
|
||||||
ObDereferenceObject(Process);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
LogonProcess = (PPROCESSINFO)Process->Win32Process;
|
gpidLogon = ProcessId;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Deregister the logon process */
|
/* Deregister the logon process */
|
||||||
if (LogonProcess != (PPROCESSINFO)Process->Win32Process)
|
if (gpidLogon != ProcessId)
|
||||||
{
|
|
||||||
ObDereferenceObject(Process);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
LogonProcess = NULL;
|
gpidLogon = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObDereferenceObject(Process);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -451,7 +446,6 @@ NtUserCallTwoParam(
|
||||||
STUB
|
STUB
|
||||||
RETURN( 0);
|
RETURN( 0);
|
||||||
|
|
||||||
|
|
||||||
case TWOPARAM_ROUTINE_SETCARETPOS:
|
case TWOPARAM_ROUTINE_SETCARETPOS:
|
||||||
RETURN( (DWORD_PTR)co_IntSetCaretPos((int)Param1, (int)Param2));
|
RETURN( (DWORD_PTR)co_IntSetCaretPos((int)Param1, (int)Param2));
|
||||||
|
|
||||||
|
|
|
@ -947,7 +947,7 @@ NtUserLockWindowStation(HWINSTA hWindowStation)
|
||||||
TRACE("About to set process window station with handle (%p)\n",
|
TRACE("About to set process window station with handle (%p)\n",
|
||||||
hWindowStation);
|
hWindowStation);
|
||||||
|
|
||||||
if(PsGetCurrentProcessWin32Process() != LogonProcess)
|
if (gpidLogon != PsGetCurrentProcessId())
|
||||||
{
|
{
|
||||||
ERR("Unauthorized process attempted to lock the window station!\n");
|
ERR("Unauthorized process attempted to lock the window station!\n");
|
||||||
EngSetLastError(ERROR_ACCESS_DENIED);
|
EngSetLastError(ERROR_ACCESS_DENIED);
|
||||||
|
@ -992,7 +992,7 @@ NtUserUnlockWindowStation(HWINSTA hWindowStation)
|
||||||
TRACE("About to set process window station with handle (%p)\n",
|
TRACE("About to set process window station with handle (%p)\n",
|
||||||
hWindowStation);
|
hWindowStation);
|
||||||
|
|
||||||
if(PsGetCurrentProcessWin32Process() != LogonProcess)
|
if (gpidLogon != PsGetCurrentProcessId())
|
||||||
{
|
{
|
||||||
ERR("Unauthorized process attempted to unlock the window station!\n");
|
ERR("Unauthorized process attempted to unlock the window station!\n");
|
||||||
EngSetLastError(ERROR_ACCESS_DENIED);
|
EngSetLastError(ERROR_ACCESS_DENIED);
|
||||||
|
@ -1338,12 +1338,12 @@ NtUserBuildNameList(
|
||||||
BOOL APIENTRY
|
BOOL APIENTRY
|
||||||
NtUserSetLogonNotifyWindow(HWND hWnd)
|
NtUserSetLogonNotifyWindow(HWND hWnd)
|
||||||
{
|
{
|
||||||
if(LogonProcess != PsGetCurrentProcessWin32Process())
|
if (gpidLogon != PsGetCurrentProcessId())
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!IntIsWindow(hWnd))
|
if (!IntIsWindow(hWnd))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ typedef struct _WINSTATION_OBJECT
|
||||||
} WINSTATION_OBJECT, *PWINSTATION_OBJECT;
|
} WINSTATION_OBJECT, *PWINSTATION_OBJECT;
|
||||||
|
|
||||||
extern WINSTATION_OBJECT *InputWindowStation;
|
extern WINSTATION_OBJECT *InputWindowStation;
|
||||||
extern PPROCESSINFO LogonProcess;
|
extern HANDLE gpidLogon;
|
||||||
extern HWND hwndSAS;
|
extern HWND hwndSAS;
|
||||||
extern UNICODE_STRING gustrWindowStationsDir;
|
extern UNICODE_STRING gustrWindowStationsDir;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue