/* for ClassFactory */ HRESULT WINAPI create_dmband(REFIID lpcGUID, void **ppobj) { IDirectMusicBandImpl* obj; HRESULT hr; obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicBandImpl)); if (NULL == obj) { *ppobj = NULL; return E_OUTOFMEMORY; } obj->IDirectMusicBand_iface.lpVtbl = &dmband_vtbl; obj->ObjectVtbl = &DirectMusicBand_Object_Vtbl; obj->PersistStreamVtbl = &DirectMusicBand_PersistStream_Vtbl; obj->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC)); DM_STRUCT_INIT(obj->pDesc); obj->pDesc->dwValidData |= DMUS_OBJ_CLASS; obj->pDesc->guidClass = CLSID_DirectMusicBand; obj->ref = 1; list_init (&obj->Instruments); DMBAND_LockModule(); hr = IDirectMusicBand_QueryInterface(&obj->IDirectMusicBand_iface, lpcGUID, ppobj); IDirectMusicBand_Release(&obj->IDirectMusicBand_iface); return hr; }
static HRESULT WINAPI BandCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) { TRACE("(%d)\n", dolock); if (dolock) DMBAND_LockModule(); else DMBAND_UnlockModule(); return S_OK; }
static ULONG WINAPI IDirectMusicBandImpl_IUnknown_AddRef (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicBandImpl, UnknownVtbl, iface); ULONG ref = InterlockedIncrement(&This->ref); TRACE("(%p) : AddRef from %d\n", This, ref - 1); DMBAND_LockModule(); return ref; }
static ULONG WINAPI BandTrackCF_AddRef(LPCLASSFACTORY iface) { DMBAND_LockModule(); return 2; /* non-heap based object */ }