http://bugs.winehq.org/show_bug.cgi?id=13297
--- Comment #50 from Tony Wasserka tony.wasserka@freenet.de 2010-08-25 16:37:34 --- FWIW, check this file http://repo.or.cz/w/wine/d3dx9TW.git/blob/e4dfdb7c2cc4264bbe89ef938c939a3965...
About your implementation of D3DXCreateTextureFromFileInMemoryEx (not sure if your goal was to make it accurate of if you just wanted to get stuff working): a) you're only loading the first surface, the mipmaps will stay black b) the mipfilter parameter is used for just that - generating the mipmaps from the surface 0 using D3DXFilterTexture.
If you look at the link I posted, that's just what I'm doing ;) so the Merge branch should work fine, too.