Hack around attaching a process to an already attached thread

svn path=/trunk/; revision=6828
This commit is contained in:
Gé van Geldorp 2003-11-30 19:15:21 +00:00
parent d6b77edb3c
commit 6cbc61a453
2 changed files with 11 additions and 4 deletions

View file

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.2 2003/11/05 22:31:50 gvg Exp $ # $Id: Makefile,v 1.3 2003/11/30 19:15:21 gvg Exp $
PATH_TO_TOP = ../../.. PATH_TO_TOP = ../../..
@ -6,7 +6,7 @@ TARGET_TYPE = export_driver
TARGET_NAME = videoprt TARGET_NAME = videoprt
TARGET_CFLAGS += -Wall -Werror TARGET_CFLAGS += -Wall -Werror -I$(PATH_TO_TOP)/ntoskrnl/include
TARGET_OBJECTS = videoprt.o TARGET_OBJECTS = videoprt.o

View file

@ -1,4 +1,4 @@
/* $Id: videoprt.c,v 1.12 2003/11/05 22:31:50 gvg Exp $ /* $Id: videoprt.c,v 1.13 2003/11/30 19:15:21 gvg Exp $
* *
* VideoPort driver * VideoPort driver
* Written by Rex Jolliff * Written by Rex Jolliff
@ -9,7 +9,8 @@
#include <roskrnl.h> #include <roskrnl.h>
#include <ddk/ntddvid.h> #include <ddk/ntddvid.h>
#include "../../../ntoskrnl/include/internal/v86m.h" #include "internal/v86m.h"
#include "internal/ps.h"
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
@ -704,12 +705,17 @@ VideoPortInt10(IN PVOID HwDeviceExtension,
KV86M_REGISTERS Regs; KV86M_REGISTERS Regs;
NTSTATUS Status; NTSTATUS Status;
PEPROCESS CallingProcess; PEPROCESS CallingProcess;
PEPROCESS OldProcess;
PETHREAD CurrentThread;
DPRINT("VideoPortInt10\n"); DPRINT("VideoPortInt10\n");
CallingProcess = PsGetCurrentProcess(); CallingProcess = PsGetCurrentProcess();
if (CallingProcess != Csrss) if (CallingProcess != Csrss)
{ {
CurrentThread = PsGetCurrentThread();
OldProcess = CurrentThread->OldProcess;
CurrentThread->OldProcess = NULL;
KeAttachProcess(Csrss); KeAttachProcess(Csrss);
} }
@ -726,6 +732,7 @@ VideoPortInt10(IN PVOID HwDeviceExtension,
if (CallingProcess != Csrss) if (CallingProcess != Csrss)
{ {
KeDetachProcess(); KeDetachProcess();
CurrentThread->OldProcess = OldProcess;
} }
return(Status); return(Status);