Old 15th June 2011, 14:02   #441
zenpoy
Junior Member
 
Join Date: Feb 2011
Posts: 38
the command line I'm using is:

Inetc::get /NOPROXY /QUESTION "" /CAPTION "Installing $TITLE" $IS_PROXY_ALLOWED $URL $R3 /END
zenpoy is offline   Reply With Quote
Old 15th June 2011, 14:27   #442
zenpoy
Junior Member
 
Join Date: Feb 2011
Posts: 38
Anyway - I think I fixed it I've changed dlgProc, case IDCANCEL to be:

case IDCANCEL:
if(nocancel) break;
if(szQuestion) {
msgboxAnswer = MessageBox(hDlg, szQuestion, szCaption, MB_ICONWARNING|MB_YESNO);
if (msgboxAnswer == IDNO)
break;
else if (status == ST_DOWNLOAD)
status = ST_CANCELLED;
}
zenpoy is offline   Reply With Quote
Old 16th June 2011, 07:39   #443
zenpoy
Junior Member
 
Join Date: Feb 2011
Posts: 38
ok... now I've fixed it

Sorry for spamming the thread... The former solution wasn't a solution - it did not clear the stack but it returned a wrong status. So please ignore the last fix.

There's a function called inetTransfer which pops pairs of url and file name and downloads them. what I did was to add two lines right after the loop that does that:

if (lstrcmpi(url, _T("/end"))==0)
pushstring(url);

And in cleanup section I removed the status check - so now I always clean the stack.

Hope it makes sense to anyone. If you want the fixed version, tell me.

J.
zenpoy is offline   Reply With Quote
Old 16th June 2011, 10:41   #444
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
Quote:
Originally Posted by zenpoy View Post
Hope it makes sense to anyone. If you want the fixed version, tell me.
J.
Thanks, zenpoy!
If you can send me PM with updated source, I'll merge changes and build new release for wiki.
Unfortunatelly I am overloaded with business tasks and had not time to dig into proble, sorry .
Takhir
Takhir is offline   Reply With Quote
Old 27th July 2011, 12:48   #445
zenpoy
Junior Member
 
Join Date: Feb 2011
Posts: 38
What do you use to compile inetc?

When I'm using the inetc.dll out of the box (that is, out of the zip) it works fine in winxp sp2. When I use my x64 (win7) pc with both vs2008 and vs2010 to compile the source code it produces a dll that works in win7 but is not working in winxp sp2 (without any updates/vc++ packs or anything, completely fresh install).

When I try to call inetc:

code:

strcpy $R0 "http://www.google.com/intl/en_com/images/srpr/logo2w.png"
Inetc::get /SILENT /CONNECTTIMEOUT 10000 $R0 "image.png" /END
dumpstate::debug



it leaves the args on the stack ( /SILENT /CONNECTTIMEOUT 10000 $R0 "image.png" /END)

So how do you compile it to be compatible for xp sp2??

Thanks
zenpoy is offline   Reply With Quote
Old 27th July 2011, 13:23   #446
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
I compile it in VS 6 on XP or Vista. Resulting DLL depends on msvctr.dll but this is OK. You can change settings in later VS to multithreaded DLL, this case module size should increase, but without dependencies to runtimes. IMHO targetver.h should not produce any conflicts.
Takhir is offline   Reply With Quote
Old 3rd August 2011, 08:10   #447
zenpoy
Junior Member
 
Join Date: Feb 2011
Posts: 38
Thanks! that helped... I tried to change to multithreasded DLL but still, it didn't work. So I used VS6 and it works like a charm.
zenpoy is offline   Reply With Quote
Old 4th August 2011, 06:53   #448
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
Oups... Sorry, 'multithreaded' only. No 'DLL' and no dependencies to runtimes this case. But any case VS 6 is better way.
Takhir is offline   Reply With Quote
Old 4th August 2011, 08:33   #449
zenpoy
Junior Member
 
Join Date: Feb 2011
Posts: 38
I have now another issue with winxp32 sp2. In win7/vista and others I can redirect from https to http. but in winxp32sp2 I get error Redirection (302). I thought I should add something like:

code:


