#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winioctl.h>
#include "mmioctl.h"
#include "mmddk.h"
Go to the source code of this file.
|
BOOL | NotifyClient (SessionInfo *session_info, DWORD message, DWORD_PTR parameter1, DWORD_PTR parameter2) |
|
MMRESULT | ErrorToMmResult (UINT error_code) |
|
MMRESULT | CobbleDeviceName (DeviceType device_type, UINT device_id, PWCHAR out_device_name) |
|
MMRESULT | OpenKernelDevice (DeviceType device_type, UINT device_id, DWORD access, HANDLE *handle) |
|
VOID | CloseKernelDevice (HANDLE device_handle) |
|
MMRESULT | SetDeviceData (HANDLE device_handle, DWORD ioctl, PBYTE input_buffer, DWORD buffer_size) |
|
MMRESULT | GetDeviceData (HANDLE device_handle, DWORD ioctl, PBYTE output_buffer, DWORD buffer_size) |
|
MMRESULT | CreateSession (DeviceType device_type, UINT device_id, SessionInfo **session_info) |
|
VOID | DestroySession (SessionInfo *session) |
|
SessionInfo * | GetSession (DeviceType device_type, UINT device_id) |
|
MMRESULT | StartSessionThread (SessionInfo *session_info) |
|
MMRESULT | CallSessionThread (SessionInfo *session_info, ThreadFunction function, PVOID thread_parameter) |
|
DWORD | HandleBySessionThread (DWORD_PTR private_handle, DWORD_PTR message, DWORD_PTR parameter) |
|
DWORD | GetDeviceCount (DeviceType device_type) |
|
DWORD | GetDeviceCapabilities (DeviceType device_type, UINT device_id, DWORD_PTR capabilities, DWORD capabilities_size) |
|
DWORD | OpenDevice (DeviceType device_type, UINT device_id, PVOID open_descriptor, DWORD flags, DWORD_PTR private_handle) |
|
DWORD | CloseDevice (DWORD_PTR private_handle) |
|
DWORD | PauseDevice (DWORD private_handle) |
|
DWORD | RestartDevice (DWORD private_handle) |
|
DWORD | ResetDevice (DWORD private_handle) |
|
DWORD | GetPosition (DWORD private_handle, PMMTIME time, DWORD time_size) |
|
DWORD | BreakLoop (DWORD private_handle) |
|
DWORD | QueryWaveFormat (DeviceType device_type, PVOID lpFormat) |
|
DWORD | WriteWaveBuffer (DWORD_PTR private_handle, PWAVEHDR wave_header, DWORD wave_header_size) |
|
DWORD | WaveThread (LPVOID parameter) |
|
VOID | PerformWaveIO (SessionInfo *session_info) |
|
◆ ASSERT
◆ DRVM_INVALID
#define DRVM_INVALID 0xFFFFFFFF |
◆ DRVM_TERMINATE
#define DRVM_TERMINATE 0xFFFFFFFE |
◆ IsAuxDevice
◆ IsMidiDevice
◆ IsWaveDevice
◆ MAX_BUFFER_SIZE
#define MAX_BUFFER_SIZE 1048576 |
◆ MAX_DEVICE_NAME_LENGTH
#define MAX_DEVICE_NAME_LENGTH 256 |
◆ MAX_DEVICES
◆ MAX_WAVE_BYTES
#define MAX_WAVE_BYTES 1048576 |
◆ WHDR_COMPLETE
#define WHDR_COMPLETE 0x80000000 |
◆ WIN32_NO_STATUS
◆ LoopInfo
◆ SessionInfo
◆ ThreadFunction
◆ ThreadInfo
◆ DeviceType
Initial value:{
PWDF_DRIVER_GLOBALS WdfDriverGlobals
_In_ PWDFDEVICE_INIT DeviceInit
Enumerator |
---|
WaveOutDevice | |
WaveInDevice | |
MidiOutDevice | |
MidiInDevice | |
AuxDevice | |
Definition at line 41 of file mmdrv.h.
◆ WaveState
Enumerator |
---|
WavePlaying | |
WaveStopped | |
WaveReset | |
WaveRestart | |
Definition at line 89 of file mmdrv.h.
◆ BreakLoop()
◆ CallSessionThread()
◆ CloseDevice()
Definition at line 239 of file common.c.
VOID DestroySession(SessionInfo *session)
void CloseKernelDevice(HANDLE device_handle)
HANDLE kernel_device_handle
MMRESULT CallSessionThread(SessionInfo *session_info, ThreadFunction function, PVOID thread_parameter)
◆ CloseKernelDevice()
◆ CobbleDeviceName()
Definition at line 28 of file kernel.c.
67 base_device_name +
strlen(
"\\Device"),
ACPI_SIZE strlen(const char *String)
#define WAVE_IN_DEVICE_NAME
#define MIDI_IN_DEVICE_NAME
#define WAVE_OUT_DEVICE_NAME
#define MMSYSERR_BADDEVICEID
#define MIDI_OUT_DEVICE_NAME
#define MAX_DEVICE_NAME_LENGTH
Referenced by OpenKernelDevice().
◆ CreateSession()
Definition at line 63 of file session.c.
78 DPRINT(
"Already allocated session\n");
85 if ( ! *session_info )
87 DPRINT(
"Failed to allocate mem for session info\n");
93 (*session_info)->device_id = device_id;
SessionInfo * GetSession(DeviceType device_type, UINT device_id)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define MMSYSERR_ALLOCATED
SessionInfo * session_list
CRITICAL_SECTION session_lock
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
Referenced by CsrSbCreateSession(), OpenDevice(), and SmpLoadSubSystem().
◆ DestroySession()
Definition at line 113 of file session.c.
128 while ( session_node )
138 session_prev = session_node;
139 session_node = session_node->
next;
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
struct _SessionInfo * next
SessionInfo * session_list
CRITICAL_SECTION session_lock
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define HeapFree(x, y, z)
Referenced by CloseDevice(), and OpenDevice().
◆ ErrorToMmResult()
Definition at line 22 of file common.c.
#define ERROR_INVALID_FUNCTION
#define ERROR_NOT_ENOUGH_MEMORY
#define ERROR_ACCESS_DENIED
#define MMSYSERR_ALLOCATED
#define MMSYSERR_NOTSUPPORTED
#define MMSYSERR_BADDEVICEID
#define MMSYSERR_INVALPARAM
#define ERROR_NOT_SUPPORTED
#define ERROR_INSUFFICIENT_BUFFER
Referenced by GetDeviceCapabilities(), GetDeviceData(), and OpenKernelDevice().
◆ GetDeviceCapabilities()
Definition at line 84 of file common.c.
94 BOOL device_io_result;
116 DPRINT(
"Failed to open kernel device\n");
131 if ( device_io_result )
#define IsMidiDevice(devicetype)
void CloseKernelDevice(HANDLE device_handle)
DWORD WINAPI GetLastError(VOID)
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
#define IOCTL_MIDI_GET_CAPABILITIES
#define IsAuxDevice(devicetype)
MMRESULT OpenKernelDevice(DeviceType device_type, UINT device_id, DWORD access, HANDLE *handle)
#define MMSYSERR_NOTSUPPORTED
MMRESULT ErrorToMmResult(UINT error_code)
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)
#define IOCTL_WAVE_GET_CAPABILITIES
#define IsWaveDevice(devicetype)
◆ GetDeviceCount()
Definition at line 58 of file common.c.
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
MMRESULT OpenKernelDevice(DeviceType device_type, UINT device_id, DWORD access, HANDLE *handle)
Referenced by auxMessage(), midMessage(), modMessage(), and wodMessage().
◆ GetDeviceData()
Definition at line 152 of file kernel.c.
159 DWORD bytes_returned;
163 DPRINT(
"GetDeviceData\n");
165 memset(&overlap, 0,
sizeof(overlap));
DWORD WINAPI WaitForSingleObjectEx(IN HANDLE hHandle, IN DWORD dwMilliseconds, IN BOOL bAlertable)
BOOL WINAPI GetOverlappedResult(IN HANDLE hFile, IN LPOVERLAPPED lpOverlapped, OUT LPDWORD lpNumberOfBytesTransferred, IN BOOL bWait)
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
DWORD WINAPI GetLastError(VOID)
static void buffer_size(GLcontext *ctx, GLuint *width, GLuint *height)
#define WAIT_IO_COMPLETION
#define success(from, fromstr, to, tostr)
MMRESULT ErrorToMmResult(UINT error_code)
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)
◆ GetPosition()
◆ GetSession()
Definition at line 30 of file session.c.
39 while ( session_info )
42 ( session_info->
device_id == device_id ) )
48 session_info = session_info->
next;
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
struct _SessionInfo * next
SessionInfo * session_list
CRITICAL_SECTION session_lock
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
Referenced by CreateSession().
◆ HandleBySessionThread()
Definition at line 240 of file session.c.
MMRESULT CallSessionThread(SessionInfo *session_info, ThreadFunction function, PVOID thread_parameter)
Referenced by wodMessage().
◆ NotifyClient()
Definition at line 25 of file mme.c.
BOOL WINAPI DriverCallback(DWORD dwCallBack, UINT uFlags, HDRVR hDev, UINT wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2)
Referenced by OpenDevice(), and ReturnCompletedBuffers().
◆ OpenDevice()
Definition at line 153 of file common.c.
169 DPRINT(
"Couldn't allocate session info\n");
180 DPRINT(
"Failed to open kernel device\n");
200 DPRINT(
"Only wave devices are supported at present!\n");
GLenum GLuint GLenum GLsizei const GLchar * message
VOID DestroySession(SessionInfo *session)
BOOL NotifyClient(SessionInfo *session_info, DWORD message, DWORD_PTR parameter1, DWORD_PTR parameter2)
MMRESULT CreateSession(DeviceType device_type, UINT device_id, SessionInfo **session_info)
MMRESULT OpenKernelDevice(DeviceType device_type, UINT device_id, DWORD access, HANDLE *handle)
#define MMSYSERR_NOTSUPPORTED
HANDLE kernel_device_handle
struct WAVEOPENDESC * LPWAVEOPENDESC
#define IsWaveDevice(devicetype)
MMRESULT StartSessionThread(SessionInfo *session_info)
◆ OpenKernelDevice()
Definition at line 84 of file kernel.c.
static const WCHAR device_name[]
#define INVALID_HANDLE_VALUE
DWORD WINAPI GetLastError(VOID)
MMRESULT ErrorToMmResult(UINT error_code)
IN OUT PVCB OUT PDIRENT OUT PBCB IN BOOLEAN CreateFile
GLuint GLint GLboolean GLint GLenum access
MMRESULT CobbleDeviceName(DeviceType device_type, UINT device_id, PWCHAR out_device_name)
#define FILE_FLAG_OVERLAPPED
#define MAX_DEVICE_NAME_LENGTH
Referenced by GetDeviceCapabilities(), GetDeviceCount(), and OpenDevice().
◆ PauseDevice()
◆ PerformWaveIO()
◆ QueryWaveFormat()
◆ ResetDevice()
◆ RestartDevice()
◆ SetDeviceData()
◆ StartSessionThread()
Definition at line 154 of file session.c.
167 DPRINT(
"Couldn't create thread_ready event\n");
177 DPRINT(
"Couldn't create thread_go event\n");
196 DPRINT(
"Task creation failed\n");
UINT APIENTRY mmTaskCreate(LPTASKCALLBACK lpfn, HANDLE FAR *lph, DWORD dwInst)
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
TASKCALLBACK FAR * LPTASKCALLBACK
DWORD WaveThread(LPVOID parameter)
Referenced by OpenDevice().
◆ WaveThread()
Definition at line 266 of file wave.c.
275 DPRINT(
"Wave processing thread setting ready state\n");
290 DPRINT(
"Wave processing thread woken up\n");
296 DPRINT(
"Processing thread request\n");
303 DPRINT(
"Performing wave I/O\n");
307 DPRINT(
"Wave processing thread sleeping\n");
DWORD WINAPI WaitForSingleObjectEx(IN HANDLE hHandle, IN DWORD dwMilliseconds, IN BOOL bAlertable)
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
HANDLE WINAPI GetCurrentThread(VOID)
VOID PerformWaveIO(SessionInfo *session_info)
#define WAIT_IO_COMPLETION
BOOL WINAPI SetThreadPriority(IN HANDLE hThread, IN int nPriority)
VOID ReturnCompletedBuffers(SessionInfo *session_info)
void MSVCRT() terminate()
#define THREAD_PRIORITY_TIME_CRITICAL
DWORD ProcessSessionThreadRequest(SessionInfo *session_info)
Referenced by StartSessionThread().
◆ WriteWaveBuffer()
Definition at line 372 of file wave.c.
MMRESULT CallSessionThread(SessionInfo *session_info, ThreadFunction function, PVOID thread_parameter)
Referenced by wodMessage().
◆ critical_section