Commit 0bb1c564 authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

shell32: Use list of allowed PIDL types rather than assuming there are no more than two.

parent dfdf2be7
...@@ -74,9 +74,9 @@ ...@@ -74,9 +74,9 @@
static GUID CLSID_CommonDocuments = { 0x0000000c, 0x0000, 0x0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x1a } }; static GUID CLSID_CommonDocuments = { 0x0000000c, 0x0000, 0x0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x1a } };
struct shellExpectedValues { struct shellExpectedValues {
int folder; int folder;
BYTE pidlType; int numTypes;
BYTE altPidlType; const BYTE *types;
}; };
static HRESULT (WINAPI *pDllGetVersion)(DLLVERSIONINFO *); static HRESULT (WINAPI *pDllGetVersion)(DLLVERSIONINFO *);
...@@ -90,75 +90,83 @@ static int (WINAPI *pSHFileOperationA)(LPSHFILEOPSTRUCTA); ...@@ -90,75 +90,83 @@ static int (WINAPI *pSHFileOperationA)(LPSHFILEOPSTRUCTA);
static HRESULT (WINAPI *pSHGetMalloc)(LPMALLOC *); static HRESULT (WINAPI *pSHGetMalloc)(LPMALLOC *);
static DLLVERSIONINFO shellVersion = { 0 }; static DLLVERSIONINFO shellVersion = { 0 };
static LPMALLOC pMalloc; static LPMALLOC pMalloc;
static const BYTE guidType[] = { PT_GUID };
static const BYTE controlPanelType[] = { PT_SHELLEXT, PT_GUID };
static const BYTE folderType[] = { PT_FOLDER };
static const BYTE favoritesType[] = { PT_FOLDER, 0 };
static const BYTE folderOrSpecialType[] = { PT_FOLDER, PT_IESPECIAL2 };
/* FIXME: don't know the type of 0x71 returned by Vista/2008 for printers */
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 };
#define DECLARE_TYPE(x, y) { x, sizeof(y) / sizeof(y[0]), y }
static const struct shellExpectedValues requiredShellValues[] = { static const struct shellExpectedValues requiredShellValues[] = {
{ CSIDL_BITBUCKET, PT_GUID, 0 }, DECLARE_TYPE(CSIDL_BITBUCKET, guidType),
{ CSIDL_CONTROLS, PT_SHELLEXT, PT_GUID }, DECLARE_TYPE(CSIDL_CONTROLS, controlPanelType),
{ CSIDL_COOKIES, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_COOKIES, folderType),
{ CSIDL_DESKTOPDIRECTORY, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_DESKTOPDIRECTORY, folderType),
{ CSIDL_DRIVES, PT_GUID, 0 }, DECLARE_TYPE(CSIDL_DRIVES, guidType),
/* Note that 0 is an expected type for CSIDL_FAVORITES. Inverting the order DECLARE_TYPE(CSIDL_FAVORITES, favoritesType),
* will cause the test to fail, as it'll only check for PT_FOLDER. DECLARE_TYPE(CSIDL_FONTS, folderOrSpecialType),
*/
{ CSIDL_FAVORITES, 0, PT_FOLDER },
{ CSIDL_FONTS, PT_FOLDER, PT_IESPECIAL2 },
/* FIXME: the following fails in Wine, returns type PT_FOLDER /* FIXME: the following fails in Wine, returns type PT_FOLDER
{ CSIDL_HISTORY, PT_IESPECIAL2, 0 }, DECLARE_TYPE(CSIDL_HISTORY, ieSpecialType),
*/ */
{ CSIDL_INTERNET, PT_GUID, 0 }, DECLARE_TYPE(CSIDL_INTERNET, guidType),
{ CSIDL_NETHOOD, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_NETHOOD, folderType),
{ CSIDL_NETWORK, PT_GUID, 0 }, DECLARE_TYPE(CSIDL_NETWORK, guidType),
/* FIXME: don't know the type of 0x71 returned by Vista/2008 for printers */ DECLARE_TYPE(CSIDL_PRINTERS, printersType),
{ CSIDL_PRINTERS, PT_YAGUID, 0x71 }, DECLARE_TYPE(CSIDL_PRINTHOOD, folderType),
{ CSIDL_PRINTHOOD, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_PROGRAMS, folderType),
{ CSIDL_PROGRAMS, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_RECENT, folderOrSpecialType),
{ CSIDL_RECENT, PT_FOLDER, PT_IESPECIAL2 }, DECLARE_TYPE(CSIDL_SENDTO, folderType),
{ CSIDL_SENDTO, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_STARTMENU, folderType),
{ CSIDL_STARTMENU, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_STARTUP, folderType),
{ CSIDL_STARTUP, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_TEMPLATES, folderType),
{ CSIDL_TEMPLATES, PT_FOLDER, 0 },
}; };
static const struct shellExpectedValues optionalShellValues[] = { static const struct shellExpectedValues optionalShellValues[] = {
/* FIXME: the following only semi-succeed; they return NULL PIDLs on XP.. hmm. /* FIXME: the following only semi-succeed; they return NULL PIDLs on XP.. hmm.
{ CSIDL_ALTSTARTUP, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_ALTSTARTUP, folderType),
{ CSIDL_COMMON_ALTSTARTUP, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_COMMON_ALTSTARTUP, folderType),
{ CSIDL_COMMON_OEM_LINKS, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_COMMON_OEM_LINKS, folderType),
*/ */
/* Windows NT-only: */ /* Windows NT-only: */
{ CSIDL_COMMON_DESKTOPDIRECTORY, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_COMMON_DESKTOPDIRECTORY, folderType),
{ CSIDL_COMMON_DOCUMENTS, PT_SHELLEXT, 0 }, DECLARE_TYPE(CSIDL_COMMON_DOCUMENTS, shellExtType),
{ CSIDL_COMMON_FAVORITES, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_COMMON_FAVORITES, folderType),
{ CSIDL_COMMON_PROGRAMS, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_COMMON_PROGRAMS, folderType),
{ CSIDL_COMMON_STARTMENU, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_COMMON_STARTMENU, folderType),
{ CSIDL_COMMON_STARTUP, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_COMMON_STARTUP, folderType),
{ CSIDL_COMMON_TEMPLATES, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_COMMON_TEMPLATES, folderType),
/* first appearing in shell32 version 4.71: */ /* first appearing in shell32 version 4.71: */
{ CSIDL_APPDATA, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_APPDATA, folderType),
/* first appearing in shell32 version 4.72: */ /* first appearing in shell32 version 4.72: */
{ CSIDL_INTERNET_CACHE, PT_IESPECIAL2, 0 }, DECLARE_TYPE(CSIDL_INTERNET_CACHE, ieSpecialType),
/* first appearing in shell32 version 5.0: */ /* first appearing in shell32 version 5.0: */
{ CSIDL_ADMINTOOLS, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_ADMINTOOLS, folderType),
{ CSIDL_COMMON_APPDATA, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_COMMON_APPDATA, folderType),
{ CSIDL_LOCAL_APPDATA, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_LOCAL_APPDATA, folderType),
{ OLD_CSIDL_MYDOCUMENTS, PT_FOLDER, 0 }, DECLARE_TYPE(OLD_CSIDL_MYDOCUMENTS, folderType),
{ CSIDL_MYMUSIC, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_MYMUSIC, folderType),
{ CSIDL_MYPICTURES, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_MYPICTURES, folderType),
{ CSIDL_MYVIDEO, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_MYVIDEO, folderType),
{ CSIDL_PROFILE, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_PROFILE, folderType),
{ CSIDL_PROGRAM_FILES, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_PROGRAM_FILES, folderType),
{ CSIDL_PROGRAM_FILESX86, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_PROGRAM_FILESX86, folderType),
{ CSIDL_PROGRAM_FILES_COMMON, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_PROGRAM_FILES_COMMON, folderType),
{ CSIDL_PROGRAM_FILES_COMMONX86, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_PROGRAM_FILES_COMMONX86, folderType),
{ CSIDL_SYSTEM, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_SYSTEM, folderType),
{ CSIDL_WINDOWS, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_WINDOWS, folderType),
/* first appearing in shell32 6.0: */ /* first appearing in shell32 6.0: */
{ CSIDL_CDBURN_AREA, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_CDBURN_AREA, folderType),
{ CSIDL_COMMON_MUSIC, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_COMMON_MUSIC, folderType),
{ CSIDL_COMMON_PICTURES, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_COMMON_PICTURES, folderType),
{ CSIDL_COMMON_VIDEO, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_COMMON_VIDEO, folderType),
{ CSIDL_COMPUTERSNEARME, PT_WORKGRP, 0 }, DECLARE_TYPE(CSIDL_COMPUTERSNEARME, workgroupType),
{ CSIDL_RESOURCES, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_RESOURCES, folderType),
{ CSIDL_RESOURCES_LOCALIZED, PT_FOLDER, 0 }, DECLARE_TYPE(CSIDL_RESOURCES_LOCALIZED, folderType),
}; };
#undef DECLARE_TYPE
static void loadShell32(void) static void loadShell32(void)
{ {
...@@ -476,40 +484,27 @@ static void testShellValues(const struct shellExpectedValues testEntries[], ...@@ -476,40 +484,27 @@ static void testShellValues(const struct shellExpectedValues testEntries[],
for (i = 0; i < numEntries; i++) for (i = 0; i < numEntries; i++)
{ {
BYTE type; BYTE type;
int j;
BOOL foundTypeMatch = FALSE;
if (pSHGetFolderLocation) if (pSHGetFolderLocation)
{ {
type = testSHGetFolderLocation(optional, testEntries[i].folder); type = testSHGetFolderLocation(optional, testEntries[i].folder);
if (!testEntries[i].altPidlType) for (j = 0; !foundTypeMatch && j < testEntries[i].numTypes; j++)
ok(type == testEntries[i].pidlType || optional || if (testEntries[i].types[j] == type)
broken(type == 0xff) /* Win9x */, foundTypeMatch = TRUE;
"%s has type %d (0x%02x), expected %d (0x%02x)\n", ok(foundTypeMatch || optional || broken(type == 0xff) /* Win9x */,
getFolderName(testEntries[i].folder), type, type, "%s has unexpected type %d (0x%02x)\n",
testEntries[i].pidlType, testEntries[i].pidlType); getFolderName(testEntries[i].folder), type, type);
else
ok(type == testEntries[i].pidlType ||
type == testEntries[i].altPidlType ||
optional || broken(type == 0xff) /* Win9x */,
"%s has type %d (0x%02x), expected %d (0x%02x) or %d (0x%02x)\n",
getFolderName(testEntries[i].folder), type, type,
testEntries[i].pidlType, testEntries[i].pidlType,
testEntries[i].altPidlType, testEntries[i].altPidlType);
} }
type = testSHGetSpecialFolderLocation(optional, testEntries[i].folder); type = testSHGetSpecialFolderLocation(optional, testEntries[i].folder);
if (!testEntries[i].altPidlType) for (j = 0, foundTypeMatch = FALSE; !foundTypeMatch &&
ok(type == testEntries[i].pidlType || optional || j < testEntries[i].numTypes; j++)
broken(type == 0xff) /* Win9x */, if (testEntries[i].types[j] == type)
"%s has type %d (0x%02x), expected %d (0x%02x)\n", foundTypeMatch = TRUE;
getFolderName(testEntries[i].folder), type, type, ok(foundTypeMatch || optional || broken(type == 0xff) /* Win9x */,
testEntries[i].pidlType, testEntries[i].pidlType); "%s has unexpected type %d (0x%02x)\n",
else getFolderName(testEntries[i].folder), type, type);
ok(type == testEntries[i].pidlType ||
type == testEntries[i].altPidlType ||
optional || broken(type == 0xff) /* Win9x */,
"%s has type %d (0x%02x), expected %d (0x%02x) or %d (0x%02x)\n",
getFolderName(testEntries[i].folder), type, type,
testEntries[i].pidlType, testEntries[i].pidlType,
testEntries[i].altPidlType, testEntries[i].altPidlType);
switch (type) switch (type)
{ {
case PT_FOLDER: case PT_FOLDER:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment