So after next few hours of "debuging my way" (HeapAlloc + printf + HeapFree) and bisecting where HeapAlloc is OK and where isn't i come to conclusion, that there is someting bad with wined3d_mutex_unlock(), i.e. it looks like pure luck, that the game runs with native openal32 and freezes with builtin openal32.
void WINAPI wined3d_mutex_unlock(void) { "HeapAlloc + printf_before + HeapFree"
LeaveCriticalSection(&wined3d_cs);
"HeapAlloc + printf_after + HeapFree" <--- ** BAD in #274 ** }
During the initialization, the game enters wined3d_mutex_unlock() a lot of time, but when the number of entering reaches 274, print_before says allocated OK, but printf_after shows the insane address.
To be precise:
#271 before wined3d_mutex_lock(), 0x0020a118=HeapAlloc(), &wined3d_cs=0x7e22fda0 #271 after wined3d_mutex_lock(), 0x0020a118=HeapAlloc(), &wined3d_cs=0x7e22fda0
#270 before wined3d_mutex_unlock(), 0x0020a118=HeapAlloc(), &wined3d_cs=0x7e22fda0 #270 after wined3d_mutex_unlock(), 0x0020a118=HeapAlloc(), &wined3d_cs=0x7e22fda0
#271 before wined3d_mutex_unlock(), 0x0020a118=HeapAlloc(), &wined3d_cs=0x7e22fda0 #271 after wined3d_mutex_unlock(), 0x0020a118=HeapAlloc(), &wined3d_cs=0x7e22fda0
#272 before wined3d_mutex_lock(), 0x0020a118=HeapAlloc(), &wined3d_cs=0x7e22fda0 #272 after wined3d_mutex_lock(), 0x0020a118=HeapAlloc(), &wined3d_cs=0x7e22fda0
#272 before wined3d_mutex_unlock(), 0x0020a118=HeapAlloc(), &wined3d_cs=0x7e22fda0 #272 after wined3d_mutex_unlock(), 0x0020a118=HeapAlloc(), &wined3d_cs=0x7e22fda0
#273 before wined3d_mutex_lock(), 0x0020a118=HeapAlloc(), &wined3d_cs=0x7e22fda0 #273 after wined3d_mutex_lock(), 0x0020a118=HeapAlloc(), &wined3d_cs=0x7e22fda0
#273 before wined3d_mutex_unlock(), 0x0020a118=HeapAlloc(), &wined3d_cs=0x7e22fda0 #273 after wined3d_mutex_unlock(), 0x0020a118=HeapAlloc(), &wined3d_cs=0x7e22fda0
#274 before wined3d_mutex_lock(), 0x0020a130=HeapAlloc(), &wined3d_cs=0x7e22fda0 #274 after wined3d_mutex_lock(), 0x0020a130=HeapAlloc(), &wined3d_cs=0x7e22fda0
#275 before wined3d_mutex_lock(), 0x0020a2b0=HeapAlloc(), &wined3d_cs=0x7e22fda0 #275 after wined3d_mutex_lock(), 0x0020a2b0=HeapAlloc(), &wined3d_cs=0x7e22fda0
#274 before wined3d_mutex_unlock(), 0x0020a3f0=HeapAlloc(), &wined3d_cs=0x7e22fda0 #274 after wined3d_mutex_unlock(), 0x18fa7048=HeapAlloc(), &wined3d_cs=0x7e22fda0 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Any suggestion?
Juan Lang:
Sounds like heap corruption. Try using valgrind to see if there are
memory errors before the second call to DirectSoundDevice_Create(). --Juan
It's bug 20799. I already attached several valgrind logs there, but unfortunately valgrind does not survives and dies under Mirror's Edge.