ReactOS  0.4.15-dev-506-ga3ec01c
devname.h
Go to the documentation of this file.
1 /*
2  ReactOS Sound System
3  Device naming & creation helper routines
4 
5  Author:
6  Andrew Greenwood (silverblade@reactos.org)
7 
8  History:
9  25 May 2008 - Created
10 */
11 
12 #ifndef ROS_DEVNAME
13 #define ROS_DEVNAME
14 
15 /*
16  ConstructDeviceName
17 
18  This takes a wide-character string containing the device name body (for
19  example, "\\Device\\WaveOut") and appends the device index, forming a
20  string like "\\Device\\WaveOut0", and so on.
21 
22  The resulting device name is a unicode string.
23 */
24 
27  IN PCWSTR Path,
28  IN UCHAR Index,
30 
31 
32 /*
33  FreeUnicodeStringBuffer
34 
35  A small helper routine to free a unicode string buffer, nullify the
36  buffer and reset the lengths to zero.
37 */
38 
39 VOID
41 
42 
43 /*
44  GetDefaultSoundDeviceNameBodies
45 
46  Simply accesses the SoundDeviceNameBodies struct defined earlier and
47  fills the DeviceNameBody and DosDeviceNameBody parameters accordingly.
48 
49  Basically a "safe" way to access the array and perform two assignments
50  with one call, as this will assign the name and DOS name if a valid
51  DeviceType is passed, otherwise it will fail with STATUS_INVALID_PARAMETER.
52 */
53 
57  OUT PCWSTR* DeviceNameBody,
58  OUT PCWSTR* DosDeviceNameBody);
59 
60 
61 /*
62  ConstructSoundDeviceNames
63 
64  Given two wide-character strings and a device index, convert these into
65  two unicode strings with the index appended to the end.
66 
67  This is intended for converting a device name and a DOS device name at
68  the same time.
69 */
70 
73  IN PCWSTR DeviceNameBody,
74  IN PCWSTR DosDeviceNameBody,
75  IN UCHAR Index,
76  OUT PUNICODE_STRING FullDeviceName,
77  OUT PUNICODE_STRING FullDosDeviceName);
78 
79 
80 /*
81  CreateSoundDevice
82 
83  Creates a device and symbolically-links a DOS device to this. Use this
84  when you want to specify alternative device names to the defaults
85  (eg: "\\Device\\MySoundDev" rather than "\\Device\\WaveOut")
86 */
87 
91  IN PCWSTR WideDeviceName,
92  IN PCWSTR WideDosDeviceName,
93  IN UCHAR Index,
94  IN ULONG ExtensionSize,
96 
97 
98 /*
99  CreateSoundDeviceWithDefaultName
100 
101  Similar to CreateSoundDevice, except this uses the default device names
102  ("\\Device\\WaveOut" etc.) based on the DeviceType parameter.
103 */
104 
105 NTSTATUS
109  IN UCHAR Index,
110  IN ULONG ExtensionSize,
112 
113 
114 /*
115  DestroySoundDevice
116 
117  Destroy a device and its symbolic link
118 */
119 NTSTATUS
122  IN PCWSTR WideDosDeviceName,
123  IN UCHAR Index);
124 
125 
126 /*
127  DestroySoundDeviceWithDefaultName
128 
129  Similar to DestroySoundDevice, but operating on one of the
130  default device names.
131 */
132 NTSTATUS
136  IN UCHAR Index);
137 
138 #endif
NTSTATUS CreateSoundDevice(IN PDRIVER_OBJECT DriverObject, IN PCWSTR WideDeviceName, IN PCWSTR WideDosDeviceName, IN UCHAR Index, IN ULONG ExtensionSize, OUT PDEVICE_OBJECT *DeviceObject)
Definition: devname.c:261
const uint16_t * PCWSTR
Definition: typedefs.h:56
#define IN
Definition: typedefs.h:39
VOID FreeUnicodeStringBuffer(IN PUNICODE_STRING String)
Definition: devname.c:142
DeviceType
Definition: mmdrv.h:41
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS DestroySoundDeviceWithDefaultName(IN PDEVICE_OBJECT DeviceObject, IN UCHAR DeviceType, IN UCHAR Index)
Definition: devname.c:445
static WCHAR String[]
Definition: stringtable.c:55
WCHAR DeviceName[]
Definition: adapter.cpp:21
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
NTSTATUS GetDefaultSoundDeviceNameBodies(IN UCHAR DeviceType, OUT PCWSTR *DeviceNameBody, OUT PCWSTR *DosDeviceNameBody)
Definition: devname.c:167
NTSTATUS ConstructDeviceName(IN PCWSTR Path, IN UCHAR Index, OUT PUNICODE_STRING DeviceName)
Definition: devname.c:73
static const UCHAR Index[8]
Definition: usbohci.c:18
NTSTATUS DestroySoundDevice(IN PDEVICE_OBJECT DeviceObject, IN PCWSTR WideDosDeviceName, IN UCHAR Index)
Definition: devname.c:402
unsigned char UCHAR
Definition: xmlstorage.h:181
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1569
PRTL_UNICODE_STRING_BUFFER Path
#define OUT
Definition: typedefs.h:40
NTSTATUS ConstructSoundDeviceNames(IN PCWSTR DeviceNameBody, IN PCWSTR DosDeviceNameBody, IN UCHAR Index, OUT PUNICODE_STRING FullDeviceName, OUT PUNICODE_STRING FullDosDeviceName)
Definition: devname.c:207
unsigned int ULONG
Definition: retypes.h:1
NTSTATUS CreateSoundDeviceWithDefaultName(IN PDRIVER_OBJECT DriverObject, IN UCHAR DeviceType, IN UCHAR Index, IN ULONG ExtensionSize, OUT PDEVICE_OBJECT *DeviceObject)
Definition: devname.c:349