• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 138
  • Last Modified:

NT/Internet problems Part 2

An application with a TClientSocket component sends a full path (incl. filename) to an application with a TServerSocket component on another machine. How do I convert the full path to the "shared" path (eg. d:\work\test.exe might be machinename + d_drive\work\text.exe for the receiving machin) ?

This has to work under NT 4.0, and I cant tell the shared names in advance

If you have an idea, please include one or more examples, as I'm not that strong on this side of delphi

 
0
hatecapletters
Asked:
hatecapletters
  • 3
  • 2
1 Solution
 
MadshiCommented:
I'm sorry, I don't have the time to write a complete share enumerating source for you. The API you need is "NetShareEnum". Let's say someone has shared "d:\" under "d_drive" you would have to enumerate through all shares. For each available share you'll get the share name and the local path. Then you should check each local path with "Pos(UpperCase(localPath), UpperCase(PathReceivedFromSocket))". If the result is "1", you have found a share that helps.

Regards, Madshi.
0
 
MadshiCommented:
Perhaps there's a share enumeration component available on torrys?

http://www.torry.ru
0
 
EpsylonCommented:
This code translates the mapped drive H: to a network recource path like \\machine\dir:

var buf: array[0..MAX_PATH] of Char;
    len: Cardinal;
begin
  len := MAX_PATH;
  WNetGetConnection(PChar('H:'), @buf, len);
  ShowMessage(buf);
end;
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
hatecaplettersAuthor Commented:
epsylon >> sorry, but i keep getting an empty "buf" when i try that

madshi >> sounds like you are on the right track. I've tried to read up on wnetenumopen and wnetenumresource, but i'm too dense to get it right.. sombody out who can give me an example ?
0
 
hatecaplettersAuthor Commented:
i have to give you a "B" for this one, since I had to do a LOT of work myself ;-)
0
 
MadshiCommented:
That's okay...   :-)

So did get it working now?
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now