Using NT registry calls to solve CR-LF issue with text files.

Gunnar Degnbol degnbol at
Mon Feb 7 11:06:06 GMT 2000

At 13:32 07-02-2000 +1100, Luke Kenneth Casson Leighton wrote:
> > It might be possible to add a property sheet to files on Samba shares with
> > the Unix file attributes/owner. It would require some way to communicate
> > the attributes, preferably within the SMB session. Perhaps squatting an
> > unused information level somewhere ?
>it's been done before, but not made publicly available (requires
>installation of dll on clients0.  it's a commercial solution.

I think that must be SunLink/Totalnet ?  I believe it includes some kind of 
shell extension for changing Unix attributes.  But I didn't study it in 
detail before I replaced it with Samba.

>go for it.
Ok.  I have looked a little more at it, but it doesn't just require a 
client DLL, it also needs support in Samba.  I have only figured half the 
solution (getting the attributes), and it involves a gross hack on the SMB 
protocol.  I am not sure what the policy on extending Microsoft's protocols 
is, if there is one.

I will describe this from the Windows API side.  Getting the attributes 
could be done by adding an information level to NetFileEnum, with somewhat 
different semantics from the existing levels.  This would return the same 
information as NFS's GETATTR call.

NetFileEnum returns a list of information on open files under a directory 
path. The is either a list of fileids (info level 2, not supported by 
Samba), or a list with fileids and some more useful information (info level 
3).  In NT, NetFileGetInfo can be used with the fileids from info level 2 
to get information (level 2 or 3) on each file 
individually.  NetFileGetInfo is not supported in Windows 9x or by 
Samba.  NetFileEnum is not a close match, but the NetAccessXXX functions 
are not supported by Samba (they are declared obsolete, only for connecting 
to LanMan 2.x, and has been undocumented).

It should not be neccessary to open a file to get the attributes, nor 
should it be neccessary to get the attributes of all the open files in a 
directory tree when only one file or one directory is needed.  Also, 
Windows 95 can't return more than 64 KB of information in one function call.

But if the basepath parameter to NetFileEnum is interpreted as a wildcard 
specification (for all files, not only open files) when used with the new 
info level, it would be possible to get the information that is actually 

I have not figured out how the attributes can be set.  Setting Unix 
attributes also involves some security and administration 
considerations.  Of course, it could all be done with ls and chmod through 
remote shell, but this would not be useful for anyone who cares much about 
file permissions.


More information about the samba-technical mailing list