From fc1193592b5c91c74b81c99260e1f82b793a72f5 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Thu, 18 Jul 2002 00:29:19 +0000 Subject: [PATCH] Fixed access to non-existent device extension. svn path=/trunk/; revision=3250 --- reactos/drivers/dd/beep/beep.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/reactos/drivers/dd/beep/beep.c b/reactos/drivers/dd/beep/beep.c index 612b042e130..a26a49a5254 100644 --- a/reactos/drivers/dd/beep/beep.c +++ b/reactos/drivers/dd/beep/beep.c @@ -1,4 +1,4 @@ -/* $Id: beep.c,v 1.10 2001/08/27 01:25:17 ekohl Exp $ +/* $Id: beep.c,v 1.11 2002/07/18 00:29:19 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -32,7 +32,6 @@ typedef struct _BEEP_DEVICE_EXTENSION /* FUNCTIONS ***************************************************************/ - static VOID STDCALL BeepDPC(PKDPC Dpc, PVOID DeferredContext, @@ -245,26 +244,15 @@ DriverEntry(PDRIVER_OBJECT DriverObject, UNICODE_STRING SymlinkName; NTSTATUS Status; - DbgPrint("Beep Device Driver 0.0.3\n"); + DPRINT("Beep Device Driver 0.0.3\n"); + DriverObject->Flags = 0; DriverObject->MajorFunction[IRP_MJ_CREATE] = BeepCreate; DriverObject->MajorFunction[IRP_MJ_CLOSE] = BeepClose; DriverObject->MajorFunction[IRP_MJ_CLEANUP] = BeepCleanup; DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = BeepDeviceControl; DriverObject->DriverUnload = BeepUnload; - /* set up device extension */ - DeviceExtension = DeviceObject->DeviceExtension; - DeviceExtension->BeepOn = FALSE; - - KeInitializeDpc(&DeviceExtension->Dpc, - BeepDPC, - DeviceExtension); - KeInitializeTimer(&DeviceExtension->Timer); - KeInitializeEvent(&DeviceExtension->Event, - SynchronizationEvent, - FALSE); - RtlInitUnicodeString(&DeviceName, L"\\Device\\Beep"); Status = IoCreateDevice(DriverObject, @@ -277,6 +265,19 @@ DriverEntry(PDRIVER_OBJECT DriverObject, if (!NT_SUCCESS(Status)) return Status; + /* set up device extension */ + DeviceExtension = DeviceObject->DeviceExtension; + DeviceExtension->BeepOn = FALSE; + + KeInitializeDpc(&DeviceExtension->Dpc, + BeepDPC, + DeviceExtension); + KeInitializeTimer(&DeviceExtension->Timer); + KeInitializeEvent(&DeviceExtension->Event, + SynchronizationEvent, + FALSE); + + /* Create the dos device link */ RtlInitUnicodeString(&SymlinkName, L"\\??\\Beep"); IoCreateSymbolicLink(&SymlinkName,