Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Outfile "$%temp%\test.exe"
- requestexecutionlevel user
- showinstdetails show
- page instfiles
- !include FileFunc.nsh
- !include LogicLib.nsh
- section
- InitPluginsDir
- SetOutPath $pluginsdir
- FileOpen $0 "$pluginsdir\1.txt" w
- FileWrite $0 "Hello World"
- Push $0
- FileOpen $0 "$pluginsdir\2.txt" w
- Push $0
- FileOpen $0 "$pluginsdir\3.txt" w
- Push $0
- FileOpen $0 "$pluginsdir\4.txt" w
- Push $0 #FileClose $0
- Sleep 2000
- FileOpen $0 "$pluginsdir\ref.txt" w
- FileClose $0
- ${GetTime} "$pluginsdir\ref.txt" M $0 $1 $2 $3 $4 $5 $6
- DetailPrint "Target: $4:$5:$6"
- DetailPrint " "
- #!define FILE_WRITE_ATTRIBUTES 0x0100
- Pop $0 #FileOpen $0 "$pluginsdir\4.txt" w
- System::Alloc 24
- System::Call 'kernel32::GetSystemTime(isr1)'
- IntOp $2 $1 + 16 ;Ptr to FILETIME
- System::Call 'kernel32::SystemTimeToFileTime(ir1,ir2)'
- System::Call 'kernel32::SetFileTime(ir0,i0,i0,ir2)'
- System::Free $1
- FileClose $0
- ${GetTime} "$pluginsdir\4.txt" M $0 $1 $2 $3 $4 $5 $6
- DetailPrint "SetFileTime: $4:$5:$6"
- pop $0
- System::Call 'kernel32::FlushFileBuffers(ir0)'
- FileClose $0
- ${GetTime} "$pluginsdir\3.txt" M $0 $1 $2 $3 $4 $5 $6
- DetailPrint "FlushFileBuffers: $4:$5:$6"
- pop $0
- FileClose $0
- ${GetTime} "$pluginsdir\2.txt" M $0 $1 $2 $3 $4 $5 $6
- DetailPrint "CloseHandle: $4:$5:$6"
- pop $0
- FileSeek $0 0 SET ; just to be safe
- FileReadByte $0 $1
- ${If} $1 != "" ;Not going to work if the file is empty
- FileSeek $0 0 SET
- FileWriteByte $0 $1
- ${EndIf}
- FileClose $0
- ${GetTime} "$pluginsdir\1.txt" M $0 $1 $2 $3 $4 $5 $6
- DetailPrint "FileReadByte+FileWriteByte: $4:$5:$6"
- SetDetailsPrint textonly
- SetOutPath $temp
- sectionend
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement