/* for ClassFactory */ HRESULT WINAPI DMUSIC_CreateDirectMusicScriptImpl(REFIID lpcGUID, void **ppobj, IUnknown *pUnkOuter) { IDirectMusicScriptImpl *obj; HRESULT hr; *ppobj = NULL; if (pUnkOuter) return CLASS_E_NOAGGREGATION; obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicScriptImpl)); if (!obj) return E_OUTOFMEMORY; obj->IDirectMusicScript_iface.lpVtbl = &dmscript_vtbl; obj->ObjectVtbl = &DirectMusicScript_Object_Vtbl; obj->PersistStreamVtbl = &DirectMusicScript_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_DirectMusicScript; obj->ref = 1; DMSCRIPT_LockModule(); hr = IDirectMusicScript_QueryInterface(&obj->IDirectMusicScript_iface, lpcGUID, ppobj); IDirectMusicScript_Release(&obj->IDirectMusicScript_iface); return hr; }
static ULONG WINAPI IDirectMusicScriptTrack_IUnknown_AddRef (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicScriptTrack, UnknownVtbl, iface); ULONG ref = InterlockedIncrement(&This->ref); TRACE("(%p): AddRef from %d\n", This, ref - 1); DMSCRIPT_LockModule(); return ref; }