Commit f6907843 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

d3dx9: Check for tx_1_0 blob magic earlier in D3DXCreateTextureShader().

parent 0e44c658
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
#define ULONG64_MAX (~(ULONG64)0) #define ULONG64_MAX (~(ULONG64)0)
#define FOURCC_TX_1 0x54580100
struct vec4 struct vec4
{ {
float x, y, z, w; float x, y, z, w;
......
...@@ -144,7 +144,6 @@ static double pres_div(double *args, int n) {return 0.0;} ...@@ -144,7 +144,6 @@ static double pres_div(double *args, int n) {return 0.0;}
#define FOURCC_CLIT 0x54494c43 #define FOURCC_CLIT 0x54494c43
#define FOURCC_FXLC 0x434c5846 #define FOURCC_FXLC 0x434c5846
#define FOURCC_PRSI 0x49535250 #define FOURCC_PRSI 0x49535250
#define FOURCC_TX_1 0x54580100
#define PRES_SIGN 0x46580000 #define PRES_SIGN 0x46580000
struct op_info struct op_info
......
...@@ -2653,6 +2653,9 @@ HRESULT WINAPI D3DXCreateTextureShader(const DWORD *function, ID3DXTextureShader ...@@ -2653,6 +2653,9 @@ HRESULT WINAPI D3DXCreateTextureShader(const DWORD *function, ID3DXTextureShader
if (!function || !texture_shader) if (!function || !texture_shader)
return D3DERR_INVALIDCALL; return D3DERR_INVALIDCALL;
if (*function != FOURCC_TX_1)
return D3DXERR_INVALIDDATA;
if (!(size = D3DXGetShaderSize(function))) if (!(size = D3DXGetShaderSize(function)))
return D3DXERR_INVALIDDATA; return D3DXERR_INVALIDDATA;
......
...@@ -2475,17 +2475,25 @@ float4 main(float3 pos : POSITION, float3 size : PSIZE) : COLOR ...@@ -2475,17 +2475,25 @@ float4 main(float3 pos : POSITION, float3 size : PSIZE) : COLOR
hr = D3DXCreateTextureShader(NULL, NULL); hr = D3DXCreateTextureShader(NULL, NULL);
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr); ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
tx = (void *)0xdeadbeef;
hr = D3DXCreateTextureShader(NULL, &tx); hr = D3DXCreateTextureShader(NULL, &tx);
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr); ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
ok(tx == (void *)0xdeadbeef, "Unexpected pointer %p.\n", tx);
tx = (void *)0xdeadbeef;
hr = D3DXCreateTextureShader(shader_invalid, &tx); hr = D3DXCreateTextureShader(shader_invalid, &tx);
todo_wine ok(hr == D3DXERR_INVALIDDATA, "Got unexpected hr %#lx.\n", hr); ok(hr == D3DXERR_INVALIDDATA, "Got unexpected hr %#lx.\n", hr);
ok(tx == (void *)0xdeadbeef, "Unexpected pointer %p.\n", tx);
tx = (void *)0xdeadbeef;
hr = D3DXCreateTextureShader(shader_zero, &tx); hr = D3DXCreateTextureShader(shader_zero, &tx);
todo_wine ok(hr == D3DXERR_INVALIDDATA, "Got unexpected hr %#lx.\n", hr); ok(hr == D3DXERR_INVALIDDATA, "Got unexpected hr %#lx.\n", hr);
ok(tx == (void *)0xdeadbeef, "Unexpected pointer %p.\n", tx);
tx = (void *)0xdeadbeef;
hr = D3DXCreateTextureShader(shader_empty, &tx); hr = D3DXCreateTextureShader(shader_empty, &tx);
todo_wine ok(hr == D3DXERR_INVALIDDATA, "Got unexpected hr %#lx.\n", hr); ok(hr == D3DXERR_INVALIDDATA, "Got unexpected hr %#lx.\n", hr);
ok(tx == (void *)0xdeadbeef, "Unexpected pointer %p.\n", tx);
hr = D3DXCreateTextureShader(shader_code, &tx); hr = D3DXCreateTextureShader(shader_code, &tx);
ok(SUCCEEDED(hr), "Got unexpected hr %#lx.\n", hr); ok(SUCCEEDED(hr), "Got unexpected hr %#lx.\n", hr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment