-/* $Id: beep.c,v 1.10 2001/08/27 01:25:17 ekohl Exp $
+/* $Id$
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
#define NDEBUG
#include <debug.h>
+NTSTATUS STDCALL
+DriverEntry(PDRIVER_OBJECT DriverObject,
+ PUNICODE_STRING RegistryPath);
/* TYEPEDEFS ***************************************************************/
/* FUNCTIONS ***************************************************************/
-
static VOID STDCALL
BeepDPC(PKDPC Dpc,
PVOID DeferredContext,
DeviceExtension->BeepOn = FALSE;
KeSetEvent(&DeviceExtension->Event,
0,
- TRUE);
+ FALSE);
DPRINT("BeepDPC() finished!\n");
}
static NTSTATUS STDCALL
-BeepCreate(PDEVICE_OBJECT DeviceObject,
- PIRP Irp)
+BeepCreate(
+ PDEVICE_OBJECT DeviceObject,
+ PIRP Irp)
/*
* FUNCTION: Handles user mode requests
* ARGUMENTS:
/* do the beep!! */
DPRINT("Beep:\n Freq: %lu Hz\n Dur: %lu ms\n",
- pbsp->Frequency,
- pbsp->Duration);
-
+ BeepParam->Frequency,
+ BeepParam->Duration);
if (BeepParam->Duration >= 0)
{
DueTime.QuadPart = (LONGLONG)BeepParam->Duration * -10000;
}
-static NTSTATUS STDCALL
+static VOID STDCALL
BeepUnload(PDRIVER_OBJECT DriverObject)
{
DPRINT("BeepUnload() called!\n");
- return(STATUS_SUCCESS);
}
{
PDEVICE_EXTENSION DeviceExtension;
PDEVICE_OBJECT DeviceObject;
- UNICODE_STRING DeviceName;
- UNICODE_STRING SymlinkName;
+ UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\Beep");
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;
+ Status = IoCreateDevice(DriverObject,
+ sizeof(DEVICE_EXTENSION),
+ &DeviceName,
+ FILE_DEVICE_BEEP,
+ 0,
+ FALSE,
+ &DeviceObject);
+ if (!NT_SUCCESS(Status))
+ return Status;
+
/* set up device extension */
DeviceExtension = DeviceObject->DeviceExtension;
DeviceExtension->BeepOn = FALSE;
SynchronizationEvent,
FALSE);
- RtlInitUnicodeString(&DeviceName,
- L"\\Device\\Beep");
- Status = IoCreateDevice(DriverObject,
- sizeof(DEVICE_EXTENSION),
- &DeviceName,
- FILE_DEVICE_BEEP,
- 0,
- FALSE,
- &DeviceObject);
- if (!NT_SUCCESS(Status))
- return Status;
-
- RtlInitUnicodeString(&SymlinkName,
- L"\\??\\Beep");
- IoCreateSymbolicLink(&SymlinkName,
- &DeviceName);
-
return(STATUS_SUCCESS);
}