[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: zabkat info <info_at_zabkat.com>
Date: 2006-05-11 10:40:52 CEST

I think we have found at least one problem:

> 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);

Microsoft also did that mistake, casting a HANDLE into a pointer. See this
post and in particular the comments made by Jim Barry at the very end:
http://groups.google.com/group/microsoft.public.platformsdk.shell/browse_thr
ead/thread/52fd75ef9cdd38f0/a0f0771a3334f7fb?lnk=st&q=SHMultiFileProperties&
rnum=1&hl=en#a0f0771a3334f7fb

Standard OLE procedures mean that you cannot use a global handle straight,
but you have to lock it first as such:

CIDA* cida = (CIDA*)GlobalLock(medium.hGlobal);

This converts it from a meaningless handle to a proper memory location.
After you're done and before releasing the medium you should unlock it as
such:

GlobalUnlock(medium.hGlobal);

Also I'm not sure what this statement does:

> LPCITEMIDLIST _parent = GetPIDLItem(cida, i), &parent);

Unbalanced parentheses, surely?

Could you please make the necessary adjustments?
Thanks
nikos

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Thu May 11 11:05:37 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.