Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/shlwapi/tests/istream.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
diff --git a/dlls/shlwapi/tests/istream.c b/dlls/shlwapi/tests/istream.c index 300e9b9c00..f1854a283f 100644 --- a/dlls/shlwapi/tests/istream.c +++ b/dlls/shlwapi/tests/istream.c @@ -247,6 +247,27 @@ static void test_stream_read_write(IStream *stream, DWORD mode) ok(buf[0] == 0x5e && buf[1] == 0xa7, "expected 5ea7, got %02x%02x\n", buf[0], buf[1]); }
+static void test_stream_qi(IStream *stream) +{ + IUnknown *unk; + HRESULT hr; + + hr = IStream_QueryInterface(stream, &IID_IStream, (void **)&unk); + ok(SUCCEEDED(hr), "Failed to get IStream interface, hr %#x.\n", hr); + IUnknown_Release(unk); + + unk = NULL; + hr = IStream_QueryInterface(stream, &IID_ISequentialStream, (void **)&unk); +todo_wine + ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* XP */, "Failed to get ISequentialStream interface, hr %#x.\n", hr); + if (unk) + IUnknown_Release(unk); + + hr = IStream_QueryInterface(stream, &IID_IUnknown, (void **)&unk); + ok(SUCCEEDED(hr), "Failed to get IUnknown interface, hr %#x.\n", hr); + IUnknown_Release(unk); +} + static void test_SHCreateStreamOnFileA(DWORD mode, DWORD stgm) { IStream * stream; @@ -310,6 +331,7 @@ if (0) /* This test crashes on WinXP SP2 */ ok(stream != NULL, "SHCreateStreamOnFileA: expected a valid IStream object, got NULL\n");
if (stream) { + test_stream_qi(stream); test_IStream_invalid_operations(stream, mode);
refcount = IStream_Release(stream); @@ -422,6 +444,7 @@ static void test_SHCreateStreamOnFileW(DWORD mode, DWORD stgm) ok(stream != NULL, "SHCreateStreamOnFileW: expected a valid IStream object, got NULL\n");
if (stream) { + test_stream_qi(stream); test_IStream_invalid_operations(stream, mode);
refcount = IStream_Release(stream); @@ -551,6 +574,7 @@ static void test_SHCreateStreamOnFileEx(DWORD mode, DWORD stgm) ok(stream != NULL, "SHCreateStreamOnFileEx: expected a valid IStream object, got NULL\n");
if (stream) { + test_stream_qi(stream); test_IStream_invalid_operations(stream, mode);
refcount = IStream_Release(stream);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/shlwapi/istream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/shlwapi/istream.c b/dlls/shlwapi/istream.c index 946d2c84b6..7ebb478b29 100644 --- a/dlls/shlwapi/istream.c +++ b/dlls/shlwapi/istream.c @@ -242,7 +242,7 @@ static HRESULT WINAPI IStream_fnCopyTo(IStream *iface, IStream* pstm, ULARGE_INT pcbRead->QuadPart += ulRead;
/* Write */ - hRet = IStream_fnWrite(pstm, copyBuff, ulRead, &ulWritten); + hRet = IStream_Write(pstm, copyBuff, ulRead, &ulWritten); if (pcbWritten) pcbWritten->QuadPart += ulWritten; if (FAILED(hRet) || ulWritten != ulLeft)
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/shlwapi/istream.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/dlls/shlwapi/istream.c b/dlls/shlwapi/istream.c index 7ebb478b29..8cae1cd4af 100644 --- a/dlls/shlwapi/istream.c +++ b/dlls/shlwapi/istream.c @@ -55,9 +55,6 @@ static inline ISHFileStream *impl_from_IStream(IStream *iface) return CONTAINING_RECORD(iface, ISHFileStream, IStream_iface); }
-static HRESULT WINAPI IStream_fnCommit(IStream*,DWORD); - - /************************************************************************** * IStream_fnQueryInterface */ @@ -104,7 +101,7 @@ static ULONG WINAPI IStream_fnRelease(IStream *iface)
if (!refCount) { - IStream_fnCommit(iface, 0); /* If ever buffered, this will be needed */ + IStream_Commit(iface, 0); /* If ever buffered, this will be needed */ LocalFree(This->lpszPath); CloseHandle(This->hFile); HeapFree(GetProcessHeap(), 0, This); @@ -171,7 +168,7 @@ static HRESULT WINAPI IStream_fnSeek(IStream *iface, LARGE_INTEGER dlibMove,
TRACE("(%p,%d,%d,%p)\n", This, dlibMove.u.LowPart, dwOrigin, pNewPos);
- IStream_fnCommit(iface, 0); /* If ever buffered, this will be needed */ + IStream_Commit(iface, 0); /* If ever buffered, this will be needed */ dwPos = SetFilePointer(This->hFile, dlibMove.u.LowPart, NULL, dwOrigin); if( dwPos == INVALID_SET_FILE_POINTER ) return HRESULT_FROM_WIN32(GetLastError()); @@ -193,7 +190,7 @@ static HRESULT WINAPI IStream_fnSetSize(IStream *iface, ULARGE_INTEGER libNewSiz
TRACE("(%p,%d)\n", This, libNewSize.u.LowPart);
- IStream_fnCommit(iface, 0); /* If ever buffered, this will be needed */ + IStream_Commit(iface, 0); /* If ever buffered, this will be needed */ if( ! SetFilePointer( This->hFile, libNewSize.QuadPart, NULL, FILE_BEGIN ) ) return E_FAIL;
@@ -224,7 +221,7 @@ static HRESULT WINAPI IStream_fnCopyTo(IStream *iface, IStream* pstm, ULARGE_INT if (!pstm) return S_OK;
- IStream_fnCommit(iface, 0); /* If ever buffered, this will be needed */ + IStream_Commit(iface, 0); /* If ever buffered, this will be needed */
/* Copy data */ ulSize = cb.QuadPart; @@ -235,7 +232,7 @@ static HRESULT WINAPI IStream_fnCopyTo(IStream *iface, IStream* pstm, ULARGE_INT ulLeft = ulSize > sizeof(copyBuff) ? sizeof(copyBuff) : ulSize;
/* Read */ - hRet = IStream_fnRead(iface, copyBuff, ulLeft, &ulRead); + hRet = IStream_Read(iface, copyBuff, ulLeft, &ulRead); if (FAILED(hRet) || ulRead == 0) break; if (pcbRead)
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/shlwapi/istream.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/dlls/shlwapi/istream.c b/dlls/shlwapi/istream.c index 8cae1cd4af..43f53ffc79 100644 --- a/dlls/shlwapi/istream.c +++ b/dlls/shlwapi/istream.c @@ -118,7 +118,7 @@ static HRESULT WINAPI IStream_fnRead(IStream *iface, void* pv, ULONG cb, ULONG* ISHFileStream *This = impl_from_IStream(iface); DWORD dwRead = 0;
- TRACE("(%p,%p,0x%08x,%p)\n", This, pv, cb, pcbRead); + TRACE("(%p,%p,%u,%p)\n", This, pv, cb, pcbRead);
if (!ReadFile(This->hFile, pv, cb, &dwRead, NULL)) { @@ -138,7 +138,7 @@ static HRESULT WINAPI IStream_fnWrite(IStream *iface, const void* pv, ULONG cb, ISHFileStream *This = impl_from_IStream(iface); DWORD dwWritten = 0;
- TRACE("(%p,%p,0x%08x,%p)\n", This, pv, cb, pcbWritten); + TRACE("(%p,%p,%u,%p)\n", This, pv, cb, pcbWritten);
switch (STGM_ACCESS_MODE(This->dwMode)) { @@ -166,7 +166,7 @@ static HRESULT WINAPI IStream_fnSeek(IStream *iface, LARGE_INTEGER dlibMove, ISHFileStream *This = impl_from_IStream(iface); DWORD dwPos;
- TRACE("(%p,%d,%d,%p)\n", This, dlibMove.u.LowPart, dwOrigin, pNewPos); + TRACE("(%p,%s,%d,%p)\n", This, wine_dbgstr_longlong(dlibMove.QuadPart), dwOrigin, pNewPos);
IStream_Commit(iface, 0); /* If ever buffered, this will be needed */ dwPos = SetFilePointer(This->hFile, dlibMove.u.LowPart, NULL, dwOrigin); @@ -188,7 +188,7 @@ static HRESULT WINAPI IStream_fnSetSize(IStream *iface, ULARGE_INTEGER libNewSiz { ISHFileStream *This = impl_from_IStream(iface);
- TRACE("(%p,%d)\n", This, libNewSize.u.LowPart); + TRACE("(%p,%s)\n", This, wine_dbgstr_longlong(libNewSize.QuadPart));
IStream_Commit(iface, 0); /* If ever buffered, this will be needed */ if( ! SetFilePointer( This->hFile, libNewSize.QuadPart, NULL, FILE_BEGIN ) ) @@ -211,7 +211,7 @@ static HRESULT WINAPI IStream_fnCopyTo(IStream *iface, IStream* pstm, ULARGE_INT ULONGLONG ulSize; HRESULT hRet = S_OK;
- TRACE("(%p,%p,%d,%p,%p)\n", This, pstm, cb.u.LowPart, pcbRead, pcbWritten); + TRACE("(%p,%p,%s,%p,%p)\n", This, pstm, wine_dbgstr_longlong(cb.QuadPart), pcbRead, pcbWritten);
if (pcbRead) pcbRead->QuadPart = 0; @@ -280,7 +280,7 @@ static HRESULT WINAPI IStream_fnLockUnlockRegion(IStream *iface, ULARGE_INTEGER ULARGE_INTEGER cb, DWORD dwLockType) { ISHFileStream *This = impl_from_IStream(iface); - TRACE("(%p,%d,%d,%d)\n", This, libOffset.u.LowPart, cb.u.LowPart, dwLockType); + TRACE("(%p,%s,%s,%d)\n", This, wine_dbgstr_longlong(libOffset.QuadPart), wine_dbgstr_longlong(cb.QuadPart), dwLockType); return E_NOTIMPL; }
@@ -327,7 +327,7 @@ static HRESULT WINAPI IStream_fnClone(IStream *iface, IStream** ppstm) { ISHFileStream *This = impl_from_IStream(iface);
- TRACE("(%p)\n",This); + TRACE("(%p,%p)\n", This, ppstm); if (ppstm) *ppstm = NULL; return E_NOTIMPL; @@ -540,7 +540,7 @@ HRESULT WINAPI SHIStream_Read(IStream *lpStream, LPVOID lpvDest, ULONG ulSize) ULONG ulRead; HRESULT hRet;
- TRACE("(%p,%p,%d)\n", lpStream, lpvDest, ulSize); + TRACE("(%p,%p,%u)\n", lpStream, lpvDest, ulSize);
hRet = IStream_Read(lpStream, lpvDest, ulSize, &ulRead);