sxs: COM cleanup for the IAssemblyCache iface.

This commit is contained in:
Michael Stefaniuc 2011-01-14 00:39:39 +01:00 committed by Alexandre Julliard
parent c91afb9733
commit 1c35951f9f
1 changed files with 11 additions and 6 deletions

View File

@ -45,16 +45,21 @@ static inline WCHAR *strdupW( const WCHAR *s )
struct cache struct cache
{ {
const IAssemblyCacheVtbl *vtbl; IAssemblyCache IAssemblyCache_iface;
LONG refs; LONG refs;
}; };
static inline struct cache *impl_from_IAssemblyCache(IAssemblyCache *iface)
{
return CONTAINING_RECORD(iface, struct cache, IAssemblyCache_iface);
}
static HRESULT WINAPI cache_QueryInterface( static HRESULT WINAPI cache_QueryInterface(
IAssemblyCache *iface, IAssemblyCache *iface,
REFIID riid, REFIID riid,
void **obj ) void **obj )
{ {
struct cache *cache = (struct cache *)iface; struct cache *cache = impl_from_IAssemblyCache(iface);
TRACE("%p, %s, %p\n", cache, debugstr_guid(riid), obj); TRACE("%p, %s, %p\n", cache, debugstr_guid(riid), obj);
@ -73,13 +78,13 @@ static HRESULT WINAPI cache_QueryInterface(
static ULONG WINAPI cache_AddRef( IAssemblyCache *iface ) static ULONG WINAPI cache_AddRef( IAssemblyCache *iface )
{ {
struct cache *cache = (struct cache *)iface; struct cache *cache = impl_from_IAssemblyCache(iface);
return InterlockedIncrement( &cache->refs ); return InterlockedIncrement( &cache->refs );
} }
static ULONG WINAPI cache_Release( IAssemblyCache *iface ) static ULONG WINAPI cache_Release( IAssemblyCache *iface )
{ {
struct cache *cache = (struct cache *)iface; struct cache *cache = impl_from_IAssemblyCache(iface);
ULONG refs = InterlockedDecrement( &cache->refs ); ULONG refs = InterlockedDecrement( &cache->refs );
if (!refs) if (!refs)
@ -605,9 +610,9 @@ HRESULT WINAPI CreateAssemblyCache( IAssemblyCache **obj, DWORD reserved )
if (!cache) if (!cache)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
cache->vtbl = &cache_vtbl; cache->IAssemblyCache_iface.lpVtbl = &cache_vtbl;
cache->refs = 1; cache->refs = 1;
*obj = (IAssemblyCache *)cache; *obj = &cache->IAssemblyCache_iface;
return S_OK; return S_OK;
} }