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

downloadedinstrument.c
Go to the documentation of this file.
00001 /* IDirectMusicDownloadedInstrument 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 /* IDirectMusicDownloadedInstrumentImpl IUnknown part: */
00025 static HRESULT WINAPI IDirectMusicDownloadedInstrumentImpl_QueryInterface (LPDIRECTMUSICDOWNLOADEDINSTRUMENT iface, REFIID riid, LPVOID *ppobj) {
00026     IDirectMusicDownloadedInstrumentImpl *This = (IDirectMusicDownloadedInstrumentImpl *)iface;
00027     TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
00028 
00029     if (IsEqualIID (riid, &IID_IUnknown)
00030         || IsEqualIID (riid, &IID_IDirectMusicDownloadedInstrument)
00031         || IsEqualIID (riid, &IID_IDirectMusicDownloadedInstrument8)) {
00032         IUnknown_AddRef(iface);
00033         *ppobj = This;
00034         return S_OK;
00035     }
00036     WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
00037     return E_NOINTERFACE;
00038 }
00039 
00040 static ULONG WINAPI IDirectMusicDownloadedInstrumentImpl_AddRef (LPDIRECTMUSICDOWNLOADEDINSTRUMENT iface) {
00041     IDirectMusicDownloadedInstrumentImpl *This = (IDirectMusicDownloadedInstrumentImpl *)iface;
00042     ULONG refCount = InterlockedIncrement(&This->ref);
00043 
00044     TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
00045 
00046     DMUSIC_LockModule();
00047 
00048     return refCount;
00049 }
00050 
00051 static ULONG WINAPI IDirectMusicDownloadedInstrumentImpl_Release (LPDIRECTMUSICDOWNLOADEDINSTRUMENT iface) {
00052     IDirectMusicDownloadedInstrumentImpl *This = (IDirectMusicDownloadedInstrumentImpl *)iface;
00053     ULONG refCount = InterlockedDecrement(&This->ref);
00054 
00055     TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
00056 
00057     if (!refCount) {
00058         HeapFree(GetProcessHeap(), 0, This);
00059     }
00060 
00061     DMUSIC_UnlockModule();
00062     
00063     return refCount;
00064 }
00065 
00066 /* IDirectMusicDownloadedInstrumentImpl IDirectMusicDownloadedInstrument part: */
00067 /* none at this time */
00068 
00069 static const IDirectMusicDownloadedInstrumentVtbl DirectMusicDownloadedInstrument_Vtbl = {
00070     IDirectMusicDownloadedInstrumentImpl_QueryInterface,
00071     IDirectMusicDownloadedInstrumentImpl_AddRef,
00072     IDirectMusicDownloadedInstrumentImpl_Release
00073 };
00074 
00075 /* for ClassFactory */
00076 HRESULT WINAPI DMUSIC_CreateDirectMusicDownloadedInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
00077     IDirectMusicDownloadedInstrumentImpl* dmdlinst;
00078     
00079     dmdlinst = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicDownloadedInstrumentImpl));
00080     if (NULL == dmdlinst) {
00081         *ppobj = NULL;
00082         return E_OUTOFMEMORY;
00083     }
00084     dmdlinst->lpVtbl = &DirectMusicDownloadedInstrument_Vtbl;
00085     dmdlinst->ref = 0; /* will be inited by QueryInterface */
00086     
00087     return IDirectMusicDownloadedInstrumentImpl_QueryInterface ((LPDIRECTMUSICDOWNLOADEDINSTRUMENT)dmdlinst, lpcGUID, ppobj);   
00088 }

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.