wine/dlls/shell32 shfldr_desktop.c shlfolder.c ...
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Nov 28 04:59:39 CST 2005
ChangeSet ID: 21446
CVSROOT: /opt/cvs-commit
Module name: wine
Changes by: julliard at winehq.org 2005/11/28 04:59:39
Modified files:
dlls/shell32 : shfldr_desktop.c shlfolder.c
dlls/shell32/tests: shlfolder.c
Log message:
Martin Fuchs <martin-fuchs at gmx.net>
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().
Patch: http://cvs.winehq.org/patch.py?id=21446
Old revision New revision Changes Path
1.50 1.51 +5 -0 wine/dlls/shell32/shfldr_desktop.c
1.106 1.107 +4 -5 wine/dlls/shell32/shlfolder.c
1.43 1.44 +18 -2 wine/dlls/shell32/tests/shlfolder.c
Index: wine/dlls/shell32/shfldr_desktop.c
diff -u -p wine/dlls/shell32/shfldr_desktop.c:1.50 wine/dlls/shell32/shfldr_desktop.c:1.51
--- wine/dlls/shell32/shfldr_desktop.c:1.50 28 Nov 2005 10:59:39 -0000
+++ wine/dlls/shell32/shfldr_desktop.c 28 Nov 2005 10:59:39 -0000
@@ -431,6 +431,9 @@ static HRESULT WINAPI ISF_Desktop_fnGetA
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_fnGetA
pdump (*apidl);
if (_ILIsDesktop(*apidl)) {
*rgfInOut &= dwDesktopAttributes;
+ } else if (_ILIsMyComputer(*apidl)) {
+ *rgfInOut &= dwMyComputerAttributes;
} else {
SHELL32_GetItemAttributes (_IShellFolder_ (This), *apidl, rgfInOut);
}
Index: wine/dlls/shell32/shlfolder.c
diff -u -p wine/dlls/shell32/shlfolder.c:1.106 wine/dlls/shell32/shlfolder.c:1.107
--- wine/dlls/shell32/shlfolder.c:1.106 28 Nov 2005 10:59:39 -0000
+++ wine/dlls/shell32/shlfolder.c 28 Nov 2005 10:59:39 -0000
@@ -408,14 +408,13 @@ HRESULT SHELL32_GetItemAttributes (IShel
*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);
Index: wine/dlls/shell32/tests/shlfolder.c
diff -u -p wine/dlls/shell32/tests/shlfolder.c:1.43 wine/dlls/shell32/tests/shlfolder.c:1.44
--- wine/dlls/shell32/tests/shlfolder.c:1.43 28 Nov 2005 10:59:39 -0000
+++ wine/dlls/shell32/tests/shlfolder.c 28 Nov 2005 10:59:39 -0000
@@ -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(voi
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(voi
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)
More information about the wine-cvs
mailing list