Andrew Eikum : shell32: Fix unused knownfolder definition.

Alexandre Julliard julliard at winehq.org
Thu Jul 8 16:43:51 CDT 2021


Module: wine
Branch: master
Commit: c99a406b716f90d9746a528b517eac7ad8dd3296
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=c99a406b716f90d9746a528b517eac7ad8dd3296

Author: Andrew Eikum <aeikum at codeweavers.com>
Date:   Thu Jul  8 10:10:43 2021 -0500

shell32: Fix unused knownfolder definition.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51425
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/shell32/shellpath.c       |  4 ++--
 dlls/shell32/tests/shellpath.c | 52 ++++++++++++++++++++++++++++++------------
 2 files changed, 39 insertions(+), 17 deletions(-)

diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c
index 005e905baaa..2ffd608f645 100644
--- a/dlls/shell32/shellpath.c
+++ b/dlls/shell32/shellpath.c
@@ -2445,9 +2445,9 @@ static const CSIDL_DATA CSIDL_Data[] =
     },
     { /* 0x45 */
         &GUID_NULL,
-        CSIDL_Type_User,
+        CSIDL_Type_Disallowed,
+        NULL,
         NULL,
-        DocumentsW
     },
     { /* 0x46 */
         &FOLDERID_DocumentsLibrary,
diff --git a/dlls/shell32/tests/shellpath.c b/dlls/shell32/tests/shellpath.c
index df9d4ecc949..0ba3734c518 100644
--- a/dlls/shell32/tests/shellpath.c
+++ b/dlls/shell32/tests/shellpath.c
@@ -111,6 +111,7 @@ static const BYTE printersType[] = { PT_YAGUID, PT_SHELLEXT, 0x71 };
 static const BYTE ieSpecialType[] = { PT_IESPECIAL2 };
 static const BYTE shellExtType[] = { PT_SHELLEXT };
 static const BYTE workgroupType[] = { PT_WORKGRP };
+static const BYTE missingType[] = { 0xff };
 #define DECLARE_TYPE(x, y) { x, ARRAY_SIZE(y), y }
 static const struct shellExpectedValues requiredShellValues[] = {
  DECLARE_TYPE(CSIDL_BITBUCKET, guidType),
@@ -178,6 +179,14 @@ static const struct shellExpectedValues optionalShellValues[] = {
  DECLARE_TYPE(CSIDL_RESOURCES, folderType),
  DECLARE_TYPE(CSIDL_RESOURCES_LOCALIZED, folderType),
 };
+static const struct shellExpectedValues undefinedShellValues[] = {
+ DECLARE_TYPE(0x0f, missingType),
+ DECLARE_TYPE(0x32, missingType),
+ DECLARE_TYPE(0x33, missingType),
+ DECLARE_TYPE(0x34, missingType),
+ DECLARE_TYPE(0x3c, missingType),
+ DECLARE_TYPE(0x45, missingType),
+};
 #undef DECLARE_TYPE
 
 static void loadShell32(void)
@@ -1399,8 +1408,7 @@ static BYTE testSHGetSpecialFolderLocation(int folder)
     HRESULT hr;
     BYTE ret = 0xff;
 
-    /* treat absence of function as success */
-    if (!pSHGetSpecialFolderLocation) return TRUE;
+    if (!pSHGetSpecialFolderLocation) return ret;
 
     pidl = NULL;
     hr = pSHGetSpecialFolderLocation(NULL, folder, &pidl);
@@ -1447,8 +1455,14 @@ static void test_SHGetSpecialFolderPath(BOOL optional, int folder)
      getFolderName(folder));
 }
 
+enum ShellValuesTestExpect {
+    ShellValuesTestExpect_Required,
+    ShellValuesTestExpect_Optional,
+    ShellValuesTestExpect_Missing,
+};
+
 static void test_ShellValues(const struct shellExpectedValues testEntries[],
- int numEntries, BOOL optional)
+ int numEntries, enum ShellValuesTestExpect expect)
 {
     int i;
 
@@ -1462,7 +1476,9 @@ static void test_ShellValues(const struct shellExpectedValues testEntries[],
         for (j = 0; !foundTypeMatch && j < testEntries[i].numTypes; j++)
             if (testEntries[i].types[j] == type)
                 foundTypeMatch = TRUE;
-        ok(foundTypeMatch || optional || broken(type == 0xff) /* Win9x */,
+        ok((expect == ShellValuesTestExpect_Required && foundTypeMatch) ||
+                (expect == ShellValuesTestExpect_Optional) ||
+                (expect == ShellValuesTestExpect_Missing && type == 0xff),
          "%s has unexpected type %d (0x%02x)\n",
          getFolderName(testEntries[i].folder), type, type);
 
@@ -1471,18 +1487,23 @@ static void test_ShellValues(const struct shellExpectedValues testEntries[],
          j < testEntries[i].numTypes; j++)
             if (testEntries[i].types[j] == type)
                 foundTypeMatch = TRUE;
-        ok(foundTypeMatch || optional || broken(type == 0xff) /* Win9x */,
+        ok((expect == ShellValuesTestExpect_Required && foundTypeMatch) ||
+                (expect == ShellValuesTestExpect_Optional) ||
+                (expect == ShellValuesTestExpect_Missing && type == 0xff),
          "%s has unexpected type %d (0x%02x)\n",
          getFolderName(testEntries[i].folder), type, type);
-        switch (type)
+        if (expect != ShellValuesTestExpect_Missing)
         {
-            case PT_FOLDER:
-            case PT_DRIVE:
-            case PT_DRIVE2:
-            case PT_IESPECIAL2:
-                test_SHGetFolderPath(optional, testEntries[i].folder);
-                test_SHGetSpecialFolderPath(optional, testEntries[i].folder);
-                break;
+            switch (type)
+            {
+                case PT_FOLDER:
+                case PT_DRIVE:
+                case PT_DRIVE2:
+                case PT_IESPECIAL2:
+                    test_SHGetFolderPath(expect == ShellValuesTestExpect_Optional, testEntries[i].folder);
+                    test_SHGetSpecialFolderPath(expect == ShellValuesTestExpect_Optional, testEntries[i].folder);
+                    break;
+            }
         }
     }
 }
@@ -1555,8 +1576,9 @@ static void test_PidlTypes(void)
     test_SHGetFolderPath(FALSE, CSIDL_DESKTOP);
     test_SHGetSpecialFolderPath(FALSE, CSIDL_DESKTOP);
 
-    test_ShellValues(requiredShellValues, ARRAY_SIZE(requiredShellValues), FALSE);
-    test_ShellValues(optionalShellValues, ARRAY_SIZE(optionalShellValues), TRUE);
+    test_ShellValues(requiredShellValues, ARRAY_SIZE(requiredShellValues), ShellValuesTestExpect_Required);
+    test_ShellValues(optionalShellValues, ARRAY_SIZE(optionalShellValues), ShellValuesTestExpect_Optional);
+    test_ShellValues(undefinedShellValues, ARRAY_SIZE(undefinedShellValues), ShellValuesTestExpect_Missing);
 }
 
 /* FIXME: Should be in shobjidl.idl */




More information about the wine-cvs mailing list