shell32: Partial implementation of IShellItem::BindToHandler.
David Hedberg
david.hedberg at gmail.com
Mon Aug 2 07:07:16 CDT 2010
On Mon, Aug 2, 2010 at 10:50 AM, Nikolay Sivov <nsivov at codeweavers.com> wrote:
>
> Ok, this test is present already cause Desktop list is an empty list. So
> please change this test for
> mkid.cb magic value to _ILIsEmpty() in BindToObject() and all other
> occurrences too (InitializeTreeView() for example).
>
Is something like the attached patch acceptable? I have only changed
the checks where it would not introduce an extra check for NULL, and I
have also not touched debughlp.c. Should I be more radical and also
change places that only checks pidl->mkid.cb?
Also, the check in _ILIsDesktop() seems a bit counter-intuitive to me
(interpreting it as "pidl && (pidl->mkid.cb ? FALSE : TRUE)" is closer
to what you would expect as the current version also considers NULL
pidl's to be the desktop (or empty)), but I assume that the current
meaning is the intended one.
-------------- next part --------------
From 1a8d009fd59ca7b3e9229ed7819a0be1aac4f678 Mon Sep 17 00:00:00 2001
From: David Hedberg <david.hedberg at gmail.com>
Date: Mon, 2 Aug 2010 13:50:23 +0200
Subject: [PATCH] shell32: Replace some checks with calls to _ILIsEmpty().
---
dlls/shell32/brsfolder.c | 4 ++--
dlls/shell32/pidl.c | 4 ++--
dlls/shell32/shfldr_unixfs.c | 12 ++++++------
dlls/shell32/shlfolder.c | 2 +-
4 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/dlls/shell32/brsfolder.c b/dlls/shell32/brsfolder.c
index 83ed1dd..77c55c8 100644
--- a/dlls/shell32/brsfolder.c
+++ b/dlls/shell32/brsfolder.c
@@ -239,7 +239,7 @@ static void InitializeTreeView( browse_info *info )
return;
}
- if (pidlChild && pidlChild->mkid.cb) {
+ if (!_ILIsEmpty(pidlChild)) {
hr = IShellFolder_BindToObject(lpsfParent, pidlChild, 0, &IID_IShellFolder, (LPVOID*)&lpsfRoot);
} else {
lpsfRoot = lpsfParent;
@@ -519,7 +519,7 @@ static LRESULT BrsFolder_Treeview_Expand( browse_info *info, NMTREEVIEWW *pnmtv
if ((pnmtv->itemNew.state & TVIS_EXPANDEDONCE))
return 0;
- if (lptvid->lpi && lptvid->lpi->mkid.cb) {
+ if (!_ILIsEmpty(lptvid->lpi)) {
r = IShellFolder_BindToObject( lptvid->lpsfParent, lptvid->lpi, 0,
&IID_IShellFolder, (LPVOID *)&lpsf2 );
} else {
diff --git a/dlls/shell32/pidl.c b/dlls/shell32/pidl.c
index a596ebf..1c9cf22 100644
--- a/dlls/shell32/pidl.c
+++ b/dlls/shell32/pidl.c
@@ -217,7 +217,7 @@ BOOL WINAPI ILRemoveLastID(LPITEMIDLIST pidl)
{
TRACE_(shell)("pidl=%p\n",pidl);
- if (!pidl || !pidl->mkid.cb)
+ if (_ILIsEmpty(pidl))
return FALSE;
ILFindLastID(pidl)->mkid.cb = 0;
return TRUE;
@@ -2062,7 +2062,7 @@ DWORD _ILSimpleGetTextW (LPCITEMIDLIST pidl, LPWSTR szOut, UINT uOutSize)
*/
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
{
- if(pidl && pidl->mkid.cb != 0x00)
+ if(!_ILIsEmpty(pidl))
return (LPPIDLDATA)pidl->mkid.abID;
return NULL;
}
diff --git a/dlls/shell32/shfldr_unixfs.c b/dlls/shell32/shfldr_unixfs.c
index 9ae030f..35eb8e3 100644
--- a/dlls/shell32/shfldr_unixfs.c
+++ b/dlls/shell32/shfldr_unixfs.c
@@ -716,7 +716,7 @@ static HRESULT UNIXFS_initialize_target_folder(UnixFolder *This, const char *szB
WCHAR *dos_name;
/* Determine the path's length bytes */
- while (current && current->mkid.cb) {
+ while (!_ILIsEmpty(current)) {
dwPathLen += UNIXFS_filename_from_shitemid(current, NULL) + 1; /* For the '/' */
current = ILGetNext(current);
};
@@ -734,7 +734,7 @@ static HRESULT UNIXFS_initialize_target_folder(UnixFolder *This, const char *szB
pNextDir += strlen(szBasePath);
if (This->m_dwPathMode == PATHMODE_UNIX || IsEqualCLSID(&CLSID_MyDocuments, This->m_pCLSID))
This->m_dwAttributes |= SFGAO_FILESYSTEM;
- while (current && current->mkid.cb) {
+ while (!_ILIsEmpty(current)) {
pNextDir += UNIXFS_filename_from_shitemid(current, pNextDir);
*pNextDir++ = '/';
current = ILGetNext(current);
@@ -948,7 +948,7 @@ static HRESULT WINAPI UnixFolder_IShellFolder2_BindToObject(IShellFolder2* iface
TRACE("(iface=%p, pidl=%p, pbcReserver=%p, riid=%p, ppvOut=%p)\n",
iface, pidl, pbcReserved, riid, ppvOut);
- if (!pidl || !pidl->mkid.cb)
+ if (_ILIsEmpty(pidl))
return E_INVALIDARG;
if (IsEqualCLSID(This->m_pCLSID, &CLSID_FolderShortcut)) {
@@ -993,8 +993,8 @@ static HRESULT WINAPI UnixFolder_IShellFolder2_CompareIDs(IShellFolder2* iface,
TRACE("(iface=%p, lParam=%ld, pidl1=%p, pidl2=%p)\n", iface, lParam, pidl1, pidl2);
- isEmpty1 = !pidl1 || !pidl1->mkid.cb;
- isEmpty2 = !pidl2 || !pidl2->mkid.cb;
+ isEmpty1 = _ILIsEmpty(pidl1);
+ isEmpty2 = _ILIsEmpty(pidl2);
if (isEmpty1 && isEmpty2)
return MAKE_HRESULT(SEVERITY_SUCCESS, 0, 0);
@@ -1160,7 +1160,7 @@ static HRESULT WINAPI UnixFolder_IShellFolder2_GetDisplayNameOf(IShellFolder2* i
if ((GET_SHGDN_FOR(uFlags) & SHGDN_FORPARSING) &&
(GET_SHGDN_RELATION(uFlags) != SHGDN_INFOLDER))
{
- if (!pidl || !pidl->mkid.cb) {
+ if (_ILIsEmpty(pidl)) {
lpName->uType = STRRET_WSTR;
if (This->m_dwPathMode == PATHMODE_UNIX) {
UINT len = MultiByteToWideChar(CP_UNIXCP, 0, This->m_pszPath, -1, NULL, 0);
diff --git a/dlls/shell32/shlfolder.c b/dlls/shell32/shlfolder.c
index 230d7c6..9ab34a9 100644
--- a/dlls/shell32/shlfolder.c
+++ b/dlls/shell32/shlfolder.c
@@ -271,7 +271,7 @@ HRESULT SHELL32_BindToChild (LPCITEMIDLIST pidlRoot,
TRACE("(%p %s %p %s %p)\n", pidlRoot, debugstr_w(pathRoot), pidlComplete, debugstr_guid(riid), ppvOut);
- if (!pidlRoot || !ppvOut || !pidlComplete || !pidlComplete->mkid.cb)
+ if (!pidlRoot || !ppvOut || _ILIsEmpty(pidlComplete))
return E_INVALIDARG;
*ppvOut = NULL;
--
1.7.2
More information about the wine-devel
mailing list