[2/3] d3d8: IDirect3DDevice8Impl_GetVertexShaderFunction gets passed a handle instead of a pointer

H. Verbeet hverbeet at gmail.com
Sat Jan 6 11:03:54 CST 2007


Similar to the previous patch, but this time for vertex shaders.

Changelog:
  - IDirect3DDevice8Impl_GetVertexShaderFunction gets passed a handle
instead of a pointer
-------------- next part --------------
---

 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 9aeb987..1f8bb6e 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -1298,10 +1298,18 @@ static HRESULT WINAPI IDirect3DDevice8Im
     return D3DERR_INVALIDCALL;
 }
 static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShaderFunction(LPDIRECT3DDEVICE8 iface, DWORD pVertexShader, void* pData, DWORD* pSizeOfData) {
-    IDirect3DVertexShader8Impl *This = (IDirect3DVertexShader8Impl *)pVertexShader;
+    IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
+    IDirect3DVertexShader8Impl *shader = NULL;
 
-    TRACE("(%p) : Relay\n", This);
-    return IWineD3DVertexShader_GetFunction(This->wineD3DVertexShader, pData, (UINT *)pSizeOfData);
+    TRACE("(%p) : pVertexShader %#x, pData %p, pSizeOfData %p\n", This, pVertexShader, pData, pSizeOfData);
+
+    if (pVertexShader <= VS_HIGHESTFIXEDFXF || This->allocated_shader_handles <= pVertexShader - (VS_HIGHESTFIXEDFXF + 1)) {
+        ERR("Passed an invalid shader handle.\n");
+        return D3DERR_INVALIDCALL;
+    }
+
+    shader = This->shader_handles[pVertexShader - (VS_HIGHESTFIXEDFXF + 1)];
+    return IWineD3DVertexShader_GetFunction(shader->wineD3DVertexShader, pData, (UINT *)pSizeOfData);
 }
 
 static HRESULT WINAPI IDirect3DDevice8Impl_SetIndices(LPDIRECT3DDEVICE8 iface, IDirect3DIndexBuffer8* pIndexData, UINT baseVertexIndex) {


More information about the wine-patches mailing list