d3dx9: Fix D3DXCompileShaderFromFileW.
Matteo Bruni
matteo.mystral at gmail.com
Wed Sep 8 12:10:03 CDT 2010
-------------- next part --------------
From edd7a5f7e22268613978d97600d34a2c927fb46c Mon Sep 17 00:00:00 2001
From: Matteo Bruni <matteo.mystral at gmail.com>
Date: Wed, 8 Sep 2010 16:07:07 +0200
Subject: d3dx9: Fix D3DXCompileShaderFromFileW.
---
dlls/d3dx9_36/shader.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/d3dx9_36/shader.c b/dlls/d3dx9_36/shader.c
index 1ddcde7..a3648c2 100644
--- a/dlls/d3dx9_36/shader.c
+++ b/dlls/d3dx9_36/shader.c
@@ -423,7 +423,7 @@ HRESULT WINAPI D3DXCompileShaderFromFileW(LPCWSTR filename,
LPD3DXCONSTANTTABLE* constant_table)
{
void *buffer;
- DWORD len;
+ DWORD len, filename_len;
HRESULT hr;
struct D3DXIncludeImpl includefromfile;
char *filename_a;
@@ -437,13 +437,14 @@ HRESULT WINAPI D3DXCompileShaderFromFileW(LPCWSTR filename,
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)
{
UnmapViewOfFile(buffer);
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,
(ID3DInclude *)include, entrypoint, profile, flags, 0,
--
1.7.2.2
More information about the wine-patches
mailing list