Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DirectSoundEnumerate throwing an exception

18 views
Skip to first unread message

Nuno Centeio

unread,
Jul 30, 2009, 4:08:18 AM7/30/09
to
Hi!

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?

Chris P.

unread,
Jul 31, 2009, 3:56:17 PM7/31/09
to

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]

Nuno Centeio

unread,
Aug 4, 2009, 3:50:02 AM8/4/09
to
> --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

Chris P.

unread,
Aug 4, 2009, 9:45:23 AM8/4/09
to
On Tue, 4 Aug 2009 00:50:02 -0700 (PDT), Nuno Centeio wrote:

> 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.

--

Nuno Centeio

unread,
Aug 5, 2009, 3:59:20 AM8/5/09
to
On Aug 4, 2:45 pm, "Chris P." <m...@chrisnet.net> wrote:
> On Tue, 4 Aug 2009 00:50:02 -0700 (PDT), Nuno Centeio wrote:
> > 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.
>
> --http://www.chrisnet.net/code.htm

> [MS MVP for DirectShow / MediaFoundation]

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

0 new messages