Sometimes my clients send me logs of my application crashing because
of an exception in DirectSoundEnumerate function.
Here is the callstack:
Attempted to read or write protected memory. This is often an
indication that other memory is corrupt.
at DirectSoundEnumerateA(IntPtr , Void* )
at CDXSoftphoneEngine.EnumDevices(_GUID* clsidDeviceClass)
I'm using managed code with clrOldSyntax.
What can cause an exception to be throwned inside
DirectSoundEnumerate?
I've protected the EnumDevices function but it's not that simple
because my application needs to know what audio devices are present.
This exception starts to happening during the normal application
running and when it happens no more calls to DirectSoundEnumerate will
work.
Any ideas?
Do you hot plug USB audio devices? I've never seen it cause an exception,
but DirectSoundEnumerate() simply regurgitates what the DSound.dll found
when it was loaded into your process. You should get the same output over
and over again because Dsound.dll never unloads from the process because it
calls LoadLibrary on itself. So I can't think of why it would work for a
while and then start breaking.
--
http://www.chrisnet.net/code.htm
[MS MVP for DirectShow / MediaFoundation]
Hi.
Thanks for replying.
Do you know where can I see the source code for DirectSoundEnumerate?
It never happened on my devel machine, so debugging is impossible :(
Thanks
> Do you know where can I see the source code for DirectSoundEnumerate?
>
> It never happened on my devel machine, so debugging is impossible :(
There's no source code available unfortunately. You can trace through the
assembly code of InternalDirectSoundEnumerate() but that's about it.
You also might want to try my DirectSoundEnumerate sample to see if it
reproduces the same behavior.
--
I'm starting to wonder if it may be related with some problem when
passing managed to unmanaged...
The context that I pass for DirectSoundEnumerate is a managed Array.
I'm using GCHandle::Alloc but perhaps there is some kind of problem
with that. However, the context should only be used by the
DirectSoundEnumerate callback function and not inside the
DirectSoundEnumerate() function...
I really don't know :(
If I only could explain why from a second to another the functions
starts throwing exceptions :(
I'll take a look at your example. May be I'm missing something...
Thanks