[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Tortoise brings down xplorer2

From: Stefan Küng <tortoisesvn_at_gmail.com>
Date: 2006-05-10 22:25:52 CEST

zabkat info wrote:
> -----Original Message-----
> From: Stefan Küng [mailto:tortoisesvn@gmail.com]
> Sent: 10 May 2006 18:18
>
>> Exactly. The Desktop is the shell namespace root and therefore *always*
>> exists. Many functions have to use that root because of that. At least
>> all functions that need a full path as the result and not just a
>> filename. In your case, the property pages in the default explorer
>> 'properties' dialog only act on files/folders and don't need the full
>> path (or don't need those if multiple items are selected). TSVN needs
>> the full path even if multiple items are selected, so it's important
>> that the PIDL root is the desktop.
>
>
> If I understand correctly then this could be the problem. You are assuming
> that HIDA_GetPIDLFolder will always return the desktop pidl (?) whereas in
> the dataobject x2 supplies this is the common root of all the files in the
> CIDA bundle.

Not sure if we really assume that.

> The correct way to take the full path of item #i would be
>
> ILCombine(HIDA_GetPIDLFolder(cida), HIDA_GetPIDLItem(cida, i))
>
>
>> if (parent_)
>> {
>> hr = shellFolder->BindToObject(parent_, 0, IID_IShellFolder,
> (void**)
>> &parentFolder);
>>
>> In the above code snippet, the crash occurs inside the BindToObject()
>> call because the root is not the desktop.
>
>
> Can you please post the code how you get the "parent_" pidl? Is it
> single-level as required by BindToObject?

You call (indirectly I guess) our
IShellExtInit::Initialize(LPCITEMIDLIST pIDFolder,LPDATAOBJECT
pDataObj,HKEY /* hRegKey */) method. In there, we do (some code left out
here):

#define GetPIDLFolder(pida)
(LPCITEMIDLIST)(((LPBYTE)pida)+(pida)->aoffset[0])
#define GetPIDLItem(pida, i)
(LPCITEMIDLIST)(((LPBYTE)pida)+(pida)->aoffset[i+1])

if (pDataObj)
{
   STGMEDIUM medium;
   FORMATETC fmte = {(CLIPFORMAT)g_shellidlist,
                     (DVTARGETDEVICE FAR *)NULL,
                     DVASPECT_CONTENT,
                     -1,
                     TYMED_HGLOBAL};
   HRESULT hres = pDataObj->GetData(&fmte, &medium);
   if (SUCCEEDED(hres) && medium.hGlobal)
   {
     //Enumerate PIDLs which the user has selected
     CIDA* cida = (CIDA*)medium.hGlobal;
     LPCITEMIDLIST parent = GetPIDLFolder(cida);

     int count = cida->cidl;
     for (int i = 0; i < count; ++i)
     {
        LPCITEMIDLIST _parent = GetPIDLItem(cida, i), &parent);

        IShellFolder *shellFolder = NULL;
        IShellFolder *parentFolder = NULL;
        STRRET name;
        TCHAR * szDisplayName = NULL;
        stdstring ret;
        HRESULT hr;

        SHGetDesktopFolder(&shellFolder);
        if (_parent)
        {
//--> here it crashes!!!
           shellFolder->BindToObject(_parent, 0, IID_IShellFolder,
(void**) &parentFolder);
           if (!SUCCEEDED(hr))
             parentFolder = shellFolder;
        }
// ... much more code below
     }
   }
}

It appears that the _parent PIDL is invalid. It points to some illegal
memory, that's why BindToObject() crashes.

Stefan

-- 
        ___
   oo  // \\      "De Chelonian Mobile"
  (_,\/ \_/ \     TortoiseSVN
    \ \_/_\_/>    The coolest Interface to (Sub)Version Control
    /_/   \_\     http://tortoisesvn.tigris.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Wed May 10 22:26:07 2006

This is an archived mail posted to the TortoiseSVN Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.