Clean up attach hack a little bit, it's still a hack though

svn path=/trunk/; revision=6852
This commit is contained in:
Gé van Geldorp 2003-12-03 16:57:22 +00:00
parent 14f190d1d4
commit 883794822c

View file

@ -1,4 +1,4 @@
/* $Id: videoprt.c,v 1.13 2003/11/30 19:15:21 gvg Exp $ /* $Id: videoprt.c,v 1.14 2003/12/03 16:57:22 gvg Exp $
* *
* VideoPort driver * VideoPort driver
* Written by Rex Jolliff * Written by Rex Jolliff
@ -694,7 +694,7 @@ VideoPortInitialize(IN PVOID Context1,
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
int dummy;
/* /*
* @implemented * @implemented
*/ */
@ -705,17 +705,22 @@ VideoPortInt10(IN PVOID HwDeviceExtension,
KV86M_REGISTERS Regs; KV86M_REGISTERS Regs;
NTSTATUS Status; NTSTATUS Status;
PEPROCESS CallingProcess; PEPROCESS CallingProcess;
PEPROCESS OldProcess; PEPROCESS PrevAttachedProcess;
PETHREAD CurrentThread;
DPRINT("VideoPortInt10\n"); DPRINT("VideoPortInt10\n");
CallingProcess = PsGetCurrentProcess(); CallingProcess = PsGetCurrentProcess();
if (CallingProcess != Csrss) if (CallingProcess != Csrss)
{ {
CurrentThread = PsGetCurrentThread(); if (NULL != PsGetCurrentThread()->OldProcess)
OldProcess = CurrentThread->OldProcess; {
CurrentThread->OldProcess = NULL; PrevAttachedProcess = CallingProcess;
KeDetachProcess();
}
else
{
PrevAttachedProcess = NULL;
}
KeAttachProcess(Csrss); KeAttachProcess(Csrss);
} }
@ -732,7 +737,10 @@ VideoPortInt10(IN PVOID HwDeviceExtension,
if (CallingProcess != Csrss) if (CallingProcess != Csrss)
{ {
KeDetachProcess(); KeDetachProcess();
CurrentThread->OldProcess = OldProcess; if (NULL != PrevAttachedProcess)
{
KeAttachProcess(PrevAttachedProcess);
}
} }
return(Status); return(Status);