LZCopy mantain the timestamp in expanded file
Marcelo Duarte
wine-devel at bol.com.br
Wed Jul 9 12:37:53 CDT 2003
Recently, I have a problem installing a program and post a message in
wine-devel, search bugzilla, and none results.
The current implementation of LZCopy() only expand the file to new file, and
after some tests I checked that the the window$ LZCopy mantain the modified
date of expanded file the same of the original file.
I do some tests, and after the patch, it runs correctly.
It is the small test program:
#include <windows.h>
int main(int argc, char *argv[])
{
HANDLE src, dest;
//INT lzSrc, lzDest;
if (argc < 3) {
printf("testlz32 [file.ex_] [file.ext]\n");
return 0;
}
// I do not use LZOpenFIle, LZInit, LZClose, etc so I am sure that LZCopy is
the correct local of the patch.
src = CreateFile(argv[1], GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, 0);
dest = CreateFile(argv[2], GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
//lzSrc = LZInit(src);
//lzDest = LZInit(dest);
LZCopy(src, dest); // LZCopy(lzSrc, lzDest);
//LZClose(lzSrc);
//LZClose(lzDest);
CloseHandle(src);
CloseHandle(dest);
return 0;
}
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 9 Jul 2003 17:03:14 -0000
@@ -476,6 +476,16 @@
if (wret!=ret)
return LZERROR_WRITE;
}
+
+ /* Change the timestamp of file */
+ HFILE fd;
+ FILETIME filetime;
+ struct lzstate *lzs;
+ fd = (!(lzs = GET_LZ_STATE(src))) ? src : lzs->realfd;
+ GetFileTime((HANDLE)fd, NULL, NULL, &filetime);
+ SetFileTime((HANDLE)dest, NULL, NULL, &filetime);
+
+ /* close handle */
if (usedlzinit)
LZClose(src);
return len;
More information about the wine-devel
mailing list