setupapi: Add an exception handler in SetupGetLineCount to work around broken MS installers.

Hans Leidekker hans at codeweavers.com
Tue Jan 6 06:41:44 CST 2009


See http://bugs.winehq.org/show_bug.cgi?id=16013 for more information.

 -Hans

diff --git a/dlls/setupapi/parser.c b/dlls/setupapi/parser.c
index 656fb78..f9d5ae4 100644
--- a/dlls/setupapi/parser.c
+++ b/dlls/setupapi/parser.c
@@ -40,6 +40,7 @@
 
 #include "wine/unicode.h"
 #include "wine/debug.h"
+#include "wine/exception.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
 
@@ -1272,12 +1273,21 @@ LONG WINAPI SetupGetLineCountW( HINF hinf, PCWSTR section )
     int section_index;
     LONG ret = -1;
 
-    for (file = hinf; file; file = file->next)
+    __TRY
     {
-        if ((section_index = find_section( file, section )) == -1) continue;
-        if (ret == -1) ret = 0;
-        ret += file->sections[section_index]->nb_lines;
+        for (file = hinf; file; file = file->next)
+        {
+            if ((section_index = find_section( file, section )) == -1) continue;
+            if (ret == -1) ret = 0;
+            ret += file->sections[section_index]->nb_lines;
+        }
     }
+    __EXCEPT_PAGE_FAULT
+    {
+        WARN("caught exception, broken MS installer?\n");
+    }
+    __ENDTRY
+
     TRACE( "(%p,%s) returning %d\n", hinf, debugstr_w(section), ret );
     SetLastError( (ret == -1) ? ERROR_SECTION_NOT_FOUND : 0 );
     return ret;



More information about the wine-patches mailing list