ReactOS 0.4.15-dev-5669-g09dde2c
kmixer.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Kernel Streaming Mixer
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: drivers/wdm/audio/filters/kmixer/kmixer.c
5 * PURPOSE: main entry point
6 * PROGRAMMERS: Johannes Anderwald (johannes.anderwald@reactos.org)
7 */
8
9#include "kmixer.h"
10
11#define YDEBUG
12#include <debug.h>
13
18 IN PIRP Irp)
19{
20 PIO_STACK_LOCATION IrpStack;
21
23
24 DPRINT("KMix_Pnp called for func %x\n", IrpStack->MinorFunction);
25
27 {
28 Irp->IoStatus.Information |= PNP_DEVICE_NOT_DISABLEABLE;
29 }
30
32}
33
34VOID
37{
38 DPRINT1("SysAudio_Unload called\n");
39}
40
46{
50 PKMIXER_DEVICE_EXT DeviceExtension;
52
53 DPRINT1("KMix_InstallDevice called\n");
54
55 /* create the device */
57 sizeof(KMIXER_DEVICE_EXT),
60 0,
61 FALSE,
63
64 /* check for success */
65 if (!NT_SUCCESS(Status))
66 {
67 DPRINT("Failed to create \\Device\\kmixer !\n");
68 return Status;
69 }
70
71 DeviceExtension = (PKMIXER_DEVICE_EXT)DeviceObject->DeviceExtension;
72 /* initialize device extension */
73 RtlZeroMemory(DeviceExtension, sizeof(KMIXER_DEVICE_EXT));
74
75
76 Status = KMixAllocateDeviceHeader(DeviceExtension);
77 if (!NT_SUCCESS(Status))
78 {
79 DPRINT1("KMixAllocateDeviceHeader failed with %x\n", Status);
80 goto cleanup;
81 }
82
83 /* set io flags */
85
86 /* clear initializing flag */
87 DeviceObject->Flags &= ~ DO_DEVICE_INITIALIZING;
88
91
92 DPRINT("KMix_InstallDevice result %x\n", Status);
93 return STATUS_SUCCESS;
94
96
98 return Status;
99}
100
101
103NTAPI
106 PUNICODE_STRING RegistryPathName)
107{
108 DPRINT1("KMixer.sys loaded\n");
109
114
117 DriverObject->MajorFunction[IRP_MJ_PNP] = KMix_Pnp;
118 DriverObject->DriverUnload = KMix_Unload;
119 DriverObject->DriverExtension->AddDevice = KMix_AddDevice;
120
121 return STATUS_SUCCESS;
122}
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1157
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
_In_ PIRP Irp
Definition: csq.h:116
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static void cleanup(void)
Definition: main.c:1335
DRIVER_INITIALIZE DriverEntry
Definition: condrv.c:21
KSDDKAPI NTSTATUS NTAPI KsDefaultDispatchPnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: api.c:110
KSDDKAPI VOID NTAPI KsSetDevicePnpAndBaseObject(IN KSDEVICE_HEADER Header, IN PDEVICE_OBJECT PnpDeviceObject, IN PDEVICE_OBJECT BaseDevice)
Definition: api.c:257
KSDDKAPI NTSTATUS NTAPI KsDefaultForwardIrp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: api.c:227
KSDDKAPI NTSTATUS NTAPI KsDefaultDispatchPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: api.c:166
KSDDKAPI NTSTATUS NTAPI KsSetMajorFunctionHandler(IN PDRIVER_OBJECT DriverObject, IN ULONG MajorFunction)
Definition: irp.c:2029
NTSTATUS NTAPI KMixAllocateDeviceHeader(IN PKMIXER_DEVICE_EXT DeviceExtension)
Definition: filter.c:179
#define DO_DIRECT_IO
Definition: env_spec_w32.h:396
Status
Definition: gdiplustypes.h:25
VOID NTAPI KMix_Unload(IN PDRIVER_OBJECT DriverObject)
Definition: kmixer.c:36
NTSTATUS NTAPI KMix_Pnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: kmixer.c:16
NTSTATUS NTAPI KMix_AddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject)
Definition: kmixer.c:43
struct KMIXER_DEVICE_EXT * PKMIXER_DEVICE_EXT
_Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT * NextDeviceObject
Definition: ndis.h:4642
PDEVICE_OBJECT NTAPI IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:966
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1031
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
#define L(x)
Definition: ntvdm.h:50
#define FILE_DEVICE_KS
Definition: winioctl.h:153
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:71
KSDEVICE_HEADER KsDeviceHeader
Definition: kmixer.h:9
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
#define NTAPI
Definition: typedefs.h:36
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define IN
Definition: typedefs.h:39
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3275
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793
#define IRP_MN_QUERY_PNP_DEVICE_STATE
#define PNP_DEVICE_NOT_DISABLEABLE
Definition: iotypes.h:1006
#define DO_POWER_PAGABLE
#define IRP_MJ_SYSTEM_CONTROL
#define IRP_MJ_POWER