[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Re: Cabinet problems in latest wine cvs
From:       "Gregory M. Turner" <gmturner007 () ameritech ! net>
Date:       2003-07-31 20:56:40
[Download RAW message or body]

On Thursday 31 July 2003 02:57 pm, Boris wrote:
> When attempting to install Office 2000 under the latest wine from cvs, It
> stops half way through the installation with the following error.
>
>
> err:cabinet:FDICopy FDIIsCabinet failed. Any ideas?

This rollup of the recent cabinet patches should fix it.

--
gmt

["cabinet-wip025.diff" (text/x-diff)]

diff -ur --minimal --exclude-from=/home/greg/bin/winetreediff_excl \
                ../wine.vanilla/dlls/cabinet/cabinet.h ./dlls/cabinet/cabinet.h
--- ../wine.vanilla/dlls/cabinet/cabinet.h	2003-07-19 05:16:03.000000000 -0500
+++ ./dlls/cabinet/cabinet.h	2003-07-29 15:00:00.000000000 -0500
@@ -24,6 +24,10 @@
 #include "fdi.h"
 #include "fci.h"
 
+/* from msvcrt/sys/stat.h */
+#define _S_IWRITE 0x0080
+#define _S_IREAD  0x0100
+
 #define CAB_SPLITMAX (10)
 
 #define CAB_SEARCH_SIZE (32*1024)
diff -ur --minimal --exclude-from=/home/greg/bin/winetreediff_excl \
                ../wine.vanilla/dlls/cabinet/fdi.c ./dlls/cabinet/fdi.c
--- ../wine.vanilla/dlls/cabinet/fdi.c	2003-07-19 05:16:03.000000000 -0500
+++ ./dlls/cabinet/fdi.c	2003-07-29 17:31:48.000000000 -0500
@@ -39,7 +39,6 @@
 #include "winbase.h"
 #include "winerror.h"
 #include "fdi.h"
-#include "msvcrt/fcntl.h" /* _O_.* */
 #include "cabinet.h"
 
 #include "wine/debug.h"
@@ -1825,7 +1824,7 @@
             TRACE("full cab path/file name: %s\n", debugstr_a(fullpath));
         
             /* try to get a handle to the cabfile */
-            cabhf = PFDI_OPEN(CAB(hfdi), fullpath, _O_BINARY | _O_RDONLY | \
_O_SEQUENTIAL, 0); +            cabhf = PFDI_OPEN(CAB(hfdi), fullpath, 32768, \
_S_IREAD | _S_IWRITE);  if (cabhf == -1) {
               /* no file.  allow the user to try again */
               fdin.fdie = FDIERROR_CABINET_NOT_FOUND;
@@ -1833,6 +1832,13 @@
               continue;
             }
         
+            if (cabhf == 0) {
+              ERR("PFDI_OPEN returned zero for %s.\n", fullpath);
+              fdin.fdie = FDIERROR_CABINET_NOT_FOUND;
+              if (((*pfnfdin)(fdintNEXT_CABINET, &fdin))) return DECR_USERABORT;
+              continue;
+            }
+ 
             /* check if it's really a cabfile. Note that this doesn't implement the \
                bug */
             if (!FDI_read_entries(CAB(hfdi), cabhf, &fdici, &(cab->next->mii))) {
               WARN("FDIIsCabinet failed.\n");
@@ -2020,7 +2026,7 @@
   TRACE("full cab path/file name: %s\n", debugstr_a(fullpath));
 
   /* get a handle to the cabfile */
-  cabhf = PFDI_OPEN(hfdi, fullpath, _O_BINARY | _O_RDONLY | _O_SEQUENTIAL, 0);
+  cabhf = PFDI_OPEN(hfdi, fullpath, 32768, _S_IREAD | _S_IWRITE);
   if (cabhf == -1) {
     PFDI_INT(hfdi)->perf->erfOper = FDIERROR_CABINET_NOT_FOUND;
     PFDI_INT(hfdi)->perf->erfType = ERROR_FILE_NOT_FOUND;
@@ -2029,6 +2035,15 @@
     return FALSE;
   }
 
+  if (cabhf == 0) {
+    ERR("PFDI_OPEN returned zero for %s.\n", fullpath);
+    PFDI_INT(hfdi)->perf->erfOper = FDIERROR_CABINET_NOT_FOUND;
+    PFDI_INT(hfdi)->perf->erfType = ERROR_FILE_NOT_FOUND;
+    PFDI_INT(hfdi)->perf->fError = TRUE;
+    SetLastError(ERROR_FILE_NOT_FOUND);
+    return FALSE;
+  }
+
   /* check if it's really a cabfile. Note that this doesn't implement the bug */
   if (!FDI_read_entries(hfdi, cabhf, &fdici, &(CAB(mii)))) {
     ERR("FDIIsCabinet failed.\n");
@@ -2201,6 +2216,7 @@
     if (filehf) {
       cab_UWORD comptype = fol->comp_type;
       int ct1 = comptype & cffoldCOMPTYPE_MASK;
+      int ct2 = CAB(current) ? (CAB(current)->comp_type & cffoldCOMPTYPE_MASK) : 0;
       int err = 0;
 
       TRACE("Extracting file %s as requested by callee.\n", \
debugstr_a(file->filename)); @@ -2209,11 +2225,35 @@
       CAB(hfdi) = hfdi;
       CAB(filehf) = filehf;
       CAB(cabhf) = cabhf;
-      CAB(current) = fol;
-      CAB(decomp_cab) = NULL;
 
-      /* set up the appropriate decompressor */
-      switch (ct1) {
+      /* Was there a change of folder?  Compression type?  Did we somehow go \
backwards? */ +      if ((ct1 != ct2) || (CAB(current) != fol) || (file->offset < \
CAB(offset))) { +
+        TRACE("Resetting folder for file %s.\n", debugstr_a(file->filename));
+
+        /* free stuff for the old decompressor */
+        switch (ct2) {
+        case cffoldCOMPTYPE_LZX:
+          if (LZX(window)) {
+            PFDI_FREE(hfdi, LZX(window));
+            LZX(window) = NULL;
+          }
+          break;
+        case cffoldCOMPTYPE_QUANTUM:
+          if (QTM(window)) {
+            PFDI_FREE(hfdi, QTM(window));
+            QTM(window) = NULL;
+          }
+          break;
+        }
+
+        CAB(decomp_cab) = NULL;
+        PFDI_SEEK(CAB(hfdi), CAB(cabhf), fol->offset, SEEK_SET);
+        CAB(offset) = 0;
+        CAB(outlen) = 0;
+
+        /* initialize the new decompressor */
+        switch (ct1) {
         case cffoldCOMPTYPE_NONE:
           CAB(decompress) = NONEfdi_decomp;
           break;
@@ -2230,8 +2270,11 @@
           break;
         default:
           err = DECR_DATAFORMAT;
+        }
       }
 
+      CAB(current) = fol;
+
       switch (err) {
         case DECR_OK:
           break;
@@ -2248,10 +2291,6 @@
           goto bail_and_fail;
       }
 
-      PFDI_SEEK(CAB(hfdi), CAB(cabhf), fol->offset, SEEK_SET);
-      CAB(offset) = 0;
-      CAB(outlen) = 0;
-
       if (file->offset > CAB(offset)) {
         /* decode bytes and send them to /dev/null */
         switch ((err = fdi_decomp(file, 0, decomp_state, pszCabPath, pfnfdin, \
pvUser))) { @@ -2302,24 +2341,6 @@
           goto bail_and_fail;
       }
 
-      /* free decompression temps */
-      switch (ct1) {
-        case cffoldCOMPTYPE_LZX:
-          if (LZX(window)) {
-            PFDI_FREE(hfdi, LZX(window));
-            LZX(window) = NULL;
-          }
-          break;
-        case cffoldCOMPTYPE_QUANTUM:
-          if (QTM(window)) {
-            PFDI_FREE(hfdi, QTM(window));
-            QTM(window) = NULL;
-          }
-          break;
-        default:
-          break;
-      }
-
       /* fdintCLOSE_FILE_INFO notification */
       ZeroMemory(&fdin, sizeof(FDINOTIFICATION));
       fdin.pv = pvUser;
@@ -2344,6 +2365,16 @@
     }
   }
 
+  /* free decompression temps */
+  if (LZX(window)) {
+    PFDI_FREE(hfdi, LZX(window));
+    LZX(window) = NULL;
+  }
+  if (QTM(window)) {
+    PFDI_FREE(hfdi, QTM(window));
+    QTM(window) = NULL;
+  }
+
   while (decomp_state) {
     fdi_decomp_state *prev_fds;
 
@@ -2376,6 +2407,16 @@
 
   bail_and_fail: /* here we free ram before error returns */
 
+  /* free decompression temps */
+  if (LZX(window)) {
+    PFDI_FREE(hfdi, LZX(window));
+    LZX(window) = NULL;
+  }
+  if (QTM(window)) {
+    PFDI_FREE(hfdi, QTM(window));
+    QTM(window) = NULL;
+  }
+
   while (decomp_state) {
     fdi_decomp_state *prev_fds;
 



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic