Commit 0b175293 authored by Martin Fuchs's avatar Martin Fuchs Committed by Alexandre Julliard

Correctly call HCR_GetFolderAttributes() in SHELL32_GetItemAttributes().

Directly return the correct "My Computer" attributes in ISF_Desktop_fnGetAttributesOf(). Remove "todo_wine" from the "My Computer" attributes test case. Add test case for retrieving the file system path from the CSIDL_PROGRAM_FILES PIDL using SHGetPathFromIDListW().
parent 53bd3eec
......@@ -431,6 +431,9 @@ static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf (IShellFolder2 * iface,
static const DWORD dwDesktopAttributes =
SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR |
SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER;
static const DWORD dwMyComputerAttributes =
SFGAO_CANRENAME | SFGAO_CANDELETE | SFGAO_HASPROPSHEET |
SFGAO_DROPTARGET | SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08lx))\n",
This, cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0);
......@@ -450,6 +453,8 @@ static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf (IShellFolder2 * iface,
pdump (*apidl);
if (_ILIsDesktop(*apidl)) {
*rgfInOut &= dwDesktopAttributes;
} else if (_ILIsMyComputer(*apidl)) {
*rgfInOut &= dwMyComputerAttributes;
} else {
SHELL32_GetItemAttributes (_IShellFolder_ (This), *apidl, rgfInOut);
}
......
......@@ -408,14 +408,13 @@ HRESULT SHELL32_GetItemAttributes (IShellFolder * psf, LPCITEMIDLIST pidl, LPDWO
*pdwAttributes &= dwSupportedAttr;
}
dwAttributes = *pdwAttributes;
if (_ILIsDrive (pidl)) {
*pdwAttributes &= SFGAO_HASSUBFOLDER|SFGAO_FILESYSTEM|SFGAO_FOLDER|SFGAO_FILESYSANCESTOR|
SFGAO_DROPTARGET|SFGAO_HASPROPSHEET|SFGAO_CANLINK;
} else if (_ILGetGUIDPointer (pidl)) {
if (!HCR_GetFolderAttributes (pidl, pdwAttributes)) {
*pdwAttributes &= SFGAO_HASSUBFOLDER|SFGAO_FOLDER|SFGAO_FILESYSANCESTOR|
SFGAO_DROPTARGET|SFGAO_HASPROPSHEET|SFGAO_CANRENAME|SFGAO_CANLINK;
}
} else if (_ILGetGUIDPointer (pidl) && HCR_GetFolderAttributes(pidl, &dwAttributes)) {
*pdwAttributes = dwAttributes;
} else if (_ILGetDataPointer (pidl)) {
dwAttributes = _ILGetFileAttributes (pidl, NULL, 0);
......
......@@ -602,8 +602,8 @@ static void test_GetAttributesOf(void)
dwFlags = 0xffffffff;
hr = IShellFolder_GetAttributesOf(psfDesktop, 1, (LPCITEMIDLIST*)&pidlMyComputer, &dwFlags);
ok (SUCCEEDED(hr), "Desktop->GetAttributesOf(MyComputer) failed! hr = %08lx\n", hr);
todo_wine { ok ((dwFlags & ~(DWORD)SFGAO_CANLINK) == dwMyComputerFlags,
"Wrong MyComputer attributes: %08lx, expected: %08lx\n", dwFlags, dwMyComputerFlags); }
ok ((dwFlags & ~(DWORD)SFGAO_CANLINK) == dwMyComputerFlags,
"Wrong MyComputer attributes: %08lx, expected: %08lx\n", dwFlags, dwMyComputerFlags);
hr = IShellFolder_BindToObject(psfDesktop, pidlMyComputer, NULL, &IID_IShellFolder, (LPVOID*)&psfMyComputer);
ok (SUCCEEDED(hr), "Desktop failed to bind to MyComputer object! hr = %08lx\n", hr);
......@@ -641,6 +641,9 @@ static void test_SHGetPathFromIDList(void)
STRRET strret;
static WCHAR wszTestFile[] = {
'w','i','n','e','t','e','s','t','.','f','o','o',0 };
HRESULT (WINAPI *pSHGetSpecialFolderLocation)(HWND, int, LPITEMIDLIST *);
HMODULE hShell32;
LPITEMIDLIST pidlPrograms;
if(!pSHGetSpecialFolderPathW) return;
......@@ -725,6 +728,19 @@ static void test_SHGetPathFromIDList(void)
IMalloc_Free(ppM, pidlTestFile);
if (!result) return;
ok(0 == lstrcmpW(wszFileName, wszPath), "SHGetPathFromIDListW returned incorrect path for file placed on desktop\n");
/* Test if we can get the path from the start menu "program files" PIDL. */
hShell32 = GetModuleHandleA("shell32");
pSHGetSpecialFolderLocation = (HRESULT(WINAPI*)(HWND,int,LPITEMIDLIST*))GetProcAddress(hShell32, "SHGetSpecialFolderLocation");
hr = pSHGetSpecialFolderLocation(NULL, CSIDL_PROGRAM_FILES, &pidlPrograms);
ok(SUCCEEDED(hr), "SHGetFolderLocation failed: 0x%08lx\n", hr);
SetLastError(0xdeadbeef);
result = SHGetPathFromIDListW(pidlPrograms, wszPath);
IMalloc_Free(ppM, pidlPrograms);
ok(result, "SHGetPathFromIDList failed\n");
}
static void test_EnumObjects_and_CompareIDs(void)
......
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