H. Verbeet : d3d8: IDirect3DDevice8Impl_GetPixelShaderFunction gets passed a handle instead of a pointer .

Alexandre Julliard julliard at wine.codeweavers.com
Mon Jan 8 06:35:13 CST 2007


Module: wine
Branch: master
Commit: cae630f92e14169be89caf1bb1ff74d0fd585e39
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=cae630f92e14169be89caf1bb1ff74d0fd585e39

Author: H. Verbeet <hverbeet at gmail.com>
Date:   Sat Jan  6 18:03:49 2007 +0100

d3d8: IDirect3DDevice8Impl_GetPixelShaderFunction gets passed a handle instead of a pointer.

---

 dlls/d3d8/device.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index b9aea7f..9aeb987 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -1450,10 +1450,18 @@ static HRESULT WINAPI IDirect3DDevice8Im
 }
 
 static HRESULT WINAPI IDirect3DDevice8Impl_GetPixelShaderFunction(LPDIRECT3DDEVICE8 iface, DWORD pPixelShader, void* pData, DWORD* pSizeOfData) {
-    IDirect3DPixelShader8Impl *This = (IDirect3DPixelShader8Impl *)pPixelShader;
+    IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
+    IDirect3DPixelShader8Impl *shader = NULL;
 
-    TRACE("(%p) : Relay\n", This);
-    return IWineD3DPixelShader_GetFunction(This->wineD3DPixelShader, pData, (UINT *)pSizeOfData);
+    TRACE("(%p) : pPixelShader %#x, pData %p, pSizeOfData %p\n", This, pPixelShader, pData, pSizeOfData);
+
+    if (pPixelShader <= VS_HIGHESTFIXEDFXF || This->allocated_shader_handles <= pPixelShader - (VS_HIGHESTFIXEDFXF + 1)) {
+        ERR("Passed an invalid shader handle.\n");
+        return D3DERR_INVALIDCALL;
+    }
+
+    shader = This->shader_handles[pPixelShader - (VS_HIGHESTFIXEDFXF + 1)];
+    return IWineD3DPixelShader_GetFunction(shader->wineD3DPixelShader, pData, (UINT *)pSizeOfData);
 }
 
 static HRESULT WINAPI IDirect3DDevice8Impl_DrawRectPatch(LPDIRECT3DDEVICE8 iface, UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo) {




More information about the wine-cvs mailing list