Click to See Complete Forum and Search --> : How to copy files to another computer using Window XP by programming?


dungla
December 8th, 2004, 06:43 AM
Hi all,

I've a problem: copy files to remote computer using Window XP by programming.

I have found WNetAddConnection2 function, but when I try to use this function connect to remote computer use WinXP with user has administrator right, it alway return "5" (Access Denied).

Anyone know why this function failed?

If possible, please show me the solution to connect to remote computer using Win XP by programming (using WNetAddConnection or the other solutions).

I've hear about tftp, but i wonder that, if the remote computer don't have tftp listening, how can i use tftp to copy the files to it?

Please, help me find the right solution to do that.

Many thanks.

venAdder
December 8th, 2004, 11:16 AM
I you are using string like \\servername\c$ to connect using WNetConnection2 make sure c: drive is shared as c$ with full access to everyone.

In 2k this setting looks liek this:
Right click on c drive. It should say shared as c$. Under security tab the list for permissions shoudl contain everyone and in the access rights should have full control (if u want full control). Only then WNetAddConnection succeeds(atleast that's what I have seen in my experiments with it).

There must be a corressponding dialog in xp if u right click on your c drive. I don't have xp computer here so can't be sure, but ig u dig u will find something similar.

Hope it Helps

dungla
December 8th, 2004, 09:29 PM
I'm running code with administrator's username and password of target computer. Therefore, I don't know why it always return "Access Denied" error.

venAdder
December 8th, 2004, 10:49 PM
It will retunr that error if that the target drive does not have share on it as i described.

Correct me someone if I am wrong.

Try accessing that drive from windows explorer using \\servername\sharename(c$)

If you do not have share on it , it will probably not even ask for user name and password and tell you access is denied or the path not found

dungla
December 9th, 2004, 02:40 AM
I'm sure that is shared and the user to logon is the administrator. But it still return "Access Denied"

venAdder
December 9th, 2004, 11:27 AM
Well as i said I have similar problems too, so Let's keep on searching.