Commit 18632c2b authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

itss: Fix opening streams with back slashes.

parent e716c5b1
...@@ -329,7 +329,7 @@ static HRESULT WINAPI ITSS_IStorageImpl_OpenStream( ...@@ -329,7 +329,7 @@ static HRESULT WINAPI ITSS_IStorageImpl_OpenStream(
DWORD len; DWORD len;
struct chmUnitInfo ui; struct chmUnitInfo ui;
int r; int r;
WCHAR *path; WCHAR *path, *p;
TRACE("%p %s %p %u %u %p\n", This, debugstr_w(pwcsName), TRACE("%p %s %p %u %u %p\n", This, debugstr_w(pwcsName),
reserved1, grfMode, reserved2, ppstm ); reserved1, grfMode, reserved2, ppstm );
...@@ -337,21 +337,29 @@ static HRESULT WINAPI ITSS_IStorageImpl_OpenStream( ...@@ -337,21 +337,29 @@ static HRESULT WINAPI ITSS_IStorageImpl_OpenStream(
len = strlenW( This->dir ) + strlenW( pwcsName ) + 1; len = strlenW( This->dir ) + strlenW( pwcsName ) + 1;
path = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) ); path = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
strcpyW( path, This->dir ); 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 == '/' ) ) while( ( path <= p ) && ( *p == '/' ) )
*p-- = 0; *p-- = 0;
} }
strcatW( path, pwcsName ); strcatW( path, pwcsName );
for(p=path; *p; p++) {
if(*p == '\\')
*p = '/';
}
TRACE("Resolving %s\n", debugstr_w(path)); TRACE("Resolving %s\n", debugstr_w(path));
r = chm_resolve_object(This->chmfile, path, &ui); r = chm_resolve_object(This->chmfile, path, &ui);
HeapFree( GetProcessHeap(), 0, path ); HeapFree( GetProcessHeap(), 0, path );
if( r != CHM_RESOLVE_SUCCESS ) if( r != CHM_RESOLVE_SUCCESS ) {
WARN("Could not resolve object\n");
return STG_E_FILENOTFOUND; return STG_E_FILENOTFOUND;
}
stm = ITSS_create_stream( This, &ui ); stm = ITSS_create_stream( This, &ui );
if( !stm ) if( !stm )
...@@ -660,7 +668,7 @@ static HRESULT WINAPI ITSS_IStream_Read( ...@@ -660,7 +668,7 @@ static HRESULT WINAPI ITSS_IStream_Read(
This->addr += count; This->addr += count;
if( pcbRead ) if( pcbRead )
*pcbRead = count; *pcbRead = count;
return count ? S_OK : S_FALSE; return count ? S_OK : S_FALSE;
} }
......
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