Hi, Anyone know why this might be...

I call only DirectSoundCreate(0, &lpDS, 0). The program reaches the "ret" instruction, but doesn't return, whether or not I do the release IDirectSound_Release(lpDS).

Can I make it return without importing ExitProcess? I have tested it with XP.
Posted on 2006-07-24 06:50:25 by ansps
Check the returnvalue.. is it one of these?
DSERR_ALLOCATED
DSERR_INVALIDPARAM
DSERR_NOAGGREGATION
DSERR_NODRIVER
DSERR_OUTOFMEMORY

If in doubt, ALWAYS check the return value for api calls, ESPECIALLY for COM-related stuff such as DX.
Posted on 2006-07-24 09:01:02 by Homer
The return value is DD_OK. I've tried to check everything I know.

The program just somehow hangs at/after when I try to exit it with only a ret instruction, which normally works.

It does that after _a successful_ call to DirectSoundCreate.

... and I'm not using any external heading/trailing code :)
Posted on 2006-07-24 09:44:28 by ansps
It 'might' be because you are not setting the cooperative level?


The application must call the IDirectSound8::SetCooperativeLevel method immediately after creating a device object.


Microsoft says MUST, I assume they have a reason.
Posted on 2006-07-24 11:25:13 by Homer
Yeah, that's right. But it wont work that way either :/

You could maybe test it and see it's not working. I'd be interested why.

I'm using this kind of solution for now:
        push    return

        code
        code
        mov    eax,123
        ret

return  push    eax
        call   
Posted on 2006-07-25 00:43:11 by ansps
OK attach your source and I'll take a look.
Posted on 2006-07-25 04:41:49 by Homer
The source-code of my EasySound library could help you:
http://www.asmcommunity.net/board/index.php?topic=22355.0

P.S: I'd look for incorrect stack (ESP value). Maybe somewhere you have the DirectSoundCreate marked as C-call
Posted on 2006-07-25 04:49:49 by Ultrano