D3D8_GetCreationParameters fix

Andrei Barbu teval at myrealbox.com
Fri Jul 9 15:02:27 CDT 2004


MSDN says that if it's given an invalid pointer it should return
D3DERR_INVALIDCALL, so that's what it does now.

MSDN:
http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/directx9_c/directx/graphics/reference/d3d/interfaces/idirect3ddevice9/GetCreationParameters.asp

So I'm guessing this is right now.

I don't have a windows computer to check this against, but it does
comply with the docs.

Andrei

On Fri, 2004-07-09 at 11:19, Mike McCormack wrote:
> This patch is better than the first one, but...
> 
> Windows doesn't usually check pointers like this.  Can you try testing 
> the Windows implementation of IDirect3DDevice8->GetCreationParameters() 
> to see whether it crashes when passed an invalid pointer such as NULL or 
> 0x00000001?  It may be that the invalid pointer is coming from somewhere 
> else in Wine's code, so you may be just hiding another bug.
> 
> Mike
> 
> Andrei Barbu wrote:
> > And this is the correct patch.
> 
> > @@ -380,6 +381,12 @@
> >  HRESULT  WINAPI  IDirect3DDevice8Impl_GetCreationParameters(LPDIRECT3DDEVICE8 iface, D3DDEVICE_CREATION_PARAMETERS *pParameters) {
> >      ICOM_THIS(IDirect3DDevice8Impl,iface);
> >      TRACE("(%p) copying to %p\n", This, pParameters);    
> > +
> > +    if( IsBadWritePtr( pParameters , sizeof( D3DDEVICE_CREATION_PARAMETERS ) ) )
> > +    {
> > +	WARN("(%p) : bad pointer in device caps (%p)\n", This, pParameters);
> > +	return D3DERR_INVALIDCALL;
> > +    }
> >      memcpy(pParameters, &This->CreateParms, sizeof(D3DDEVICE_CREATION_PARAMETERS));
> >      return D3D_OK;
> >  }
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20040709/333fc7a8/attachment.pgp


More information about the wine-devel mailing list