2001-08-15 21:26:52 +02:00
|
|
|
/*
|
|
|
|
* Implementation of CLSID_MemoryAllocator.
|
|
|
|
*
|
|
|
|
* FIXME - stub.
|
|
|
|
*
|
|
|
|
* hidenori@a2.ctktv.ne.jp
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "wingdi.h"
|
|
|
|
#include "winerror.h"
|
|
|
|
#include "wine/obj_base.h"
|
|
|
|
#include "strmif.h"
|
|
|
|
#include "uuids.h"
|
|
|
|
|
|
|
|
#include "debugtools.h"
|
|
|
|
DEFAULT_DEBUG_CHANNEL(quartz);
|
|
|
|
|
|
|
|
#include "quartz_private.h"
|
|
|
|
#include "memalloc.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* can I use offsetof safely? - FIXME? */
|
|
|
|
static QUARTZ_IFEntry IFEntries[] =
|
|
|
|
{
|
|
|
|
{ &IID_IMemAllocator, offsetof(CMemoryAllocator,memalloc)-offsetof(CMemoryAllocator,unk) },
|
|
|
|
};
|
|
|
|
|
2001-09-07 21:46:49 +02:00
|
|
|
static void QUARTZ_DestroyMemoryAllocator(IUnknown* punk)
|
|
|
|
{
|
|
|
|
CMemoryAllocator_THIS(punk,unk);
|
|
|
|
|
|
|
|
CMemoryAllocator_UninitIMemAllocator( This );
|
|
|
|
}
|
|
|
|
|
2001-08-15 21:26:52 +02:00
|
|
|
HRESULT QUARTZ_CreateMemoryAllocator(IUnknown* punkOuter,void** ppobj)
|
|
|
|
{
|
|
|
|
CMemoryAllocator* pma;
|
2001-09-07 21:46:49 +02:00
|
|
|
HRESULT hr;
|
2001-08-15 21:26:52 +02:00
|
|
|
|
|
|
|
TRACE("(%p,%p)\n",punkOuter,ppobj);
|
|
|
|
|
|
|
|
pma = (CMemoryAllocator*)QUARTZ_AllocObj( sizeof(CMemoryAllocator) );
|
|
|
|
if ( pma == NULL )
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
2001-08-22 20:06:00 +02:00
|
|
|
QUARTZ_IUnkInit( &pma->unk, punkOuter );
|
2001-09-07 21:46:49 +02:00
|
|
|
hr = CMemoryAllocator_InitIMemAllocator( pma );
|
|
|
|
if ( FAILED(hr) )
|
|
|
|
{
|
|
|
|
QUARTZ_FreeObj( pma );
|
|
|
|
return hr;
|
|
|
|
}
|
2001-08-15 21:26:52 +02:00
|
|
|
|
|
|
|
pma->unk.pEntries = IFEntries;
|
|
|
|
pma->unk.dwEntries = sizeof(IFEntries)/sizeof(IFEntries[0]);
|
2001-09-07 21:46:49 +02:00
|
|
|
pma->unk.pOnFinalRelease = QUARTZ_DestroyMemoryAllocator;
|
2001-08-15 21:26:52 +02:00
|
|
|
|
2001-08-22 20:06:00 +02:00
|
|
|
*ppobj = (void*)(&pma->unk);
|
2001-08-15 21:26:52 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|