From 4d7946464a104f49b12e059fbafbe56c843484cb Mon Sep 17 00:00:00 2001 From: Robert Shearman Date: Wed, 26 Apr 2006 15:42:14 +0100 Subject: [PATCH] setupapi: Fix parsing of UCS-16 files. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix parsing of UCS-16 files prefixed with the Unicode BOM. Based on a patch by Hervé Poussineau. --- dlls/setupapi/parser.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dlls/setupapi/parser.c b/dlls/setupapi/parser.c index e6587c7952a..514e85afb3d 100644 --- a/dlls/setupapi/parser.c +++ b/dlls/setupapi/parser.c @@ -967,7 +967,14 @@ static struct inf_file *parse_file( HANDLE handle, const WCHAR *class, UINT *err HeapFree( GetProcessHeap(), 0, new_buff ); } } - else err = parse_buffer( file, buffer, (WCHAR *)((char *)buffer + size), error_line ); + else + { + WCHAR *new_buff = (WCHAR *)buffer; + /* UCS-16 files should start with the Unicode BOM; we should skip it */ + if (*new_buff == 0xfeff) + new_buff++; + err = parse_buffer( file, new_buff, (WCHAR *)((char *)buffer + size), error_line ); + } if (!err) /* now check signature */ {