ReactOS  0.4.14-dev-323-g6fe6a88
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 
15 NTAPI
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 
34 VOID
35 NTAPI
37 {
38  DPRINT1("SysAudio_Unload called\n");
39 }
40 
42 NTAPI
46 {
48  UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\kmixer");
50  PKMIXER_DEVICE_EXT DeviceExtension;
52 
53  DPRINT1("KMix_InstallDevice called\n");
54 
55  /* create the device */
57  sizeof(KMIXER_DEVICE_EXT),
58  &DeviceName,
60  0,
61  FALSE,
62  &DeviceObject);
63 
64  /* check for success */
65  if (!NT_SUCCESS(Status))
66  {
67  DPRINT("Failed to create \\Device\\kmixer !\n");
68  return Status;
69  }
70 
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 */
88 
91 
92  DPRINT("KMix_InstallDevice result %x\n", Status);
93  return STATUS_SUCCESS;
94 
95 cleanup:
96 
98  return Status;
99 }
100 
101 
102 NTSTATUS
103 NTAPI
106  PUNICODE_STRING RegistryPathName)
107 {
108  DPRINT1("KMixer.sys loaded\n");
109 
114 
120 
121  return STATUS_SUCCESS;
122 }
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
KSDDKAPI NTSTATUS NTAPI KsDefaultDispatchPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: api.c:166
#define DO_POWER_PAGABLE
KSDDKAPI NTSTATUS NTAPI KsDefaultDispatchPnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: api.c:110
#define IN
Definition: typedefs.h:38
NTSTATUS NTAPI KMix_AddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject)
Definition: kmixer.c:43
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
KSDDKAPI VOID NTAPI KsSetDevicePnpAndBaseObject(IN KSDEVICE_HEADER Header, IN PDEVICE_OBJECT PnpDeviceObject, IN PDEVICE_OBJECT BaseDevice)
Definition: api.c:257
_In_ PIRP Irp
Definition: csq.h:116
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
LONG NTSTATUS
Definition: precomp.h:26
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1122
WCHAR DeviceName[]
Definition: adapter.cpp:21
#define DO_DIRECT_IO
Definition: env_spec_w32.h:396
KSDDKAPI NTSTATUS NTAPI KsSetMajorFunctionHandler(IN PDRIVER_OBJECT DriverObject, IN ULONG MajorFunction)
Definition: irp.c:2017
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
struct KMIXER_DEVICE_EXT * PKMIXER_DEVICE_EXT
PDEVICE_OBJECT NTAPI IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:966
PDRIVER_EXTENSION DriverExtension
Definition: iotypes.h:2174
PVOID DeviceExtension
Definition: env_spec_w32.h:418
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
void DPRINT(...)
Definition: polytest.cpp:61
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
VOID NTAPI KMix_Unload(IN PDRIVER_OBJECT DriverObject)
Definition: kmixer.c:36
#define PNP_DEVICE_NOT_DISABLEABLE
Definition: iotypes.h:969
NTSTATUS NTAPI KMixAllocateDeviceHeader(IN PKMIXER_DEVICE_EXT DeviceExtension)
Definition: filter.c:179
_Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT * NextDeviceObject
Definition: ndis.h:4640
#define IRP_MJ_POWER
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
static const WCHAR L[]
Definition: oid.c:1250
PDRIVER_UNLOAD DriverUnload
Definition: iotypes.h:2180
KSDEVICE_HEADER KsDeviceHeader
Definition: kmixer.h:9
#define IRP_MJ_SYSTEM_CONTROL
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
PDRIVER_ADD_DEVICE AddDevice
Definition: iotypes.h:2112
KSDDKAPI NTSTATUS NTAPI KsDefaultForwardIrp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: api.c:227
NTSTATUS NTAPI DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPathName)
Definition: kmixer.c:104
#define FILE_DEVICE_KS
Definition: winioctl.h:152
NTSTATUS NTAPI KMix_Pnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: kmixer.c:16
#define DPRINT1
Definition: precomp.h:8
PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION+1]
Definition: iotypes.h:2181
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
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
char * cleanup(char *str)
Definition: wpickclick.c:99
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
return STATUS_SUCCESS
Definition: btrfs.c:2938
#define IRP_MN_QUERY_PNP_DEVICE_STATE
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14