ReactOS  0.4.14-dev-323-g6fe6a88
auxil.c
Go to the documentation of this file.
1 /*
2  *
3  * COPYRIGHT: See COPYING in the top level directory
4  * PROJECT: ReactOS Multimedia
5  * FILE: lib/mmdrv/auxil.c
6  * PURPOSE: Multimedia User Mode Driver
7  * PROGRAMMER: Andrew Greenwood
8  * Aleksey Bragin
9  * UPDATE HISTORY:
10  * Mar 16, 2004: Created skeleton implementation
11  */
12 
13 #include "mmdrv.h"
14 
15 #define NDEBUG
16 #include <debug.h>
17 
18 #include "wave.h"
19 
21  UINT uMessage,
22  DWORD dwUser,
23  DWORD dwParam1,
24  DWORD dwParam2)
25 
26 {
29 
30  DPRINT("auxMessage\n");
31 
32 
33  // the following cases are documented by DDK
34  switch (uMessage)
35  {
36  case AUXDM_GETDEVCAPS:
37  DPRINT("AUXDM_GETDEVCAPS");
38  return GetDeviceCapabilities(dwId, AuxDevice, (LPBYTE)dwParam1, (DWORD)dwParam2);
39 
40  case AUXDM_GETNUMDEVS:
41  DPRINT("AUXDM_GETNUMDEVS");
42  return GetDeviceCount(AuxDevice);
43 
44  case AUXDM_GETVOLUME:
45  DPRINT("AUXDM_GETVOLUME");
46  Result = AuxGetAudio(dwId, (PBYTE) &Volume, sizeof(Volume));
47 
48  if (Result == MMSYSERR_NOERROR)
49  {
50  *(LPDWORD)dwParam1 = (DWORD)MAKELONG(HIWORD(Volume.Left), HIWORD(Volume.Right));
51  }
52  return Result;
53 
54 
55  case AUXDM_SETVOLUME:
56  DPRINT("AUXDM_SETVOLUME");
57 
58  Volume.Right = HIWORD(dwParam1) << 16;
59  Volume.Left = LOWORD(dwParam1) << 16;
60 
61  return AuxSetAudio(dwId, (PBYTE)&Volume, sizeof(Volume));
62 
63  }
64 
65  return MMSYSERR_NOERROR;
66 }
67 
68 
69 DWORD AuxGetAudio(DWORD dwID, PBYTE pVolume, DWORD sizeVolume)
70 {
74 
76  if (Result != MMSYSERR_NOERROR)
77  return Result;
78 
79 
82 
83 
85 
86  return Result;
87  }
88 
89 DWORD AuxSetAudio(DWORD dwID, PBYTE pVolume, DWORD sizeVolume)
90 {
94 
96  if (Result != MMSYSERR_NOERROR)
97  return Result;
98 
99  Result = DeviceIoControl(DeviceHandle, IOCTL_AUX_SET_VOLUME, (LPVOID)pVolume, sizeVolume, NULL, 0,
101 
102 
104 
105  return Result;
106  }
107 
#define CloseHandle
Definition: compat.h:398
#define AUXDM_SETVOLUME
Definition: mmddk.h:185
_Inout_ PUSB_DEVICE_HANDLE DeviceHandle
Definition: hubbusif.h:121
#define IOCTL_AUX_GET_VOLUME
Definition: mmdef.h:82
UINT MMRESULT
Definition: mmsystem.h:962
DWORD AuxSetAudio(DWORD dwID, PBYTE pVolume, DWORD sizeVolume)
Definition: auxil.c:89
#define AUXDM_GETNUMDEVS
Definition: mmddk.h:182
#define IOCTL_AUX_SET_VOLUME
Definition: mmdef.h:81
MMRESULT OpenDevice(DeviceInfo **private_data, MIDIOPENDESC *open_desc, DWORD flags)
Definition: beepmidi.c:264
unsigned char * LPBYTE
Definition: typedefs.h:52
#define MAKELONG(a, b)
Definition: typedefs.h:248
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
void DPRINT(...)
Definition: polytest.cpp:61
DWORD AuxGetAudio(DWORD dwID, PBYTE pVolume, DWORD sizeVolume)
Definition: auxil.c:69
#define AUXDM_GETVOLUME
Definition: mmddk.h:184
DWORD TranslateStatus(void)
Definition: utils.c:30
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
unsigned long DWORD
Definition: ntddk_ex.h:95
#define LPDWORD
Definition: nt_native.h:46
#define AUXDM_GETDEVCAPS
Definition: mmddk.h:183
#define GENERIC_READ
Definition: compat.h:124
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: deviceio.c:136
_In_ FILTER_INFORMATION_CLASS _In_ ULONG _Out_ PULONG BytesReturned
Definition: fltkernel.h:1716
unsigned int UINT
Definition: ndis.h:50
DWORD GetDeviceCount(DeviceType device_type)
Definition: common.c:58
#define HIWORD(l)
Definition: typedefs.h:246
MMRESULT GetDeviceCapabilities(MIDIOUTCAPS *caps)
Definition: beepmidi.c:210
BYTE * PBYTE
Definition: pedump.c:66
#define LOWORD(l)
Definition: pedump.c:82
APIENTRY DWORD auxMessage(UINT dwId, UINT uMessage, DWORD dwUser, DWORD dwParam1, DWORD dwParam2)
Definition: auxil.c:20
#define APIENTRY
Definition: api.h:79