Author: hbelusca
Date: Sun Nov 23 16:09:00 2014
New Revision: 65465
URL:
http://svn.reactos.org/svn/reactos?rev=65465&view=rev
Log:
[WIN32K]: Use the logon process ID instead of a full win32k process object, it simplifies
code in some parts.
Modified:
trunk/reactos/win32ss/user/ntuser/desktop.c
trunk/reactos/win32ss/user/ntuser/main.c
trunk/reactos/win32ss/user/ntuser/simplecall.c
trunk/reactos/win32ss/user/ntuser/winsta.c
trunk/reactos/win32ss/user/ntuser/winsta.h
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] Sun Nov 23 16:09:00 2014
@@ -1701,7 +1701,7 @@
* is the logon application itself
*/
if((pdesk->rpwinstaParent->Flags & WSS_LOCKED) &&
- LogonProcess != PsGetCurrentProcessWin32Process())
+ gpidLogon != PsGetCurrentProcessId())
{
ObDereferenceObject(pdesk);
ERR("Switching desktop 0x%p denied because the window station is
locked!\n", hdesk);
Modified: trunk/reactos/win32ss/user/ntuser/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/main.c…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/main.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/main.c [iso-8859-1] Sun Nov 23 16:09:00 2014
@@ -213,10 +213,8 @@
/*
* Deregister logon application automatically
*/
- if(LogonProcess == ppiCurrent)
- {
- LogonProcess = NULL;
- }
+ if (gpidLogon == ppiCurrent->peProcess->UniqueProcessId)
+ gpidLogon = 0;
/* Close the current window station */
UserSetProcessWindowStation(NULL);
@@ -409,7 +407,7 @@
/* Assign a default window station and desktop to the process */
/* 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;
HDESK hDesk = NULL;
@@ -749,17 +747,23 @@
/* Register Object Manager Callbacks */
CalloutData.ProcessCallout = Win32kProcessCallback;
CalloutData.ThreadCallout = Win32kThreadCallback;
+ // CalloutData.GlobalAtomTableCallout = NULL;
+ // CalloutData.PowerEventCallout = NULL;
+ // CalloutData.PowerStateCallout = NULL;
+ // CalloutData.JobCallout = NULL;
+ 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.WindowStationDeleteProcedure = IntWinStaObjectDelete;
- CalloutData.WindowStationOkToCloseProcedure = IntWinstaOkToClose;
- CalloutData.DesktopOkToCloseProcedure = IntDesktopOkToClose;
- CalloutData.DesktopDeleteProcedure = IntDesktopObjectDelete;
- CalloutData.DesktopCloseProcedure = IntDesktopObjectClose;
- CalloutData.DesktopOpenProcedure = IntDesktopObjectOpen;
- CalloutData.BatchFlushRoutine = NtGdiFlushUserBatch;
+ // CalloutData.WindowStationOpenProcedure = NULL;
/* Register our per-process and per-thread structures. */
- PsEstablishWin32Callouts((PWIN32_CALLOUTS_FPNS)&CalloutData);
+ PsEstablishWin32Callouts(&CalloutData);
/* Register service hook callbacks */
#if DBG
Modified: trunk/reactos/win32ss/user/ntuser/simplecall.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/simple…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/simplecall.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/simplecall.c [iso-8859-1] Sun Nov 23 16:09:00 2014
@@ -12,8 +12,8 @@
DBG_DEFAULT_CHANNEL(UserMisc);
-/* registered Logon process */
-PPROCESSINFO LogonProcess = NULL;
+/* Registered logon process ID */
+HANDLE gpidLogon = 0;
BOOL FASTCALL
co_IntRegisterLogonProcess(HANDLE ProcessId, BOOL Register)
@@ -21,38 +21,33 @@
NTSTATUS Status;
PEPROCESS Process;
- Status = PsLookupProcessByProcessId(ProcessId,
- &Process);
+ Status = PsLookupProcessByProcessId(ProcessId, &Process);
if (!NT_SUCCESS(Status))
{
EngSetLastError(RtlNtStatusToDosError(Status));
return FALSE;
}
+ ProcessId = Process->UniqueProcessId;
+
+ ObDereferenceObject(Process);
+
if (Register)
{
/* Register the logon process */
- if (LogonProcess != NULL)
- {
- ObDereferenceObject(Process);
+ if (gpidLogon != 0)
return FALSE;
- }
-
- LogonProcess = (PPROCESSINFO)Process->Win32Process;
+
+ gpidLogon = ProcessId;
}
else
{
/* Deregister the logon process */
- if (LogonProcess != (PPROCESSINFO)Process->Win32Process)
- {
- ObDereferenceObject(Process);
+ if (gpidLogon != ProcessId)
return FALSE;
- }
-
- LogonProcess = NULL;
- }
-
- ObDereferenceObject(Process);
+
+ gpidLogon = 0;
+ }
return TRUE;
}
@@ -451,7 +446,6 @@
STUB
RETURN( 0);
-
case TWOPARAM_ROUTINE_SETCARETPOS:
RETURN( (DWORD_PTR)co_IntSetCaretPos((int)Param1, (int)Param2));
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] Sun Nov 23 16:09:00 2014
@@ -947,7 +947,7 @@
TRACE("About to set process window station with handle (%p)\n",
hWindowStation);
- if(PsGetCurrentProcessWin32Process() != LogonProcess)
+ if (gpidLogon != PsGetCurrentProcessId())
{
ERR("Unauthorized process attempted to lock the window station!\n");
EngSetLastError(ERROR_ACCESS_DENIED);
@@ -992,7 +992,7 @@
TRACE("About to set process window station with handle (%p)\n",
hWindowStation);
- if(PsGetCurrentProcessWin32Process() != LogonProcess)
+ if (gpidLogon != PsGetCurrentProcessId())
{
ERR("Unauthorized process attempted to unlock the window station!\n");
EngSetLastError(ERROR_ACCESS_DENIED);
@@ -1338,12 +1338,12 @@
BOOL APIENTRY
NtUserSetLogonNotifyWindow(HWND hWnd)
{
- if(LogonProcess != PsGetCurrentProcessWin32Process())
+ if (gpidLogon != PsGetCurrentProcessId())
{
return FALSE;
}
- if(!IntIsWindow(hWnd))
+ if (!IntIsWindow(hWnd))
{
return FALSE;
}
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] Sun Nov 23 16:09:00 2014
@@ -35,7 +35,7 @@
} WINSTATION_OBJECT, *PWINSTATION_OBJECT;
extern WINSTATION_OBJECT *InputWindowStation;
-extern PPROCESSINFO LogonProcess;
+extern HANDLE gpidLogon;
extern HWND hwndSAS;
extern UNICODE_STRING gustrWindowStationsDir;