ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

download.c
Go to the documentation of this file.
00001 /* IDirectMusicDownload Implementation
00002  *
00003  * Copyright (C) 2003-2004 Rok Mandeljc
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Lesser General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2.1 of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public
00016  * License along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00018  */
00019 
00020 #include "dmusic_private.h"
00021 
00022 WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
00023 
00024 /* IDirectMusicDownloadImpl IUnknown part: */
00025 static HRESULT WINAPI IDirectMusicDownloadImpl_QueryInterface (LPDIRECTMUSICDOWNLOAD iface, REFIID riid, LPVOID *ppobj) {
00026     IDirectMusicDownloadImpl *This = (IDirectMusicDownloadImpl *)iface;
00027     TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
00028 
00029     if (IsEqualIID (riid, &IID_IUnknown) 
00030         || IsEqualIID (riid, &IID_IDirectMusicDownload)) {
00031         IUnknown_AddRef(iface);
00032         *ppobj = This;
00033         return S_OK;
00034     }
00035     WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
00036     return E_NOINTERFACE;
00037 }
00038 
00039 static ULONG WINAPI IDirectMusicDownloadImpl_AddRef (LPDIRECTMUSICDOWNLOAD iface) {
00040     IDirectMusicDownloadImpl *This = (IDirectMusicDownloadImpl *)iface;
00041     ULONG refCount = InterlockedIncrement(&This->ref);
00042 
00043     TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
00044 
00045     DMUSIC_LockModule();
00046 
00047     return refCount;
00048 }
00049 
00050 static ULONG WINAPI IDirectMusicDownloadImpl_Release (LPDIRECTMUSICDOWNLOAD iface) {
00051     IDirectMusicDownloadImpl *This = (IDirectMusicDownloadImpl *)iface;
00052     ULONG refCount = InterlockedDecrement(&This->ref);
00053 
00054     TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
00055 
00056     if (!refCount) {
00057         HeapFree(GetProcessHeap(), 0, This);
00058     }
00059 
00060     DMUSIC_UnlockModule();
00061     
00062     return refCount;
00063 }
00064 
00065 /* IDirectMusicDownloadImpl IDirectMusicDownload part: */
00066 static HRESULT WINAPI IDirectMusicDownloadImpl_GetBuffer (LPDIRECTMUSICDOWNLOAD iface, void** ppvBuffer, DWORD* pdwSize) {
00067     IDirectMusicDownloadImpl *This = (IDirectMusicDownloadImpl *)iface;
00068     FIXME("(%p, %p, %p): stub\n", This, ppvBuffer, pdwSize);
00069     return S_OK;
00070 }
00071 
00072 static const IDirectMusicDownloadVtbl DirectMusicDownload_Vtbl = {
00073     IDirectMusicDownloadImpl_QueryInterface,
00074     IDirectMusicDownloadImpl_AddRef,
00075     IDirectMusicDownloadImpl_Release,
00076     IDirectMusicDownloadImpl_GetBuffer
00077 };
00078 
00079 /* for ClassFactory */
00080 HRESULT WINAPI DMUSIC_CreateDirectMusicDownloadImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
00081     IDirectMusicDownloadImpl* dmdl;
00082     
00083     dmdl = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicDownloadImpl));
00084     if (NULL == dmdl) {
00085         *ppobj = NULL;
00086         return E_OUTOFMEMORY;
00087     }
00088     dmdl->lpVtbl = &DirectMusicDownload_Vtbl;
00089     dmdl->ref = 0; /* will be inited by QueryInterface */
00090     
00091     return IDirectMusicDownloadImpl_QueryInterface ((LPDIRECTMUSICDOWNLOAD)dmdl, lpcGUID, ppobj);
00092 }

Generated on Sun May 27 2012 04:21:35 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.