Subject: Re: [DUG]: UNC Path Names
From: "Nello Sestini" <[email-masked]>
To: Multiple recipients of list delphi <[email-masked]>
Date: Fri, 16 Nov 2001 08:17:55 +0700

> Sorry Paul I don't know the answer, but assume that you will probably have
> to iterate through the drives and look for a match for matching UNC name.

right.

you use WNetOpenEnum to set up an enum of RESOURCETYPE_DISK resources.
then call WNetEnumResource to get them.   You get back a NETRESOURCE
structure for each resource.

NETRESOURCE has the localname and remotename so you can search through
these pairs to find one matching your UNC path.

Note that it's possible to have more than one drive mapped to the
same UNC path so this mapping isn't well defined  (the drive letter
mapped to \\mybox\myshare needn't be unique.

BTW the inverse mapping is much more straightforward - just use
WNetGetConnection.

WNetGetConnection maps local names (i.e. mapped drive letters) to
the UNC name of their corresponding network share.   This is
unique (the UNC name associated with a mapped drive letter is
well defined) so somewhat less trouble.

-ns
http://www.roserox.co.th

>
> The ExtractFileDrive is meant to extract the drive letter from a file name
> eg. D:\MyDir\Stuff.txt -> D:\
> \\MyServer\MyDir\Stuff.txt -> \\MyServer\MyDir
>
> Regards,
> John
> --------------------------------------------------------------------------
-
>     New Zealand Delphi Users group - Delphi List - [email-masked]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [email-masked]
> with body of "unsubscribe delphi"
> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
>

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [email-masked]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [email-masked] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/