Module: wine Branch: master Commit: ec364eaa4f70e35466d0f4eb85a28eca08b04c66 URL: http://source.winehq.org/git/wine.git/?a=commit;h=ec364eaa4f70e35466d0f4eb85...
Author: Matteo Bruni mbruni@codeweavers.com Date: Mon Aug 25 20:36:51 2014 +0200
d3dx9: Account for include paths mixing '/' and ''.
Include pathnames are passed unchanged to ID3DInclude objects so e.g. if a file is included as "path/file.h" the full pathname will have mixed slashes.
---
dlls/d3dx9_36/shader.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/dlls/d3dx9_36/shader.c b/dlls/d3dx9_36/shader.c index b36e7bb..5ea3d13 100644 --- a/dlls/d3dx9_36/shader.c +++ b/dlls/d3dx9_36/shader.c @@ -242,7 +242,7 @@ static HRESULT WINAPI d3dincludefromfile_open(ID3DXInclude *iface, D3DXINCLUDE_T const char *filename, const void *parent_data, const void **data, UINT *bytes) { const char *p, *parent_name = ""; - char *pathname = NULL; + char *pathname = NULL, *ptr; char **buffer = NULL; HANDLE file; UINT size; @@ -259,14 +259,23 @@ static HRESULT WINAPI d3dincludefromfile_open(ID3DXInclude *iface, D3DXINCLUDE_T
TRACE("Looking up for include file %s, parent %s\n", debugstr_a(filename), debugstr_a(parent_name));
- if ((p = strrchr(parent_name, '\')) || (p = strrchr(parent_name, '/'))) p++; - else p = parent_name; + if ((p = strrchr(parent_name, '\'))) + ++p; + else + p = parent_name; pathname = HeapAlloc(GetProcessHeap(), 0, (p - parent_name) + strlen(filename) + 1); if(!pathname) return HRESULT_FROM_WIN32(GetLastError());
memcpy(pathname, parent_name, p - parent_name); strcpy(pathname + (p - parent_name), filename); + ptr = pathname + (p - parent_name); + while (*ptr) + { + if (*ptr == '/') + *ptr = '\'; + ++ptr; + }
file = CreateFileA(pathname, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); if(file == INVALID_HANDLE_VALUE)