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

 
hatecaplettersAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.