dorakey
29th January 2010 12:05 UTC
Help with Nsis7z::ExtractWithCallback plugin
Hi, I need to retrieve the install progress when running silent install, so I try to use Nsis7z::ExtractWithCallback to output the status. This method works fine when the archived file is not large, but when the 7zip archive exceed certain limit, the callback function return me negative integer value :(
My code:
Function Callback
Pop $R8
Pop $R9
System::Int64Op $R8 * 100
Pop $R7
System::Int64Op $R7 / $R9
Pop $R6
FileSeek $R5 0 END
FileWrite $R5 "INSTALL_PERCENTAGE:$R6 $\n"
FunctionEnd
Section
...
FileOpen $R5 "$INSTDIR\log" a
GetFunctionAddress $R9 Callback
Nsis7z::ExtractWithCallback "test.7z" $R9
FileWrite $R5 "INSTALL_COMPLETE"
FileClose $R5
SectionEnd
I also tried to create the 7z archive with volume, but NSIS doesn't seems to work with volume archives..?
Have any other way to get this done? Please advise.
Thanks!!
CG!
29th January 2010 12:23 UTC
Mmhhh... if you try to access a file that is already opened/written to, you should get a blank file as far as i know.
Maybe this messes it up?
And i never tried 7z volumes because i'm pretty sure it wouldn't work. And i use the plugin in almost any installer i make with NSiS. But i really wish i could integrate another progress bar just for the plugin.
dorakey
29th January 2010 12:32 UTC
Originally posted by CG!
Mmhhh... if you try to access a file that is already opened/written to, you should get a blank file as far as i know.
Maybe this messes it up?
And i never tried 7z volumes because i'm pretty sure it wouldn't work. And i use the plugin in almost any installer i make with NSiS. But i really wish i could integrate another progress bar just for the plugin.
I got try to display the value with DetailPrint instead of write to file, return value is negative as well :(
CG!
29th January 2010 13:05 UTC
May have to do with your intOp.
My CallBack looks like this:
Function CallbackTest
Pop $R8
Pop $R9
SetDetailsPrint textonly
${if} $LANGUAGE = ${LANG_GERMAN}
DetailPrint "aktueller Fortschritt: $R8 bytes / $R9 bytes..."
${else}
DetailPrint "Current Progress: $R8 bytes / $R9 bytes..."
${endif}
SetDetailsPrint both
FunctionEnd
Ya, it's the original function. Just slightly edited.
But why should i change a winning concept? ^^
dorakey
1st February 2010 03:46 UTC
Originally posted by CG!
May have to do with your intOp.
My CallBack looks like this:
Function CallbackTest
Pop $R8
Pop $R9
SetDetailsPrint textonly
${if} $LANGUAGE = ${LANG_GERMAN}
DetailPrint "aktueller Fortschritt: $R8 bytes / $R9 bytes..."
${else}
DetailPrint "Current Progress: $R8 bytes / $R9 bytes..."
${endif}
SetDetailsPrint both
FunctionEnd
Ya, it's the original function. Just slightly edited.
But why should i change a winning concept? ^^
I try on this example, return me negative value as well. This only happen when archive size is big, and mine is more than 700Mb :(
I download nsis7z plugin source and found that the size was cast to "int" from "UInt64"(under CallbackProgressHandler function), wonder is it because of the casting caused the incorrect value... :igor: