Sync to Wine-0_9_3:
[reactos.git] / reactos / lib / oleaut32 / vartype.c
index 2075827..1214752 100644 (file)
@@ -6599,23 +6599,21 @@ HRESULT WINAPI VarBstrCat(BSTR pbstrLeft, BSTR pbstrRight, BSTR *pbstrOut)
  * RETURNS
  *  VARCMP_LT, VARCMP_EQ or VARCMP_GT indicating that pbstrLeft is less
  *  than, equal to or greater than pbstrRight respectively.
  * RETURNS
  *  VARCMP_LT, VARCMP_EQ or VARCMP_GT indicating that pbstrLeft is less
  *  than, equal to or greater than pbstrRight respectively.
- *  VARCMP_NULL is returned if either string is NULL, unless both are NULL
- *  in which case VARCMP_EQ is returned.
+ *
+ * NOTES
+ *  VARCMP_NULL is NOT returned if either string is NULL unlike MSDN
+ *  states. A NULL BSTR pointer is equivalent to an empty string.
  */
 HRESULT WINAPI VarBstrCmp(BSTR pbstrLeft, BSTR pbstrRight, LCID lcid, DWORD dwFlags)
 {
  */
 HRESULT WINAPI VarBstrCmp(BSTR pbstrLeft, BSTR pbstrRight, LCID lcid, DWORD dwFlags)
 {
-    if (!pbstrLeft)
+    if (!pbstrLeft || !*pbstrLeft)
     {
       if (!pbstrRight || !*pbstrRight)
         return VARCMP_EQ;
     {
       if (!pbstrRight || !*pbstrRight)
         return VARCMP_EQ;
-      return VARCMP_NULL;
-    }
-    else if (!pbstrRight)
-    {
-      if (!*pbstrLeft)
-        return VARCMP_EQ;
-      return VARCMP_NULL;
+      return VARCMP_LT;
     }
     }
+    else if (!pbstrRight || !*pbstrRight)
+        return VARCMP_GT;
 
     return CompareStringW(lcid, dwFlags, pbstrLeft, -1, pbstrRight, -1) - 1;
 }
 
     return CompareStringW(lcid, dwFlags, pbstrLeft, -1, pbstrRight, -1) - 1;
 }