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

Luke Kenneth Casson Leighton lkcl at
Sun Feb 6 21:41:04 GMT 2000

On Mon, 7 Feb 2000, John E. Malmberg wrote:

> Beau Kuiper <ekuiperba at> wrote:
> >
> > On Sun, 6 Feb 2000, John E. Malmberg wrote:
> >
> > > The mention of looking up performance data from the registry gave me an
> > > idea.
> > >
> > > With the registry calls that you can do now, is it possible or practical
> to
> > > look up the file type in HKEY_CLASSES_ROOT before it is transferred, and
> if
> > > it is registered as a known text type to translate the CR-LF information
> as
> > > the file is being transferred?
> > >
> > > Just a thought.
> > >
> > A very evil thought. They tried to do that with the linux msdos filesystem
> > support. It really stuffed life up for many people with scilent data
> > corruption. To do the same with samba would be not to learn from the
> > mistakes of others. to be specific: YOU CAN NEVER DETERMINE WHAT IS STORED
> Windows actually uses two methods of determining a file type.  The first is
> a registry, and the second is to examine the first two bytes of the file for
> a signature.  Some programs use the signature over the file type.
> Somewhere there is a list of these magic codes, but I can not recall where
> it is at the moment.  This is how programs like WORD, WORDPAD, and WRITE
> determine how to translate a document.  I am not sure if there is a master
> list somewhere that Windows maintains for these signatures, or if they are
> hard coded into each application as needed.

it's the storage / streams - structured file storage system.  if you have
access to the MSDN, look up the CStream and CStorage classes in the MFC
source code, and go from there.

a project i worked on needed to create documentns in structured format, so
we pinched the code and ported it to 16-bit (!!!)

More information about the samba-technical mailing list