[PATCH 2/2] regedit: Handle comment lines with leading spaces and tabs

Alexandre Julliard julliard at winehq.org
Fri Mar 31 07:07:55 CDT 2017


Hugh McMaster <hugh.mcmaster at outlook.com> writes:

> I guess it depends on how you think we should handle such whitespace. parse_file_header() checks for whitespace
> before processing the file header. We don't bother checking in processRegEntry() or processRegEntry31().
>
> On Windows, all lines in registry files can have leading spaces and tabs. The exception is Windows 3.1, which
> doesn't allow leading whitespace at all.
>
> In Wine, we ignore any registry line with leading whitespace. So importing a file like the following will fail.
> (In case it's not clear, there are two spaces before the opening square bracket.)
>
> REGEDIT4
>   [HKEY_CURRENT_USER\Software\Wine\regedit_test]
> "Value"="Data"
>
> One option is to move the check for ';' and '#' to processRegEntry(), but that would require A->W line conversion first.
> We would then add an appropriate while loop in that function, handling all line cases.
>
> Otherwise, we could add the while loops into get_lineA/W() and remove the whitespace check from parse_file_header(),
> as it would be redundant.

You can also ignore white space before comments, but still return it for
other lines, if there is a case where the callers would want that.
Otherwise getting rid of whitespace right away is fine. A few test cases
with leading whitespace may be a good idea.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list