Archive-Unzip-Burst

 view release on metacpan or  search on metacpan

unzip-6.0/win32-experimental/unz60d10_w32wide-Unicode_patch.txt  view on Meta::CPAN

+      unsigned eb_izux_flg;
+      iztimes z_utime;   /* struct for Unix-style actime & modtime, + creatime */
+# endif
+      int fs_uses_loctime = FStampIsLocTimeW(__G__ G.unipath_widefilename);
+
+      /* Copy and/or convert time and date variables, if necessary;
+       * return a flag indicating which time stamps are available. */
+# ifdef USE_EF_UT_TIME
+      if (G.extra_field &&
+#  ifdef IZ_CHECK_TZ
+          G.tz_is_valid &&
+#  endif
+          ((eb_izux_flg = ef_scan_for_izux(G.extra_field,
+            G.lrec.extra_field_length, 0, G.lrec.last_mod_dos_datetime,
+            &z_utime, NULL)) & EB_UT_FL_MTIME))
+      {
+          TTrace((stderr, "getNTfiletime:  Unix e.f. modif. time = %lu\n",
+            z_utime.mtime));
+          UTIME_2_IZFILETIME(z_utime.mtime, pModFT)
+          if (eb_izux_flg & EB_UT_FL_ATIME) {
+              UTIME_2_IZFILETIME(z_utime.atime, pAccFT)
+          }
+          if (eb_izux_flg & EB_UT_FL_CTIME) {
+              UTIME_2_IZFILETIME(z_utime.ctime, pCreFT)
+          }
+          return (int)eb_izux_flg;
+      }
+# endif /* USE_EF_UT_TIME */
+# ifndef NO_W32TIMES_IZFIX
+      if (!fs_uses_loctime) {
+          time_t ux_modtime;
+
+          ux_modtime = dos_to_unix_time(G.lrec.last_mod_dos_datetime);
+          utime2NtfsFileTime(ux_modtime, pModFT);
+      } else
+#endif /* NO_W32TIMES_IZFIX */
+      {
+          FILETIME lft;
+
+          DosDateTimeToFileTime((WORD)(G.lrec.last_mod_dos_datetime >> 16),
+                                (WORD)(G.lrec.last_mod_dos_datetime & 0xFFFFL),
+                                &lft);
+          LocalFileTimeToFileTime(&lft, pModFT);
+      }
+      *pAccFT = *pModFT;
+      return (EB_UT_FL_MTIME | EB_UT_FL_ATIME);
+
+  } /* end function getNTfiletime() */
+#endif /* (UNICODE_SUPPORT && WIN32_WIDE) */
+
+
 
 
@@ -1059,66 +1177,72 @@
     unsigned ebSDlen;
 #endif
+
+#if defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)
+    if (!G.has_win32_wide) {
+#endif
 #ifdef __RSXNT__        /* RSXNT/EMX C rtl uses OEM charset */
-    char *ansi_name = (char *)alloca(strlen(G.filename) + 1);
+      char *ansi_name = (char *)alloca(strlen(G.filename) + 1);
 
-    INTERN_TO_ISO(G.filename, ansi_name);
-#   define Ansi_Fname  ansi_name
+      INTERN_TO_ISO(G.filename, ansi_name);
+#     define Ansi_Fname  ansi_name
 #else
-#   define Ansi_Fname  G.filename
+#     define Ansi_Fname  G.filename
 #endif
 
 #ifndef __RSXNT__
-    if (IsWinNT()) {
+# if !(defined(UNICODE_SUPPORT) && defined(WIN32_WIDE))
+      if (IsWinNT()) {
         /* Truncate the file to the current position.
          * This is needed to remove excess allocation in case the
          * extraction has failed or stopped prematurely. */
         SetEndOfFile((HANDLE)_get_osfhandle(fileno(G.outfile)));
-    }
+      }
+# endif /* !(defined(UNICODE_SUPPORT) && defined(WIN32_WIDE)) */
 #endif
 
-    /* Close the file and then re-open it using the Win32
-     * CreateFile call, so that the file can be created
-     * with GENERIC_WRITE access, otherwise the SetFileTime
-     * call will fail. */
-    fclose(G.outfile);
-
-    /* don't set the time stamp and attributes on standard output */
-    if (uO.cflag)
-        return;
-
-    /* skip restoring time stamps on user's request */
-    if (uO.D_flag <= 1) {
-        gotTime = getNTfiletime(__G__ &Modft, &Accft, &Creft);
-
-        /* open a handle to the file before processing extra fields;
-           we do this in case new security on file prevents us from updating
-           time stamps */
-        hFile = CreateFileA(Ansi_Fname, GENERIC_WRITE, FILE_SHARE_WRITE, NULL,
-             OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
-    } else {
-        gotTime = 0;
-    }
-
-    /* sfield@microsoft.com: set attributes before time in case we decide to
-       support other filetime members later.  This also allows us to apply
-       attributes before the security is changed, which may prevent this
-       from succeeding otherwise.  Also, since most files don't have
-       any interesting attributes, only change them if something other than
-       FILE_ATTRIBUTE_ARCHIVE appears in the attributes.  This works well
-       as an optimization because FILE_ATTRIBUTE_ARCHIVE gets applied to the
-       file anyway, when it's created new. */
-    if ((G.pInfo->file_attr & 0x7F) & ~FILE_ATTRIBUTE_ARCHIVE) {
-        if (!SetFileAttributesA(Ansi_Fname, G.pInfo->file_attr & 0x7F))
-            Info(slide, 1, ((char *)slide,
-              "\nwarning (%d): could not set file attributes\n",



( run in 2.172 seconds using v1.01-cache-2.11-cpan-364913b4093 )