[PATCH 1/2] regsvr32: Return the most recent error code, even if later DLLs succeed

Hugh McMaster hugh.mcmaster at outlook.com
Wed Sep 9 05:43:52 CDT 2015


Wine currently returns the final exit code, but on Windows, the most recent
error code is returned, even if subsequent files are processed successfully
(and return 0).
---
 programs/regsvr32/regsvr32.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/programs/regsvr32/regsvr32.c b/programs/regsvr32/regsvr32.c
index a1b55a3..6a35226 100644
--- a/programs/regsvr32/regsvr32.c
+++ b/programs/regsvr32/regsvr32.c
@@ -221,7 +221,7 @@ static WCHAR *parse_command_line(WCHAR *command_line)
 
 int wmain(int argc, WCHAR* argv[])
 {
-    int             i;
+    int             i, res, ret = 0;
     BOOL            CallRegister = TRUE;
     BOOL            CallInstall = FALSE;
     BOOL            Unregister = FALSE;
@@ -286,7 +286,7 @@ int wmain(int argc, WCHAR* argv[])
         if (argv[i])
         {
             WCHAR *DllName = argv[i];
-            int res = 0;
+            res = 0;
 
             DllFound = TRUE;
             if (CallInstall && Unregister)
@@ -294,7 +294,10 @@ int wmain(int argc, WCHAR* argv[])
 
             /* The Windows version stops processing the current file on the first error. */
             if (res)
+            {
+                ret = res;
                 continue;
+            }
 
             if (!CallInstall || (CallInstall && CallRegister))
             {
@@ -305,13 +308,19 @@ int wmain(int argc, WCHAR* argv[])
             }
 
             if (res)
+            {
+                ret = res;
                 continue;
+            }
 
             if (CallInstall && !Unregister)
                 res = InstallDll(!Unregister, DllName, wsCommandLine);
 
             if (res)
+            {
+                ret = res;
 		continue;
+            }
         }
     }
 
@@ -324,5 +333,6 @@ int wmain(int argc, WCHAR* argv[])
 
     OleUninitialize();
 
-    return 0;
+    /* The Windows version returns the most recent error code, even if later DLLs succeed. */
+    return ret;
 }
-- 
1.9.1




More information about the wine-patches mailing list