d3d8: Move texturing code over to wined3d (based on Oliver Stieber's work).
[wine] / dlls / dmusic / portdownload.c
1 /* IDirectMusicPortDownloadImpl Implementation
2  *
3  * Copyright (C) 2003-2004 Rok Mandeljc
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 #include "dmusic_private.h"
21
22 WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
23
24 /* IDirectMusicPortDownload IUnknown parts follow: */
25 HRESULT WINAPI IDirectMusicPortDownloadImpl_QueryInterface (LPDIRECTMUSICPORTDOWNLOAD iface, REFIID riid, LPVOID *ppobj) {
26         IDirectMusicPortDownloadImpl *This = (IDirectMusicPortDownloadImpl *)iface;
27         TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
28
29         if (IsEqualIID (riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectMusicPortDownload)) {
30                 IDirectMusicPortDownloadImpl_AddRef(iface);
31                 *ppobj = This;
32                 return S_OK;
33         }
34         WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
35         return E_NOINTERFACE;
36 }
37
38 ULONG WINAPI IDirectMusicPortDownloadImpl_AddRef (LPDIRECTMUSICPORTDOWNLOAD iface) {
39         IDirectMusicPortDownloadImpl *This = (IDirectMusicPortDownloadImpl *)iface;
40         ULONG refCount = InterlockedIncrement(&This->ref);
41
42         TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
43
44         DMUSIC_LockModule();
45
46         return refCount;
47 }
48
49 ULONG WINAPI IDirectMusicPortDownloadImpl_Release (LPDIRECTMUSICPORTDOWNLOAD iface) {
50         IDirectMusicPortDownloadImpl *This = (IDirectMusicPortDownloadImpl *)iface;
51         ULONG refCount = InterlockedDecrement(&This->ref);
52
53         TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
54
55         if (!refCount) {
56                 HeapFree(GetProcessHeap(), 0, This);
57         }
58
59         DMUSIC_UnlockModule();
60
61         return refCount;
62 }
63
64 /* IDirectMusicPortDownload Interface follow: */
65 HRESULT WINAPI IDirectMusicPortDownloadImpl_GetBuffer (LPDIRECTMUSICPORTDOWNLOAD iface, DWORD dwDLId, IDirectMusicDownload** ppIDMDownload) {
66         IDirectMusicPortDownloadImpl *This = (IDirectMusicPortDownloadImpl *)iface;
67         FIXME("(%p, %ld, %p): stub\n", This, dwDLId, ppIDMDownload);
68         return S_OK;
69 }
70
71 HRESULT WINAPI IDirectMusicPortDownloadImpl_AllocateBuffer (LPDIRECTMUSICPORTDOWNLOAD iface, DWORD dwSize, IDirectMusicDownload** ppIDMDownload) {
72         IDirectMusicPortDownloadImpl *This = (IDirectMusicPortDownloadImpl *)iface;
73         FIXME("(%p, %ld, %p): stub\n", This, dwSize, ppIDMDownload);
74         return S_OK;
75 }
76
77 HRESULT WINAPI IDirectMusicPortDownloadImpl_GetDLId (LPDIRECTMUSICPORTDOWNLOAD iface, DWORD* pdwStartDLId, DWORD dwCount) {
78         IDirectMusicPortDownloadImpl *This = (IDirectMusicPortDownloadImpl *)iface;
79         FIXME("(%p, %p, %ld): stub\n", This, pdwStartDLId, dwCount);
80         return S_OK;
81 }
82
83 HRESULT WINAPI IDirectMusicPortDownloadImpl_GetAppend (LPDIRECTMUSICPORTDOWNLOAD iface, DWORD* pdwAppend) {
84         IDirectMusicPortDownloadImpl *This = (IDirectMusicPortDownloadImpl *)iface;
85         FIXME("(%p, %p): stub\n", This, pdwAppend);
86         return S_OK;
87 }
88
89 HRESULT WINAPI IDirectMusicPortDownloadImpl_Download (LPDIRECTMUSICPORTDOWNLOAD iface, IDirectMusicDownload* pIDMDownload) {
90         IDirectMusicPortDownloadImpl *This = (IDirectMusicPortDownloadImpl *)iface;
91         FIXME("(%p, %p): stub\n", This, pIDMDownload);
92         return S_OK;
93 }
94
95 HRESULT WINAPI IDirectMusicPortDownloadImpl_Unload (LPDIRECTMUSICPORTDOWNLOAD iface, IDirectMusicDownload* pIDMDownload) {
96         IDirectMusicPortDownloadImpl *This = (IDirectMusicPortDownloadImpl *)iface;
97         FIXME("(%p, %p): stub\n", This, pIDMDownload);
98         return S_OK;
99 }
100
101 static const IDirectMusicPortDownloadVtbl DirectMusicPortDownload_Vtbl = {
102         IDirectMusicPortDownloadImpl_QueryInterface,
103         IDirectMusicPortDownloadImpl_AddRef,
104         IDirectMusicPortDownloadImpl_Release,
105         IDirectMusicPortDownloadImpl_GetBuffer,
106         IDirectMusicPortDownloadImpl_AllocateBuffer,
107         IDirectMusicPortDownloadImpl_GetDLId,
108         IDirectMusicPortDownloadImpl_GetAppend,
109         IDirectMusicPortDownloadImpl_Download,
110         IDirectMusicPortDownloadImpl_Unload
111 };