- Move Process Information structure back into kernel space. We use client information via TEB to provide a pointer for user space as a reference pointer.

svn path=/trunk/; revision=41051
This commit is contained in:
James Tabor 2009-05-23 00:57:51 +00:00
parent e7a4eae2bb
commit bde03977f6
5 changed files with 23 additions and 66 deletions

View file

@ -1,7 +1,7 @@
#ifndef __WIN32K_NTUSER_H
#define __WIN32K_NTUSER_H
struct _PROCESSINFO;
typedef struct _PROCESSINFO *PPROCESSINFO;
struct _W32THREADINFO;
struct _WINDOW;
@ -335,20 +335,6 @@ typedef struct _SERVERINFO
DWORD SrvEventActivity;
} SERVERINFO, *PSERVERINFO;
typedef struct _PROCESSINFO
{
PVOID UserHandleTable;
HANDLE hUserHeap;
ULONG_PTR UserHeapDelta;
HINSTANCE hModUser;
PWINDOWCLASS LocalClassList;
PWINDOWCLASS GlobalClassList;
PWINDOWCLASS SystemClassList;
UINT RegisteredSysClasses : 1;
} PROCESSINFO, *PPROCESSINFO;
#define CTI_INSENDMESSAGE 0x0002
typedef struct _CLIENTTHREADINFO

View file

@ -94,4 +94,17 @@ typedef struct _W32PROCESS
PPROCESSINFO ProcessInfo;
} W32PROCESS, *PW32PROCESS;
typedef struct _PROCESSINFO
{
W32PROCESS XzyxW32Process; /* Place holder. */
/* ReactOS */
HINSTANCE hModUser;
PWINDOWCLASS LocalClassList;
PWINDOWCLASS GlobalClassList;
PWINDOWCLASS SystemClassList;
UINT RegisteredSysClasses : 1;
} PROCESSINFO;
#endif /* __INCLUDE_NAPI_WIN32_H */

View file

@ -67,12 +67,12 @@ Win32kProcessCallback(struct _EPROCESS *Process,
{
/* FIXME - lock the process */
Win32Process = ExAllocatePoolWithTag(NonPagedPool,
sizeof(W32PROCESS),
sizeof(PROCESSINFO),
TAG('W', '3', '2', 'p'));
if (Win32Process == NULL) RETURN( STATUS_NO_MEMORY);
RtlZeroMemory(Win32Process, sizeof(W32PROCESS));
RtlZeroMemory(Win32Process, sizeof(PROCESSINFO));
PsSetProcessWin32Process(Process, Win32Process);
/* FIXME - unlock the process */
@ -152,12 +152,6 @@ Win32kProcessCallback(struct _EPROCESS *Process,
{
LogonProcess = NULL;
}
if (Win32Process->ProcessInfo != NULL)
{
UserHeapFree(Win32Process->ProcessInfo);
Win32Process->ProcessInfo = NULL;
}
}
RETURN( STATUS_SUCCESS);
@ -339,12 +333,12 @@ Win32kInitWin32Thread(PETHREAD Thread)
if (Process->Win32Process == NULL)
{
/* FIXME - lock the process */
Process->Win32Process = ExAllocatePool(NonPagedPool, sizeof(W32PROCESS));
Process->Win32Process = ExAllocatePool(NonPagedPool, sizeof(PROCESSINFO));
if (Process->Win32Process == NULL)
return STATUS_NO_MEMORY;
RtlZeroMemory(Process->Win32Process, sizeof(W32PROCESS));
RtlZeroMemory(Process->Win32Process, sizeof(PROCESSINFO));
/* FIXME - unlock the process */
Win32kProcessCallback(Process, TRUE);

View file

@ -463,43 +463,7 @@ IntFreeNULLTerminatedFromUnicodeString(PWSTR NullTerminated, PUNICODE_STRING Uni
PPROCESSINFO
GetW32ProcessInfo(VOID)
{
PPROCESSINFO pi;
PW32PROCESS W32Process = PsGetCurrentProcessWin32Process();
if (W32Process == NULL)
{
/* FIXME - temporary hack for system threads... */
return NULL;
}
if (W32Process->ProcessInfo == NULL)
{
pi = UserHeapAlloc(sizeof(PROCESSINFO));
if (pi != NULL)
{
RtlZeroMemory(pi,
sizeof(PROCESSINFO));
/* initialize it */
pi->UserHandleTable = gHandleTable;
pi->hUserHeap = W32Process->HeapMappings.KernelMapping;
pi->UserHeapDelta = (ULONG_PTR)W32Process->HeapMappings.KernelMapping -
(ULONG_PTR)W32Process->HeapMappings.UserMapping;
if (InterlockedCompareExchangePointer(&W32Process->ProcessInfo,
pi,
NULL) != NULL)
{
UserHeapFree(pi);
}
}
else
{
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
}
}
return W32Process->ProcessInfo;
return (PPROCESSINFO)PsGetCurrentProcessWin32Process();
}
PW32THREADINFO

View file

@ -893,12 +893,13 @@ NtUserProcessConnect(
{
UserEnterShared();
GetW32ThreadInfo();
PPROCESSINFO ppi = GetW32ProcessInfo();
PW32PROCESS W32Process = PsGetCurrentProcessWin32Process();
_SEH2_TRY
{
pUserConnect->siClient.psi = gpsi;
pUserConnect->siClient.aheList = ppi->UserHandleTable;
pUserConnect->siClient.ulSharedDelta = ppi->UserHeapDelta;
pUserConnect->siClient.aheList = gHandleTable;
pUserConnect->siClient.ulSharedDelta = (ULONG_PTR)W32Process->HeapMappings.KernelMapping -
(ULONG_PTR)W32Process->HeapMappings.UserMapping;
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
@ -909,7 +910,6 @@ NtUserProcessConnect(
{
SetLastNtError(Status);
}
DPRINT("NtUserPC SI 0x%x : HT 0x%x : D 0x%x\n", gpsi, ppi->UserHandleTable, ppi->UserHeapDelta);
UserLeave();
return Status;
}