*/
typedef struct {
- IShellFolder2Vtbl *lpVtbl;
- DWORD ref;
+ const IShellFolder2Vtbl *lpVtbl;
+ LONG ref;
CLSID *pclsid;
LPWSTR sPathTarget; /* complete path to target used for enumeration and ChangeNotify */
LPITEMIDLIST pidlRoot; /* absolute pidl */
- int dwAttributes; /* attributes returned by GetAttributesOf FIXME: use it */
-
UINT cfShellIDList; /* clipboardformat for IDropTarget */
BOOL fAcceptFmt; /* flag for pending Drop */
} IGenericSFImpl;
BOOL ret = TRUE;
WCHAR szPath[MAX_PATH];
- TRACE("(%p)->(flags=0x%08lx) \n",list,dwFlags);
+ TRACE("(%p)->(flags=0x%08lx)\n", list, dwFlags);
/* enumerate the root folders */
if (dwFlags & SHCONTF_FOLDERS)
{
HKEY hkey;
- LONG r;
+ UINT i;
/* create the pidl for This item */
ret = AddToEnumList(list, _ILCreateMyComputer());
- r = RegOpenKeyExW(HKEY_LOCAL_MACHINE, Desktop_NameSpaceW,
- 0, KEY_READ, &hkey);
- if (ret && ERROR_SUCCESS == r)
- {
- WCHAR iid[50];
- int i=0;
- BOOL moreKeys = TRUE;
-
- while (ret && moreKeys)
+ for (i=0; i<2; i++) {
+ if (ret && !RegOpenKeyExW(i == 0 ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER,
+ Desktop_NameSpaceW, 0, KEY_READ, &hkey))
{
- DWORD size;
+ WCHAR iid[50];
+ int i=0;
- size = sizeof (iid);
- r = RegEnumKeyExW(hkey, i, iid, &size, 0, NULL, NULL, NULL);
- if (ERROR_SUCCESS == r)
+ while (ret)
{
- ret = AddToEnumList(list, _ILCreateGuidFromStrW(iid));
- i++;
+ DWORD size;
+ LONG r;
+
+ size = sizeof (iid);
+ r = RegEnumKeyExW(hkey, i, iid, &size, 0, NULL, NULL, NULL);
+ if (ERROR_SUCCESS == r)
+ {
+ ret = AddToEnumList(list, _ILCreateGuidFromStrW(iid));
+ i++;
+ }
+ else if (ERROR_NO_MORE_ITEMS == r)
+ break;
+ else
+ ret = FALSE;
}
- else if (ERROR_NO_MORE_ITEMS == r)
- moreKeys = FALSE;
- else
- ret = FALSE;
+ RegCloseKey(hkey);
}
- RegCloseKey(hkey);
}
}
LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
{
IGenericSFImpl *This = (IGenericSFImpl *)iface;
- char szPath[MAX_PATH];
TRACE ("(%p)->(pidl=%p,%p,%s,%p)\n",
This, pidl, pbcReserved, shdebugstr_guid (riid), ppvOut);
- WideCharToMultiByte( CP_ACP, 0, This->sPathTarget, -1,
- szPath, MAX_PATH, NULL, NULL );
- return SHELL32_BindToChild( This->pidlRoot, szPath, pidl, riid, ppvOut );
+ return SHELL32_BindToChild( This->pidlRoot, This->sPathTarget, pidl, riid, ppvOut );
}
/**************************************************************************
{
IGenericSFImpl *This = (IGenericSFImpl *)iface;
HRESULT hr = S_OK;
+ 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=0x%08lx)\n",
- This, cidl, apidl, *rgfInOut);
+ TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08lx))\n",
+ This, cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0);
- if (!cidl || !apidl || !rgfInOut)
+ if (!rgfInOut)
+ return E_INVALIDARG;
+ if (cidl && !apidl)
return E_INVALIDARG;
if (*rgfInOut == 0)
*rgfInOut = ~0;
-
- while (cidl > 0 && *apidl)
- {
- pdump (*apidl);
- SHELL32_GetItemAttributes (_IShellFolder_ (This), *apidl, rgfInOut);
- apidl++;
- cidl--;
+
+ if(cidl == 0) {
+ *rgfInOut &= dwDesktopAttributes;
+ } else {
+ while (cidl > 0 && *apidl) {
+ pdump (*apidl);
+ if (_ILIsDesktop(*apidl)) {
+ *rgfInOut &= dwDesktopAttributes;
+ } else if (_ILIsMyComputer(*apidl)) {
+ *rgfInOut &= dwMyComputerAttributes;
+ } else {
+ SHELL32_GetItemAttributes (_IShellFolder_ (This), *apidl, rgfInOut);
+ }
+ apidl++;
+ cidl--;
+ }
}
+ /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
+ *rgfInOut &= ~SFGAO_VALIDATE;
TRACE ("-- result=0x%08lx\n", *rgfInOut);
if (_ILIsDesktop (pidl))
{
if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) &&
- (GET_SHGDN_FOR (dwFlags) == SHGDN_FORPARSING))
+ (GET_SHGDN_FOR (dwFlags) & SHGDN_FORPARSING))
{
BOOL defCharUsed;
if ((clsid = _ILGetGUIDPointer (pidl)))
{
- if (GET_SHGDN_FOR (dwFlags) == SHGDN_FORPARSING)
+ if (GET_SHGDN_FOR (dwFlags) & SHGDN_FORPARSING)
{
int bWantsForParsing;
}
else
{
- /* file system folder */
- _ILSimpleGetText (pidl, strRet->u.cStr, MAX_PATH);
+ int cLen = 0;
+
+ /* file system folder or file rooted at the desktop */
+ if ((GET_SHGDN_FOR(dwFlags) == SHGDN_FORPARSING) &&
+ (GET_SHGDN_RELATION(dwFlags) != SHGDN_INFOLDER))
+ {
+ WideCharToMultiByte(CP_ACP, 0, This->sPathTarget, -1, strRet->u.cStr, MAX_PATH,
+ NULL, NULL);
+ PathAddBackslashA(strRet->u.cStr);
+ cLen = lstrlenA(strRet->u.cStr);
+ }
+
+ _ILSimpleGetText (pidl, strRet->u.cStr + cLen, MAX_PATH - cLen);
if (!_ILIsFolder(pidl))
SHELL_FS_ProcessDisplayFilename(strRet->u.cStr, dwFlags);
return E_NOTIMPL;
}
-static IShellFolder2Vtbl vt_MCFldr_ShellFolder2 =
+static const IShellFolder2Vtbl vt_MCFldr_ShellFolder2 =
{
ISF_Desktop_fnQueryInterface,
ISF_Desktop_fnAddRef,