|
|
#1 |
|
Senior Member
Join Date: Mar 2004
Posts: 138
|
Question about VPatch
When I use VPatch to patch a file, it will modified file CreationTime to LastWriteTime. I want to save the CreationTime so I search MSDN for GetFileTime and SetFileTime but not work.
My code: FileOpen $1 "$INSTDIR\newfile.txt" r System::Call '*(&i2, &i2) i .r0' System::Call 'kernel32::GetFileTime(i, i, i, i) i (r1, r0,,) .r9' vpatch::vpatchfile "$PLUGINSDIR\patch.pat" "$INSTDIR\oldfile.txt" "$INSTDIR\newfile.txt" System::Call 'kernel32::SetFileTime(i, i, i, i) i (r1, r0,,) .r8' System::Free $0 FileClose $1 StrCmp $8 0 +2 DetailPrint "Success!" |
|
|
|
|
|
#2 |
|
Major Dude
|
Try this one (as I didn't):
code: Last edited by deguix; 17th October 2004 at 16:20. |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Mar 2004
Posts: 138
|
Tested, but not work
|
|
|
|
|
|
#4 |
|
Major Dude
|
try this:
code: hand by comm@nder21 ---------- WiKi pages:CreateInternetShortcut|Enhanced FindWindow|Parse CSV-Data|Open/Close CD-Drive|Installer without Icon|Vista application compatibility |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Mar 2004
Posts: 138
|
I modified VPatch source to save the FileTime, in vpatchdll.c header:
#include <Winbase.h> FILETIME ftCreate, ftWrite; and change: result = DoPatch(hPatch, hSource, hDest); to: GetFileTime(hSource, &ftCreate, NULL, &ftWrite); result = DoPatch(hPatch, hSource, hDest); SetFileTime(hDest, &ftCreate, NULL, &ftWrite); Comm@nder21's code I am not test, because modified the source is easy, I thinks. And the FileOpen w flags will destroy the newfile. thanks. Last edited by bluenet; 19th October 2004 at 04:01. |
|
|
|
|
|
#6 |
|
NSIS Dev
Join Date: Feb 2003
Location: Boston, MA, U.S.A.
Posts: 455
|
Modifying the source may be easy for now, but unless you submit it to Kichik for inclusion in CVS, either you are stuck with your modified version forever, with no updates or your modified version will be overwritten the next time you update NSIS.
Using the scripted method is a better solution, imo. |
|
|
|
|
|
#7 |
|
Senior Member
Join Date: Mar 2004
Posts: 138
|
OK. The modified plugins in attach file.
VPatch.dll is in "NSIS\Plugins" Readme.html is in "NSIS\Contrib\VPatch" vpatchdll.c is in "NSIS\Contrib\VPatch\Source\Plugin" The vpatchfile function not change, and a new function SmartPatch add to keep the file time while patch.
|
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|