The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: RedXVII on November 02, 2006, 10:03:19 PM

Title: Grab Network File
Post by: RedXVII on November 02, 2006, 10:03:19 PM
Short and sweet.
1) I dont suppose theres an easy way to copy a file from the network. Will "CopyFile" work?

2) How about from http and ftp?


Cheers all  :U
RedXVII
Title: Re: Grab Network File
Post by: Ghirai on November 02, 2006, 10:56:30 PM
If the location is mapped to a drive, yeah, you can use copyfile.
If it's not, you can map it yourself.

As for ftp, look at some APIs exported by wininet, the're quite useful.
Title: Re: Grab Network File
Post by: GregL on November 03, 2006, 01:38:35 AM
Take a look at URLDownloadToFile (http://msdn.microsoft.com/workshop/networking/moniker/reference/functions/urldownloadtofile.asp) for grabbing a file off of the Internet. I have used it, and it works.
Title: Re: Grab Network File
Post by: PBrennick on November 03, 2006, 03:17:10 AM
RedXVII,
Attached is a console app that uses URLDownloadToFile (http://msdn.microsoft.com/workshop/networking/moniker/reference/functions/urldownloadtofile.asp) as Greg suggested. This example was originally posted by Hutch, I think.

Paul


[attachment deleted by admin]
Title: Re: Grab Network File
Post by: RedXVII on November 05, 2006, 07:43:30 PM
Thats a very very nice api.

Cheers guys!  :U  :U
Title: Re: Grab Network File
Post by: P1 on November 06, 2006, 03:48:45 PM
RedXVII,

Were you referring to the Internet or LAN files?

CopyFile works for both standard DOS notation and UNC for copying files.
szSource         db "\\MORK\AC_Temps\Install\AC_Temps.exe",0

Regards,  P1  :8)

PS:  We have servers named Moe, Larry, Curly, Shemp, Ricky, Lucy.  Mork, but did not do Mindy, yet.
Title: Re: Grab Network File
Post by: PBrennick on November 06, 2006, 04:04:10 PM
P1,
That's nice to know, about CopyFile working with UNC paths.  :U

Paul