Seems I forgot to commit this, sorry

svn path=/trunk/; revision=16296
This commit is contained in:
Alex Ionescu 2005-06-26 18:00:22 +00:00
parent 954200311b
commit 025d7c475c

View file

@ -36,13 +36,32 @@ extern ULONG Win32kNumberOfSysCalls;
PSHARED_SECTION_POOL SessionSharedSectionPool = NULL; PSHARED_SECTION_POOL SessionSharedSectionPool = NULL;
NTSTATUS STDCALL NTSTATUS
Win32kProcessCallback (struct _EPROCESS *Process, STDCALL
BOOLEAN Create) Win32kProcessCallback(struct _EPROCESS *Process,
BOOLEAN Create)
{ {
PW32PROCESS Win32Process; PW32PROCESS Win32Process;
/* Get the Win32 Process */
Win32Process = PsGetProcessWin32Process(Process);
/* Allocate one if needed */
if (!Win32Process)
{
/* FIXME - lock the process */
Win32Process = ExAllocatePoolWithTag(NonPagedPool,
sizeof(W32PROCESS),
TAG('W', '3', '2', 'p'));
if (Win32Process == NULL) return STATUS_NO_MEMORY;
RtlZeroMemory(Win32Process, sizeof(W32PROCESS));
PsSetProcessWin32Process(Process, Win32Process);
/* FIXME - unlock the process */
}
Win32Process = (PW32PROCESS)Process->Win32Process;
if (Create) if (Create)
{ {
DPRINT("Creating W32 process PID:%d at IRQ level: %lu\n", Process->UniqueProcessId, KeGetCurrentIrql()); DPRINT("Creating W32 process PID:%d at IRQ level: %lu\n", Process->UniqueProcessId, KeGetCurrentIrql());
@ -97,15 +116,34 @@ Win32kProcessCallback (struct _EPROCESS *Process,
} }
NTSTATUS STDCALL NTSTATUS
Win32kThreadCallback (struct _ETHREAD *Thread, STDCALL
BOOLEAN Create) Win32kThreadCallback(struct _ETHREAD *Thread,
BOOLEAN Create)
{ {
struct _EPROCESS *Process; struct _EPROCESS *Process;
PW32THREAD Win32Thread; PW32THREAD Win32Thread;
Process = Thread->ThreadsProcess; Process = Thread->ThreadsProcess;
Win32Thread = Thread->Tcb.Win32Thread;
/* Get the Win32 Thread */
Win32Thread = PsGetThreadWin32Thread(Thread);
/* Allocate one if needed */
if (!Win32Thread)
{
/* FIXME - lock the process */
Win32Thread = ExAllocatePoolWithTag(NonPagedPool,
sizeof(W32THREAD),
TAG('W', '3', '2', 't'));
if (Win32Thread == NULL) return STATUS_NO_MEMORY;
RtlZeroMemory(Win32Thread, sizeof(W32THREAD));
PsSetThreadWin32Thread(Thread, Win32Thread);
/* FIXME - unlock the process */
}
if (Create) if (Create)
{ {
HWINSTA hWinSta = NULL; HWINSTA hWinSta = NULL;
@ -237,7 +275,7 @@ DriverEntry (
{ {
NTSTATUS Status; NTSTATUS Status;
BOOLEAN Result; BOOLEAN Result;
W32_OBJECT_CALLBACK Win32kObjectCallbacks; W32_CALLOUT_DATA CalloutData;
/* /*
* Register user mode call interface * Register user mode call interface
@ -254,24 +292,22 @@ DriverEntry (
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
/* /*
* Register Object Manager Callbacks * Register Object Manager Callbacks
*/ */
Win32kObjectCallbacks.WinStaCreate = IntWinStaObjectOpen; CalloutData.WinStaCreate = IntWinStaObjectOpen;
Win32kObjectCallbacks.WinStaParse = IntWinStaObjectParse; CalloutData.WinStaParse = IntWinStaObjectParse;
Win32kObjectCallbacks.WinStaDelete = IntWinStaObjectDelete; CalloutData.WinStaDelete = IntWinStaObjectDelete;
Win32kObjectCallbacks.WinStaFind = IntWinStaObjectFind; CalloutData.WinStaFind = IntWinStaObjectFind;
Win32kObjectCallbacks.DesktopCreate = IntDesktopObjectCreate; CalloutData.DesktopCreate = IntDesktopObjectCreate;
Win32kObjectCallbacks.DesktopDelete = IntDesktopObjectDelete; CalloutData.DesktopDelete = IntDesktopObjectDelete;
/* CalloutData.W32ProcessCallout = Win32kProcessCallback;
* Register our per-process and per-thread structures. CalloutData.W32ThreadCallout = Win32kThreadCallback;
*/
PsEstablishWin32Callouts (Win32kProcessCallback, /*
Win32kThreadCallback, * Register our per-process and per-thread structures.
&Win32kObjectCallbacks, */
0, PsEstablishWin32Callouts(&CalloutData);
sizeof(W32THREAD),
sizeof(W32PROCESS));
Status = IntUserCreateSharedSectionPool(48 * 1024 * 1024, /* 48 MB by default */ Status = IntUserCreateSharedSectionPool(48 * 1024 * 1024, /* 48 MB by default */
&SessionSharedSectionPool); &SessionSharedSectionPool);