[PATCH 1/5] ddraw: Fix querying device interfaces in IDirect3DDeviceImpl_7_QueryInterface().
Henri Verbeet
hverbeet at codeweavers.com
Thu Apr 5 12:55:34 CDT 2012
Version 7 devices can only return the version 7 interface. The other versions
can only return earlier interfaces.
---
dlls/ddraw/device.c | 30 ++++++++----------------------
1 files changed, 8 insertions(+), 22 deletions(-)
diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index a1daa3f..e766940 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -117,33 +117,19 @@ IDirect3DDeviceImpl_7_QueryInterface(IDirect3DDevice7 *iface,
*obj = iface;
}
- /* Direct3DDevice */
- else if ( IsEqualGUID( &IID_IDirect3DDevice , refiid ) )
+ if (This->version == 7)
{
- *obj = &This->IDirect3DDevice_iface;
- TRACE("(%p) Returning IDirect3DDevice interface at %p\n", This, *obj);
- }
- else if ( IsEqualGUID( &IID_IDirect3DDevice2 , refiid ) ) {
- *obj = &This->IDirect3DDevice2_iface;
- TRACE("(%p) Returning IDirect3DDevice2 interface at %p\n", This, *obj);
+ if (IsEqualGUID(&IID_IDirect3DDevice7, refiid))
+ *obj = iface;
}
- else if ( IsEqualGUID( &IID_IDirect3DDevice3 , refiid ) ) {
+ else if (IsEqualGUID(&IID_IDirect3DDevice3, refiid) && This->version == 3)
*obj = &This->IDirect3DDevice3_iface;
- TRACE("(%p) Returning IDirect3DDevice3 interface at %p\n", This, *obj);
- }
- else if ( IsEqualGUID( &IID_IDirect3DDevice7 , refiid ) ) {
- *obj = &This->IDirect3DDevice7_iface;
- TRACE("(%p) Returning IDirect3DDevice7 interface at %p\n", This, *obj);
- }
-
- /* DirectDrawSurface */
+ else if (IsEqualGUID(&IID_IDirect3DDevice2, refiid) && This->version >= 2)
+ *obj = &This->IDirect3DDevice2_iface;
+ else if (IsEqualGUID(&IID_IDirect3DDevice, refiid))
+ *obj = &This->IDirect3DDevice_iface;
else if (IsEqualGUID(&IID_IDirectDrawSurface, refiid) && This->version == 1)
- {
*obj = &This->target->IDirectDrawSurface_iface;
- TRACE("Returning IDirectDrawSurface interface %p.\n", *obj);
- }
-
- /* Unknown interface */
else
{
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(refiid));
--
1.7.3.4
More information about the wine-patches
mailing list