InternetQueryOption (hFile, INTERNET_OPTION_SECURITY_FLAGS,
(LPVOID)&rslt, &(err = sizeof(rslt)));
rslt |= SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTP;
InternetSetOption (hFile, INTERNET_OPTION_SECURITY_FLAGS,
&rslt, sizeof(rslt) );




but it didn't work - I'm not that familiar with the code, can you give me some guidance?
zenpoy is offline   Reply With Quote
Old 4th August 2011, 09:04   #450
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
Inetc already has

#define MY_REDIR_FLAGS INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP | INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS

for primary https URL. 'SECURITY_' flags are the same

#define SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTPS INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS
#define SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTP INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP

So I guess problem is in this XP settings or in WinInet.dll version supplied with this OS/SP.

I am attaching test version with merged code for 'Cancel' issue (because it's not possible to send link in PM ). BTW I am not sure if anybody use this 'multiple download' mode. May be has sence to remove this option and download one file per Inetc call? For me this even simpler then long-long-long strings with name-URL pairs...
Attached Files
File Type: zip Inetc.zip (57.6 KB, 335 views)
Takhir is offline   Reply With Quote
Old 4th August 2011, 12:53   #451
zenpoy
Junior Member
 
Join Date: Feb 2011
Posts: 38
1. regarding the winint.dll and https->http redirection in xp sp2, I found out this http://support.microsoft.com/kb/907301 issue, and applying the hotfix (which only replaces winint.dll and adds registry key) solves it! the bad news is that wininit.dll is a 'KnownDll' which means it always loaded from Windows\System32 and only OS can update it. I think the only way is to change the redirection to be like XP SP2 wants.

2. regarding the 'cancel' bug - looks good The bug is not related to multiple downloads, I use only one download at a time, and I had this bug.
zenpoy is offline   Reply With Quote
Old 19th October 2011, 14:36   #452
tperquin
Junior Member
 
Join Date: Oct 2011
Posts: 1
Hello Takhir,

First of thanks for the plugin. I however encountered a problem with the FTP PUT functionality of the plugin. It has to do when PUTing files that are in non-existing (on the FTP server) subdirectories.

The plugin determines if a FTP PUT upload failed due to a non existing subdirectory and tries to create the necessary subdirectories.

However the code that determines non-existing subdirectories relies on the FTP server's response. And I encountered a FTP server where the code in the plugin failed.

I attached two images with the different responses by different FTP servers on non-existing directory.

Code fix should be easy, around line 528 in inetc.cpp:
code:

if(fput && _tcsstr(buf, _T("550")) != NULL)
{


Change to: (or what you prefer)
code:

if(fput && (_tcsstr(buf, _T("550")) != NULL || _tcsstr(buf, _T("553")) != NULL))
{



I saw a few messages that also had problem with subdirectories and FTP PUT earlier in the thread. Those probably had to do with this as well.
Attached Thumbnails
Click image for larger version

Name:	ftpput1.gif
Views:	337
Size:	18.4 KB
ID:	49225   Click image for larger version

Name:	ftp_put2.gif
Views:	292
Size:	18.9 KB
ID:	49226  
tperquin is offline   Reply With Quote
Old 19th October 2011, 17:40   #453
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
Good job, tperquin, than you!
I uploaded new release http://nsis.sourceforge.net/File:Inetc.zip
Takhir is offline   Reply With Quote
Old 21st October 2011, 10:12   #454
DaLiV
Junior Member
 
Join Date: Oct 2011
Posts: 1
in .zip lost non-unicode version
DaLiV is offline   Reply With Quote
Old 21st October 2011, 10:48   #455
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
Oups... Fixed.
Takhir is offline   Reply With Quote
Old 26th October 2011, 17:45   #456
CritterNYC
Junior Member
 
Join Date: May 2006
Location: Astoria, NY
Posts: 12
It seems that inetc, even in a completely silent installer with no splash screen or other plugins, will still steal focus from another app when it is instantiated. Does anyone know of a fix for this?
CritterNYC is offline   Reply With Quote
Old 17th November 2011, 19:49   #457
Zinthose
Senior Member
 
Join Date: May 2009
Posts: 152
Unhappy

It looks like inetc::head is corrupting the stack.

code:
DetailPrint "Beer is placed on the stack.."
Push "BEER"

inetc::head "http://download.macromedia.com/pub/flashplayer/current/install_flash_player_ax_32bit.exe" "$TEMP\Temp.dat"
Pop $0
DetailPrint "Result of inetc::head = $0"

DetailPrint "Reach for Beer..."
Pop $0
${If} $0 == "BEER"
DetailPrint "Sip... ahh... sweet sweet beer!"
${Else}
DetailPrint "I'm sorry but inetc::head drank your beer. :'-("
${EndIf}



Please won't someone find my beer?
Zinthose is offline   Reply With Quote
Old 17th November 2011, 19:57   #458
zenpoy
Junior Member
 
Join Date: Feb 2011
Posts: 38
Zinthose, try putting /END as the last argument to tell inetc where is the end of your argument list:

inetc::head "http://download.macromedia.com/pub/flashplayer/current/install_flash_player_ax_32bit.exe" "$TEMP\Temp.dat" /END
zenpoy is offline   Reply With Quote
Old 17th November 2011, 20:05   #459
Zinthose
Senior Member
 
Join Date: May 2009
Posts: 152
You found my beer!

Weird bug though... need a tinfoil hat for this one.
Zinthose is offline   Reply With Quote
Old 8th December 2011, 07:02   #460
klopfdreh
Junior Member
 
Join Date: Feb 2008
Posts: 34
Thumbs up Details button and information text in instfiles page

Hello!

Since I wrote the last time into this thread the plugin is working like a charm, so thanks a lot first!

I have only two little feature request regarding the detail button and the information which are being displayed.

1. Is it possible not to grey the button out, but instead to make it pushable and print the downloading information into the textarea on each refresh?

Example:
<filename>: 14071kb (6%) of 234523kb @ 1543.0kb/s (2 seconds remaining)
<filename>: 32833kb (14%) of 234523kb @ 1543.0kb/s (2 seconds remaining)
<filename>: 53940kb (23%) of 234523kb @ 1543.0kb/s (2 seconds remaining)
.
.
.

2. Is there a way to show which file is downloading at the moment, because in my installer there is only the product name displayed on top of the installation bar?

Example:

Downloading: <filename>
[ || || || || || || || || || || || || || || || || || || || || ]

Thanks a lot!
klopfdreh is offline   Reply With Quote
Old 5th February 2012, 22:38   #461
dravster
Junior Member
 
Join Date: Feb 2012
Posts: 2
Odd Error with Inetc::get

Using the below simple test code at both my work (win7) and home (xp) hosts I get
the error "U" off the stack. I'm using NSIS 2.46 and the latest Inetc plugin from
http://nsis.sourceforge.net/Inetc_plug-in.



code:
Name "InetClient GET Test"
OutFile "get.exe"

!AddPluginDir ./plugins

!include "MUI.nsh"
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install-colorful.ico"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"

Section "Dummy Section" SecDummy

SetDetailsView hide
; single file, NSISdl-style embedded progress bar with specific cancel button text

inetc::get /canceltext "interrupt!" "http://drav.net/test.md5" "$EXEDIR\test.md5" /end
; NSISdl::download /TIMEOUT=30000 http://drav.net/test.md5 $TEMP\test.md5
Pop $1
MessageBox MB_OK "Download Status: $1"

SectionEnd

;--------------------------------
;Installer Functions

Function .onInit
FunctionEnd



The Error appears as so (and no file is downloaded).

dravster is offline   Reply With Quote
Old 6th February 2012, 04:43   #462
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
test.md5 38 bytes, status OK. String may be trancated to first char only ('U') if you use Unicode plug-in version with multibyte installer.
Takhir is offline   Reply With Quote
Old 6th February 2012, 08:31   #463
dravster
Junior Member
 
Join Date: Feb 2012
Posts: 2
Talking Re: Odd Error with Inetc::get

Yep that was it, drop in the "plugin/Inetc.dll" file (rather than unicode/Inetc.dll) and volia - It works

Cheers for the quick response (as ever!) Takhir!

Regards

D.
dravster is offline   Reply With Quote
Old 2nd April 2012, 06:08   #464
klopfdreh
Junior Member
 
Join Date: Feb 2008
Posts: 34
Quote:
Originally Posted by klopfdreh View Post
Hello!

Since I wrote the last time into this thread the plugin is working like a charm, so thanks a lot first!

I have only two little feature request regarding the detail button and the information which are being displayed.

1. Is it possible not to grey the button out, but instead to make it pushable and print the downloading information into the textarea on each refresh?

Example:
<filename>: 14071kb (6%) of 234523kb @ 1543.0kb/s (2 seconds remaining)
<filename>: 32833kb (14%) of 234523kb @ 1543.0kb/s (2 seconds remaining)
<filename>: 53940kb (23%) of 234523kb @ 1543.0kb/s (2 seconds remaining)
.
.
.

2. Is there a way to show which file is downloading at the moment, because in my installer there is only the product name displayed on top of the installation bar?

Example:

Downloading: <filename>
[ || || || || || || || || || || || || || || || || || || || || ]

Thanks a lot!
Hello again,

only wanted to say that I solved the "2." by settings the right caption, but point "1." would be really nice if it is possible.
klopfdreh is offline   Reply With Quote
Old 5th June 2012, 17:25   #465
barabanger
Winamp Dev Team
 
Join Date: Apr 2004
Location: USA
Posts: 1
Send a message via AIM to barabanger
Quote:
Originally Posted by CritterNYC View Post
It seems that inetc, even in a completely silent installer with no splash screen or other plugins, will still steal focus from another app when it is instantiated. Does anyone know of a fix for this?
I noticed same issue, at least when using inetc from another process. From what I discovered, to avoid this, WS_EX_NOACTIVATE style should be set in dialog template.
barabanger is offline   Reply With Quote
Old 6th June 2012, 08:27   #466
klopfdreh
Junior Member
 
Join Date: Feb 2008
Posts: 34
Hello everyone again,

I got some troubles with the inetc plugin and a low speed http server. After an undefined time the download aborts and a dialog show an error that the connection isn't available. If I press retry the dialog is shown again - so there is a loop which always show the error message and retry/abort. If I press abort the process is aborted as expected. The error is not within the time of 1800 seconds - it appears randomly.

I'm using the following call in our NSIS script:

code:

inetc::get /NOCOOKIES /CONNECTTIMEOUT 1800 /RECEIVETIMEOUT 1800
/NOCANCEL /CAPTION "$(INETCHeader)${What}" /TRANSLATE
"$(INETC1)" "$(INETC2)" "$(INETC3)" "$(INETC4)" "$(INETC5)"
"$(INETC6)" "$(INETC7)" "$(INETC8)" /RESUME
"$(DownloadResumeWarning)" "$downloadURL${What}"
"$userhomeworkingdir\${What}" /END



Thanks a lot!
klopfdreh is offline   Reply With Quote
Old 21st August 2012, 04:28   #467
negativesir
Junior Member
 
Join Date: Aug 2012
Posts: 3
Quote:
Originally Posted by CritterNYC View Post
It seems that inetc, even in a completely silent installer with no splash screen or other plugins, will still steal focus from another app when it is instantiated. Does anyone know of a fix for this?
Yes, this has to do with WM_INITDIALOG not returning false.

From MSDN:
Quote:
The dialog box procedure should return TRUE to direct the system to set the keyboard focus to the control specified by wParam. Otherwise, it should return FALSE to prevent the system from setting the default keyboard focus.
Here is the fix for it, compiled in Visual C++ 6.0, tested on Windows 95.
Attached Files
File Type: zip Inetc.zip (61.3 KB, 325 views)

Last edited by negativesir; 21st August 2012 at 06:02.
negativesir is offline   Reply With Quote
Old 21st August 2012, 08:10   #468
T.Slappy
Major Dude
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 546
Send a message via ICQ to T.Slappy
[OT] Thanks for the fix, but seriously you are using Visual C++ 6.0 and Win 95 ??? [/OT]

Cool looking installers with custom design: www.graphical-installer.com
Create Setup Pages easily: www.install-designer.com
Build installers in Visual Studio 2005-2019: www.visual-installer.com
or RAD Studio 2009, 2010, XE-10.4 Sydney: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Old 21st August 2012, 08:14   #469
negativesir
Junior Member
 
Join Date: Aug 2012
Posts: 3
Quote:
Originally Posted by T.Slappy View Post
[OT] Thanks for the fix, but seriously you are using Visual C++ 6.0 and Win 95 ??? [/OT]
Yea. NSIS supports Windows 95 or higher. If I compile the source with anything higher than Visual C++ 6.0, the resulting DLL will not work on Windows 95. I have a Virtual PC Windows 95 image which makes it easy and I just had to downloaded Visual C++ 6.0. I compiled on Windows 7 and copied it over to the VM and tested the installer with the DLL.
negativesir is offline   Reply With Quote
Old 23rd August 2012, 04:57   #470
T.Slappy
Major Dude
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 546
Send a message via ICQ to T.Slappy
Quote:
Originally Posted by negativesir View Post
Yea. NSIS supports Windows 95 or higher. If I compile the source with anything higher than Visual C++ 6.0, the resulting DLL will not work on Windows 95. I have a Virtual PC Windows 95 image which makes it easy and I just had to downloaded Visual C++ 6.0. I compiled on Windows 7 and copied it over to the VM and tested the installer with the DLL.
[OT]
Thanks for explanation, nice job.

I assume nobody uses version below Windows 2000 and also Microsoft does not support such old versions any more.
[/OT]

Cool looking installers with custom design: www.graphical-installer.com
Create Setup Pages easily: www.install-designer.com
Build installers in Visual Studio 2005-2019: www.visual-installer.com
or RAD Studio 2009, 2010, XE-10.4 Sydney: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Old 23rd August 2012, 05:17   #471
negativesir
Junior Member
 
Join Date: Aug 2012
Posts: 3
Quote:
Originally Posted by T.Slappy View Post
[OT]
Thanks for explanation, nice job.

I assume nobody uses version below Windows 2000 and also Microsoft does not support such old versions any more.
[/OT]
I don't doubt that. I know Microsoft doesn't support Windows 9X but NSIS does! Let me put it this way, I have a duty.. no a.. moral obligation.. to ensure that my patch does not break the minimum OS requirements.
negativesir is offline   Reply With Quote
Old 24th August 2012, 07:03   #472
T.Slappy
Major Dude
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 546
Send a message via ICQ to T.Slappy
Quote:
Originally Posted by negativesir View Post
Let me put it this way, I have a duty.. no a.. moral obligation.. to ensure that my patch does not break the minimum OS requirements.
Like!!!

Cool looking installers with custom design: www.graphical-installer.com
Create Setup Pages easily: www.install-designer.com
Build installers in Visual Studio 2005-2019: www.visual-installer.com
or RAD Studio 2009, 2010, XE-10.4 Sydney: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Old 10th September 2012, 14:29   #473
thaman667
Junior Member
 
Join Date: Sep 2012
Posts: 22
For me it's not showing any window with download information which is very annoying..
thaman667 is offline   Reply With Quote
Old 10th September 2012, 14:36   #474
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Where are you calling the plug-in from? To show download progress you probably need to use it in a Section (and without /silent).

Stu
Afrow UK is offline   Reply With Quote
Old 8th November 2012, 07:34   #475
zenpoy
Junior Member
 
Join Date: Feb 2011
Posts: 38
Can I resolve the filename from the request with inetc?

I have a url which I download a file from during install, this url is using redirection and the name of the file is based on some of the get parameters I use. Anyway, is there a way to use inetc to use/extract the filename from the last redirection in the redirection chains and use that as the filename? I have no problem do the change myself and try it, but I don't have to much experience with wininet api.

BTW - When I put the url in the browser (e.g. chrome) address bar it automatically uses the correct filename to save the file - this is the behaviour I would like to implement.

Thanks
zenpoy is offline   Reply With Quote
Old 3rd December 2012, 12:04   #476
maliktous
Junior Member
 
Join Date: Dec 2012
Posts: 6
Quote:
Originally Posted by negativesir View Post
Yes, this has to do with WM_INITDIALOG not returning false.

Here is the fix for it, compiled in Visual C++ 6.0, tested on Windows 95.
Thank. You save my day.

Takhir, are you planning to include this fix into new version?
maliktous is offline   Reply With Quote
Old 14th May 2013, 20:50   #477
newuser10
Junior Member
 
Join Date: May 2013
Posts: 1
Hey guys,

Just a disclaimer, I'm still new to NSIS in general

The INETC plugin seems to work very well in general, although I'm having an issue which appears to be intermittent.. Basically i am attempting to retrieve a large number of files, approx 2 GB in size spread over 150 files and the transfer of some files are failing intermittently.

I am using the /resume switch and when the failure occurs it takes place somewhere in the middle of a file transfer, when I click on resume, I right away get the same popup coming up asking if i want to resume or cancel.

If i close up the installation package entirely, it will usually go through that file no issue but then fail on another. I'm not seeing any patterns as to specific files failing over and over again, it looks like its completely random.

I thought it might be network related so i ran wireshark to verify if the outbound httpd request goes through and it does.. Also, if i cancel that specific file the next few files go through without issue and since they are all retrieving from the same web server i don't believe its network related.

I'm not sure where to look to get this resolved, can i enable any additional logging?

I can post the script if necessary

Thanks in advance
newuser10 is offline   Reply With Quote
Old 20th May 2013, 11:20   #478
T.Slappy
Major Dude
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 546
Send a message via ICQ to T.Slappy
Is there any safe way how to detect the source of the problem when downloading file fails (inetc::get) ?

Sometimes I am getting ERR_SENDREQUEST which is "SendRequest Error" but I cannot found the problem.

Here is code:
PHP Code:
bool queryStatus(HINTERNET hFile)
{
    
TCHAR buf[256] = _T("");
    
DWORD rslt;
    if(
HttpQueryInfo(hFileHTTP_QUERY_STATUS_CODE,
        
buf, &(rslt sizeof(buf)), NULL))
    {
        
buf[3] = 0;
        if(
lstrcmp(buf_T("0")) == || *buf == 0) <<< The result code is zero (0) - but why???
            
status ERR_SENDREQUEST

Cool looking installers with custom design: www.graphical-installer.com
Create Setup Pages easily: www.install-designer.com
Build installers in Visual Studio 2005-2019: www.visual-installer.com
or RAD Studio 2009, 2010, XE-10.4 Sydney: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Old 1st August 2013, 08:59   #479
tom_q
Junior Member
 
Join Date: Jun 2013
Posts: 4
Hi,

I'm trying to use inetc to download files. I allow users to cancel the download, and to try to download the file a second time. I use the following code:

code:
Function OnDownloadPageClose
Push $0
;Download the file
inetc::get /BANNER "Download in progress." \
/CAPTION "Downloading..." \
"http://www.myuri.com/myfile.txt" \
"$DownloadDirectory\myfile.txt" \
/END
Pop $0
${If} $0 == "OK"
ExecWait "$DownloadDirectory\myfile.txt -d$\"$DownloadDirectory$\" -s"
Delete "$DownloadDirectory\myfile.txt"
${Else} ;an error occured
MessageBox MB_YESNO|MB_ICONEXCLAMATION \
"The file could not be downloaded. This may be due to a faulty \
Internet connection. Click 'Yes' to try again, or click 'No' to finish installation \
without downloading the optional files." \
IDNO exit
Delete "$DownloadDirectory\myfile.txt" ; !! THIS DOES NOT WORK
Pop $0
Abort ; do not go to the next installer page, so the user can try again.
${EndIf}
exit:
Pop $0
FunctionEnd



This does not work, most likely because when the download is interrupted by the user (closing the download pop-up) the half-downloaded-file cannot be deleted. It is also impossible to delete the file manually for as long as the installer is running ("Another program is using this file").

Edit: I get the same issue in other modes (besides banner mode) when clicking the cancel button. It seems like cancelled downloads are not properly handled -- the downloaded files are never closed. Then again it might just be that I have forgotten some essential operation.
tom_q is offline   Reply With Quote
Old 1st August 2013, 13:42   #480
aerDNA
Senior Member
 
aerDNA's Avatar
 
Join Date: Feb 2007
Location: Rijeka, Croatia
Posts: 225
inetc automatically deletes the file on dl cancel; why it doesn't in your case, it's hard to say. Does the problem persist with some other file from a different server? Try using Unlocker to see if some 3rd party sw is hijacking the file. If you can't resolve the problem, a workaround can be to use GetTempFileName for the destination, then move the completed dl to target dir.

PostEnd:
aerDNA is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

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