Module: wine Branch: master Commit: 18632c2b3c13d5b369051a919151b40dbcd25f91 URL: http://source.winehq.org/git/wine.git/?a=commit;h=18632c2b3c13d5b369051a9191...
Author: Jacek Caban jacek@codeweavers.com Date: Thu Feb 22 21:08:47 2007 +0100
itss: Fix opening streams with back slashes.
---
dlls/itss/storage.c | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/dlls/itss/storage.c b/dlls/itss/storage.c index 6c163ad..c3c144c 100644 --- a/dlls/itss/storage.c +++ b/dlls/itss/storage.c @@ -329,7 +329,7 @@ static HRESULT WINAPI ITSS_IStorageImpl_OpenStream( DWORD len; struct chmUnitInfo ui; int r; - WCHAR *path; + WCHAR *path, *p;
TRACE("%p %s %p %u %u %p\n", This, debugstr_w(pwcsName), reserved1, grfMode, reserved2, ppstm ); @@ -337,21 +337,29 @@ static HRESULT WINAPI ITSS_IStorageImpl_OpenStream( len = strlenW( This->dir ) + strlenW( pwcsName ) + 1; path = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) ); strcpyW( path, This->dir ); - if( pwcsName[0] == '/' ) + + if( pwcsName[0] == '/' || pwcsName[0] == '\' ) { - WCHAR *p = &path[strlenW( path ) - 1]; + p = &path[strlenW( path ) - 1]; while( ( path <= p ) && ( *p == '/' ) ) *p-- = 0; } strcatW( path, pwcsName );
+ for(p=path; *p; p++) { + if(*p == '\') + *p = '/'; + } + TRACE("Resolving %s\n", debugstr_w(path));
r = chm_resolve_object(This->chmfile, path, &ui); HeapFree( GetProcessHeap(), 0, path );
- if( r != CHM_RESOLVE_SUCCESS ) + if( r != CHM_RESOLVE_SUCCESS ) { + WARN("Could not resolve object\n"); return STG_E_FILENOTFOUND; + }
stm = ITSS_create_stream( This, &ui ); if( !stm ) @@ -660,7 +668,7 @@ static HRESULT WINAPI ITSS_IStream_Read( This->addr += count; if( pcbRead ) *pcbRead = count; - + return count ? S_OK : S_FALSE; }