[ros-diffs] [fireball] 49216: [ADVAPI32] - Roel Messiant: Fix short-circuit evaluation. See issue #5677 for more details.

fireball at svn.reactos.org fireball at svn.reactos.org
Thu Oct 21 20:30:38 UTC 2010


Author: fireball
Date: Thu Oct 21 20:30:37 2010
New Revision: 49216

URL: http://svn.reactos.org/svn/reactos?rev=49216&view=rev
Log:
[ADVAPI32]
- Roel Messiant: Fix short-circuit evaluation.
See issue #5677 for more details.

Modified:
    trunk/reactos/dll/win32/advapi32/sec/cred.c

Modified: trunk/reactos/dll/win32/advapi32/sec/cred.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/sec/cred.c?rev=49216&r1=49215&r2=49216&view=diff
==============================================================================
--- trunk/reactos/dll/win32/advapi32/sec/cred.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/advapi32/sec/cred.c [iso-8859-1] Thu Oct 21 20:30:37 2010
@@ -103,16 +103,22 @@
         credential->TargetName = (LPWSTR)buffer;
         ret = RegQueryValueExW(hkey, NULL, 0, &type, (LPVOID)credential->TargetName,
                                &count);
-        if (ret != ERROR_SUCCESS || type != REG_SZ) return ret;
+        if (ret != ERROR_SUCCESS)
+            return ret;
+        else if (type != REG_SZ)
+            return ERROR_REGISTRY_CORRUPT;
         buffer += count;
     }
 
     ret = RegQueryValueExW(hkey, wszCommentValue, 0, &type, NULL, &count);
-    if (ret != ERROR_FILE_NOT_FOUND && ret != ERROR_SUCCESS)
-        return ret;
-    else if (type != REG_SZ)
-        return ERROR_REGISTRY_CORRUPT;
-    *len += count;
+    if (ret != ERROR_FILE_NOT_FOUND)
+    {
+        if (ret != ERROR_SUCCESS)
+            return ret;
+        else if (type != REG_SZ)
+            return ERROR_REGISTRY_CORRUPT;
+        *len += count;
+    }
     if (credential)
     {
         credential->Comment = (LPWSTR)buffer;
@@ -129,11 +135,14 @@
     }
 
     ret = RegQueryValueExW(hkey, wszTargetAliasValue, 0, &type, NULL, &count);
-    if (ret != ERROR_FILE_NOT_FOUND && ret != ERROR_SUCCESS)
-        return ret;
-    else if (type != REG_SZ)
-        return ERROR_REGISTRY_CORRUPT;
-    *len += count;
+    if (ret != ERROR_FILE_NOT_FOUND)
+    {
+        if (ret != ERROR_SUCCESS)
+            return ret;
+        else if (type != REG_SZ)
+            return ERROR_REGISTRY_CORRUPT;
+        *len += count;
+    }
     if (credential)
     {
         credential->TargetAlias = (LPWSTR)buffer;
@@ -150,11 +159,14 @@
     }
 
     ret = RegQueryValueExW(hkey, wszUserNameValue, 0, &type, NULL, &count);
-    if (ret != ERROR_FILE_NOT_FOUND && ret != ERROR_SUCCESS)
-        return ret;
-    else if (type != REG_SZ)
-        return ERROR_REGISTRY_CORRUPT;
-    *len += count;
+    if (ret != ERROR_FILE_NOT_FOUND)
+    {
+        if (ret != ERROR_SUCCESS)
+            return ret;
+        else if (type != REG_SZ)
+            return ERROR_REGISTRY_CORRUPT;
+        *len += count;
+    }
     if (credential)
     {
         credential->UserName = (LPWSTR)buffer;
@@ -171,9 +183,12 @@
     }
 
     ret = read_credential_blob(hkey, key_data, NULL, &count);
-    if (ret != ERROR_FILE_NOT_FOUND && ret != ERROR_SUCCESS)
-        return ret;
-    *len += count;
+    if (ret != ERROR_FILE_NOT_FOUND)
+    {
+        if (ret != ERROR_SUCCESS)
+            return ret;
+        *len += count;
+    }
     if (credential)
     {
         credential->CredentialBlob = (LPBYTE)buffer;




More information about the Ros-diffs mailing list