Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenkmixer.c
Go to the documentation of this file.
00001 /* 00002 * PROJECT: ReactOS Kernel Streaming Mixer 00003 * LICENSE: GPL - See COPYING in the top level directory 00004 * FILE: drivers/wdm/audio/filters/kmixer/kmixer.c 00005 * PURPOSE: main entry point 00006 * PROGRAMMERS: Johannes Anderwald (janderwald@reactos.org) 00007 */ 00008 00009 #include "kmixer.h" 00010 00011 NTSTATUS 00012 NTAPI 00013 KMix_Pnp( 00014 IN PDEVICE_OBJECT DeviceObject, 00015 IN PIRP Irp) 00016 { 00017 PIO_STACK_LOCATION IrpStack; 00018 00019 IrpStack = IoGetCurrentIrpStackLocation(Irp); 00020 00021 DPRINT("KMix_Pnp called for func %x\n", IrpStack->MinorFunction); 00022 00023 if (IrpStack->MinorFunction == IRP_MN_QUERY_PNP_DEVICE_STATE) 00024 { 00025 Irp->IoStatus.Information |= PNP_DEVICE_NOT_DISABLEABLE; 00026 } 00027 00028 return KsDefaultDispatchPnp(DeviceObject, Irp); 00029 } 00030 00031 VOID 00032 NTAPI 00033 KMix_Unload(IN PDRIVER_OBJECT DriverObject) 00034 { 00035 DPRINT1("SysAudio_Unload called\n"); 00036 } 00037 00038 NTSTATUS 00039 NTAPI 00040 KMix_InstallDevice( 00041 IN PDRIVER_OBJECT DriverObject) 00042 { 00043 NTSTATUS Status; 00044 UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\kmixer"); 00045 PDEVICE_OBJECT DeviceObject; 00046 PKMIXER_DEVICE_EXT DeviceExtension; 00047 00048 DPRINT1("KMix_InstallDevice called\n"); 00049 00050 /* create the device */ 00051 Status = IoCreateDevice(DriverObject, 00052 sizeof(KMIXER_DEVICE_EXT), 00053 &DeviceName, 00054 FILE_DEVICE_KS, 00055 0, 00056 FALSE, 00057 &DeviceObject); 00058 00059 /* check for success */ 00060 if (!NT_SUCCESS(Status)) 00061 { 00062 DPRINT("Failed to create \\Device\\kmixer !\n"); 00063 return Status; 00064 } 00065 00066 DeviceExtension = (PKMIXER_DEVICE_EXT)DeviceObject->DeviceExtension; 00067 /* initialize device extension */ 00068 RtlZeroMemory(DeviceExtension, sizeof(KMIXER_DEVICE_EXT)); 00069 00070 00071 Status = KMixAllocateDeviceHeader(DeviceExtension); 00072 if (!NT_SUCCESS(Status)) 00073 { 00074 DPRINT1("KMixAllocateDeviceHeader failed with %x\n", Status); 00075 goto cleanup; 00076 } 00077 00078 /* set io flags */ 00079 DeviceObject->Flags |= DO_DIRECT_IO | DO_POWER_PAGABLE; 00080 /* clear initializing flag */ 00081 DeviceObject->Flags &= ~ DO_DEVICE_INITIALIZING; 00082 00083 DPRINT("KMix_InstallDevice result %x\n", Status); 00084 return STATUS_SUCCESS; 00085 00086 cleanup: 00087 00088 IoDeleteDevice(DeviceObject); 00089 return Status; 00090 } 00091 00092 00093 NTSTATUS 00094 NTAPI 00095 DriverEntry( 00096 PDRIVER_OBJECT DriverObject, 00097 PUNICODE_STRING RegistryPathName) 00098 { 00099 DPRINT1("KMixer.sys loaded\n"); 00100 00101 KsSetMajorFunctionHandler(DriverObject, IRP_MJ_CREATE); 00102 KsSetMajorFunctionHandler(DriverObject, IRP_MJ_CLOSE); 00103 KsSetMajorFunctionHandler(DriverObject, IRP_MJ_WRITE); 00104 KsSetMajorFunctionHandler(DriverObject, IRP_MJ_DEVICE_CONTROL); 00105 00106 DriverObject->MajorFunction[IRP_MJ_POWER] = KsDefaultDispatchPower; 00107 DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = KsDefaultForwardIrp; 00108 DriverObject->MajorFunction[IRP_MJ_PNP] = KMix_Pnp; 00109 DriverObject->DriverUnload = KMix_Unload; 00110 00111 return KMix_InstallDevice(DriverObject); 00112 } Generated on Sun May 27 2012 04:28:39 for ReactOS by
1.7.6.1
|