[KERNEL32/WINE] Sync lzexpand.c with Wine Staging 3.3. CORE-14434
authorAmine Khaldi <amine.khaldi@reactos.org>
Wed, 11 Apr 2018 11:30:53 +0000 (12:30 +0100)
committerAmine Khaldi <amine.khaldi@reactos.org>
Wed, 11 Apr 2018 11:30:53 +0000 (12:30 +0100)
dll/win32/kernel32/wine/lzexpand.c
media/doc/README.WINE

index 94ac68b..eea124e 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * LZ Decompression functions
  *
  * Copyright 1996 Marcus Meissner
@@ -33,6 +33,8 @@
  *
  */
 
+#ifdef __REACTOS__
+
 #include <k32.h>
 
 #define NDEBUG
@@ -45,6 +47,30 @@ DEBUG_CHANNEL(kernel32file);
 
 #define _lwrite(a, b, c) (long)(_hwrite(a, b, (long)c))
 
+#else /* __REACTOS__ */
+
+#include "config.h"
+
+#include <string.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <stdarg.h>
+#include <stdio.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#include "windef.h"
+#include "winbase.h"
+#include "lzexpand.h"
+
+#include "wine/unicode.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(file);
+
+#endif /* __REACTOS__ */
+
 /* The readahead length of the decompressor. Reading single bytes
  * using _lread() would be SLOW.
  */
@@ -136,7 +162,7 @@ static INT read_header(HFILE fd,struct lzfileheader *head)
        memcpy(&(head->compressiontype),buf+LZ_MAGIC_LEN,1);
        memcpy(&(head->lastchar),buf+LZ_MAGIC_LEN+1,1);
 
-       /* FIXME: consider endianess on non-intel architectures */
+       /* FIXME: consider endianness on non-intel architectures */
        memcpy(&(head->reallength),buf+LZ_MAGIC_LEN+2,4);
 
        if (memcmp(head->magic,LZMagic,LZ_MAGIC_LEN))
@@ -468,7 +494,11 @@ LONG WINAPI LZCopy( HFILE src, HFILE dest )
 
        /* not compressed? just copy */
         if (!IS_LZ_HANDLE(src))
+#ifdef __REACTOS__
                xread=(_readfun)_hread; // ROSHACK
+#else
+               xread=_lread;
+#endif
        else
                xread=(_readfun)LZRead;
        len=0;
@@ -526,6 +556,7 @@ static LPSTR LZEXPAND_MangleName( LPCSTR fn )
 HFILE WINAPI LZOpenFileA( LPSTR fn, LPOFSTRUCT ofs, WORD mode )
 {
        HFILE   fd,cfd;
+       BYTE    ofs_cBytes = ofs->cBytes;
 
        TRACE("(%s,%p,%d)\n",fn,ofs,mode);
        /* 0x70 represents all OF_SHARE_* flags, ignore them for the check */
@@ -536,6 +567,8 @@ HFILE WINAPI LZOpenFileA( LPSTR fn, LPOFSTRUCT ofs, WORD mode )
             fd = OpenFile(mfn,ofs,mode);
             HeapFree( GetProcessHeap(), 0, mfn );
        }
+       if (fd==HFILE_ERROR)
+               ofs->cBytes = ofs_cBytes;
        if ((mode&~0x70)!=OF_READ)
                return fd;
        if (fd==HFILE_ERROR)
@@ -579,6 +612,8 @@ void WINAPI LZClose( HFILE fd )
         }
 }
 
+#ifdef __REACTOS__
+
 /*
  * @implemented
  */
@@ -606,3 +641,4 @@ LZCreateFileW(IN LPCWSTR FileName,
     return ERROR_CALL_NOT_IMPLEMENTED;
 }
 
+#endif /* __REACTOS__ */
index d65efe2..08a4312 100644 (file)
@@ -272,7 +272,7 @@ iphlpapi -
 kernel32 -
   reactos/dll/win32/kernel32/wine/actctx.c               # Partly synced with Wine 1.7.55
   reactos/dll/win32/kernel32/wine/comm.c                 # Synced in r52754
-  reactos/dll/win32/kernel32/wine/lzexpand.c             # Synced in r52754
+  reactos/dll/win32/kernel32/wine/lzexpand.c             # Synced to WineStaging-3.3
   reactos/dll/win32/kernel32/wine/profile.c              # Partially synced to WineStaging-1.7.55
   reactos/dll/win32/kernel32/wine/res.c                  # Partially synced to WineStaging-1.7.55
   reactos/dll/win32/kernel32/winnls/string/casemap.c     # Synced to WineStaging-1.7.55