DXGL r534 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r533‎ | r534 | r535 >
Date:22:51, 16 September 2014
Author:admin
Status:new
Tags:
Comment:
Set IDirectDrawSurface7::QueryInterface failure return based on version of interface it was created on.
Fix crash with QueryInterface on a D3D1 object.
Modified paths:
  • /ddraw/glDirectDrawSurface.cpp (modified) (history)
  • /ddraw/glDirectDrawSurface.h (modified) (history)

Diff [purge]

Index: ddraw/glDirectDrawSurface.cpp
@@ -41,6 +41,7 @@
4242 glDirectDrawPalette *palettein, TEXTURE *parenttex, DWORD miplevel, int version)
4343 {
4444 TRACE_ENTER(5,14,this,14,lpDD7,14,lpDDSurfaceDesc2,14,error,14,palettein);
 45+ this->version = version;
4546 creator = NULL;
4647 overlay = false;
4748 hasstencil = false;
@@ -534,14 +535,22 @@
535536 }
536537 else
537538 {
538 - HRESULT ret = device->QueryInterface(IID_IDirect3DDevice,ppvObj);
 539+ HRESULT ret = device1->QueryInterface(IID_IDirect3DDevice,ppvObj);
539540 TRACE_VAR("*ppvObj",14,*ppvObj);
540541 TRACE_EXIT(23,ret);
541542 return ret;
542543 }
543544 }
544 - TRACE_EXIT(23,E_NOINTERFACE);
545 - return E_NOINTERFACE;
 545+ if (version == 7)
 546+ {
 547+ TRACE_EXIT(23, E_NOINTERFACE);
 548+ return E_NOINTERFACE;
 549+ }
 550+ else
 551+ {
 552+ TRACE_EXIT(23, DDERR_INVALIDPARAMS);
 553+ return DDERR_INVALIDPARAMS;
 554+ }
546555 }
547556 ULONG WINAPI glDirectDrawSurface7::AddRef()
548557 {
Index: ddraw/glDirectDrawSurface.h
@@ -177,6 +177,7 @@
178178 glDirect3DDevice7 *device;
179179 bool overlay;
180180 IUnknown *zbuffer_iface;
 181+ int version;
181182 };
182183
183184 // Legacy DDRAW Interfaces