wine/dlls/shell32 tests/shlfolder.c shlfolder. ...
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Nov 3 03:56:07 CST 2005
ChangeSet ID: 21075
CVSROOT: /opt/cvs-commit
Module name: wine
Changes by: julliard at winehq.org 2005/11/03 03:56:07
Modified files:
dlls/shell32/tests: shlfolder.c
dlls/shell32 : shlfolder.c shfldr_unixfs.c
Log message:
Vitaliy Margolen <wine-patch at kievinfo.com>
Michael Jung <mjung at iss.tu-darmstadt.de>
Set all capability flags supported by the shellfolder, disregarding
the flag mask given to GetAttributesOf.
Unit tests to demonstrate this behaviour.
Patch: http://cvs.winehq.org/patch.py?id=21075
Old revision New revision Changes Path
1.39 1.40 +17 -9 wine/dlls/shell32/tests/shlfolder.c
1.105 1.106 +15 -8 wine/dlls/shell32/shlfolder.c
1.57 1.58 +5 -5 wine/dlls/shell32/shfldr_unixfs.c
Index: wine/dlls/shell32/tests/shlfolder.c
diff -u -p wine/dlls/shell32/tests/shlfolder.c:1.39 wine/dlls/shell32/tests/shlfolder.c:1.40
--- wine/dlls/shell32/tests/shlfolder.c:1.39 3 Nov 2005 9:56: 7 -0000
+++ wine/dlls/shell32/tests/shlfolder.c 3 Nov 2005 9:56: 7 -0000
@@ -163,14 +163,15 @@ static void test_EnumObjects(IShellFolde
{ 1, 1, 1, 1, 0}
};
- /* Just test SFGAO_FILESYSTEM | SFGAO_FOLDER | SFGAO_FILESYSANCESTOR for now */
+#define SFGAO_testfor SFGAO_FILESYSTEM | SFGAO_FOLDER | SFGAO_FILESYSANCESTOR | SFGAO_CAPABILITYMASK
+ /* Don't test for SFGAO_HASSUBFOLDER since we return real state and native cached */
static const ULONG attrs[5] =
{
- SFGAO_FILESYSTEM | SFGAO_FOLDER | SFGAO_FILESYSANCESTOR,
- SFGAO_FILESYSTEM | SFGAO_FOLDER | SFGAO_FILESYSANCESTOR,
- SFGAO_FILESYSTEM,
- SFGAO_FILESYSTEM,
- SFGAO_FILESYSTEM,
+ SFGAO_CAPABILITYMASK | SFGAO_FILESYSTEM | SFGAO_FOLDER | SFGAO_FILESYSANCESTOR,
+ SFGAO_CAPABILITYMASK | SFGAO_FILESYSTEM | SFGAO_FOLDER | SFGAO_FILESYSANCESTOR,
+ SFGAO_CAPABILITYMASK | SFGAO_FILESYSTEM,
+ SFGAO_CAPABILITYMASK | SFGAO_FILESYSTEM,
+ SFGAO_CAPABILITYMASK | SFGAO_FILESYSTEM,
};
hr = IShellFolder_EnumObjects(iFolder, NULL, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN, &iEnumList);
@@ -206,11 +207,18 @@ static void test_EnumObjects(IShellFolde
for (i = 0; i < 5; i++)
{
SFGAOF flags;
- flags = SFGAO_FILESYSTEM | SFGAO_FOLDER | SFGAO_FILESYSANCESTOR;
+ /* Native returns all flags no matter what we ask for */
+ flags = SFGAO_CANCOPY;
hr = IShellFolder_GetAttributesOf(iFolder, 1, (LPCITEMIDLIST*)(idlArr + i), &flags);
- flags &= SFGAO_FILESYSTEM | SFGAO_FOLDER | SFGAO_FILESYSANCESTOR;
+ flags &= SFGAO_testfor;
ok(hr == S_OK, "GetAttributesOf returns %08lx\n", hr);
- ok(flags == attrs[i], "GetAttributesOf gets attrs %08lx, expects %08lx\n", flags, attrs[i]);
+ ok(flags == (attrs[i]), "GetAttributesOf[%i] got %08lx, expected %08lx\n", i, flags, attrs[i]);
+
+ flags = SFGAO_testfor;
+ hr = IShellFolder_GetAttributesOf(iFolder, 1, (LPCITEMIDLIST*)(idlArr + i), &flags);
+ flags &= SFGAO_testfor;
+ ok(hr == S_OK, "GetAttributesOf returns %08lx\n", hr);
+ ok(flags == attrs[i], "GetAttributesOf[%i] got %08lx, expected %08lx\n", i, flags, attrs[i]);
}
for (i=0;i<5;i++)
Index: wine/dlls/shell32/shlfolder.c
diff -u -p wine/dlls/shell32/shlfolder.c:1.105 wine/dlls/shell32/shlfolder.c:1.106
--- wine/dlls/shell32/shlfolder.c:1.105 3 Nov 2005 9:56: 7 -0000
+++ wine/dlls/shell32/shlfolder.c 3 Nov 2005 9:56: 7 -0000
@@ -419,16 +419,23 @@ HRESULT SHELL32_GetItemAttributes (IShel
} else if (_ILGetDataPointer (pidl)) {
dwAttributes = _ILGetFileAttributes (pidl, NULL, 0);
- if ((SFGAO_FILESYSANCESTOR & *pdwAttributes) && !(dwAttributes & FILE_ATTRIBUTE_DIRECTORY))
- *pdwAttributes &= ~SFGAO_FILESYSANCESTOR;
-
- if ((SFGAO_FOLDER & *pdwAttributes) && !(dwAttributes & FILE_ATTRIBUTE_DIRECTORY))
- *pdwAttributes &= ~(SFGAO_FOLDER | SFGAO_HASSUBFOLDER);
-
- if ((SFGAO_HIDDEN & *pdwAttributes) && !(dwAttributes & FILE_ATTRIBUTE_HIDDEN))
+ /* Set common attributes */
+ *pdwAttributes |= SFGAO_FILESYSTEM | SFGAO_DROPTARGET | SFGAO_HASPROPSHEET | SFGAO_CANDELETE |
+ SFGAO_CANRENAME | SFGAO_CANLINK | SFGAO_CANMOVE | SFGAO_CANCOPY;
+
+ if (dwAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ *pdwAttributes |= (SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSANCESTOR);
+ else
+ *pdwAttributes &= ~(SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSANCESTOR);
+
+ if (dwAttributes & FILE_ATTRIBUTE_HIDDEN)
+ *pdwAttributes |= SFGAO_HIDDEN;
+ else
*pdwAttributes &= ~SFGAO_HIDDEN;
- if ((SFGAO_READONLY & *pdwAttributes) && !(dwAttributes & FILE_ATTRIBUTE_READONLY))
+ if (dwAttributes & FILE_ATTRIBUTE_READONLY)
+ *pdwAttributes |= SFGAO_READONLY;
+ else
*pdwAttributes &= ~SFGAO_READONLY;
if (SFGAO_LINK & *pdwAttributes) {
Index: wine/dlls/shell32/shfldr_unixfs.c
diff -u -p wine/dlls/shell32/shfldr_unixfs.c:1.57 wine/dlls/shell32/shfldr_unixfs.c:1.58
--- wine/dlls/shell32/shfldr_unixfs.c:1.57 3 Nov 2005 9:56: 7 -0000
+++ wine/dlls/shell32/shfldr_unixfs.c 3 Nov 2005 9:56: 7 -0000
@@ -828,12 +828,12 @@ static HRESULT WINAPI UnixFolder_IShellF
char szAbsolutePath[FILENAME_MAX], *pszRelativePath;
UINT i;
- *rgfInOut &= SFGAO_FOLDER|SFGAO_HASSUBFOLDER|SFGAO_FILESYSANCESTOR|SFGAO_CANRENAME|
- SFGAO_FILESYSTEM;
+ *rgfInOut = SFGAO_CANCOPY|SFGAO_CANMOVE|SFGAO_CANLINK|SFGAO_CANRENAME|SFGAO_CANDELETE|
+ SFGAO_HASPROPSHEET|SFGAO_DROPTARGET|SFGAO_FILESYSTEM;
lstrcpyA(szAbsolutePath, This->m_pszPath);
pszRelativePath = szAbsolutePath + lstrlenA(szAbsolutePath);
for (i=0; i<cidl; i++) {
- if ((*rgfInOut & SFGAO_FILESYSTEM) && !(This->m_dwAttributes & SFGAO_FILESYSTEM)) {
+ if (!(This->m_dwAttributes & SFGAO_FILESYSTEM)) {
struct stat fileStat;
char *pszName = _ILGetTextPointer(apidl[i]);
if (!pszName) return E_INVALIDARG;
@@ -841,8 +841,8 @@ static HRESULT WINAPI UnixFolder_IShellF
if (stat(szAbsolutePath, &fileStat) || !UNIXFS_is_dos_device(&fileStat))
*rgfInOut &= ~SFGAO_FILESYSTEM;
}
- if (!_ILIsFolder(apidl[i]))
- *rgfInOut &= ~(SFGAO_FOLDER|SFGAO_HASSUBFOLDER|SFGAO_FILESYSANCESTOR);
+ if (_ILIsFolder(apidl[i]))
+ *rgfInOut |= SFGAO_FOLDER|SFGAO_HASSUBFOLDER|SFGAO_FILESYSANCESTOR;
}
}
More information about the wine-cvs
mailing list