The following patches are needed in order to make (some versions of) Microsoft Installer work. Changelog: Name of the structured storage file root node is path of the file, not the name of the root node stored in the file. When reading streams stored into structured storage files, EOF is not supposed to cause an error if at least one byte can be returned. Index: wine/dlls/ole32/stg_stream.c =================================================================== RCS file: /home/wine/wine/dlls/ole32/stg_stream.c,v retrieving revision 1.10 diff -u -r1.10 stg_stream.c --- wine/dlls/ole32/stg_stream.c 2001/10/22 19:04:32 1.10 +++ wine/dlls/ole32/stg_stream.c 2001/12/31 15:47:06 @@ -379,12 +379,11 @@ */ This->currentPosition.s.LowPart += *pcbRead; - /* - * The function returns S_OK if the buffer was filled completely - * it returns S_FALSE if the end of the stream is reached before the - * buffer is filled + /* + * The function returns S_OK if at least one byte could be read. + * FIXME: What should be returned if pcbRead argument is NULL? */ - if(*pcbRead == cb) + if (*pcbRead > 0) return S_OK; return S_FALSE; Index: wine/dlls/ole32/storage32.h =================================================================== RCS file: /home/wine/wine/dlls/ole32/storage32.h,v retrieving revision 1.7 diff -u -r1.7 storage32.h --- wine/dlls/ole32/storage32.h 2000/09/26 00:00:56 1.7 +++ wine/dlls/ole32/storage32.h 2001/12/31 15:47:45 @@ -298,7 +298,8 @@ * class */ HANDLE hFile; /* Physical support for the Docfile */ - + LPOLESTR pwcsName; /* Full path of the document file */ + /* * File header */ @@ -378,6 +379,10 @@ IStorage* iface, DWORD grfStateBits, /* [in] */ DWORD grfMask); /* [in] */ + +HRESULT WINAPI StorageImpl_Stat(IStorage* iface, + STATSTG* pstatstg, /* [out] */ + DWORD grfStatFlag); /* [in] */ void StorageImpl_Destroy( StorageImpl* This); @@ -385,6 +390,7 @@ HRESULT StorageImpl_Construct( StorageImpl* This, HANDLE hFile, + LPCOLESTR pwcsName, ILockBytes* pLkbyt, DWORD openFlags, BOOL fileBased, Index: wine/dlls/ole32/storage32.c =================================================================== RCS file: /home/wine/wine/dlls/ole32/storage32.c,v retrieving revision 1.27 diff -u -r1.27 storage32.c --- wine/dlls/ole32/storage32.c 2001/07/14 00:47:52 1.27 +++ wine/dlls/ole32/storage32.c 2001/12/31 15:52:40 @@ -159,7 +159,7 @@ StorageImpl_SetElementTimes, StorageBaseImpl_SetClass, StorageImpl_SetStateBits, - StorageBaseImpl_Stat + StorageImpl_Stat }; /* @@ -1678,7 +1678,32 @@ return hr; } +/************************************************************************ + * StorageImpl_Stat (IStorage) + * + * This method will retrieve information about this storage object. + * + * See Windows documentation for more details on IStorage methods. + */ +HRESULT WINAPI StorageImpl_Stat( + IStorage* iface, + STATSTG* pstatstg, /* [out] */ + DWORD grfStatFlag) /* [in] */ +{ + StorageImpl* const This = (StorageImpl*)iface; + HRESULT result = StorageBaseImpl_Stat( iface, pstatstg, grfStatFlag ); + + if ( !FAILED(result) && ((grfStatFlag & STATFLAG_NONAME) == 0) && This->pwcsName ) + { + CoTaskMemFree(pstatstg->pwcsName); + pstatstg->pwcsName = CoTaskMemAlloc((lstrlenW(This->pwcsName)+1)*sizeof(WCHAR)); + strcpyW(pstatstg->pwcsName, This->pwcsName); + } + return result; +} + + /********************************************************************* * * Internal Method @@ -2094,6 +2119,7 @@ HRESULT StorageImpl_Construct( StorageImpl* This, HANDLE hFile, + LPCOLESTR pwcsName, ILockBytes* pLkbyt, DWORD openFlags, BOOL fileBased, @@ -2103,7 +2129,7 @@ StgProperty currentProperty; BOOL readSuccessful; ULONG currentPropertyIndex; - + if ( FAILED( validateSTGM(openFlags) )) return STG_E_INVALIDFLAG; @@ -2127,6 +2153,17 @@ This->hFile = hFile; /* + * Store copy of file path. + */ + if(pwcsName) { + This->pwcsName = HeapAlloc(GetProcessHeap(), 0, + (lstrlenW(pwcsName)+1)*sizeof(WCHAR)); + if (!This->pwcsName) + return STG_E_INSUFFICIENTMEMORY; + strcpyW(This->pwcsName, pwcsName); + } + + /* * Initialize the big block cache. */ This->bigBlockSize = DEF_BIG_BLOCK_SIZE; @@ -2289,6 +2326,9 @@ { TRACE("(%p)\n", This); + if(This->pwcsName) + HeapFree(GetProcessHeap(), 0, This->pwcsName); + BlockChainStream_Destroy(This->smallBlockRootChain); BlockChainStream_Destroy(This->rootBlockChain); BlockChainStream_Destroy(This->smallBlockDepotChain); @@ -5360,6 +5400,7 @@ hr = StorageImpl_Construct( newStorage, hFile, + pwcsName, NULL, grfMode, TRUE, @@ -5477,6 +5518,7 @@ hr = StorageImpl_Construct( newStorage, hFile, + pwcsName, NULL, grfMode, TRUE, @@ -5533,6 +5575,7 @@ hr = StorageImpl_Construct( newStorage, 0, + 0, plkbyt, grfMode, FALSE, @@ -5597,6 +5640,7 @@ hr = StorageImpl_Construct( newStorage, 0, + 0, plkbyt, grfMode, FALSE, -- Jukka Heinonen <http://www.iki.fi/jhei/>