reactos/dll/win32/mmdrv/mme.c

144 lines
4.1 KiB
C
Raw Normal View History

/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Multimedia
* FILE: dll/win32/mmdrv/mme.c
* PURPOSE: Multimedia User Mode Driver (MME Interface)
* PROGRAMMER: Andrew Greenwood
* Aleksey Bragin
* UPDATE HISTORY:
* Jan 14, 2007: Rewritten and tidied up
*/
#include "mmdrv.h"
/*
Sends a message to the client (application), such as WOM_DONE. This
is just a wrapper around DriverCallback which translates the
parameters appropriately.
*/
BOOL
NotifyClient(
SessionInfo* session_info,
DWORD message,
Merge from amd64 branch: [SPIDER] 44002 Fix 64 bit build. (Samuel Serapión) [PAINT] 43858 Fix 64 bit warnings. (Samuel Serapión) [RAPPS] 43906 Fix 64 bit build. (Samuel Serapión) [SNDREC32] 44389 Fix 64 bit build. (Samuel Serapión) [TFTP] 41097 Fix pointer to DWORD cast. (Timo Kreuzer) [COMCTL32] 36172 Build as unicode. (Samuel Serapión) [USERMGR] 41098 Fix 2 POINTER<->DWORD casts. (Timo Kreuzer) [d3d9] 38149 Fix pointer<->ULONG cast. (Timo Kreuzer) 43839 Fix 64 bit Build. (Samuel Serapión) [DSOUND] 40753 Make DSDRIVERDESC.dnDevNode a DWORD_PTR and DSPROPERTY.InstanceId a ULONG_PTR. (Timo Kreuzer) [LSASRV] 44037 Fix 64 bit Build. (Samuel Serapión) [MMDRV] 40125 Fix 64bit build. (Samuel Serapión) [MSGINA] 40993 fix 64bit build (Timo Kreuzer) [NETSHELL] 41001 Don't cast the 1st parameter of InterlockedExchange to volatile void **, but to void ** (Timo Kreuzer) [OPENGL32] 36502 No need to assert an offset thats only used in i386 specific code. (Samuel Serapión) [POWRPROF] 41044 Don't cast NULL to DWORD. (Timo Kreuzer) 43860 Don't cast NULL to an integer type. (Samuel Serapión) [PSAPI] 38150 Fix a cast (Timo Kreuzer) [SHELL32] 38355 Use Get/SetWindowLongPtr (Samuel Serapión) 41047 Get rid of deprecated LargeInteger functions and use native int64 math instead. (Timo Kreuzer) 41048 DialogProc returns INT_PTR and not BOOL. Don't cast a pointer to LONG. Use INT_PTR instead of int for pointer math. (Timo Kreuzer) 41049 Change return type of OpenMRUListW and CreateMRUListW to HANDLE, add a comment that CREATEMRULISTW is already defined differently in explorer_new/undoc.h (Timo Kreuzer) 44601 Fix a prototype. Convert RtlLargeInteger to native int64. Fixes 64bit built. (Timo Kreuzer) [WDMAUD.DRV] 41101 Don't cast DWORD to PVOID, use UlongToPtr instead. (Timo Kreuzer) [WS2_32] 35777 fix ws2_32 spec file (Timo kreuzer) 44044 Fix ws2_32 64bit build (1 of 2) (Samuel Serapión) 44045 Fix ws2_32 64bit build (2 of 2) (Samuel Serapión) [WS2_32_NEW] 44389 Fix 64 bit built. (Samuel Serapión) svn path=/trunk/; revision=44602
2009-12-15 15:16:01 +00:00
DWORD_PTR parameter1,
DWORD_PTR parameter2)
{
return DriverCallback(session_info->callback,
HIWORD(session_info->flags),
session_info->mme_handle,
message,
session_info->app_user_data,
parameter1,
parameter2);
}
/*
MME Driver Entrypoint
Wave Output
*/
DWORD APIENTRY
wodMessage(
Merge from amd64 branch: [SPIDER] 44002 Fix 64 bit build. (Samuel Serapión) [PAINT] 43858 Fix 64 bit warnings. (Samuel Serapión) [RAPPS] 43906 Fix 64 bit build. (Samuel Serapión) [SNDREC32] 44389 Fix 64 bit build. (Samuel Serapión) [TFTP] 41097 Fix pointer to DWORD cast. (Timo Kreuzer) [COMCTL32] 36172 Build as unicode. (Samuel Serapión) [USERMGR] 41098 Fix 2 POINTER<->DWORD casts. (Timo Kreuzer) [d3d9] 38149 Fix pointer<->ULONG cast. (Timo Kreuzer) 43839 Fix 64 bit Build. (Samuel Serapión) [DSOUND] 40753 Make DSDRIVERDESC.dnDevNode a DWORD_PTR and DSPROPERTY.InstanceId a ULONG_PTR. (Timo Kreuzer) [LSASRV] 44037 Fix 64 bit Build. (Samuel Serapión) [MMDRV] 40125 Fix 64bit build. (Samuel Serapión) [MSGINA] 40993 fix 64bit build (Timo Kreuzer) [NETSHELL] 41001 Don't cast the 1st parameter of InterlockedExchange to volatile void **, but to void ** (Timo Kreuzer) [OPENGL32] 36502 No need to assert an offset thats only used in i386 specific code. (Samuel Serapión) [POWRPROF] 41044 Don't cast NULL to DWORD. (Timo Kreuzer) 43860 Don't cast NULL to an integer type. (Samuel Serapión) [PSAPI] 38150 Fix a cast (Timo Kreuzer) [SHELL32] 38355 Use Get/SetWindowLongPtr (Samuel Serapión) 41047 Get rid of deprecated LargeInteger functions and use native int64 math instead. (Timo Kreuzer) 41048 DialogProc returns INT_PTR and not BOOL. Don't cast a pointer to LONG. Use INT_PTR instead of int for pointer math. (Timo Kreuzer) 41049 Change return type of OpenMRUListW and CreateMRUListW to HANDLE, add a comment that CREATEMRULISTW is already defined differently in explorer_new/undoc.h (Timo Kreuzer) 44601 Fix a prototype. Convert RtlLargeInteger to native int64. Fixes 64bit built. (Timo Kreuzer) [WDMAUD.DRV] 41101 Don't cast DWORD to PVOID, use UlongToPtr instead. (Timo Kreuzer) [WS2_32] 35777 fix ws2_32 spec file (Timo kreuzer) 44044 Fix ws2_32 64bit build (1 of 2) (Samuel Serapión) 44045 Fix ws2_32 64bit build (2 of 2) (Samuel Serapión) [WS2_32_NEW] 44389 Fix 64 bit built. (Samuel Serapión) svn path=/trunk/; revision=44602
2009-12-15 15:16:01 +00:00
UINT device_id,
UINT message,
DWORD_PTR private_handle,
DWORD_PTR parameter1,
DWORD_PTR parameter2)
{
switch ( message )
{
/* http://www.osronline.com/ddkx/w98ddk/mmedia_4p80.htm */
case WODM_GETNUMDEVS :
DPRINT("WODM_GETNUMDEVS\n");
return GetDeviceCount(WaveOutDevice);
/* http://www.osronline.com/ddkx/w98ddk/mmedia_4p6h.htm */
case WODM_GETDEVCAPS :
DPRINT("WODM_GETDEVCAPS\n");
return GetDeviceCapabilities(WaveOutDevice,
device_id,
Merge from amd64 branch: [SPIDER] 44002 Fix 64 bit build. (Samuel Serapión) [PAINT] 43858 Fix 64 bit warnings. (Samuel Serapión) [RAPPS] 43906 Fix 64 bit build. (Samuel Serapión) [SNDREC32] 44389 Fix 64 bit build. (Samuel Serapión) [TFTP] 41097 Fix pointer to DWORD cast. (Timo Kreuzer) [COMCTL32] 36172 Build as unicode. (Samuel Serapión) [USERMGR] 41098 Fix 2 POINTER<->DWORD casts. (Timo Kreuzer) [d3d9] 38149 Fix pointer<->ULONG cast. (Timo Kreuzer) 43839 Fix 64 bit Build. (Samuel Serapión) [DSOUND] 40753 Make DSDRIVERDESC.dnDevNode a DWORD_PTR and DSPROPERTY.InstanceId a ULONG_PTR. (Timo Kreuzer) [LSASRV] 44037 Fix 64 bit Build. (Samuel Serapión) [MMDRV] 40125 Fix 64bit build. (Samuel Serapión) [MSGINA] 40993 fix 64bit build (Timo Kreuzer) [NETSHELL] 41001 Don't cast the 1st parameter of InterlockedExchange to volatile void **, but to void ** (Timo Kreuzer) [OPENGL32] 36502 No need to assert an offset thats only used in i386 specific code. (Samuel Serapión) [POWRPROF] 41044 Don't cast NULL to DWORD. (Timo Kreuzer) 43860 Don't cast NULL to an integer type. (Samuel Serapión) [PSAPI] 38150 Fix a cast (Timo Kreuzer) [SHELL32] 38355 Use Get/SetWindowLongPtr (Samuel Serapión) 41047 Get rid of deprecated LargeInteger functions and use native int64 math instead. (Timo Kreuzer) 41048 DialogProc returns INT_PTR and not BOOL. Don't cast a pointer to LONG. Use INT_PTR instead of int for pointer math. (Timo Kreuzer) 41049 Change return type of OpenMRUListW and CreateMRUListW to HANDLE, add a comment that CREATEMRULISTW is already defined differently in explorer_new/undoc.h (Timo Kreuzer) 44601 Fix a prototype. Convert RtlLargeInteger to native int64. Fixes 64bit built. (Timo Kreuzer) [WDMAUD.DRV] 41101 Don't cast DWORD to PVOID, use UlongToPtr instead. (Timo Kreuzer) [WS2_32] 35777 fix ws2_32 spec file (Timo kreuzer) 44044 Fix ws2_32 64bit build (1 of 2) (Samuel Serapión) 44045 Fix ws2_32 64bit build (2 of 2) (Samuel Serapión) [WS2_32_NEW] 44389 Fix 64 bit built. (Samuel Serapión) svn path=/trunk/; revision=44602
2009-12-15 15:16:01 +00:00
parameter1,
parameter2);
/* http://www.osronline.com/ddkx/w98ddk/mmedia_4p85.htm */
case WODM_OPEN :
{
WAVEOPENDESC* open_desc = (WAVEOPENDESC*) parameter1;
DPRINT("WODM_OPEN\n");
if ( parameter2 && WAVE_FORMAT_QUERY )
return QueryWaveFormat(WaveOutDevice, open_desc->lpFormat);
else
return OpenDevice(WaveOutDevice,
device_id,
open_desc,
parameter2,
private_handle);
}
/* http://www.osronline.com/ddkx/w98ddk/mmedia_4p6g.htm */
case WODM_CLOSE :
{
DPRINT("WODM_CLOSE\n");
return CloseDevice(private_handle);
}
/* http://www.osronline.com/ddkx/w98ddk/mmedia_4p9w.htm */
case WODM_WRITE :
{
DPRINT("WODM_WRITE\n");
return WriteWaveBuffer(private_handle,
(PWAVEHDR) parameter1,
parameter2);
}
/* http://www.osronline.com/ddkx/w98ddk/mmedia_4p86.htm */
case WODM_PAUSE :
{
DPRINT("WODM_PAUSE\n");
return HandleBySessionThread(private_handle, message, 0);
}
/* http://www.osronline.com/ddkx/w98ddk/mmedia_4p89.htm */
case WODM_RESTART :
{
DPRINT("WODM_RESTART\n");
return HandleBySessionThread(private_handle, message, 0);
}
/* http://www.osronline.com/ddkx/w98ddk/mmedia_4p88.htm */
case WODM_RESET :
{
DPRINT("WODM_RESET\n");
return HandleBySessionThread(private_handle, message, 0);
}
/* http://www.osronline.com/ddkx/w98ddk/mmedia_4p83.htm */
#if 0
case WODM_GETPOS :
{
DPRINT("WODM_GETPOS\n");
return GetPosition(private_handle,
(PMMTIME) parameter1,
parameter2);
}
#endif
/* http://www.osronline.com/ddkx/w98ddk/mmedia_4p6f.htm */
case WODM_BREAKLOOP :
{
DPRINT("WODM_BREAKLOOP\n");
return HandleBySessionThread(private_handle, message, 0);
}
/* TODO: Others */
}
DPRINT("Unsupported message\n");
return MMSYSERR_NOTSUPPORTED;
}