How to get network path from local path?
Is it possible to convert from a shared directory (D:\data\MyShare) or mapped driveletter (lets say 'N:\') to the networkname (\\Client\MyShare\)?
I know that the mapped drive is mapped with GetDriveType, but i must give the networkname (that is know by the server) to the server.
An other problem (less important) is how to get from \\Client\disk1\test\ to D:\data\test\ ?
(when are physical on this client)
If anybody knows how to solve these problems (realy need the first one) i'm a happy person and can sleep a bit better :-)
Mark
Re: How to get network path from local path?
check out WNetGetConnection
Re: How to get network path from local path?
Thanks Lothar,
but this only works for mapped drives.
Can i get the locally shared directory in any way?
Like i shared a directory on my disk (say: C:\Data\ForAll\ shared as Mark), how can i detect if this directory is shared to the public?
(convert to \\Client\Mark\)
Mark
Re: How to get network path from local path?
I haven't tried it, but the description for NetShareCheck looks like it could give an answer to your question.
Re: How to get network path from local path?
I am about to jump into the same pool of 'trouble' water as you are. Check out the WNetxxxxxx series of function calls. I have not tried yet but they look promissing.
Another place to look at is QueryDosDevice(..).
Do let me know how you get on.
Will