The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Arroso on May 02, 2006, 02:47:51 PM

Title: URLDownloadToFile
Post by: Arroso on May 02, 2006, 02:47:51 PM
Hi everybody,
I'm using the URLDownloadToFile function (urlmon.inc & .lib) almost successfully. I mean, I'm able to download a file.
Once the function has ended I always get a 0h into EAX. No matter the file was found or wasn't.

Do you guys know if there's anything else that could be tested?

thanks in advance

Title: Re: URLDownloadToFile
Post by: zcoder on May 02, 2006, 03:06:53 PM
Arroso,
the MSDN says:


E_OUTOFMEMORY = The buffer length is invalid or there was insufficient memory to complete the operation.
S_OK = The operation succeeded.


But if it does like you say and only returns 0 for sucess or not, then you will have to
just check to see if the file exists or not to know if it was sucessfull or not.

I am not sure why it is not letting you know the results.

Zcoder....
Title: Re: URLDownloadToFile
Post by: Arroso on May 02, 2006, 03:17:21 PM
thanks Zcoder, testing 4 file existence is what I'm actually doing, indeed.
a funny variation of the case is a site that once asked 4 a non-existing file they give you a default html page instead!
oh my...  :8)  it ends up scanning the "[ht" substring into the ready file too  :eek

all an all, the W2K is alwayS fun

thanks again

   
Title: Re: URLDownloadToFile
Post by: PBrennick on May 04, 2006, 06:13:16 PM
Arroso
Quotea funny variation of the case is a site that once asked 4 a non-existing file they give you a default html page instead!

This is not a funny or unusual thing.  It is done on purpose to prevent a certain type of access to your website.  It closes a loophole, in other words.  If an error of type 'file not found' occurs, a script is automatically run called .htaccess, mine contains the following line,
QuoteErrorDocument 404 /404.html
As you can see, if someone tries to break in that way, 404.html will run.  To see mine in action, you will note that http://www.pbrennick.com/trash.can yields the same results as http://www.pbrennick.com/404.html

hth,
Paul
Title: Re: URLDownloadToFile
Post by: PBrennick on May 04, 2006, 06:25:58 PM
Arroso,
As far as the topic (URLDownloadToFile function) is concerned; Greg posted a utility that uses that function (correctly) to download a ZIP file from the web and unzip it into the director of your choosing.  A powerful utility that can be found here,
http://www.masmforum.com/simple/index.php?topic=4687.msg35173#msg35173

Have fun,
Paul
Title: Re: URLDownloadToFile
Post by: Arroso on May 09, 2006, 05:02:27 PM
thank you very much Paul