comctl32/tests: Flush events before testing edit control IME messages.
[wine.git] / dlls / dmusic / download.c
blob56ee9c7477d462520d313f502e4733829bc30c72
1 /*
2 * IDirectMusicDownload Implementation
4 * Copyright (C) 2003-2004 Rok Mandeljc
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "dmusic_private.h"
22 #include "dmobject.h"
24 WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
26 static inline IDirectMusicDownloadImpl* impl_from_IDirectMusicDownload(IDirectMusicDownload *iface)
28 return CONTAINING_RECORD(iface, IDirectMusicDownloadImpl, IDirectMusicDownload_iface);
31 /* IDirectMusicDownloadImpl IUnknown part: */
32 static HRESULT WINAPI IDirectMusicDownloadImpl_QueryInterface(IDirectMusicDownload *iface, REFIID riid, void **ret_iface)
34 TRACE("(%p, %s, %p)\n", iface, debugstr_dmguid(riid), ret_iface);
36 if (IsEqualIID(riid, &IID_IUnknown) ||
37 IsEqualIID(riid, &IID_IDirectMusicDownload))
39 IDirectMusicDownload_AddRef(iface);
40 *ret_iface = iface;
41 return S_OK;
44 *ret_iface = NULL;
45 WARN("(%p, %s, %p): not found\n", iface, debugstr_dmguid(riid), ret_iface);
46 return E_NOINTERFACE;
49 static ULONG WINAPI IDirectMusicDownloadImpl_AddRef(IDirectMusicDownload *iface)
51 IDirectMusicDownloadImpl *This = impl_from_IDirectMusicDownload(iface);
52 ULONG ref = InterlockedIncrement(&This->ref);
54 TRACE("(%p): new ref = %lu\n", iface, ref);
56 return ref;
59 static ULONG WINAPI IDirectMusicDownloadImpl_Release(IDirectMusicDownload *iface)
61 IDirectMusicDownloadImpl *This = impl_from_IDirectMusicDownload(iface);
62 ULONG ref = InterlockedDecrement(&This->ref);
64 TRACE("(%p): new ref = %lu\n", iface, ref);
66 if (!ref) {
67 HeapFree(GetProcessHeap(), 0, This);
68 DMUSIC_UnlockModule();
71 return ref;
74 /* IDirectMusicDownloadImpl IDirectMusicDownload part: */
75 static HRESULT WINAPI IDirectMusicDownloadImpl_GetBuffer(IDirectMusicDownload *iface, void **buffer, DWORD *size)
77 FIXME("(%p, %p, %p): stub\n", iface, buffer, size);
79 return S_OK;
82 static const IDirectMusicDownloadVtbl DirectMusicDownload_Vtbl = {
83 IDirectMusicDownloadImpl_QueryInterface,
84 IDirectMusicDownloadImpl_AddRef,
85 IDirectMusicDownloadImpl_Release,
86 IDirectMusicDownloadImpl_GetBuffer
89 /* for ClassFactory */
90 HRESULT DMUSIC_CreateDirectMusicDownloadImpl(const GUID *guid, void **ret_iface, IUnknown *unk_outer)
92 IDirectMusicDownloadImpl *download;
94 download = HeapAlloc(GetProcessHeap(), 0, sizeof(*download));
95 if (!download)
97 *ret_iface = NULL;
98 return E_OUTOFMEMORY;
101 download->IDirectMusicDownload_iface.lpVtbl = &DirectMusicDownload_Vtbl;
102 download->ref = 1;
103 *ret_iface = download;
105 DMUSIC_LockModule();
106 return S_OK;