Nikolay Sivov : shlwapi: Forward IStream helpers to shcore.

Alexandre Julliard julliard at winehq.org
Mon Dec 3 15:28:53 CST 2018


Module: wine
Branch: master
Commit: 77a8ac36838131d39f8345de014bd1447807acb3
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=77a8ac36838131d39f8345de014bd1447807acb3

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Mon Dec  3 10:40:59 2018 +0300

shlwapi: Forward IStream helpers to shcore.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/shlwapi/istream.c    | 112 +---------------------------------------------
 dlls/shlwapi/shlwapi.spec |   8 ++--
 2 files changed, 6 insertions(+), 114 deletions(-)

diff --git a/dlls/shlwapi/istream.c b/dlls/shlwapi/istream.c
index ba9874b..37fa4c6 100644
--- a/dlls/shlwapi/istream.c
+++ b/dlls/shlwapi/istream.c
@@ -35,35 +35,6 @@
 WINE_DEFAULT_DEBUG_CHANNEL(shell);
 
 /*************************************************************************
- * @       [SHLWAPI.184]
- *
- * Call IStream_Read() on a stream.
- *
- * PARAMS
- *  lpStream [I] IStream object
- *  lpvDest  [O] Destination for data read
- *  ulSize   [I] Size of data to read
- *
- * RETURNS
- *  Success: S_OK. ulSize bytes have been read from the stream into lpvDest.
- *  Failure: An HRESULT error code, or E_FAIL if the read succeeded but the
- *           number of bytes read does not match.
- */
-HRESULT WINAPI SHIStream_Read(IStream *lpStream, LPVOID lpvDest, ULONG ulSize)
-{
-  ULONG ulRead;
-  HRESULT hRet;
-
-  TRACE("(%p,%p,%u)\n", lpStream, lpvDest, ulSize);
-
-  hRet = IStream_Read(lpStream, lpvDest, ulSize, &ulRead);
-
-  if (SUCCEEDED(hRet) && ulRead != ulSize)
-    hRet = E_FAIL;
-  return hRet;
-}
-
-/*************************************************************************
  * @       [SHLWAPI.166]
  *
  * Determine if a stream has 0 length.
@@ -91,10 +62,10 @@ BOOL WINAPI SHIsEmptyStream(IStream *lpStream)
   }
   else
   {
-    DWORD dwDummy;
+    DWORD dummy, read_len;
 
     /* Try to read from the stream */
-    if(SUCCEEDED(SHIStream_Read(lpStream, &dwDummy, sizeof(dwDummy))))
+    if (SUCCEEDED(IStream_Read(lpStream, &dummy, sizeof(dummy), &read_len)) && read_len == sizeof(dummy))
     {
       LARGE_INTEGER zero;
       zero.QuadPart = 0;
@@ -105,82 +76,3 @@ BOOL WINAPI SHIsEmptyStream(IStream *lpStream)
   }
   return bRet;
 }
-
-/*************************************************************************
- * @       [SHLWAPI.212]
- *
- * Call IStream_Write() on a stream.
- *
- * PARAMS
- *  lpStream [I] IStream object
- *  lpvSrc   [I] Source for data to write
- *  ulSize   [I] Size of data
- *
- * RETURNS
- *  Success: S_OK. ulSize bytes have been written to the stream from lpvSrc.
- *  Failure: An HRESULT error code, or E_FAIL if the write succeeded but the
- *           number of bytes written does not match.
- */
-HRESULT WINAPI SHIStream_Write(IStream *lpStream, LPCVOID lpvSrc, ULONG ulSize)
-{
-  ULONG ulWritten;
-  HRESULT hRet;
-
-  TRACE("(%p,%p,%d)\n", lpStream, lpvSrc, ulSize);
-
-  hRet = IStream_Write(lpStream, lpvSrc, ulSize, &ulWritten);
-
-  if (SUCCEEDED(hRet) && ulWritten != ulSize)
-    hRet = E_FAIL;
-
-  return hRet;
-}
-
-/*************************************************************************
- * @       [SHLWAPI.213]
- *
- * Seek to the start of a stream.
- *
- * PARAMS
- *  lpStream [I] IStream object
- *
- * RETURNS
- *  Success: S_OK. The current position within the stream is updated
- *  Failure: An HRESULT error code.
- */
-HRESULT WINAPI IStream_Reset(IStream *lpStream)
-{
-  LARGE_INTEGER zero;
-  TRACE("(%p)\n", lpStream);
-  zero.QuadPart = 0;
-  return IStream_Seek(lpStream, zero, 0, NULL);
-}
-
-/*************************************************************************
- * @       [SHLWAPI.214]
- *
- * Get the size of a stream.
- *
- * PARAMS
- *  lpStream [I] IStream object
- *  lpulSize [O] Destination for size
- *
- * RETURNS
- *  Success: S_OK. lpulSize contains the size of the stream.
- *  Failure: An HRESULT error code.
- */
-HRESULT WINAPI IStream_Size(IStream *lpStream, ULARGE_INTEGER* lpulSize)
-{
-  STATSTG statstg;
-  HRESULT hRet;
-
-  TRACE("(%p,%p)\n", lpStream, lpulSize);
-
-  memset(&statstg, 0, sizeof(statstg));
-
-  hRet = IStream_Stat(lpStream, &statstg, 1);
-
-  if (SUCCEEDED(hRet) && lpulSize)
-    *lpulSize = statstg.cbSize;
-  return hRet;
-}
diff --git a/dlls/shlwapi/shlwapi.spec b/dlls/shlwapi/shlwapi.spec
index 9c01c3f..6e64a9c 100644
--- a/dlls/shlwapi/shlwapi.spec
+++ b/dlls/shlwapi/shlwapi.spec
@@ -181,7 +181,7 @@
 181 stdcall -noname SHEnableMenuItem(long long long)
 182 stdcall -noname SHCheckMenuItem(long long long)
 183 stdcall -noname SHRegisterClassA(ptr)
-184 stdcall -ordinal IStream_Read(ptr ptr long) SHIStream_Read
+184 stdcall -ordinal IStream_Read(ptr ptr long) shcore.IStream_Read
 185 stdcall -ordinal SHMessageBoxCheckA(ptr str str long long str)
 186 stdcall -noname SHSimulateDrop(ptr ptr long ptr ptr)
 187 stdcall -noname SHLoadFromPropertyBag(ptr ptr)
@@ -209,9 +209,9 @@
 209 stdcall -noname FDSA_Destroy(ptr)
 210 stdcall -noname FDSA_InsertItem(ptr long ptr)
 211 stdcall -noname FDSA_DeleteItem(ptr long)
-212 stdcall -ordinal IStream_Write(ptr ptr long) SHIStream_Write
-213 stdcall -ordinal IStream_Reset(ptr)
-214 stdcall -ordinal IStream_Size(ptr ptr)
+212 stdcall -ordinal IStream_Write(ptr ptr long) shcore.IStream_Write
+213 stdcall -ordinal IStream_Reset(ptr) shcore.IStream_Reset
+214 stdcall -ordinal IStream_Size(ptr ptr) shcore.IStream_Size
 215 stdcall -ordinal SHAnsiToUnicode(str ptr long)
 216 stdcall -noname SHAnsiToUnicodeCP(long str ptr long)
 217 stdcall -ordinal SHUnicodeToAnsi(wstr ptr ptr)




More information about the wine-cvs mailing list