Redmine #4733: Make edit_line CRLF aware.

This detects the newline mode before an edit begins, remembers it and
applies the same newline mode when the file is saved.

In many places where we know we are reading text files, we now switch
to opening in text mode on Windows, which is safe even if the file has
LF endings (either line ending will return LF in memory). On Unix it
has no effect.

For files contained within the /var/cfengine tree, I generally stick
to using binary mode, even for text files, since it lowers the risk,
and they don't generally need to be CRLF format anyway.
Silence a warning about unused argument.
Fix Windows registry test.

"ProgramFilesDir" is the correct name, not "ProgramFiles". Verified on
Windows 2008 and 2012.