ReactOS  0.4.15-dev-3439-g2693a26
download.c
Go to the documentation of this file.
1 /*
2  * IDirectMusicDownload Implementation
3  *
4  * Copyright (C) 2003-2004 Rok Mandeljc
5  *
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.
10  *
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.
15  *
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
19  */
20 
21 #include "dmusic_private.h"
22 
24 
25 static inline IDirectMusicDownloadImpl* impl_from_IDirectMusicDownload(IDirectMusicDownload *iface)
26 {
27  return CONTAINING_RECORD(iface, IDirectMusicDownloadImpl, IDirectMusicDownload_iface);
28 }
29 
30 /* IDirectMusicDownloadImpl IUnknown part: */
31 static HRESULT WINAPI IDirectMusicDownloadImpl_QueryInterface(IDirectMusicDownload *iface, REFIID riid, void **ret_iface)
32 {
33  TRACE("(%p, %s, %p)\n", iface, debugstr_dmguid(riid), ret_iface);
34 
35  if (IsEqualIID(riid, &IID_IUnknown) ||
36  IsEqualIID(riid, &IID_IDirectMusicDownload))
37  {
39  *ret_iface = iface;
40  return S_OK;
41  }
42 
43  *ret_iface = NULL;
44  WARN("(%p, %s, %p): not found\n", iface, debugstr_dmguid(riid), ret_iface);
45  return E_NOINTERFACE;
46 }
47 
48 static ULONG WINAPI IDirectMusicDownloadImpl_AddRef(IDirectMusicDownload *iface)
49 {
52 
53  TRACE("(%p)->(): new ref = %u\n", iface, ref);
54 
55  return ref;
56 }
57 
58 static ULONG WINAPI IDirectMusicDownloadImpl_Release(IDirectMusicDownload *iface)
59 {
62 
63  TRACE("(%p)->(): new ref = %u\n", iface, ref);
64 
65  if (!ref) {
68  }
69 
70  return ref;
71 }
72 
73 /* IDirectMusicDownloadImpl IDirectMusicDownload part: */
74 static HRESULT WINAPI IDirectMusicDownloadImpl_GetBuffer(IDirectMusicDownload *iface, void **buffer, DWORD *size)
75 {
76  FIXME("(%p, %p, %p): stub\n", iface, buffer, size);
77 
78  return S_OK;
79 }
80 
81 static const IDirectMusicDownloadVtbl DirectMusicDownload_Vtbl = {
86 };
87 
88 /* for ClassFactory */
89 HRESULT DMUSIC_CreateDirectMusicDownloadImpl(const GUID *guid, void **ret_iface, IUnknown *unk_outer)
90 {
91  IDirectMusicDownloadImpl *download;
92 
93  download = HeapAlloc(GetProcessHeap(), 0, sizeof(*download));
94  if (!download)
95  {
96  *ret_iface = NULL;
97  return E_OUTOFMEMORY;
98  }
99 
101  download->ref = 1;
102  *ret_iface = download;
103 
105  return S_OK;
106 }
#define REFIID
Definition: guiddef.h:118
#define E_NOINTERFACE
Definition: winerror.h:2364
static HRESULT WINAPI IDirectMusicDownloadImpl_QueryInterface(IDirectMusicDownload *iface, REFIID riid, void **ret_iface)
Definition: download.c:31
const char * debugstr_dmguid(const GUID *id)
Definition: dmusic_main.c:237
#define IDirectMusicDownload_AddRef(p)
Definition: dmusicc.h:602
REFIID riid
Definition: precomp.h:44
static ULONG WINAPI IDirectMusicDownloadImpl_AddRef(IDirectMusicDownload *iface)
Definition: download.c:48
#define WARN(fmt,...)
Definition: debug.h:112
GLuint buffer
Definition: glext.h:5915
static ULONG WINAPI IDirectMusicDownloadImpl_Release(IDirectMusicDownload *iface)
Definition: download.c:58
Definition: send.c:48
static void DMUSIC_UnlockModule(void)
const GUID * guid
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
GLenum GLint ref
Definition: glext.h:6028
#define FIXME(fmt,...)
Definition: debug.h:111
static void DMUSIC_LockModule(void)
static IDirectMusicDownloadImpl * impl_from_IDirectMusicDownload(IDirectMusicDownload *iface)
Definition: download.c:25
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:79
const GUID IID_IUnknown
#define WINAPI
Definition: msvc.h:6
unsigned long DWORD
Definition: ntddk_ex.h:95
static HRESULT WINAPI IDirectMusicDownloadImpl_GetBuffer(IDirectMusicDownload *iface, void **buffer, DWORD *size)
Definition: download.c:74
#define InterlockedDecrement
Definition: armddk.h:52
static const IDirectMusicDownloadVtbl DirectMusicDownload_Vtbl
Definition: download.c:81
HRESULT DMUSIC_CreateDirectMusicDownloadImpl(const GUID *guid, void **ret_iface, IUnknown *unk_outer)
Definition: download.c:89
#define S_OK
Definition: intsafe.h:52
#define InterlockedIncrement
Definition: armddk.h:53
IDirectMusicDownload IDirectMusicDownload_iface
#define NULL
Definition: types.h:112
WINE_DEFAULT_DEBUG_CHANNEL(dmusic)
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:594
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95