Documentation for CLEANLOCALSTORAGE in OLE Automation

Huw D M Davies h.davies1 at physics.ox.ac.uk
Wed Apr 19 08:41:27 CDT 2006


On Wed, Apr 19, 2006 at 12:24:07AM +0100, Robert Shearman wrote:
> Hi,
> 
> I just thought I'd document the CLEANLOCALSTORAGE use in oleaut32 for 
> anyone that wants to implement it, although I can't implement it now for 
> obvious reasons.

Great, thanks.  I just sent a patch to wine-patches that implements
this for GetLibAttr.

> 
> First of all the background: the reason CLEANLOCALSTORAGE is needed is 
> because the structures returned from various Get* functions in ITypeInfo 
> and ITypeLib have pointers that have been allocated opaquely and have to 
> be freed using the corresponding Release* function. AFAICS, the problem 
> is not that the memory will not be freed (the RPC runtime should 
> traverse the structure thoroughly and release all of the pointers with 
> NdrOleFree), but that some of the memory may not need to be freed (and 
> memory corruption could take place if it were).

Yeah, and the reason it works is that the CLEANLOCALSTORAGE paramater
is last and hence marshalled after the structure of interest, so we
get a chance to call the _Release function before the stub does its
own cleanup.

Huw.
-- 
Huw Davies
huw at codeweavers.com



More information about the wine-devel mailing list