How to add network locations?

I recently installed some VPN software to let me connect to my college's VPN so I could access the network resources, such as my personal folder. When the software is running, I can access the network resources as if I am part of the network, e.g. with the path \\somename\ it asks for my domain\username and password, and I can access the network resource.

I'm having a hard time thinking of good search terms to find how to do this, so how can I do this with the Windows API? How does it work?
Is this even a relevant place to start looking?

http://msdn.microsoft.com/en-us/library/windows/desktop/aa370678(v=vs.85).aspx

I'm lost amongst hundreds of similarly ambiguously named things.
It's not clear what your asking about. Are you asking about VPNs or Windows connectivity?

The VPN just establishes a connection at the network layer. The standard connectivity stuff just works transparently at the application layer.
If I understand you correctly then you want to use "LogonUser()": http://msdn.microsoft.com/en-us/library/windows/desktop/aa378184(v=vs.85).aspx

Notice how the second parameter is a domain? That's the name of the authority that you tell this function to use in order to authenticate.

I've sort of done this before, at home I can VPN into my office and run an app that uses this function to log on to the work domain while the station I am running it from is logged into with a local account that would not have the permissions to do any of the things that I have that app doing. In that case the machine I am logging into already has an established domain trust, but that should not matter if you're using VPN.
I guess I wasn't clear enough. I want that this path:

\\my-test\

Does not exist yet, but when I run my program, it does exist and my program decides what appears in it. The whole logging on with credentials thing is just something I thought would be cool to mess with.
Last edited on
It's still not clear to me. Do you want to create a local folder and share it on the network?
No.

So, before I run this software my university provides, if I try to go to \\pc2\ I get an error. When I run the software my university provides, suddenly I have the ability to go to \\pc2\ and see various folders - it's connected to Unix systems located at my university. When I close the software I can't open \\pc2\ anymore.

When I'm opening or saving files, it's kind of slow because of course it's going across the internet, but I assumed it was also going through the software itself.
Sounds like the software is mounting a network share. I'm still not sure what you want to do. My next guess is connect to your school network.
Last edited on
I mean, I want to write code to do that myself. I want to know which functions in the Windows API I have to use to get the same results. How can here be so much confusion here?

It doesn't help that when I try searching Google just about everything I get is about mounting network drives, which is completely unrelated to what I want.
Last edited on
L B wrote:
It doesn't help that when I try searching Google just about everything I get is about mounting network drives, which is completely unrelated to what I want.

That's what it sounds to me that you want, to map a network folder. From what you described it sounds like the software is creating a VPN tunnel and mounting the resource over the tunnel.
Maybe these functions? http://msdn.microsoft.com/en-us/library/windows/desktop/aa385391(v=vs.85).aspx
Looking at the example code for WNetAddConnection2 makes me say no, unfortunately. Maybe there's a misunderstanding in "map network folder"? I'm not talking about the commonly-known feature of mapping a drive letter to a network path, which is what all my search results explain and what the code example for WNetAddConnection2 does.
Is the problem that they say drive and not folder? My next guess is its a webdav share which will (AFAIK) map to folder. http://msdn.microsoft.com/en-us/library/windows/desktop/dd408161(v=vs.85).aspx
I'm pretty sure HTTP was not involved in this process :\

Is it really that confusing to imagine typing \\my-test\ into windows explorer and it doing a callback to a running program to list the contents?
Is it really that confusing to imagine typing \\my-test\ into windows explorer and it doing a callback to a running program to list the contents?
Is that what you want to do or what you think the software is doing? Just out of curiosity does the folder properties give any target information?
Is this what you're talking about?

http://i.imgur.com/oQAPZ3i.png
Topic archived. No new replies allowed.