Want to map symbolic links as Windows Shortcuts
Green, Paul
Paul.Green at stratus.com
Mon Apr 23 18:21:06 GMT 2001
Thanks, Phil, for the comprehensive answer. The reasons you state for not
mapping them appear sound to me. It is disappointing, although perhaps not
surprising, that they are incompletely implemented in Windows. Your
information gives me something I can tell my users. I don't think I'm going
to try to map them right now -- I think I'll wait and see how my customers
react to the existing behavior first.
Oh, by the way, the www.wotsit.org site blocks direct access to its files.
It redirected me to a different page. But I just entered "shortcut" into the
search engine and was off and running again.
Thanks
PG
-----Original Message-----
From: Mayers, Philip J [mailto:p.mayers at ic.ac.uk]
Sent: Monday, April 23, 2001 1:46 PM
To: 'Green, Paul'; Samba Technical (E-mail)
Subject: RE: Want to map symbolic links as Windows Shortcuts
Samba intentionally does not makes Symlinks look like shortcuts. One reason
is that such files are only meaningful to Explorer, and other Win32 SH*
function-based programs - e.g. the CreateFile API doesn't "follow" them,
although the Common Dialog Boxes do.
So, .LNK files aren't symlinks (and vice-versa) which is why they aren't
translated.
<offtopic>Most Unixes use symlinks as heavily or lightly as you like - they
can be a boon or a nightmare, if used improperly</offtopic>
The SMB protocol is described in some (ahem) detail -
http://www.samba.org/cifs/ is a good place to start.
Windows Shortcuts are just files with some binary junk in them and a .lnk
extension. I *suppose* it would be theoretically possible to remap a symlink
to such a file, and back again, but it would leave a really bad taste in my
mouth... The file format for .LNK files is at:
http://www.wotsit.org/download.asp?f=shortcut
You could do this using the VFS (virtual file system) layer in Samba 2.2
onwards, to hook into the file open/close ops - you'd need to maintain a
virtual (hidden) file which is filled in from the symlink info on open, has
the changes stored to it by explorer, and on close is re-translated back to
a symlink (shudder...). Bear in mind that not all the information (not even
most) in a .LNK file can be stored in a symlink:
Target - can be just a plain file but can also be a program to execute, with
arguments
Start in - directory to make the CWD - no analog for symlinks
Shortcut key - no analog
Run - no analog
Comment - no analog
Run as different user - no analog
Run in seperate memory space - no analog
Icon - no analog
For the items that have no analog, you *could* maintain a separate database
that stores these, but keeping that in-sync with the filesystem would be
tough.
Regards,
Phil
+----------------------------------+
| Phil Mayers, Network Support |
| Centre for Computing Services |
| Imperial College |
+----------------------------------+
-----Original Message-----
From: Green, Paul [mailto:Paul.Green at stratus.com]
Sent: 23 April 2001 17:46
To: Samba Technical (E-mail)
Subject: Want to map symbolic links as Windows Shortcuts
I am responsible for the port of Samba 2.0.7 to the Stratus VOS
fault-tolerant operating system. The port has gone well and we are in beta
test now. Thanks to everyone for creating and maintaining such a
high-quality product.
I have noticed that Windows is able to list a directory and accurately
portray which entries are shortcuts, but that when Windows lists a VOS
directory using Samba, all of the VOS symbolic links are listed as real
files or real directories. I have assumed that Unix folks must not be big
users of symbolic links...but VOS users do use them fairly often.
I poked around in the source code, but the message formats that Samba uses
to communicate with the client aren't exactly transparent. Short of
capturing and decoding some packets (ugh), I don't see how to mark the reply
so that Windows knows the object is a shortcut.
Is there a way to map symbolic links to Windows shortcuts and I just don't
see it? Does anyone at least know the necessary Windows message format so
I can code up a trial solution?
Many thanks,
PG
--
S T R A T U S C O M P U T E R
111 Powdermill Road
Maynard, MA 01754-3409 U.S.A.
Paul Green
Senior Technical Consultant
TEL +1 (978) 461-7557
FAX +1 (978) 461-3610
More information about the samba-technical
mailing list