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().
This commit is contained in:
parent
53bd3eecec
commit
0b17529332
|
@ -431,6 +431,9 @@ static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf (IShellFolder2 * iface,
|
||||||
static const DWORD dwDesktopAttributes =
|
static const DWORD dwDesktopAttributes =
|
||||||
SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR |
|
SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR |
|
||||||
SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER;
|
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",
|
TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08lx))\n",
|
||||||
This, cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0);
|
This, cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0);
|
||||||
|
@ -450,6 +453,8 @@ static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf (IShellFolder2 * iface,
|
||||||
pdump (*apidl);
|
pdump (*apidl);
|
||||||
if (_ILIsDesktop(*apidl)) {
|
if (_ILIsDesktop(*apidl)) {
|
||||||
*rgfInOut &= dwDesktopAttributes;
|
*rgfInOut &= dwDesktopAttributes;
|
||||||
|
} else if (_ILIsMyComputer(*apidl)) {
|
||||||
|
*rgfInOut &= dwMyComputerAttributes;
|
||||||
} else {
|
} else {
|
||||||
SHELL32_GetItemAttributes (_IShellFolder_ (This), *apidl, rgfInOut);
|
SHELL32_GetItemAttributes (_IShellFolder_ (This), *apidl, rgfInOut);
|
||||||
}
|
}
|
||||||
|
|
|
@ -408,14 +408,13 @@ HRESULT SHELL32_GetItemAttributes (IShellFolder * psf, LPCITEMIDLIST pidl, LPDWO
|
||||||
*pdwAttributes &= dwSupportedAttr;
|
*pdwAttributes &= dwSupportedAttr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dwAttributes = *pdwAttributes;
|
||||||
|
|
||||||
if (_ILIsDrive (pidl)) {
|
if (_ILIsDrive (pidl)) {
|
||||||
*pdwAttributes &= SFGAO_HASSUBFOLDER|SFGAO_FILESYSTEM|SFGAO_FOLDER|SFGAO_FILESYSANCESTOR|
|
*pdwAttributes &= SFGAO_HASSUBFOLDER|SFGAO_FILESYSTEM|SFGAO_FOLDER|SFGAO_FILESYSANCESTOR|
|
||||||
SFGAO_DROPTARGET|SFGAO_HASPROPSHEET|SFGAO_CANLINK;
|
SFGAO_DROPTARGET|SFGAO_HASPROPSHEET|SFGAO_CANLINK;
|
||||||
} else if (_ILGetGUIDPointer (pidl)) {
|
} else if (_ILGetGUIDPointer (pidl) && HCR_GetFolderAttributes(pidl, &dwAttributes)) {
|
||||||
if (!HCR_GetFolderAttributes (pidl, pdwAttributes)) {
|
*pdwAttributes = dwAttributes;
|
||||||
*pdwAttributes &= SFGAO_HASSUBFOLDER|SFGAO_FOLDER|SFGAO_FILESYSANCESTOR|
|
|
||||||
SFGAO_DROPTARGET|SFGAO_HASPROPSHEET|SFGAO_CANRENAME|SFGAO_CANLINK;
|
|
||||||
}
|
|
||||||
} else if (_ILGetDataPointer (pidl)) {
|
} else if (_ILGetDataPointer (pidl)) {
|
||||||
dwAttributes = _ILGetFileAttributes (pidl, NULL, 0);
|
dwAttributes = _ILGetFileAttributes (pidl, NULL, 0);
|
||||||
|
|
||||||
|
|
|
@ -602,8 +602,8 @@ static void test_GetAttributesOf(void)
|
||||||
dwFlags = 0xffffffff;
|
dwFlags = 0xffffffff;
|
||||||
hr = IShellFolder_GetAttributesOf(psfDesktop, 1, (LPCITEMIDLIST*)&pidlMyComputer, &dwFlags);
|
hr = IShellFolder_GetAttributesOf(psfDesktop, 1, (LPCITEMIDLIST*)&pidlMyComputer, &dwFlags);
|
||||||
ok (SUCCEEDED(hr), "Desktop->GetAttributesOf(MyComputer) failed! hr = %08lx\n", hr);
|
ok (SUCCEEDED(hr), "Desktop->GetAttributesOf(MyComputer) failed! hr = %08lx\n", hr);
|
||||||
todo_wine { ok ((dwFlags & ~(DWORD)SFGAO_CANLINK) == dwMyComputerFlags,
|
ok ((dwFlags & ~(DWORD)SFGAO_CANLINK) == dwMyComputerFlags,
|
||||||
"Wrong MyComputer attributes: %08lx, expected: %08lx\n", dwFlags, dwMyComputerFlags); }
|
"Wrong MyComputer attributes: %08lx, expected: %08lx\n", dwFlags, dwMyComputerFlags);
|
||||||
|
|
||||||
hr = IShellFolder_BindToObject(psfDesktop, pidlMyComputer, NULL, &IID_IShellFolder, (LPVOID*)&psfMyComputer);
|
hr = IShellFolder_BindToObject(psfDesktop, pidlMyComputer, NULL, &IID_IShellFolder, (LPVOID*)&psfMyComputer);
|
||||||
ok (SUCCEEDED(hr), "Desktop failed to bind to MyComputer object! hr = %08lx\n", hr);
|
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;
|
STRRET strret;
|
||||||
static WCHAR wszTestFile[] = {
|
static WCHAR wszTestFile[] = {
|
||||||
'w','i','n','e','t','e','s','t','.','f','o','o',0 };
|
'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;
|
if(!pSHGetSpecialFolderPathW) return;
|
||||||
|
|
||||||
|
@ -725,6 +728,19 @@ static void test_SHGetPathFromIDList(void)
|
||||||
IMalloc_Free(ppM, pidlTestFile);
|
IMalloc_Free(ppM, pidlTestFile);
|
||||||
if (!result) return;
|
if (!result) return;
|
||||||
ok(0 == lstrcmpW(wszFileName, wszPath), "SHGetPathFromIDListW returned incorrect path for file placed on desktop\n");
|
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)
|
static void test_EnumObjects_and_CompareIDs(void)
|
||||||
|
|
Loading…
Reference in New Issue