diff --git a/reactos/drivers/video/videoprt/dispatch.c b/reactos/drivers/video/videoprt/dispatch.c index 617ef9d99a8..91ffe8635a0 100644 --- a/reactos/drivers/video/videoprt/dispatch.c +++ b/reactos/drivers/video/videoprt/dispatch.c @@ -18,7 +18,7 @@ * If not, write to the Free Software Foundation, * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * $Id: dispatch.c,v 1.2 2004/03/19 20:58:32 navaraf Exp $ + * $Id: dispatch.c,v 1.3 2004/04/08 09:43:55 navaraf Exp $ */ #include "videoprt.h" @@ -55,11 +55,11 @@ IntVideoPortResetDisplayParameters(ULONG Columns, ULONG Rows) &ResetDisplayParametersDeviceExtension->MiniPortDeviceExtension, Columns, Rows)) { + ResetDisplayParametersDeviceExtension = NULL; return FALSE; } ResetDisplayParametersDeviceExtension = NULL; - return TRUE; } @@ -131,6 +131,8 @@ IntVideoPortDispatchOpen( { Irp->IoStatus.Status = STATUS_SUCCESS; + InterlockedIncrement(&DeviceExtension->DeviceOpened); + /* * Storing the device extension pointer in a static variable is an * ugly hack. Unfortunately, we need it in VideoPortResetDisplayParameters @@ -168,10 +170,17 @@ IntVideoPortDispatchClose( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { + PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension; + DPRINT("IntVideoPortDispatchClose\n"); - if (ResetDisplayParametersDeviceExtension != NULL) + DeviceExtension = (PVIDEO_PORT_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + if (DeviceExtension->DeviceOpened > 1 && + InterlockedDecrement(&DeviceExtension->DeviceOpened) == 0) + { + ResetDisplayParametersDeviceExtension = DeviceExtension; HalReleaseDisplayOwnership(); + } Irp->IoStatus.Status = STATUS_SUCCESS; IoCompleteRequest(Irp, IO_NO_INCREMENT); diff --git a/reactos/drivers/video/videoprt/videoprt.h b/reactos/drivers/video/videoprt/videoprt.h index cb37851c8b1..d33d7139eb3 100644 --- a/reactos/drivers/video/videoprt/videoprt.h +++ b/reactos/drivers/video/videoprt/videoprt.h @@ -18,7 +18,7 @@ * If not, write to the Free Software Foundation, * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * $Id: videoprt.h,v 1.9 2004/03/21 12:31:19 gvg Exp $ + * $Id: videoprt.h,v 1.10 2004/04/08 09:43:55 navaraf Exp $ */ #ifndef VIDEOPRT_H @@ -71,6 +71,7 @@ typedef struct _VIDEO_PORT_DEVICE_EXTENSTION LIST_ENTRY AddressMappingListHead; KDPC DpcObject; VIDEO_PORT_DRIVER_EXTENSION *DriverExtension; + ULONG DeviceOpened; CHAR MiniPortDeviceExtension[1]; } VIDEO_PORT_DEVICE_EXTENSION, *PVIDEO_PORT_DEVICE_EXTENSION;