Author: silverblade
Date: Sun Jul 13 15:48:50 2008
New Revision: 34468
URL:
http://svn.reactos.org/svn/reactos?rev=34468&view=rev
Log:
Made parameter checks macro-based, and added other validation and debugging
code. Basically a code tidy-up with some additional code to prevent/detect
bugs.
Modified:
branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h
branches/silverblade-audio/lib/drivers/sound/mmebuddy/capabilities.c
branches/silverblade-audio/lib/drivers/sound/mmebuddy/devices.c
branches/silverblade-audio/lib/drivers/sound/mmebuddy/instances.c
branches/silverblade-audio/lib/drivers/sound/mmebuddy/kernel.c
branches/silverblade-audio/lib/drivers/sound/mmebuddy/nt4.c
branches/silverblade-audio/lib/drivers/sound/mmebuddy/thread.c
branches/silverblade-audio/lib/drivers/sound/mmebuddy/utility.c
branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/format.c
branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/streamcontrol.c
branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/streaming.c
branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wodMessage.c
Modified: branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/include/react…
==============================================================================
--- branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h [iso-8859-1]
(original)
+++ branches/silverblade-audio/include/reactos/libs/sound/mmebuddy.h [iso-8859-1] Sun Jul
13 15:48:50 2008
@@ -62,12 +62,27 @@
} \
}
+#define TRACE_ENTRY() \
+ TRACE_("entered function\n")
+
+#define TRACE_EXIT(retval) \
+ TRACE_("returning %d (0x%x)\n", (int)retval, (int)retval)
+
#endif
/*
Some memory allocation helper macros
*/
+
+#define AllocateMemory(amount) \
+ AllocateTaggedMemory(0x00000000, amount)
+
+#define FreeMemory(ptr) \
+ FreeTaggedMemory(0x00000000, ptr)
+
+#define AllocateTaggedMemoryFor(tag, thing) \
+ (thing*) AllocateTaggedMemory(tag, sizeof(thing))
#define AllocateMemoryFor(thing) \
(thing*) AllocateMemory(sizeof(thing))
@@ -85,11 +100,30 @@
CopyMemory(dest, source, StringLengthToBytes(WCHAR, wcslen(source)))
+/*
+ Helps find the minimum/maximum of two values
+*/
+
#define MinimumOf(value_a, value_b) \
( value_a < value_b ? value_a : value_b )
#define MaximumOf(value_a, value_b) \
( value_a > value_b ? value_a : value_b )
+
+
+/*
+ Validation
+*/
+
+#define VALIDATE_MMSYS_PARAMETER(parameter_condition) \
+ { \
+ if ( ! (parameter_condition) ) \
+ { \
+ ERR_("Parameter check: %s\n", #parameter_condition); \
+ TRACE_EXIT(MMSYSERR_INVALPARAM); \
+ return MMSYSERR_INVALPARAM; \
+ } \
+ }
struct _SOUND_DEVICE;
@@ -208,6 +242,8 @@
Represents an audio device
*/
+#define SOUND_DEVICE_TAG "SndD"
+
typedef struct _SOUND_DEVICE
{
struct _SOUND_DEVICE* Next;
@@ -221,6 +257,8 @@
/*
Represents an individual instance of an audio device
*/
+
+#define WAVE_STREAM_INFO_TAG "WavS"
typedef struct _WAVE_STREAM_INFO
{
@@ -237,6 +275,9 @@
DWORD BuffersOutstanding;
} WAVE_STREAM_INFO, *PWAVE_STREAM_INFO;
+
+#define SOUND_DEVICE_INSTANCE_TAG "SndI"
+
typedef struct _SOUND_DEVICE_INSTANCE
{
struct _SOUND_DEVICE_INSTANCE* Next;
@@ -465,11 +506,13 @@
*/
PVOID
-AllocateMemory(
+AllocateTaggedMemory(
+ IN DWORD Tag,
IN DWORD Size);
VOID
-FreeMemory(
+FreeTaggedMemory(
+ IN DWORD Tag,
IN PVOID Pointer);
DWORD
@@ -482,6 +525,9 @@
MMRESULT
Win32ErrorToMmResult(IN UINT error_code);
+MMRESULT
+TranslateInternalMmResult(MMRESULT Result);
+
/*
instances.c
@@ -521,7 +567,7 @@
MMRESULT
GetSoundDeviceCapabilities(
- IN PSOUND_DEVICE Device,
+ IN PSOUND_DEVICE SoundDevice,
OUT PUNIVERSAL_CAPS Capabilities);
MMRESULT
Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/capabilities.c
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/mmebuddy/capabilities.c [iso-8859-1]
(original)
+++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/capabilities.c [iso-8859-1] Sun
Jul 13 15:48:50 2008
@@ -17,16 +17,13 @@
MMRESULT
GetSoundDeviceCapabilities(
- IN PSOUND_DEVICE Device,
+ IN PSOUND_DEVICE SoundDevice,
OUT PUNIVERSAL_CAPS Capabilities)
{
- if ( ! Device )
- return MMSYSERR_INVALPARAM;
+ VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) );
+ VALIDATE_MMSYS_PARAMETER( Capabilities );
- if ( ! Capabilities )
- return MMSYSERR_INVALPARAM;
-
- return Device->Functions.GetCapabilities(Device, Capabilities);
+ return SoundDevice->Functions.GetCapabilities(SoundDevice, Capabilities);
}
MMRESULT
@@ -41,13 +38,10 @@
MMRESULT Result;
DWORD BytesReturned;
+ VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) );
+ VALIDATE_MMSYS_PARAMETER( Capabilities );
+
ZeroMemory(Capabilities, sizeof(UNIVERSAL_CAPS));
-
- if ( ! SoundDevice )
- return MMSYSERR_INVALPARAM;
-
- if ( ! Capabilities )
- return MMSYSERR_INVALPARAM;
/* Select appropriate IOCTL and capabilities structure */
switch ( SoundDevice->DeviceType )
@@ -96,7 +90,8 @@
if ( Result != MMSYSERR_NOERROR )
{
- return Result; /* OK? */
+ Result = TranslateInternalMmResult(Result);
+ return Result;
}
/* Call the driver */
Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/devices.c
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/mmebuddy/devices.c [iso-8859-1]
(original)
+++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/devices.c [iso-8859-1] Sun Jul
13 15:48:50 2008
@@ -23,17 +23,27 @@
ULONG SoundDeviceTotals[SOUND_DEVICE_TYPES];
PSOUND_DEVICE SoundDeviceLists[SOUND_DEVICE_TYPES];
+#define DEVICE_TYPE_TO_INDEX(device_type) \
+ ( device_type - MIN_SOUND_DEVICE_TYPE )
+
ULONG
GetSoundDeviceCount(
IN UCHAR DeviceType)
{
+ ULONG Count;
+ TRACE_ENTRY();
+
if ( ! VALID_SOUND_DEVICE_TYPE(DeviceType) )
{
+ TRACE_EXIT(0);
return 0;
}
- return SoundDeviceTotals[DeviceType - MIN_SOUND_DEVICE_TYPE];
+ Count = SoundDeviceTotals[DeviceType - MIN_SOUND_DEVICE_TYPE];
+
+ TRACE_EXIT(Count);
+ return Count;
}
@@ -42,6 +52,8 @@
IN PSOUND_DEVICE Device,
IN PMMFUNCTION_TABLE SourceFunctionTable)
{
+ TRACE_ENTRY();
+
Device->Functions.Constructor = DefaultInstanceConstructor;
Device->Functions.Destructor = DefaultInstanceDestructor;
@@ -56,7 +68,10 @@
Device->Functions.RestartWaveDevice = DefaultRestartWaveDevice;
if ( ! SourceFunctionTable )
+ {
+ TRACE_EXIT(0);
return;
+ }
/* If we get here, the function table is being over-ridden */
@@ -107,6 +122,8 @@
Device->Functions.RestartWaveDevice =
SourceFunctionTable->RestartWaveDevice;
}
+
+ TRACE_EXIT(0);
}
@@ -119,10 +136,13 @@
PSOUND_DEVICE NewDevice;
UCHAR TypeIndex;
+ TRACE_ENTRY();
+
TRACE_("Adding a sound device to list %d\n", DeviceType);
if ( ! VALID_SOUND_DEVICE_TYPE(DeviceType) )
{
+ TRACE_EXIT(FALSE);
return FALSE;
}
@@ -136,6 +156,7 @@
if ( ! NewDevice )
{
+ TRACE_EXIT(FALSE);
return FALSE;
}
@@ -153,6 +174,7 @@
{
FreeMemory(NewDevice);
/*HeapFree(GetProcessHeap(), 0, NewDevice);*/
+ TRACE_EXIT(FALSE);
return FALSE;
}
@@ -189,6 +211,7 @@
++ SoundDeviceTotals[TypeIndex];
TRACE_("Now %d devices of type %d\n", (int) SoundDeviceTotals[TypeIndex],
DeviceType);
+ TRACE_EXIT(TRUE);
return TRUE;
}
@@ -198,13 +221,13 @@
IN PSOUND_DEVICE SoundDevice)
{
ULONG TypeIndex;
+ BOOLEAN Done = FALSE;
PSOUND_DEVICE CurrentDevice = NULL;
PSOUND_DEVICE PreviousDevice = NULL;
/*TRACE_("Removing a sound device from list %d\n", DeviceType);*/
- if ( ! SoundDevice )
- return MMSYSERR_INVALPARAM;
+ VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) );
TypeIndex = SoundDevice->DeviceType - MIN_SOUND_DEVICE_TYPE;
@@ -217,6 +240,7 @@
if ( SoundDeviceLists[TypeIndex] == SoundDevice )
{
SoundDeviceLists[TypeIndex] = SoundDevice->Next;
+ Done = TRUE;
}
else
{
@@ -230,6 +254,7 @@
{
ASSERT(PreviousDevice != NULL);
PreviousDevice->Next = CurrentDevice->Next;
+ Done = TRUE;
break;
}
@@ -239,10 +264,13 @@
}
}
+ ASSERT(Done);
+
/* Free the memory associated with the device info */
FreeMemory(SoundDevice->DevicePath);
FreeMemory(SoundDevice);
+ TRACE_EXIT(MMSYSERR_NOERROR);
return MMSYSERR_NOERROR;;
}
@@ -251,15 +279,14 @@
RemoveSoundDevices(
IN UCHAR DeviceType)
{
+ MMRESULT Result;
PSOUND_DEVICE CurrentDevice;
+ TRACE_ENTRY();
+
TRACE_("Emptying device list for device type %d\n", DeviceType);
- if ( ! VALID_SOUND_DEVICE_TYPE(DeviceType) )
- {
- ERR_("Invalid device type - %d\n", DeviceType);
- return MMSYSERR_INVALPARAM;
- }
+ VALIDATE_MMSYS_PARAMETER( VALID_SOUND_DEVICE_TYPE(DeviceType) );
/*
Clean out the device list. This works by repeatedly removing the
@@ -268,13 +295,15 @@
while ( (CurrentDevice =
SoundDeviceLists[DeviceType - MIN_SOUND_DEVICE_TYPE]) )
{
- RemoveSoundDevice(CurrentDevice);
+ Result = RemoveSoundDevice(CurrentDevice);
+ ASSERT(Result == MMSYSERR_NOERROR);
}
/* Reset the list content and item count */
SoundDeviceLists[DeviceType - MIN_SOUND_DEVICE_TYPE] = NULL;
SoundDeviceTotals[DeviceType - MIN_SOUND_DEVICE_TYPE] = 0;
+ TRACE_EXIT(MMSYSERR_NOERROR);
return MMSYSERR_NOERROR;
}
@@ -283,21 +312,54 @@
RemoveAllSoundDevices()
{
ULONG i;
-
- TRACE_("Emptying all device lists\n");
+ TRACE_ENTRY();
+
+ TRACE_("RemoveAllSoundDevices\n");
for ( i = MIN_SOUND_DEVICE_TYPE; i <= MAX_SOUND_DEVICE_TYPE; ++ i )
{
RemoveSoundDevices(i);
}
+
+ TRACE_EXIT(0);
}
BOOLEAN
IsValidSoundDevice(
IN PSOUND_DEVICE SoundDevice)
{
- /* TODO */
- return ( SoundDevice != NULL );
+ UCHAR DeviceType;
+ PSOUND_DEVICE CurrentDevice;
+
+ /* TRACE_ENTRY(); */
+
+ if ( ! SoundDevice )
+ {
+ TRACE_EXIT(FALSE);
+ return FALSE;
+ }
+
+ for ( DeviceType = MIN_SOUND_DEVICE_TYPE;
+ DeviceType <= MAX_SOUND_DEVICE_TYPE;
+ ++DeviceType )
+ {
+ CurrentDevice = SoundDeviceLists[DEVICE_TYPE_TO_INDEX(DeviceType)];
+
+ while ( CurrentDevice )
+ {
+ if ( CurrentDevice == SoundDevice )
+ {
+ /* TRACE_EXIT(TRUE); */
+ return TRUE;
+ }
+
+ CurrentDevice = CurrentDevice->Next;
+ }
+ }
+
+ /* Not found in list */
+ TRACE_EXIT(FALSE);
+ return FALSE;
}
@@ -310,14 +372,16 @@
ULONG Count = 0;
PSOUND_DEVICE CurrentDevice = NULL;
- if ( ! VALID_SOUND_DEVICE_TYPE(DeviceType) )
- return MMSYSERR_INVALPARAM;
+ TRACE_ENTRY();
+
+ VALIDATE_MMSYS_PARAMETER( VALID_SOUND_DEVICE_TYPE(DeviceType) );
+ VALIDATE_MMSYS_PARAMETER( Device );
if ( DeviceIndex >= SoundDeviceTotals[DeviceType - MIN_SOUND_DEVICE_TYPE] )
+ {
+ TRACE_EXIT(MMSYSERR_BADDEVICEID);
return MMSYSERR_BADDEVICEID;
-
- if ( ! Device )
- return MMSYSERR_INVALPARAM;
+ }
/*
We know by now that a device at the index should exist
@@ -332,6 +396,7 @@
CurrentDevice = CurrentDevice->Next;
}
+ TRACE_EXIT(MMSYSERR_NOERROR);
return MMSYSERR_NOERROR;
}
@@ -341,15 +406,15 @@
IN PSOUND_DEVICE SoundDevice,
OUT LPWSTR* DevicePath)
{
- if ( ! SoundDevice )
- return MMSYSERR_INVALPARAM;
-
- if ( ! DevicePath )
- return MMSYSERR_INVALPARAM;
+ TRACE_ENTRY();
+
+ VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) );
+ VALIDATE_MMSYS_PARAMETER( DevicePath );
MessageBox(0, SoundDevice->DevicePath, L"Foo", MB_TASKMODAL | MB_OK);
*DevicePath = SoundDevice->DevicePath;
+ TRACE_EXIT(MMSYSERR_NOERROR);
return MMSYSERR_NOERROR;
}
@@ -359,14 +424,14 @@
IN PSOUND_DEVICE SoundDevice,
OUT PUCHAR DeviceType)
{
- if ( ! SoundDevice )
- return MMSYSERR_INVALPARAM;
-
- if ( ! DeviceType )
- return MMSYSERR_INVALPARAM;
+ TRACE_ENTRY();
+
+ VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) );
+ VALIDATE_MMSYS_PARAMETER( DeviceType );
*DeviceType = SoundDevice->DeviceType;
+ TRACE_EXIT(MMSYSERR_NOERROR);
return MMSYSERR_NOERROR;
}
@@ -375,14 +440,14 @@
IN PSOUND_DEVICE SoundDevice,
OUT PMMFUNCTION_TABLE* FunctionTable)
{
- if ( ! SoundDevice )
- return MMSYSERR_INVALPARAM;
-
- if ( ! FunctionTable )
- return MMSYSERR_INVALPARAM;
+ TRACE_ENTRY();
+
+ VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) );
+ VALIDATE_MMSYS_PARAMETER( FunctionTable );
*FunctionTable = &SoundDevice->Functions;
+ TRACE_EXIT(MMSYSERR_NOERROR);
return MMSYSERR_NOERROR;
}
@@ -400,7 +465,7 @@
DWORD AccessRights = GENERIC_READ;
MMRESULT Result;
- TRACE_("Default instance ctor");
+ TRACE_ENTRY();
ASSERT(SoundDeviceInstance != NULL);
GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice);
@@ -408,10 +473,12 @@
/* If this fails, we have an internal error somewhere */
Result = GetSoundDeviceType(SoundDevice, &DeviceType);
+ ASSERT(Result == MMSYSERR_NOERROR);
if ( Result != MMSYSERR_NOERROR )
{
- ASSERT(Result != MMSYSERR_NOERROR);
- return MMSYSERR_ERROR;
+ Result = TranslateInternalMmResult(Result);
+ TRACE_EXIT(Result);
+ return Result;
}
if ( DeviceType == WAVE_OUT_DEVICE_TYPE )
@@ -420,11 +487,15 @@
Result = OpenKernelSoundDevice(SoundDevice,
AccessRights,
&SoundDeviceInstance->Handle);
+
if ( Result != MMSYSERR_NOERROR )
+ {
+ Result = TranslateInternalMmResult(Result);
+ TRACE_EXIT(MMSYSERR_NOERROR);
return Result;
-
- TRACE_("Returning from default ctor");
-
+ }
+
+ TRACE_EXIT(MMSYSERR_NOERROR);
return MMSYSERR_NOERROR;
}
@@ -436,13 +507,14 @@
PSOUND_DEVICE SoundDevice;
MMRESULT Result;
- TRACE_("Default instance dtor");
+ TRACE_ENTRY();
ASSERT(SoundDeviceInstance);
GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice);
ASSERT(SoundDevice);
Result = CloseKernelSoundDevice(SoundDevice);
-
ASSERT(Result == MMSYSERR_NOERROR);
-}
+
+ TRACE_EXIT(0);
+}
Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/instances.c
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/mmebuddy/instances.c [iso-8859-1]
(original)
+++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/instances.c [iso-8859-1] Sun Jul
13 15:48:50 2008
@@ -62,6 +62,8 @@
MMRESULT Result;
PSOUND_DEVICE_INSTANCE CurrentInstance = NULL;
+ TRACE_ENTRY();
+
ASSERT(SoundDevice != NULL);
ASSERT(SoundDeviceInstance != NULL);
ASSERT(SoundDeviceInstance->Device == NULL);
@@ -75,12 +77,18 @@
}
else if ( IS_MIDI_DEVICE_TYPE(SoundDevice->DeviceType) )
{
+ /* TODO ... */
+ ASSERT(FALSE);
}
else if ( IS_MIXER_DEVICE_TYPE(SoundDevice->DeviceType) )
{
+ /* TODO ... */
+ ASSERT(FALSE);
}
else if ( IS_AUX_DEVICE_TYPE(SoundDevice->DeviceType) )
{
+ /* TODO ... */
+ ASSERT(FALSE);
}
else
{
@@ -111,6 +119,8 @@
CurrentInstance = CurrentInstance->Next;
}
}
+
+ TRACE_EXIT(0);
}
VOID
@@ -119,6 +129,8 @@
{
PSOUND_DEVICE SoundDevice;
PSOUND_DEVICE_INSTANCE CurrentInstance;
+
+ TRACE_ENTRY();
ASSERT(SoundDeviceInstance != NULL);
ASSERT(SoundDeviceInstance->Device != NULL);
@@ -145,6 +157,8 @@
/* This is actually the one before the one we want to remove */
CurrentInstance->Next = SoundDeviceInstance->Next;
}
+
+ TRACE_EXIT(0);
}
@@ -160,15 +174,20 @@
PSOUND_DEVICE_INSTANCE CreatedInstance = NULL;
MMRESULT Result;
- if ( ! SoundDevice )
- return MMSYSERR_INVALPARAM;
-
- if ( ! SoundDeviceInstance )
- return MMSYSERR_INVALPARAM;
+ TRACE_ENTRY();
+
+ TRACE_("Creating instance of PSOUND_DEVICE %p\n", SoundDevice);
+
+ VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) );
+ VALIDATE_MMSYS_PARAMETER( SoundDeviceInstance );
CreatedInstance = AllocateSoundDeviceInstance();
+
if ( ! CreatedInstance )
+ {
+ TRACE_EXIT(MMSYSERR_NOMEM);
return MMSYSERR_NOMEM;
+ }
/* Add the new instance to the device's instance list */
ListSoundDeviceInstance(SoundDevice, CreatedInstance);
@@ -183,10 +202,14 @@
FreeSoundDeviceInstance(CreatedInstance);
CreatedInstance = NULL;
//DestroySoundDeviceInstance(CreatedInstance);
+
+ Result = TranslateInternalMmResult(Result);
}
/* Fill the output parameter with this */
*SoundDeviceInstance = CreatedInstance;
+
+ TRACE_EXIT(Result);
return Result;
}
@@ -199,14 +222,14 @@
ASSERT(SoundDeviceInstance);
ASSERT(SoundDevice);
- if ( ! SoundDeviceInstance )
- return MMSYSERR_INVALPARAM;
-
- if ( ! SoundDevice )
- return MMSYSERR_INVALPARAM;
+ TRACE_ENTRY();
+
+ VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) );
+ VALIDATE_MMSYS_PARAMETER( SoundDevice );
*SoundDevice = SoundDeviceInstance->Device;
+ TRACE_EXIT(MMSYSERR_NOERROR);
return MMSYSERR_NOERROR;
}
@@ -216,8 +239,9 @@
{
PSOUND_DEVICE SoundDevice = NULL;
- if ( ! SoundDeviceInstance )
- return MMSYSERR_INVALPARAM;
+ TRACE_ENTRY();
+
+ VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) );
SoundDevice = SoundDeviceInstance->Device;
@@ -233,6 +257,7 @@
FreeSoundDeviceInstance(SoundDeviceInstance);
/*HeapFree(GetProcessHeap(), 0, Instance);*/
+ TRACE_EXIT(MMSYSERR_NOERROR);
return MMSYSERR_NOERROR;
}
@@ -243,15 +268,18 @@
PSOUND_DEVICE_INSTANCE CurrentInstance = NULL;
MMRESULT Result;
- if ( ! SoundDevice )
- return MMSYSERR_INVALPARAM;
+ TRACE_ENTRY();
+
+ VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) );
/* Just munch away at the first item repeatedly */
while ( (CurrentInstance = SoundDevice->FirstInstance) )
{
Result = DestroySoundDeviceInstance(CurrentInstance);
- }
-
+ ASSERT(Result == MMSYSERR_NOERROR);
+ }
+
+ TRACE_EXIT(MMSYSERR_NOERROR);
return MMSYSERR_NOERROR;
}
@@ -259,8 +287,21 @@
IsValidSoundDeviceInstance(
IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance)
{
- /* TODO - Once multiple instances are supported */
- return ( SoundDeviceInstance != NULL );
+ /* TRACE_ENTRY(); */
+
+ if ( ! SoundDeviceInstance )
+ {
+ TRACE_EXIT(FALSE);
+ return FALSE;
+ }
+
+ /* Now what? */
+ return TRUE;
+
+ /* TRACE_EXIT(12345678); */
+
+ TRACE_EXIT(FALSE);
+ return ( FALSE );
}
MMRESULT
@@ -271,16 +312,22 @@
MMRESULT Result;
PSOUND_DEVICE SoundDevice;
- if ( ! IsValidSoundDeviceInstance(SoundDeviceInstance) )
- return MMSYSERR_INVALPARAM;
-
- if ( ! DeviceType )
- return MMSYSERR_INVALPARAM;
+ TRACE_ENTRY();
+
+ VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) );
+ VALIDATE_MMSYS_PARAMETER( DeviceType );
Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice);
if ( Result != MMSYSERR_NOERROR )
+ {
+ TRACE_EXIT(Result);
return Result;
-
- return GetSoundDeviceType(SoundDevice, DeviceType);
-}
+ }
+
+ Result = GetSoundDeviceType(SoundDevice, DeviceType);
+ Result = TranslateInternalMmResult(Result);
+
+ TRACE_EXIT(Result);
+ return Result;
+}
Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/kernel.c
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/mmebuddy/kernel.c [iso-8859-1]
(original)
+++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/kernel.c [iso-8859-1] Sun Jul 13
15:48:50 2008
@@ -24,17 +24,8 @@
{
DWORD OpenFlags = 0;
- if ( ! Handle )
- {
- ERR_("No handle ptr\n");
- return MMSYSERR_INVALPARAM;
- }
-
- if ( ! DeviceName )
- {
- ERR_("No device name\n");
- return MMSYSERR_INVALPARAM;
- }
+ VALIDATE_MMSYS_PARAMETER( Handle );
+ VALIDATE_MMSYS_PARAMETER( DeviceName );
if ( AccessRights != GENERIC_READ )
{
@@ -68,21 +59,14 @@
{
MMRESULT Result;
- if ( ! SoundDevice )
- {
- ERR_("No sound device specified");
- return MMSYSERR_INVALPARAM;
- }
-
- if ( ! Handle )
- {
- return MMSYSERR_INVALPARAM;
- }
+ VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) );
+ VALIDATE_MMSYS_PARAMETER( Handle );
Result = OpenKernelSoundDeviceByName(SoundDevice->DevicePath,
AccessRights,
Handle);
+ Result = TranslateInternalMmResult(Result);
return Result;
}
@@ -112,8 +96,7 @@
BOOLEAN IoResult = FALSE;
DWORD AccessRights = GENERIC_READ;
- if ( Handle == INVALID_HANDLE_VALUE )
- return MMSYSERR_INVALPARAM;
+ VALIDATE_MMSYS_PARAMETER( Handle != INVALID_HANDLE_VALUE );
/* Determine if we actually need to write stuff */
if ( InBuffer != NULL )
@@ -245,18 +228,16 @@
/* TODO: move somewhere else */
MMRESULT
WriteSoundDeviceBuffer(
- PSOUND_DEVICE_INSTANCE SoundDeviceInstance,
- LPVOID Buffer,
- DWORD BufferSize,
- LPOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine,
- LPOVERLAPPED Overlapped)
-{
- if ( ( ! SoundDeviceInstance ) || ( ! Buffer ) || ( BufferSize == 0 ) )
- {
- ERR_("Invalid parameter in WriteSoundDeviceBuffer!\n");
- return MMSYSERR_INVALPARAM;
- }
-
+ IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance,
+ IN LPVOID Buffer,
+ IN DWORD BufferSize,
+ IN LPOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine,
+ IN LPOVERLAPPED Overlapped)
+{
+ VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) );
+ VALIDATE_MMSYS_PARAMETER( Buffer );
+ VALIDATE_MMSYS_PARAMETER( BufferSize > 0 );
+
/*wsprintf(msg, L"Writing to handle %x",
SoundDeviceInstance->Device->Handle);*/
/*SOUND_DEBUG(msg);*/
Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/nt4.c
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/mmebuddy/nt4.c [iso-8859-1] (original)
+++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/nt4.c [iso-8859-1] Sun Jul 13
15:48:50 2008
@@ -29,11 +29,8 @@
ULONG KeyLength;
PWCHAR ParametersKeyName;
- if ( ! ServiceName )
- return MMSYSERR_INVALPARAM;
-
- if ( ! KeyHandle )
- return MMSYSERR_INVALPARAM;
+ VALIDATE_MMSYS_PARAMETER( ServiceName );
+ VALIDATE_MMSYS_PARAMETER( KeyHandle );
/* Work out how long the string will be */
KeyLength = wcslen(REG_SERVICES_KEY_NAME_U) + 1
@@ -85,11 +82,8 @@
DWORD PathLength;
PWCHAR RegPath;
- if ( ! ServiceName )
- return MMSYSERR_INVALPARAM;
-
- if ( ! KeyHandle )
- return MMSYSERR_INVALPARAM;
+ VALIDATE_MMSYS_PARAMETER( ServiceName );
+ VALIDATE_MMSYS_PARAMETER( KeyHandle );
/*
Work out the space required to hold the path:
@@ -156,14 +150,11 @@
HKEY Key;
DWORD KeyIndex = 0;
- /* Validate parameters */
- if ( ! ServiceName )
- return MMSYSERR_INVALPARAM;
+ VALIDATE_MMSYS_PARAMETER( ServiceName );
/* Device type zero means "all" */
- if ( ( ! VALID_SOUND_DEVICE_TYPE(DeviceType) ) &&
- ( DeviceType != 0 ) )
- return MMSYSERR_INVALPARAM;
+ VALIDATE_MMSYS_PARAMETER( VALID_SOUND_DEVICE_TYPE(DeviceType) ||
+ DeviceType == 0 );
while ( OpenSoundDeviceRegKey(ServiceName, KeyIndex, &Key) == MMSYSERR_NOERROR )
{
@@ -284,10 +275,7 @@
TRACE_("Detecting NT4 style sound devices of type %d\n", DeviceType);
- if ( ! VALID_SOUND_DEVICE_TYPE(DeviceType) )
- {
- return MMSYSERR_INVALPARAM;
- }
+ VALIDATE_MMSYS_PARAMETER( VALID_SOUND_DEVICE_TYPE(DeviceType) );
DeviceNameLength = wcslen(BaseDeviceName);
/* Consider the length of the number */
Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/thread.c
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/mmebuddy/thread.c [iso-8859-1]
(original)
+++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/thread.c [iso-8859-1] Sun Jul 13
15:48:50 2008
@@ -96,17 +96,10 @@
{
PSOUND_THREAD_OVERLAPPED Overlapped;
- if ( ! SoundDeviceInstance )
- return MMSYSERR_INVALPARAM;
-
- if ( ! Buffer )
- return MMSYSERR_INVALPARAM;
-
- if ( BufferSize == 0 )
- return MMSYSERR_INVALPARAM;
-
- if ( ! IoCompletionHandler )
- return MMSYSERR_INVALPARAM;
+ VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) );
+ VALIDATE_MMSYS_PARAMETER( Buffer );
+ VALIDATE_MMSYS_PARAMETER( BufferSize > 0 );
+ VALIDATE_MMSYS_PARAMETER( IoCompletionHandler );
/* Allocate memory for the overlapped I/O structure (auto-zeroed) */
Overlapped = AllocateMemoryFor(SOUND_THREAD_OVERLAPPED);
@@ -326,8 +319,7 @@
IN SOUND_THREAD_REQUEST_HANDLER RequestHandler,
IN PVOID Parameter OPTIONAL)
{
- if ( ! RequestHandler )
- return MMSYSERR_INVALPARAM;
+ VALIDATE_MMSYS_PARAMETER( RequestHandler );
ASSERT(SoundThread != INVALID_HANDLE_VALUE);
if ( SoundThread == INVALID_HANDLE_VALUE )
Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/utility.c
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/mmebuddy/utility.c [iso-8859-1]
(original)
+++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/utility.c [iso-8859-1] Sun Jul
13 15:48:50 2008
@@ -20,11 +20,20 @@
static HANDLE ProcessHeapHandle = INVALID_HANDLE_VALUE;
static DWORD CurrentAllocations = 0;
+typedef struct _ALLOCATION
+{
+ DWORD Tag;
+ DWORD Size;
+} ALLOCATION;
+
PVOID
-AllocateMemory(
+AllocateTaggedMemory(
+ IN DWORD Tag,
IN DWORD Size)
{
PVOID Pointer = NULL;
+
+ Size += sizeof(ALLOCATION);
if ( ProcessHeapHandle == INVALID_HANDLE_VALUE )
ProcessHeapHandle = GetProcessHeap();
@@ -34,19 +43,31 @@
if ( ! Pointer )
return NULL;
+ /* Store the tag and size */
+ ((ALLOCATION*)Pointer)->Tag = Tag;
+ ((ALLOCATION*)Pointer)->Size = Size;
+
++ CurrentAllocations;
- return Pointer;
+ return ((PCHAR)Pointer) + sizeof(ALLOCATION);
}
VOID
-FreeMemory(
+FreeTaggedMemory(
+ IN DWORD Tag,
IN PVOID Pointer)
{
+ ALLOCATION* AllocationInfo;
+
ASSERT(ProcessHeapHandle != INVALID_HANDLE_VALUE);
ASSERT(Pointer);
- HeapFree(ProcessHeapHandle, 0, Pointer);
+ AllocationInfo = (ALLOCATION*)((PCHAR)Pointer - sizeof(ALLOCATION));
+
+ ASSERT( AllocationInfo->Tag == Tag );
+
+ ZeroMemory(AllocationInfo, AllocationInfo->Size + sizeof(ALLOCATION));
+ HeapFree(ProcessHeapHandle, 0, AllocationInfo);
-- CurrentAllocations;
}
@@ -78,6 +99,12 @@
return Digits;
}
+
+
+/*
+ Result codes
+*/
+
MMRESULT
Win32ErrorToMmResult(UINT error_code)
{
@@ -108,3 +135,31 @@
return MMSYSERR_ERROR;
}
+
+/*
+ If a function invokes another function, this aids in translating the result
+ code so that it is applicable in the context of the original caller. For
+ example, specifying that an invalid parameter was passed probably does not
+ make much sense if the parameter wasn't passed by the original caller!
+
+ However, things like MMSYSERR_NOMEM make sense to return to the caller.
+
+ This could potentially highlight internal logic problems.
+*/
+MMRESULT
+TranslateInternalMmResult(MMRESULT Result)
+{
+ switch ( Result )
+ {
+ case MMSYSERR_INVALPARAM :
+ case MMSYSERR_INVALFLAG :
+ {
+ ERR_("MMRESULT from an internal routine failed with error %d\n",
+ (int) Result);
+
+ return MMSYSERR_ERROR;
+ }
+ }
+
+ return Result;
+}
Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/format.c
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/format.c [iso-8859-1]
(original)
+++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/format.c [iso-8859-1] Sun
Jul 13 15:48:50 2008
@@ -25,11 +25,10 @@
UCHAR DeviceType;
MMRESULT Result;
- if ( ! IsValidSoundDevice(SoundDevice) )
- return MMSYSERR_INVALPARAM;
+ TRACE_("QueryWaveDeviceFormatSupport\n");
- if ( ! WaveFormat )
- return MMSYSERR_INVALPARAM;
+ VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) );
+ VALIDATE_MMSYS_PARAMETER( WaveFormat );
Result = GetSoundDeviceType(SoundDevice, &DeviceType);
ASSERT(Result == MMSYSERR_NOERROR);
@@ -61,19 +60,17 @@
DWORD BytesReturned = 0;
MMRESULT Result;
- if ( ! IsValidSoundDevice(SoundDevice) )
- return MMSYSERR_INVALPARAM;
+ TRACE_("DefaultQueryWaveDeviceFormatSupport\n");
- if ( ! WaveFormat )
- return MMSYSERR_INVALPARAM;
+ VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) );
+ VALIDATE_MMSYS_PARAMETER( WaveFormat );
Result = GetSoundDeviceType(SoundDevice,
&DeviceType);
ASSERT(Result == MMSYSERR_NOERROR);
/* Make sure we have a wave device */
- if ( ! IS_WAVE_DEVICE_TYPE(DeviceType) )
- return MMSYSERR_INVALPARAM; /* FIXME? */
+ VALIDATE_MMSYS_PARAMETER( IS_WAVE_DEVICE_TYPE(DeviceType) );
Result = OpenKernelSoundDevice(SoundDevice,
GENERIC_READ | GENERIC_WRITE,
@@ -105,11 +102,10 @@
PMMFUNCTION_TABLE FunctionTable;
MMRESULT Result;
- if ( ! IsValidSoundDeviceInstance(SoundDeviceInstance) )
- return MMSYSERR_INVALPARAM;
+ TRACE_("SetWaveDeviceFormat\n");
- if ( ! WaveFormat )
- return MMSYSERR_INVALPARAM;
+ VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) );
+ VALIDATE_MMSYS_PARAMETER( WaveFormat );
Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice);
ASSERT(Result == MMSYSERR_NOERROR);
@@ -118,8 +114,7 @@
ASSERT(Result == MMSYSERR_NOERROR);
/* Make sure we have a wave device */
- if ( ! IS_WAVE_DEVICE_TYPE(DeviceType) )
- return MMSYSERR_INVALPARAM; /* FIXME? */
+ VALIDATE_MMSYS_PARAMETER( IS_WAVE_DEVICE_TYPE(DeviceType) );
/* TODO: Should we check the size? */
@@ -144,11 +139,10 @@
MMRESULT Result;
DWORD BytesReturned = 0;
- if ( ! IsValidSoundDeviceInstance(SoundDeviceInstance) )
- return MMSYSERR_INVALPARAM;
+ TRACE_("DefaultSetWaveDeviceFormat\n");
- if ( ! WaveFormat )
- return MMSYSERR_INVALPARAM;
+ VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) );
+ VALIDATE_MMSYS_PARAMETER( WaveFormat );
Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice);
ASSERT(Result == MMSYSERR_NOERROR);
@@ -157,8 +151,7 @@
ASSERT(Result == MMSYSERR_NOERROR);
/* Make sure we have a wave device */
- if ( ! IS_WAVE_DEVICE_TYPE(DeviceType) )
- return MMSYSERR_INVALPARAM; /* FIXME? */
+ VALIDATE_MMSYS_PARAMETER( IS_WAVE_DEVICE_TYPE(DeviceType) );
Result = WriteToSoundDevice(SoundDeviceInstance,
IOCTL_WAVE_SET_FORMAT,
Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/streamcontrol.c
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/streamcontrol.c
[iso-8859-1] (original)
+++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/streamcontrol.c
[iso-8859-1] Sun Jul 13 15:48:50 2008
@@ -23,8 +23,7 @@
{
PWAVE_STREAM_INFO StreamInfo;
- if ( ! SoundDeviceInstance )
- return MMSYSERR_INVALPARAM;
+ VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) );
StreamInfo = &SoundDeviceInstance->Streaming.Wave;
@@ -44,17 +43,11 @@
IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance,
IN PWAVEHDR BufferHeader)
{
- if ( ! SoundDeviceInstance )
- return MMSYSERR_INVALPARAM;
-
- if ( ! BufferHeader )
- return MMSYSERR_INVALPARAM;
-
- if ( ! BufferHeader->lpData )
- return MMSYSERR_INVALPARAM;
-
- if ( ! BufferHeader->dwBufferLength )
- return MMSYSERR_INVALPARAM;
+ VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) );
+ VALIDATE_MMSYS_PARAMETER( BufferHeader );
+ VALIDATE_MMSYS_PARAMETER( BufferHeader->lpData );
+ VALIDATE_MMSYS_PARAMETER( BufferHeader->dwBufferLength > 0 );
+ /* TODO: Check anything more about this buffer? */
if ( ! (BufferHeader->dwFlags & WHDR_PREPARED ) )
return WAVERR_UNPREPARED;
@@ -74,11 +67,8 @@
IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance,
OUT PUCHAR State)
{
- if ( ! SoundDeviceInstance )
- return MMSYSERR_INVALPARAM;
-
- if ( ! State )
- return MMSYSERR_INVALPARAM;
+ VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) );
+ VALIDATE_MMSYS_PARAMETER( State );
return CallUsingSoundThread(SoundDeviceInstance,
GetWaveDeviceState_Request,
@@ -113,8 +103,7 @@
PauseWaveDevice(
IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance)
{
- if ( ! SoundDeviceInstance )
- return MMSYSERR_INVALPARAM;
+ VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) );
return CallUsingSoundThread(SoundDeviceInstance,
PauseWaveDevice_Request,
@@ -134,8 +123,7 @@
RestartWaveDevice(
IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance)
{
- if ( ! SoundDeviceInstance )
- return MMSYSERR_INVALPARAM;
+ VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) );
return CallUsingSoundThread(SoundDeviceInstance,
RestartWaveDevice_Request,
Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/streaming.c
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/streaming.c [iso-8859-1]
(original)
+++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/streaming.c [iso-8859-1]
Sun Jul 13 15:48:50 2008
@@ -65,7 +65,7 @@
TRACE_("PerformWaveIo\n");
- ASSERT(SoundDeviceInstance);
+ ASSERT( IsValidSoundDeviceInstance(SoundDeviceInstance) );
/* These shouldn't fail unless we pass them garbage */
Result = GetSoundDeviceFromInstance(SoundDeviceInstance,
@@ -210,11 +210,8 @@
PWAVEHDR WaveHeader = (PWAVEHDR) Parameter;
PWAVE_STREAM_INFO StreamInfo;
- if ( ! SoundDeviceInstance )
- return MMSYSERR_INVALPARAM;
-
- if ( ! WaveHeader )
- return MMSYSERR_INVALPARAM;
+ VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) );
+ VALIDATE_MMSYS_PARAMETER( WaveHeader );
/* To avoid stupidly long variable names we alias this */
StreamInfo = &SoundDeviceInstance->Streaming.Wave;
@@ -275,11 +272,8 @@
PMMFUNCTION_TABLE Functions;
PUCHAR State = (PUCHAR) Parameter;
- if ( ! SoundDeviceInstance )
- return MMSYSERR_INVALPARAM;
-
- if ( ! State )
- return MMSYSERR_INVALPARAM;
+ VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) );
+ VALIDATE_MMSYS_PARAMETER( State );
// *State = SoundDeviceInstance->Streaming.Wave.State;
@@ -304,8 +298,7 @@
PSOUND_DEVICE SoundDevice;
PMMFUNCTION_TABLE Functions;
- if ( ! SoundDeviceInstance )
- return MMSYSERR_INVALPARAM;
+ VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) );
Result = GetSoundDeviceFromInstance(SoundDeviceInstance,
&SoundDevice);
@@ -323,8 +316,7 @@
IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance,
IN PVOID Parameter)
{
- if ( ! SoundDeviceInstance )
- return MMSYSERR_INVALPARAM;
+ VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) );
if ( SoundDeviceInstance->Streaming.Wave.State != WAVE_DD_STOPPED )
{
Modified: branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wodMessage.c
URL:
http://svn.reactos.org/svn/reactos/branches/silverblade-audio/lib/drivers/s…
==============================================================================
--- branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wodMessage.c [iso-8859-1]
(original)
+++ branches/silverblade-audio/lib/drivers/sound/mmebuddy/wave/wodMessage.c [iso-8859-1]
Sun Jul 13 15:48:50 2008
@@ -62,6 +62,9 @@
TRACE_("In WODM_OPEN\n");
Result = GetSoundDevice(WAVE_OUT_DEVICE_TYPE, device_id, &Device);
+ TRACE_("GetSoundDevice == %d\n", (int) Result);
+
+
if ( Result != MMSYSERR_NOERROR )
return Result;
@@ -77,6 +80,8 @@
ASSERT(private_handle != 0);
Result = CreateSoundDeviceInstance(Device, &Instance);
+ TRACE_("CreateSoundDeviceInstance == %d\n", (int) Result);
+
if ( Result != MMSYSERR_NOERROR )
return Result;