mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
- Do not call KeAttachProcess/keDetachProcess if the current process is the necessary process.
svn path=/trunk/; revision=5638
This commit is contained in:
parent
e7eff667e5
commit
8ab6fed82c
4 changed files with 46 additions and 14 deletions
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: device.c,v 1.9 2003/07/11 15:59:37 royce Exp $
|
||||
/* $Id: device.c,v 1.10 2003/08/18 10:18:14 hbirr Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -50,13 +50,18 @@ EngDeviceIoControl(HANDLE hDevice,
|
|||
KEVENT Event;
|
||||
IO_STATUS_BLOCK Iosb;
|
||||
PFILE_OBJECT FileObject;
|
||||
PEPROCESS CurrentProcess;
|
||||
|
||||
DPRINT("EngDeviceIoControl() called\n");
|
||||
|
||||
KeInitializeEvent(&Event, SynchronizationEvent, FALSE);
|
||||
|
||||
/* Switch to process context in which hDevice is valid */
|
||||
KeAttachProcess(W32kDeviceProcess);
|
||||
CurrentProcess = PsGetCurrentProcess();
|
||||
if (CurrentProcess != W32kDeviceProcess)
|
||||
{
|
||||
/* Switch to process context in which hDevice is valid */
|
||||
KeAttachProcess(W32kDeviceProcess);
|
||||
}
|
||||
|
||||
Status = ObReferenceObjectByHandle(hDevice,
|
||||
FILE_READ_DATA | FILE_WRITE_DATA,
|
||||
|
@ -64,7 +69,10 @@ EngDeviceIoControl(HANDLE hDevice,
|
|||
KernelMode,
|
||||
(PVOID *)&FileObject,
|
||||
NULL);
|
||||
KeDetachProcess();
|
||||
if (CurrentProcess != W32kDeviceProcess)
|
||||
{
|
||||
KeDetachProcess();
|
||||
}
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: driver.c,v 1.26 2003/08/13 20:24:05 chorns Exp $
|
||||
/* $Id: driver.c,v 1.27 2003/08/18 10:18:14 hbirr Exp $
|
||||
*
|
||||
* GDI Driver support routines
|
||||
* (mostly swiped from Wine)
|
||||
|
@ -244,9 +244,14 @@ HANDLE DRIVER_FindMPDriver(LPCWSTR Name)
|
|||
IO_STATUS_BLOCK Iosb;
|
||||
HANDLE DisplayHandle;
|
||||
NTSTATUS Status;
|
||||
PEPROCESS CurrentProcess;
|
||||
|
||||
/* Switch to process context in which handle is to be valid */
|
||||
KeAttachProcess(W32kDeviceProcess);
|
||||
CurrentProcess = PsGetCurrentProcess();
|
||||
if (CurrentProcess != W32kDeviceProcess)
|
||||
{
|
||||
/* Switch to process context in which handle is to be valid */
|
||||
KeAttachProcess(W32kDeviceProcess);
|
||||
}
|
||||
|
||||
RtlInitUnicodeStringFromLiteral(&DeviceName, L"\\??\\DISPLAY1");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
|
@ -261,7 +266,10 @@ HANDLE DRIVER_FindMPDriver(LPCWSTR Name)
|
|||
0,
|
||||
FILE_SYNCHRONOUS_IO_ALERT);
|
||||
|
||||
KeDetachProcess();
|
||||
if (CurrentProcess != W32kDeviceProcess)
|
||||
{
|
||||
KeDetachProcess();
|
||||
}
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: dc.c,v 1.70 2003/08/17 17:32:58 royce Exp $
|
||||
/* $Id: dc.c,v 1.71 2003/08/18 10:18:14 hbirr Exp $
|
||||
*
|
||||
* DC.C - Device context functions
|
||||
*
|
||||
|
@ -511,6 +511,7 @@ W32kDeleteDC(HDC DCHandle)
|
|||
{
|
||||
if (!DRIVER_UnreferenceDriver (DCToDelete->DriverName))
|
||||
{
|
||||
PEPROCESS CurrentProcess;
|
||||
DPRINT( "No more references to driver, reseting display\n" );
|
||||
DCToDelete->DriverFunctions.AssertMode( DCToDelete->PDev, FALSE );
|
||||
CHECKPOINT;
|
||||
|
@ -518,9 +519,16 @@ W32kDeleteDC(HDC DCHandle)
|
|||
CHECKPOINT;
|
||||
DCToDelete->DriverFunctions.DisablePDev(DCToDelete->PDev);
|
||||
|
||||
KeAttachProcess(W32kDeviceProcess);
|
||||
CurrentProcess = PsGetCurrentProcess();
|
||||
if (CurrentProcess != W32kDeviceProcess)
|
||||
{
|
||||
KeAttachProcess(W32kDeviceProcess);
|
||||
}
|
||||
ZwClose(PrimarySurface.DisplayDevice);
|
||||
KeDetachProcess();
|
||||
if (CurrentProcess != W32kDeviceProcess)
|
||||
{
|
||||
KeDetachProcess();
|
||||
}
|
||||
|
||||
PrimarySurfaceCreated = FALSE;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
/*
|
||||
* GDIOBJ.C - GDI object manipulation routines
|
||||
*
|
||||
* $Id: gdiobj.c,v 1.35 2003/08/17 17:32:58 royce Exp $
|
||||
* $Id: gdiobj.c,v 1.36 2003/08/18 10:18:14 hbirr Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -534,9 +534,14 @@ CleanupForProcess (struct _EPROCESS *Process, INT Pid)
|
|||
DWORD i;
|
||||
PGDI_HANDLE_ENTRY handleEntry;
|
||||
PGDIOBJHDR objectHeader;
|
||||
PEPROCESS CurrentProcess;
|
||||
//NTSTATUS Status;
|
||||
|
||||
KeAttachProcess(Process);
|
||||
CurrentProcess = PsGetCurrentProcess();
|
||||
if (CurrentProcess != Process)
|
||||
{
|
||||
KeAttachProcess(Process);
|
||||
}
|
||||
|
||||
for(i = 1; i < GDI_HANDLE_NUMBER; i++)
|
||||
{
|
||||
|
@ -550,7 +555,10 @@ CleanupForProcess (struct _EPROCESS *Process, INT Pid)
|
|||
}
|
||||
}
|
||||
|
||||
KeDetachProcess();
|
||||
if (CurrentProcess != Process)
|
||||
{
|
||||
KeDetachProcess();
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue