Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get local path from Network Share name ?

Status
Not open for further replies.

Oppenhiemer

Programmer
Jun 28, 2001
315
GB
Hi -

Just wondering if anyone knew how to obtain a local path from a network resource ? I have seen code that enabled you to iterate through various network shared resources - but I need to obtain the Local reference once found.

If I come across say a shared drive, how can I extract its local reference ? That is local to the machine that owns the drive (resource.)

It may sound like an odd thing to need to do, but its related to automating an interbase-based application start-up procedure. I am trying to create a start-up procedure that allows the software to check if its connected to the database - if not, then call a form to let the user select the datasource from the network.

Now browsing the network, i can easily let them select a drive or folder. But (if my understanding is correct for a TCP/IP protocol) then I need to be able to provide connection information for the database in the format :

<server_name>:<path>

For example :

Narnia:D:\DbDir\ThisDb.gdb

But (and here lies the problem) the path needs to be as seen from the hosts perspective (not a mapped resource assigned letter.)

So if I could locate the network drive(path) is there anyway to extract the local path information so I can use it in the INterbase Connection string ?

As far as I know, I cannot use a UNC reference when connecting to interbase over TCP/IP. Anyway, any pointers welcome ;-).

Cheers..
Opp.

 
Have a look at the API functions in the same group as

WNetGetConnection.

Steve.
 
I appreciate your feedback , however - the only information I can manage to obtain by using the funtions in this group are Local to the calling machine (program.)

In other words, the other way round to the way I need it. What I seem unable to do is to specify the UNC (or mapped drive reference) and get the local drive name (local to the machine doing the sharing that is.)

So machine A shares its C drive. From another machine I see that the shared resource is say \\aserver\C. What I need is to somehow say that \\aserver\C is acutally refering to the 'C' drive on the mahine in question. I need this so I can pass it as a connection string for an Interbase connection.

So far I have looked at funtions such as &quot;WNetEnumResource&quot; and structures like &quot;NETRESOURCE&quot; but when ever I come across a reference to say &quot;lpLocalName&quot; its means that its local to the calling machine - not the machine doing the sharing.

Cheers..




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top