Robert Shearman : setupapi: Fix parsing of UCS-16 files.

Alexandre Julliard julliard at wine.codeweavers.com
Fri May 5 15:24:27 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 4d7946464a104f49b12e059fbafbe56c843484cb
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=4d7946464a104f49b12e059fbafbe56c843484cb

Author: Robert Shearman <rob at codeweavers.com>
Date:   Wed Apr 26 15:42:14 2006 +0100

setupapi: Fix parsing of UCS-16 files.

Fix parsing of UCS-16 files prefixed with the Unicode BOM. Based on a 
patch by Hervé Poussineau.

---

 dlls/setupapi/parser.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/dlls/setupapi/parser.c b/dlls/setupapi/parser.c
index e6587c7..514e85a 100644
--- a/dlls/setupapi/parser.c
+++ b/dlls/setupapi/parser.c
@@ -967,7 +967,14 @@ static struct inf_file *parse_file( HAND
             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 */
     {




More information about the wine-cvs mailing list