Results 1 to 9 of 9

Thread: Be careful with IDirectSoundBuffer.Lock

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    ...which is also a normal situation considering that ASUS Xonar DS did not do anything wrong, since they do not need to check for validity of the parameters. The crash is a normal response in this case, which was at your fault for sending invalid data.
    I would totally agree with this only if I had passed some invalid pointer or whatever else dangerous, but not a "wrong" size, which can be handled without no problems, this is just a zero, even not a negative value... this is almost the same as if that driver can't allocate memory(for sound buffer) and goes crash instead of returning E_OUTOFMEMORY But this thread is not about why I was so careless, just a warning about very specific problem
    Last edited by Andru; 20-03-2012 at 01:45 PM.

  2. #2
    I know and agree with you. My point was that you should not make any assumptions when making API calls. If you see a parameter value that is not documented or its description is too vague, you should take the necessary precautions or better yet, try not to rely on it.

    The behavior you described is not an exception, there will be many more cases where you should not rely on API to be "intelligent". So this is as an extension of your warning to the entire API in general, be it DirectSound, Win32 API, DirectX and so on.

    This was not always the case, you know. For instance, back in DirectDraw days you could pass the entire structure half empty and DirectDraw will fill in all the remaining values. Now if you try this with Direct3D 11, in the best case you'll get an error code and in the worst case you'll mess up the video driver, even causing BSOD under certain circumstances.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •