I'm trying to convert the direct3d tutorials in the visual c directx SDK to asm files. I have working include files etc for directx 8, but I can't get the following code working:

g_pD3D      dd                       ?
d3ddm       D3DDISPLAYMODE          
g_pd3dDevice dd                      ?

InitD3D proc    hWnd:DWORD
    invoke      Direct3DCreate8, D3D_SDK_VERSION
    mov         g_pD3D, eax
    coinvoke    g_pD3D, Direct3D8, GetAdapterDisplayMode, D3DADAPTER_DEFAULT, ADDR d3ddm
    mov         d3dpp.Windowed, TRUE
    mov         d3dpp.SwapEffect, D3DSWAPEFFECT_DISCARD
    mov         eax, d3ddm.format
    mov         d3dpp.BackBufferFormat, eax
    coinvoke    g_pD3D, Direct3D8, CreateDevice, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,\
                    hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, offset d3dpp, offset g_pd3dDevice
    .IF         eax!=D3D_OK
        int 3
InitD3D endp 
All of the above code runs fine, the return values are correct and the directx interface works correctly, but the last coinvoke, with CreateDevice, always returns D3DERR_DRIVERINVALIDCALL. In the documentation only D3DERR_INVALIDCALL is mentioned (invalid parameter), but I can find NOTHING about D3DERR_DRIVERINVALIDCALL. The example in the tutorial works fine in visual C, and I compared the complete call to the interface in C and in asm, they are the same. What's the problem? Thomas
Posted on 2001-04-09 15:34:00 by Thomas
I figured out the problem. The structure definitions were wrong. Some structures had SDWORD members that were defined as SWORD types. It's possibly a bug in Amokila's tlb2inc tool. I have mailed him about the problem already. Thomas
Posted on 2001-04-09 16:00:00 by Thomas
I'm having the same problem - What structures did you have to change? (and what members) Thanks, Ryan Fairfax
Posted on 2001-04-10 00:51:00 by thefaxman
Both D3DDISPLAYMODE and D3DPRESENT_PARAMETERS have wrong member types. all the SWORDs should be SDWORDs. But I think it's a bug in amokila's utility, so changing only that structures won't help for further errors. Thomas
Posted on 2001-04-10 01:33:00 by Thomas
Arg... the problem is that in idl uint variables and int variables have the same type : int !!! The only thing i can do is a dirty fix: add an option to treat int as SDWORDs. It should work knowing that for example for the dx8vb.dll there are are only UINTs not INTs... Any suggestions ?
Posted on 2001-04-10 13:55:00 by Amokila
You can get version 1.2.3 of Tlb2Inc with an extra option to treat INTs as SDWORDS here This message was edited by Amokila, on 4/11/2001 2:10:29 PM
Posted on 2001-04-11 14:09:00 by Amokila