OLE storage SetFilePointer fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

the OLE storage code basically disabled itself, by doing a
READ_HEADER;
in STORAGE_get_pps_entry().
This READ_HEADER uses -1 as block number for STORAGE_get_big_block()
(in order to retrieve the storage header block).
And if you look at the SetFilePointer() in STORAGE_get_big_block(),
you might notice that (n+1)*BIGSIZE for some strange reason evaluates
to 0, for n == -1.
Thus, SetFilePointer() seeks to position 0 to read the storage header.

And now I'm terribly sorry to tell you that STORAGE_get_big_block()
did a
    if (!SetFilePointer( hf, (n+1)*BIGSIZE, NULL, SEEK_SET ))
    {
        WARN(" seek failed (%ld)\n",GetLastError());
        return FALSE;
    }

Sounds like SetFilePointer() is *supposed* to return 0 if it seeks to
position 0, eh?

In other words:
- fix blatantly wrong SetFilePointer() calls

Doing so made Winword 6 go much further again
(until it bombed at the stubbed OLE2.OLEISCURRENTCLIPBOARD)
Any idea how to best implement these 16bit OLE calls?

Andreas Mohr

P.S.: Alexandre, I'd REALLY like you to finally put a patch status
tracking system in place. The number of people submitting patches
for the second, third, bazillionth time is astonishing (I speak
from my very own experience, too!). I really don't know how many very
valuable Wine patches got lost due to not getting applied without any
status reply whatsoever...
(particularly the ones from "foreigners")
Someone recently said (in WWN) that patch management was perfect or
something to that extent. I better don't comment on that statement,
you know my hot temper ;)
OK, it's definitely not awful, but I guess it could be better.


Index: dlls/ole32/storage.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/storage.c,v
retrieving revision 1.32
diff -u -r1.32 storage.c
--- dlls/ole32/storage.c	10 Apr 2003 18:17:35 -0000	1.32
+++ dlls/ole32/storage.c	12 Apr 2003 20:48:34 -0000
@@ -110,7 +110,7 @@
     DWORD result;
 
     assert(n>=-1);
-    if (!SetFilePointer( hf, (n+1)*BIGSIZE, NULL, SEEK_SET ))
+    if ((SetFilePointer( hf, (n+1)*BIGSIZE, NULL, SEEK_SET ) ==  INVALID_SET_FILE_POINTER) && (GetLastError()))
     {
         WARN(" seek failed (%ld)\n",GetLastError());
         return FALSE;
@@ -132,9 +132,9 @@
     DWORD result;
 
     assert(n>=-1);
-    if (!SetFilePointer( hf, (n+1)*BIGSIZE, NULL, SEEK_SET ))
+    if ((SetFilePointer( hf, (n+1)*BIGSIZE, NULL, SEEK_SET ) ==  INVALID_SET_FILE_POINTER) && (GetLastError()))
     {
-        WARN(" seek failed (%ld)\n",GetLastError());
+        WARN("seek failed (%ld)\n",GetLastError());
         return FALSE;
     }
     if (!WriteFile( hf, block, BIGSIZE, &result, NULL ) || result != BIGSIZE)
Index: dlls/msvcrt/file.c
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/file.c,v
retrieving revision 1.48
diff -u -r1.48 file.c
--- dlls/msvcrt/file.c	30 Mar 2003 03:06:30 -0000	1.48
+++ dlls/msvcrt/file.c	12 Apr 2003 20:48:35 -0000
@@ -605,7 +605,7 @@
         (mode==_LK_NBRLCK)?"_LK_NBRLCK":
                           "UNKNOWN");
 
-  if ((cur_locn = SetFilePointer(hand, 0L, NULL, SEEK_CUR)) == 0xffffffff)
+  if ((cur_locn = SetFilePointer(hand, 0L, NULL, SEEK_CUR)) ==  INVALID_SET_FILE_POINTER)
   {
     FIXME ("Seek failed\n");
     *MSVCRT__errno() = MSVCRT_EINVAL; /* FIXME */


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux