Hiroki Awata castaneai@by.black writes:
Incrementing object_locks by DSCF_CreateInstance is sometimes wrong. For example, dsound_render_create creates two instances because it calls system_clock_create internally, but object_locks is only increased by 1. Each create function should increase the object_locks instead of DSCF_CreateInstance.
In general getting the lock count right is tricky and error-prone, and not very useful. You can simply return FALSE from DllCanUnloadNow().