[PATCH] ole32: ignore HighPart in the Seek method HGLOBAL streams. [try 2]

Reece Dunn msclrhd at googlemail.com
Tue Feb 23 13:58:41 CST 2010


Hi,

This fixes the todo_wines in ole32:hglobalstream.

Changes:
  try 2 -- don't perform the check to see if the new position is
negative, as the LowPart of [U]LARGE_INTEGER is unsigned and HighPart
is not used. Spotted by Alexandre Julliard.

NOTE: A check for integer overflow would be `position.low + move.low <
position.low`, but there are no current tests to say if integer
overflow is handled (and how it is handled) here in the tests.
Therefore, the simplest implementation is just to remove the previous
check.

- Reece
-------------- next part --------------
From 940083eb111b128d7c8c83f38297466a0c9d00a7 Mon Sep 17 00:00:00 2001
From: Reece Dunn <msclrhd at gmail.com>
Date: Tue, 23 Feb 2010 19:50:48 +0000
Subject: [PATCH] ole32: ignore HighPart in the Seek method HGLOBAL streams.

---
 dlls/ole32/hglobalstream.c       |    4 ++--
 dlls/ole32/tests/hglobalstream.c |    3 ---
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/dlls/ole32/hglobalstream.c b/dlls/ole32/hglobalstream.c
index c43d499..497d1af 100644
--- a/dlls/ole32/hglobalstream.c
+++ b/dlls/ole32/hglobalstream.c
@@ -395,9 +395,9 @@ static HRESULT WINAPI HGLOBALStreamImpl_Seek(
    * If the file pointer ends-up after the end of the stream, the next Write operation will
    * make the file larger. This is how it is documented.
    */
-  if (dlibMove.QuadPart < 0 && newPosition.QuadPart < -dlibMove.QuadPart) return STG_E_INVALIDFUNCTION;
 
-  newPosition.QuadPart += dlibMove.QuadPart;
+  newPosition.u.HighPart = 0;
+  newPosition.u.LowPart += dlibMove.u.LowPart;
 
   if (plibNewPosition) *plibNewPosition = newPosition;
   This->currentPosition = newPosition;
diff --git a/dlls/ole32/tests/hglobalstream.c b/dlls/ole32/tests/hglobalstream.c
index 4fee612..ea7a646 100644
--- a/dlls/ole32/tests/hglobalstream.c
+++ b/dlls/ole32/tests/hglobalstream.c
@@ -79,17 +79,14 @@ static void test_streamonhglobal(IStream *pStream)
     ll.u.HighPart = -1;
     ll.u.LowPart = 0;
     hr = IStream_Seek(pStream, ll, STREAM_SEEK_SET, &ull);
-    todo_wine
     ok_ole_success(hr, "IStream_Seek");
     ok(ull.u.LowPart == 0, "should have set LowPart to 0 instead of %d\n", ull.u.LowPart);
-    todo_wine
     ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %d\n", ull.u.HighPart);
 
     /* ignores HighPart */
     ll.u.HighPart = -1;
     ll.u.LowPart = 0;
     hr = IStream_Seek(pStream, ll, STREAM_SEEK_CUR, NULL);
-    todo_wine
     ok_ole_success(hr, "IStream_Seek");
 
     hr = IStream_Commit(pStream, STGC_DEFAULT);
-- 
1.6.3.3


More information about the wine-patches mailing list