Commit d6ead897 authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

d3dx9: Fix D3DXCompileShaderFromFileW.

parent 4a5b2abc
...@@ -423,7 +423,7 @@ HRESULT WINAPI D3DXCompileShaderFromFileW(LPCWSTR filename, ...@@ -423,7 +423,7 @@ HRESULT WINAPI D3DXCompileShaderFromFileW(LPCWSTR filename,
LPD3DXCONSTANTTABLE* constant_table) LPD3DXCONSTANTTABLE* constant_table)
{ {
void *buffer; void *buffer;
DWORD len; DWORD len, filename_len;
HRESULT hr; HRESULT hr;
struct D3DXIncludeImpl includefromfile; struct D3DXIncludeImpl includefromfile;
char *filename_a; char *filename_a;
...@@ -437,13 +437,14 @@ HRESULT WINAPI D3DXCompileShaderFromFileW(LPCWSTR filename, ...@@ -437,13 +437,14 @@ HRESULT WINAPI D3DXCompileShaderFromFileW(LPCWSTR filename,
include = (LPD3DXINCLUDE)&includefromfile; include = (LPD3DXINCLUDE)&includefromfile;
} }
filename_a = HeapAlloc(GetProcessHeap(), 0, len * sizeof(char)); filename_len = WideCharToMultiByte(CP_ACP, 0, filename, -1, NULL, 0, NULL, NULL);
filename_a = HeapAlloc(GetProcessHeap(), 0, filename_len * sizeof(char));
if (!filename_a) if (!filename_a)
{ {
UnmapViewOfFile(buffer); UnmapViewOfFile(buffer);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
WideCharToMultiByte(CP_ACP, 0, filename, -1, filename_a, len, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, filename, -1, filename_a, filename_len, NULL, NULL);
hr = D3DCompile(buffer, len, filename_a, (D3D_SHADER_MACRO *)defines, hr = D3DCompile(buffer, len, filename_a, (D3D_SHADER_MACRO *)defines,
(ID3DInclude *)include, entrypoint, profile, flags, 0, (ID3DInclude *)include, entrypoint, profile, flags, 0,
......
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