Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 22nd July 2015, 16:23   #1
inst-user
Junior Member
 
Join Date: Jul 2015
Posts: 9
Inetc plugin shows negative download percentage for large 3GB file

Using the Inetc plugin to download a large 3GB file and it displays a negative percent download (so the progress bar doesn't move).

Any help?
inst-user is offline   Reply With Quote
Old 22nd July 2015, 23:14   #2
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Sounds very much like signed integer overflow

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 23rd July 2015, 15:06   #3
inst-user
Junior Member
 
Join Date: Jul 2015
Posts: 9
Is there any way I could fix this?
inst-user is offline   Reply With Quote
Old 24th July 2015, 07:38   #4
T.Slappy
Major Dude
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 533
Send a message via ICQ to T.Slappy
Quote:
Originally Posted by inst-user View Post
Is there any way I could fix this?
You need to modify the sources and rebuild the library.

Cool looking installer with custom design: www.graphical-installer.com
I offer NSIS scripting, C/C++/C#/Delphi programming: www.unsigned.sk
Develop NSIS projects in Visual Studio 2005-2019: www.visual-installer.com
or RAD Studio 2009, 2010, XE-10.3 Rio: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Old 24th July 2015, 16:44   #5
inst-user
Junior Member
 
Join Date: Jul 2015
Posts: 9
I'm kind of new to NSIS and I don't know a lot about C++ coding for editing the source file. Is there anyone who can help me with this?

Inetc Plugin: http://nsis.sourceforge.net/Inetc_plug-in

Thanks!
inst-user is offline   Reply With Quote
Old 24th July 2015, 21:51   #6
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Here is quick fix. Size above 4 GB will still cause problem, no matter what. Take this with a grain of salt!
Attached Files
File Type: zip inetc.signed-int-overflow-fix.zip (25.5 KB, 265 views)

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 27th July 2015, 13:54   #7
inst-user
Junior Member
 
Join Date: Jul 2015
Posts: 9
thank you!!
inst-user is offline   Reply With Quote
Old 27th July 2015, 14:00   #8
inst-user
Junior Member
 
Join Date: Jul 2015
Posts: 9
Quote:
Originally Posted by LoRd_MuldeR View Post
Here is quick fix. Size above 4 GB will still cause problem, no matter what. Take this with a grain of salt!
When I use this it still seems to give me a percentage far above 100 (it starts off with a 7 digit percentage) and the progress bar doesn't move. In fact it counts down from that number to 100% and then completes. Do you know what the fix for this is? Thanks!
inst-user is offline   Reply With Quote
Old 27th July 2015, 19:56   #9
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Can you share the download link to the 3 GB file, so I can actually give it a try?

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 27th July 2015, 21:49   #10
inst-user
Junior Member
 
Join Date: Jul 2015
Posts: 9
Quote:
Originally Posted by LoRd_MuldeR View Post
Can you share the download link to the 3 GB file, so I can actually give it a try?
I'm sorry I can't share the link to the file; however, I'm pretty sure theres a way to create a test file any size you want. It explains it here: http://tweaks.com/windows/62755/gene...es-in-windows/

Thanks
inst-user is offline   Reply With Quote
Old 28th July 2015, 08:48   #11
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Creating a 3 GB file locally is easy, but doesn't help for testing inetc. I would either have to upload it to a web-server (but who has 3 GB of web-space? also uploading 3 GB would take ages) or setup a web-server on my local machine. I will look into the latter option tonight...

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 28th July 2015, 13:32   #12
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,175
Just grab a copy of the free Visual Studio ISO, a Linux distro or something else that is big? To do it locally you could use HFS, Baby web server, analogx sswww or one of the other free basic web servers...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 28th July 2015, 15:32   #13
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Quote:
Originally Posted by Anders View Post
Just grab a copy of the free Visual Studio ISO, a Linux distro or something else that is big? To do it locally you could use HFS, Baby web server, analogx sswww or one of the other free basic web servers...
I'd need to find an ISO that is larger than 2 GB, but still below 4 GB. Should be pretty doable, though.

For local WWW server, I have been using XAMPP before...

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 28th July 2015, 20:06   #14
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Okay, here is another attempt

In previous version, the code was still using MulDiv(), which is signed. Unfortunately, there is no unsigned version of that function. So I had to implement my own UMulDiv() function. But then the linker failed with missing reference to __aulldiv(). Apparently a 64-Bit integer division in 32-Bit code requires CRT library calls - which isn't possible when the CRT is excluded from the binary, as in Inetc project. Bummer!

(In the end I had to add a custom __aulldiv() implementation to the Inetc project, as assembly code. Seems to work though)
Attached Files
File Type: zip inetc.signed-int-overflow-fix.V2.zip (32.3 KB, 241 views)
File Type: zip inetc-example.zip (54.1 KB, 214 views)

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 28th July 2015, 20:16   #15
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,175
You could use inline assembly but there has to be a better way. Not sure if WinInet is limited to 4gb but if it is you can just set the progressbar range to filesize/2 and the pos to downloaded/2?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 29th July 2015, 16:46   #16
inst-user
Junior Member
 
Join Date: Jul 2015
Posts: 9
Quote:
Originally Posted by LoRd_MuldeR View Post
Okay, here is another attempt

In previous version, the code was still using MulDiv(), which is signed. Unfortunately, there is no unsigned version of that function. So I had to implement my own UMulDiv() function. But then the linker failed with missing reference to __aulldiv(). Apparently a 64-Bit integer division in 32-Bit code requires CRT library calls - which isn't possible when the CRT is excluded from the binary, as in Inetc project. Bummer!

(In the end I had to add a custom __aulldiv() implementation to the Inetc project, as assembly code. Seems to work though)
It works!! Thank you
inst-user is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
download, inetc, large file, negative percent, nsis

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump