Remove the setting of the result pointer to NULL in creates, tests
show that windows doesn't set the result to NULL on error.
This commit is contained in:
parent
63e5d5e5b9
commit
58fdd892c6
|
@ -256,7 +256,6 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateCubeTexture(LPDIRECT3DDEVICE9 iface,
|
|||
|
||||
if (NULL == object) {
|
||||
FIXME("(%p) allocation of CubeTexture failed\n", This);
|
||||
*ppCubeTexture = NULL;
|
||||
return D3DERR_OUTOFVIDEOMEMORY;
|
||||
}
|
||||
object->lpVtbl = &Direct3DCubeTexture9_Vtbl;
|
||||
|
@ -266,12 +265,13 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateCubeTexture(LPDIRECT3DDEVICE9 iface,
|
|||
D3D9CB_CreateSurface);
|
||||
|
||||
if (hr != D3D_OK){
|
||||
|
||||
/* free up object */
|
||||
FIXME("(%p) call to IWineD3DDevice_CreateCubeTexture failed\n", This);
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
*ppCubeTexture = NULL;
|
||||
} else {
|
||||
*ppCubeTexture = (LPDIRECT3DCUBETEXTURE9) object;
|
||||
TRACE("(%p) : Created cube texture %p\n", This, object);
|
||||
}
|
||||
|
||||
TRACE("(%p) returning %p\n",This, *ppCubeTexture);
|
||||
|
|
|
@ -260,7 +260,6 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateSurface(LPDIRECT3DDEVICE9 iface, UINT
|
|||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DSurface9Impl));
|
||||
if (NULL == object) {
|
||||
FIXME("Allocation of memory failed\n");
|
||||
*ppSurface = NULL;
|
||||
return D3DERR_OUTOFVIDEOMEMORY;
|
||||
}
|
||||
|
||||
|
@ -272,13 +271,14 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateSurface(LPDIRECT3DDEVICE9 iface, UINT
|
|||
hrc = IWineD3DDevice_CreateSurface(This->WineD3DDevice, Width, Height, Format, Lockable, Discard, Level, &object->wineD3DSurface, Type, Usage, Pool,MultiSample,MultisampleQuality,pSharedHandle,(IUnknown *)object);
|
||||
|
||||
if (hrc != D3D_OK || NULL == object->wineD3DSurface) {
|
||||
|
||||
/* free up object */
|
||||
FIXME("(%p) call to IWineD3DDevice_CreateSurface failed\n", This);
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
*ppSurface = NULL;
|
||||
} else {
|
||||
TRACE("(%p) : Created surface %p\n", This, object);
|
||||
*ppSurface = (LPDIRECT3DSURFACE9) object;
|
||||
}
|
||||
}
|
||||
return hrc;
|
||||
}
|
||||
|
||||
|
|
|
@ -166,8 +166,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateIndexBuffer(LPDIRECT3DDEVICE9 iface,
|
|||
/* Allocate the storage for the device */
|
||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
||||
if (NULL == object) {
|
||||
FIXME("Allocation of memory failed\n");
|
||||
*ppIndexBuffer = NULL;
|
||||
FIXME("Allocation of memory failed, returning D3DERR_OUTOFVIDEOMEMORY\n");
|
||||
return D3DERR_OUTOFVIDEOMEMORY;
|
||||
}
|
||||
|
||||
|
@ -176,12 +175,13 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateIndexBuffer(LPDIRECT3DDEVICE9 iface,
|
|||
TRACE("Calling wined3d create index buffer\n");
|
||||
hrc = IWineD3DDevice_CreateIndexBuffer(This->WineD3DDevice, Length, Usage, Format, Pool, &object->wineD3DIndexBuffer, pSharedHandle, (IUnknown *)object);
|
||||
if (hrc != D3D_OK) {
|
||||
/* free up object */
|
||||
|
||||
/* free up object */
|
||||
FIXME("(%p) call to IWineD3DDevice_CreateIndexBuffer failed\n", This);
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
*ppIndexBuffer = NULL;
|
||||
} else {
|
||||
*ppIndexBuffer = (LPDIRECT3DINDEXBUFFER9) object;
|
||||
TRACE("(%p) : Created index buffer %p\n", This, object);
|
||||
}
|
||||
return hrc;
|
||||
}
|
||||
|
|
|
@ -101,29 +101,30 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreatePixelShader(LPDIRECT3DDEVICE9 iface, C
|
|||
HRESULT hrc = D3D_OK;
|
||||
|
||||
FIXME("(%p) Relay (disabled)\n", This);
|
||||
*ppShader = NULL;
|
||||
return D3D_OK;
|
||||
|
||||
if (ppShader == NULL) {
|
||||
TRACE("(%p) Invalid call\n", This);
|
||||
return D3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
||||
|
||||
if (NULL == object) {
|
||||
FIXME("Allocation of memory failed, returning D3DERR_OUTOFVIDEOMEMORY\n");
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
object->ref = 1;
|
||||
object->lpVtbl = &Direct3DPixelShader9_Vtbl;
|
||||
hrc = IWineD3DDevice_CreatePixelShader(This->WineD3DDevice, pFunction, &object->wineD3DPixelShader , (IUnknown *)object);
|
||||
if (hrc != D3D_OK) {
|
||||
|
||||
/* free up object */
|
||||
FIXME("(%p) call to IWineD3DDevice_CreatePixelShader failed\n", This);
|
||||
HeapFree(GetProcessHeap(), 0 , object);
|
||||
} else {
|
||||
|
||||
object->ref = 1;
|
||||
object->lpVtbl = &Direct3DPixelShader9_Vtbl;
|
||||
hrc = IWineD3DDevice_CreatePixelShader(This->WineD3DDevice, pFunction, &object->wineD3DPixelShader , (IUnknown *)object);
|
||||
if (hrc != D3D_OK) {
|
||||
FIXME("(%p) call to IWineD3DDevice_CreatePixelShader failed\n", This);
|
||||
HeapFree(GetProcessHeap(), 0 , object);
|
||||
*ppShader = NULL;
|
||||
} else {
|
||||
*ppShader = (IDirect3DPixelShader9*) object;
|
||||
}
|
||||
|
||||
*ppShader = (IDirect3DPixelShader9*) object;
|
||||
TRACE("(%p) : Created pixel shader %p\n", This, object);
|
||||
}
|
||||
|
||||
TRACE("(%p) : returning %p\n", This, *ppShader);
|
||||
|
|
|
@ -131,8 +131,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateQuery(LPDIRECT3DDEVICE9 iface, D3DQUER
|
|||
/* Allocate the storage for the device */
|
||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DQuery9Impl));
|
||||
if (NULL == object) {
|
||||
FIXME("Allocation of memory failed\n");
|
||||
*ppQuery = NULL;
|
||||
FIXME("Allocation of memory failed, returning D3DERR_OUTOFVIDEOMEMORY\n");
|
||||
return D3DERR_OUTOFVIDEOMEMORY;
|
||||
}
|
||||
|
||||
|
@ -141,12 +140,13 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateQuery(LPDIRECT3DDEVICE9 iface, D3DQUER
|
|||
hr = IWineD3DDevice_CreateQuery(This->WineD3DDevice, Type, &object->wineD3DQuery, (IUnknown *)object);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
|
||||
/* free up object */
|
||||
FIXME("(%p) call to IWineD3DDevice_CreateQuery failed\n", This);
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
*ppQuery = NULL;
|
||||
} else {
|
||||
*ppQuery = (LPDIRECT3DQUERY9) object;
|
||||
TRACE("(%p) : Created query %p\n", This , object);
|
||||
}
|
||||
TRACE("(%p) : returning %lx\n", This, hr);
|
||||
return hr;
|
||||
|
|
|
@ -106,7 +106,6 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateStateBlock(LPDIRECT3DDEVICE9 iface, D3
|
|||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DStateBlock9Impl));
|
||||
if (NULL == object) {
|
||||
FIXME("(%p) Failed to allocate %d bytes\n", This, sizeof(IDirect3DStateBlock9Impl));
|
||||
*ppStateBlock = NULL;
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
object->lpVtbl = &Direct3DStateBlock9_Vtbl;
|
||||
|
@ -116,11 +115,11 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateStateBlock(LPDIRECT3DDEVICE9 iface, D3
|
|||
if(hrc != D3D_OK){
|
||||
FIXME("(%p) Call to IWineD3DDevice_CreateStateBlock failed.\n", This);
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
*ppStateBlock = NULL;
|
||||
} else {
|
||||
*ppStateBlock = (IDirect3DStateBlock9*)object;
|
||||
TRACE("(%p) : Created stateblock %p\n", This, object);
|
||||
}
|
||||
TRACE("(%p) returning token (ptr to stateblock) of %p\n", This, object);
|
||||
TRACE("(%p) returning token (ptr to stateblock) of %p\n", This, object);
|
||||
return hrc;
|
||||
}
|
||||
|
||||
|
|
|
@ -151,8 +151,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateAdditionalSwapChain(LPDIRECT3DDEVICE
|
|||
|
||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
||||
if (NULL == object) {
|
||||
FIXME("Allocation of memory failed\n");
|
||||
*pSwapChain = NULL;
|
||||
FIXME("Allocation of memory failed, returning D3DERR_OUTOFVIDEOMEMORY\n");
|
||||
return D3DERR_OUTOFVIDEOMEMORY;
|
||||
}
|
||||
object->ref = 1;
|
||||
|
@ -179,9 +178,9 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateAdditionalSwapChain(LPDIRECT3DDEVICE
|
|||
if (hrc != D3D_OK) {
|
||||
FIXME("(%p) call to IWineD3DDevice_CreateAdditionalSwapChain failed\n", This);
|
||||
HeapFree(GetProcessHeap(), 0 , object);
|
||||
*pSwapChain = NULL;
|
||||
}else{
|
||||
*pSwapChain = (IDirect3DSwapChain9 *)object;
|
||||
TRACE("(%p) : Created swapchain %p\n", This, *pSwapChain);
|
||||
}
|
||||
TRACE("(%p) returning %p\n", This, *pSwapChain);
|
||||
return hrc;
|
||||
|
|
|
@ -248,8 +248,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateTexture(LPDIRECT3DDEVICE9 iface, UIN
|
|||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DTexture9Impl));
|
||||
|
||||
if (NULL == object) {
|
||||
FIXME("Allocation of memory failed\n");
|
||||
*ppTexture = NULL;
|
||||
FIXME("Allocation of memory failed, returning D3DERR_OUTOFVIDEOMEMORY\n");
|
||||
return D3DERR_OUTOFVIDEOMEMORY;
|
||||
}
|
||||
|
||||
|
@ -259,14 +258,15 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateTexture(LPDIRECT3DDEVICE9 iface, UIN
|
|||
(WINED3DFORMAT)Format, Pool, &object->wineD3DTexture, pSharedHandle, (IUnknown *)object, D3D9CB_CreateSurface);
|
||||
|
||||
if (FAILED(hrc)) {
|
||||
/* free up object */
|
||||
|
||||
/* free up object */
|
||||
FIXME("(%p) call to IWineD3DDevice_CreateTexture failed\n", This);
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
*ppTexture = NULL;
|
||||
} else {
|
||||
|
||||
*ppTexture= (LPDIRECT3DTEXTURE9) object;
|
||||
TRACE("(%p) Created Texture %p, %p\n", This, object, object->wineD3DTexture);
|
||||
}
|
||||
|
||||
TRACE("(%p) Created Texture %p, %p\n",This,object,object->wineD3DTexture);
|
||||
return hrc;
|
||||
}
|
||||
|
|
|
@ -166,8 +166,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexBuffer(LPDIRECT3DDEVICE9 iface,
|
|||
/* Allocate the storage for the device */
|
||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DVertexBuffer9Impl));
|
||||
if (NULL == object) {
|
||||
FIXME("Allocation of memory failed\n");
|
||||
*ppVertexBuffer = NULL;
|
||||
FIXME("Allocation of memory failed, returning D3DERR_OUTOFVIDEOMEMORY\n");
|
||||
return D3DERR_OUTOFVIDEOMEMORY;
|
||||
}
|
||||
|
||||
|
@ -176,11 +175,12 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexBuffer(LPDIRECT3DDEVICE9 iface,
|
|||
hrc = IWineD3DDevice_CreateVertexBuffer(This->WineD3DDevice, Size, Usage, FVF, Pool, &(object->wineD3DVertexBuffer), pSharedHandle, (IUnknown *)object);
|
||||
|
||||
if (hrc != D3D_OK) {
|
||||
/* free up object */
|
||||
|
||||
/* free up object */
|
||||
FIXME("(%p) call to IWineD3DDevice_CreateVertexBuffer failed\n", This);
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
*ppVertexBuffer = NULL;
|
||||
} else {
|
||||
TRACE("(%p) : Created vertex buffer %p\n", This, object);
|
||||
*ppVertexBuffer = (LPDIRECT3DVERTEXBUFFER9) object;
|
||||
}
|
||||
return hrc;
|
||||
|
|
|
@ -109,14 +109,14 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexDeclaration(LPDIRECT3DDEVICE9
|
|||
|
||||
TRACE("(%p) : Relay\n", iface);
|
||||
if (NULL == ppDecl) {
|
||||
return D3DERR_INVALIDCALL;
|
||||
WARN("(%p) : Caller passed NULL As ppDecl, returning D3DERR_INVALIDCALL",This);
|
||||
return D3DERR_INVALIDCALL;
|
||||
}
|
||||
/* Allocate the storage for the device */
|
||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DVertexDeclaration9Impl));
|
||||
if (NULL == object) {
|
||||
FIXME("Allocation of memory failed\n");
|
||||
*ppDecl = NULL;
|
||||
return D3DERR_OUTOFVIDEOMEMORY;
|
||||
FIXME("Allocation of memory failed, returning D3DERR_OUTOFVIDEOMEMORY\n");
|
||||
return D3DERR_OUTOFVIDEOMEMORY;
|
||||
}
|
||||
|
||||
object->lpVtbl = &Direct3DVertexDeclaration9_Vtbl;
|
||||
|
@ -124,12 +124,13 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexDeclaration(LPDIRECT3DDEVICE9
|
|||
hr = IWineD3DDevice_CreateVertexDeclaration(This->WineD3DDevice, pVertexElements, &object->wineD3DVertexDeclaration, (IUnknown *)object);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
/* free up object */
|
||||
FIXME("(%p) call to IWineD3DDevice_CreateVertexDeclaration failed\n", This);
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
*ppDecl = NULL;
|
||||
|
||||
/* free up object */
|
||||
FIXME("(%p) call to IWineD3DDevice_CreateVertexDeclaration failed\n", This);
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
} else {
|
||||
*ppDecl = (LPDIRECT3DVERTEXDECLARATION9) object;
|
||||
*ppDecl = (LPDIRECT3DVERTEXDECLARATION9) object;
|
||||
TRACE("(%p) : Created vertex declatanio %p\n", This, object);
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
|
|
|
@ -108,8 +108,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexShader(LPDIRECT3DDEVICE9 iface,
|
|||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
||||
TRACE("(%p) : pFunction(%p), ppShader(%p)\n", This, pFunction, ppShader);
|
||||
if (NULL == object) {
|
||||
FIXME("Allocation of memory failed\n");
|
||||
*ppShader = NULL;
|
||||
FIXME("Allocation of memory failed, returning D3DERR_OUTOFVIDEOMEMORY\n");
|
||||
return D3DERR_OUTOFVIDEOMEMORY;
|
||||
}
|
||||
|
||||
|
@ -118,12 +117,13 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexShader(LPDIRECT3DDEVICE9 iface,
|
|||
hrc= IWineD3DDevice_CreateVertexShader(This->WineD3DDevice, pFunction, &object->wineD3DVertexShader, (IUnknown *)object);
|
||||
|
||||
if (FAILED(hrc)) {
|
||||
|
||||
/* free up object */
|
||||
FIXME("Call to IWineD3DDevice_CreateVertexShader failed\n");
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
*ppShader = NULL;
|
||||
}else{
|
||||
*ppShader = (IDirect3DVertexShader9 *)object;
|
||||
TRACE("(%p) : Created vertex shader %p\n", This, object);
|
||||
}
|
||||
|
||||
TRACE("(%p) : returning %p\n", This, *ppShader);
|
||||
|
|
|
@ -250,8 +250,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVolumeTexture(LPDIRECT3DDEVICE9 ifac
|
|||
/* Allocate the storage for the device */
|
||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DVolumeTexture9Impl));
|
||||
if (NULL == object) {
|
||||
FIXME("(%p) allocation of memory failed\n", This);
|
||||
*ppVolumeTexture = NULL;
|
||||
FIXME("(%p) allocation of memory failed, returning D3DERR_OUTOFVIDEOMEMORY\n", This);
|
||||
return D3DERR_OUTOFVIDEOMEMORY;
|
||||
}
|
||||
|
||||
|
@ -263,12 +262,13 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVolumeTexture(LPDIRECT3DDEVICE9 ifac
|
|||
|
||||
|
||||
if (hrc != D3D_OK) {
|
||||
/* free up object */
|
||||
|
||||
/* free up object */
|
||||
FIXME("(%p) call to IWineD3DDevice_CreateVolumeTexture failed\n", This);
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
*ppVolumeTexture = NULL;
|
||||
} else {
|
||||
*ppVolumeTexture = (LPDIRECT3DVOLUMETEXTURE9) object;
|
||||
TRACE("(%p) : Created volume texture %p\n", This, object);
|
||||
}
|
||||
TRACE("(%p) returning %p\n", This , *ppVolumeTexture);
|
||||
return hrc;
|
||||
|
|
Loading…
Reference in New Issue