no need to create a symbolic link in \??
[reactos.git] / reactos / drivers / dd / beep / beep.c
index f887ff5..939228d 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: beep.c,v 1.9 2001/08/05 21:48:25 ekohl Exp $
+/* $Id$
  *
  * COPYRIGHT:            See COPYING in the top level directory
  * PROJECT:              ReactOS kernel
@@ -18,6 +18,9 @@
 #define NDEBUG
 #include <debug.h>
 
+NTSTATUS STDCALL
+DriverEntry(PDRIVER_OBJECT DriverObject,
+            PUNICODE_STRING RegistryPath);
 
 /* TYEPEDEFS ***************************************************************/
 
@@ -32,8 +35,7 @@ typedef struct _BEEP_DEVICE_EXTENSION
 
 /* FUNCTIONS ***************************************************************/
 
-
-static VOID
+static VOID STDCALL
 BeepDPC(PKDPC Dpc,
        PVOID DeferredContext,
        PVOID SystemArgument1,
@@ -47,15 +49,16 @@ BeepDPC(PKDPC Dpc,
   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:
@@ -178,9 +181,8 @@ BeepDeviceControl(PDEVICE_OBJECT DeviceObject,
 
   /* 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;
@@ -220,11 +222,10 @@ BeepDeviceControl(PDEVICE_OBJECT DeviceObject,
 }
 
 
-static NTSTATUS STDCALL
+static VOID STDCALL
 BeepUnload(PDRIVER_OBJECT DriverObject)
 {
   DPRINT("BeepUnload() called!\n");
-  return(STATUS_SUCCESS);
 }
 
 
@@ -241,18 +242,28 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
 {
   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;
@@ -265,23 +276,6 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
                    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);
 }