LZCopy mantain the timestamp of original file in expanded file (Take II)

Marcelo Duarte wine-devel at bol.com.br
Fri Jul 11 01:53:14 CDT 2003


Changelog:
 LZCopy: modified timestamp of a expanded file have to be the same of
original file.

-- 
Marcelo Duarte
-------------- next part --------------
Index: dlls/lzexpand/lzexpand_main.c
===================================================================
RCS file: /home/wine/wine/dlls/lzexpand/lzexpand_main.c,v
retrieving revision 1.20
diff -u -r1.20 lzexpand_main.c
--- dlls/lzexpand/lzexpand_main.c	30 Apr 2003 17:15:06 -0000	1.20
+++ dlls/lzexpand/lzexpand_main.c	11 Jul 2003 05:57:19 -0000
@@ -437,9 +437,11 @@
  */
 LONG WINAPI LZCopy( HFILE src, HFILE dest )
 {
-	int	usedlzinit=0,ret,wret;
+	int	usedlzinit = 0, ret, wret;
 	LONG	len;
-	HFILE	oldsrc = src;
+	HFILE	oldsrc = src, srcfd;
+	FILETIME filetime;
+	struct	lzstate	*lzs;
 #define BUFLEN	1000
 	BYTE	buf[BUFLEN];
 	/* we need that weird typedef, for i can't seem to get function pointer
@@ -476,6 +478,13 @@
 		if (wret!=ret)
 			return LZERROR_WRITE;
 	}
+
+	/* Maintain the timestamp of source file to destination file */
+	srcfd = (!(lzs = GET_LZ_STATE(src))) ? src : lzs->realfd;
+	GetFileTime((HANDLE)srcfd, NULL, NULL, &filetime);
+	SetFileTime((HANDLE)dest, NULL, NULL, &filetime);
+
+	/* close handle */
 	if (usedlzinit)
 		LZClose(src);
 	return len;


More information about the wine-patches mailing list