Direct3D device creation fail on driver 190.xx

On Win 7 x64, since drivers 190.xx were published (it was working with 185.xx/186.xx), I get the following error when I create a direct3d device from a dll (loaded by Sony Vegas Pro 9).

[codebox]Direct3D9: (INFO) :======================= Hal HWVP device selected

Direct3D9: (ERROR) :CreateDevice failed, because it is called from DllMain.

Direct3D9: (ERROR) :Failed to initialize Framework Device. CreateDeviceEx

Failed.

‘vegas90.exe’: Unloaded ‘C:\Windows\SysWOW64\powrprof.dll’

‘vegas90.exe’: Unloaded ‘C:\Windows\SysWOW64\nvd3dum.dll’

Direct3D9: (ERROR)

: ************************************************************

Direct3D9: (ERROR) :ASSERTION FAILED! File

s:\gfx_aug09\windows\directx\dxg\inactive\d3d9\d3d\fw\enum.hpp Line 133:

IsValid()

Direct3D9: (ERROR)

: ************************************************************

Direct3D9: (ERROR)

: ************************************************************

Direct3D9: (ERROR) :ASSERTION FAILED! File

s:\gfx_aug09\windows\directx\dxg\inactive\d3d9\d3d\fw\enum.hpp Line 136:

m_bTakeCriticalSection == 1

Direct3D9: (ERROR)

: ************************************************************

[/codebox]

And here’s the code :

[codebox]

extern “C”

{

BOOL APIENTRY DllMain( HINSTANCE hinst,

                    DWORD       dwReason,

                    LPVOID      pReserved)

{

HRESULT hr;

IDirect3D9 *g_pD3D;

IDirect3DDevice9 *g_pD3Dev;

HWND hWnd;

D3DPRESENT_PARAMETERS d3dpp;

switch (dwReason)

{

  case DLL_PROCESS_ATTACH:

g_pD3D = Direct3DCreate9(D3D_SDK_VERSION);

ZeroMemory(&d3dpp, sizeof(d3dpp));

    d3dpp.Windowed = TRUE;

    d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;

    d3dpp.BackBufferWidth = 640;

    d3dpp.BackBufferHeight = 480;

    d3dpp.BackBufferCount = 1;

    d3dpp.SwapEffect = D3DSWAPEFFECT_COPY;

    d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;

    d3dpp.Flags = 

D3DPRESENTFLAG_VIDEO;//D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;

hWnd = GetDesktopWindow();

logextrastatus(“CreateDevice()…”);

    hr = g_pD3D->CreateDevice(0,

                              D3DDEVTYPE_HAL,

                              hWnd,

                              D3DCREATE_MULTITHREADED | 

D3DCREATE_HARDWARE_VERTEXPROCESSING,

                              &d3dpp,

                              &g_pD3Dev);

…[/codebox]

Have you seen this error message before ? ("CreateDevice failed, because it

is called from …")

I don’t have this error when the device is created from a stand-alone application (.exe, not from a dll).

What can I do ?

This may be helpful : Steam Support :: Failed to create D3D Device