|
|
1.1 root 1:
2: /*++
3:
4: Copyright (c) 1992 Microsoft Corporation
5:
6: Module Name:
7:
8: auxout.c
9:
10: Abstract:
11:
12: This module contains code for aux control which is non
13: hardware specific.
14:
15: Author:
16:
17: Robin Speed (RobinSp) 1-Nov-1992
18:
19: Environment:
20:
21: Kernel mode
22:
23: Revision History:
24:
25: --*/
26:
27: #include <soundlib.h>
28:
29:
30: NTSTATUS
31: SoundAuxDispatch(
32: IN OUT PLOCAL_DEVICE_INFO pLDI,
33: IN PIRP pIrp,
34: IN PIO_STACK_LOCATION IrpStack
35: )
36: /*++
37:
38: Routine Description:
39:
40: AUX IOCTL call dispatcher
41:
42: Arguments:
43:
44: pLDI - Pointer to local device data
45: pIrp - Pointer to IO request packet
46: IrpStack - Pointer to current stack location
47:
48: Return Value:
49:
50: Return status from dispatched routine
51:
52: --*/
53: {
54: NTSTATUS Status;
55:
56: switch (IrpStack->MajorFunction) {
57: case IRP_MJ_CREATE:
58: Status = STATUS_SUCCESS;
59: break;
60:
61: case IRP_MJ_CLOSE:
62:
63: Status = STATUS_SUCCESS;
64:
65: break;
66:
67:
68: case IRP_MJ_DEVICE_CONTROL:
69:
70: //
71: // Dispatch the IOCTL function
72: //
73:
74: Status = STATUS_INTERNAL_ERROR;
75:
76: switch (IrpStack->Parameters.DeviceIoControl.IoControlCode) {
77:
78: case IOCTL_AUX_GET_CAPABILITIES:
79: Status = (*pLDI->DeviceInit->DevCapsRoutine)(pLDI, pIrp, IrpStack);
80: break;
81:
82: case IOCTL_AUX_SET_VOLUME:
83:
84: #ifdef MASTERVOLUME
85: //
86: // If this is the master volume device then let everyone else know
87: // (note that not all devices need a master volume because they
88: // may have a master volume control in hardware).
89: //
90:
91: if (NT_SUCCESS(Status) && pLDI->MasterVolume) {
92: //
93: // Loop through all the driver's devices setting their
94: // volume (including the master volume).
95: //
96:
97: PDEVICE_OBJECT pDO;
98: for (pDO = IrpStack->DeviceObject->DriverObject->DeviceObject;
99: pDO != NULL;
100: pDO = pDO->NextDevice) {
101:
102: NTSTATUS StatusCurrent;
103:
104: PLOCAL_DEVICE_INFO pLDICurrent = pDO->DeviceExtension;
105:
106: //
107: // Get the device mutant
108: //
109:
110: KeWaitForSingleObject(pLDICurrent->DeviceMutant,
111: Executive,
112: KernelMode,
113: FALSE, // Not alertable
114: NULL);
115:
116: StatusCurrent =
117: SoundIoctlSetVolume(pLDICurrent, pIrp, IrpStack);
118:
119: KeReleaseMutant(pLDICurrent->DeviceMutant, 0, FALSE, FALSE);
120:
121: //
122: // Return the first error
123: //
124:
125: if (!NT_SUCCESS(StatusCurrent) && NT_SUCCESS(Status)) {
126: Status = StatusCurrent;
127: }
128: }
129: } else {
130: #endif // MASTERVOLUME
131: Status = SoundIoctlSetVolume(pLDI, pIrp, IrpStack);
132: #ifdef MASTERVOLUME
133: }
134: #endif // MASTERVOLUME
135:
136: break;
137:
138: case IOCTL_AUX_GET_VOLUME:
139: Status = SoundIoctlGetVolume(pLDI, pIrp, IrpStack);
140: break;
141:
142: case IOCTL_SOUND_GET_CHANGED_VOLUME:
143: Status = SoundIoctlGetChangedVolume(pLDI, pIrp, IrpStack);
144: break;
145:
146: default:
147: dprintf2(("Unimplemented IOCTL (%08lXH) requested", IrpStack->Parameters.DeviceIoControl.IoControlCode));
148: Status = STATUS_NOT_IMPLEMENTED;
149: break;
150: }
151: break;
152:
153: case IRP_MJ_CLEANUP:
154: Status = STATUS_SUCCESS;
155: break;
156:
157:
158: default:
159: dprintf1(("Unimplemented major function requested: %08lXH", IrpStack->MajorFunction));
160: Status = STATUS_NOT_IMPLEMENTED;
161: break;
162: }
163:
164: return Status;
165: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.