shell32: Fix unused knownfolder definition.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51425
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Andrew Eikum 2021-07-08 10:10:43 -05:00 committed by Alexandre Julliard
parent 8b982a1955
commit c99a406b71
2 changed files with 39 additions and 17 deletions

View File

@ -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,

View File

@ -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,20 +1487,25 @@ 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);
if (expect != ShellValuesTestExpect_Missing)
{
switch (type)
{
case PT_FOLDER:
case PT_DRIVE:
case PT_DRIVE2:
case PT_IESPECIAL2:
test_SHGetFolderPath(optional, testEntries[i].folder);
test_SHGetSpecialFolderPath(optional, testEntries[i].folder);
test_SHGetFolderPath(expect == ShellValuesTestExpect_Optional, testEntries[i].folder);
test_SHGetSpecialFolderPath(expect == ShellValuesTestExpect_Optional, testEntries[i].folder);
break;
}
}
}
}
/* Attempts to verify that the folder path corresponding to the folder CSIDL
@ -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 */