Make the DllRegisterServer, DllRegisterServerEx, DllUnregisterServer,
[wine/wine64.git] / dlls / dmusic / clock.c
blob452e6439327846bd9b7263b76ae854c299b64567
1 /* IReferenceClock Implementation
3 * Copyright (C) 2003 Rok Mandeljc
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.
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 * MERCHANTABILIY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Library General Public License for more details.
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.
20 #include "windef.h"
21 #include "winbase.h"
22 #include "winuser.h"
23 #include "wingdi.h"
24 #include "wine/debug.h"
26 #include "dmusic_private.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
30 /* IReferenceClock IUnknown parts follow: */
31 HRESULT WINAPI IReferenceClockImpl_QueryInterface (IReferenceClock *iface, REFIID riid, LPVOID *ppobj)
33 ICOM_THIS(IReferenceClockImpl,iface);
35 if (IsEqualGUID(riid, &IID_IUnknown) ||
36 IsEqualGUID(riid, &IID_IReferenceClock))
38 IReferenceClockImpl_AddRef(iface);
39 *ppobj = This;
40 return S_OK;
42 WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
43 return E_NOINTERFACE;
46 ULONG WINAPI IReferenceClockImpl_AddRef (IReferenceClock *iface)
48 ICOM_THIS(IReferenceClockImpl,iface);
49 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
50 return ++(This->ref);
53 ULONG WINAPI IReferenceClockImpl_Release (IReferenceClock *iface)
55 ICOM_THIS(IReferenceClockImpl,iface);
56 ULONG ref = --This->ref;
57 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
58 if (ref == 0)
60 HeapFree(GetProcessHeap(), 0, This);
62 return ref;
65 /* IReferenceClock Interface follow: */
66 HRESULT WINAPI IReferenceClockImpl_GetTime (IReferenceClock *iface, REFERENCE_TIME* pTime)
68 ICOM_THIS(IReferenceClockImpl,iface);
70 TRACE("(%p, %p)\n", This, pTime);
71 *pTime = This->rtTime;
73 return S_OK;
76 HRESULT WINAPI IReferenceClockImpl_AdviseTime (IReferenceClock *iface, REFERENCE_TIME baseTime, REFERENCE_TIME streamTime, HANDLE hEvent, DWORD* pdwAdviseCookie)
78 ICOM_THIS(IReferenceClockImpl,iface);
80 FIXME("(%p, %lli, %lli, %p, %p): stub\n", This, baseTime, streamTime, hEvent, pdwAdviseCookie);
82 return S_OK;
85 HRESULT WINAPI IReferenceClockImpl_AdvisePeriodic (IReferenceClock *iface, REFERENCE_TIME startTime, REFERENCE_TIME periodTime, HANDLE hSemaphore, DWORD* pdwAdviseCookie)
87 ICOM_THIS(IReferenceClockImpl,iface);
89 FIXME("(%p, %lli, %lli, %p, %p): stub\n", This, startTime, periodTime, hSemaphore, pdwAdviseCookie);
91 return S_OK;
94 HRESULT WINAPI IReferenceClockImpl_Unadvise (IReferenceClock *iface, DWORD dwAdviseCookie)
96 ICOM_THIS(IReferenceClockImpl,iface);
98 FIXME("(%p, %ld): stub\n", This, dwAdviseCookie);
100 return S_OK;
103 ICOM_VTABLE(IReferenceClock) ReferenceClock_Vtbl =
105 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
106 IReferenceClockImpl_QueryInterface,
107 IReferenceClockImpl_AddRef,
108 IReferenceClockImpl_Release,
109 IReferenceClockImpl_GetTime,
110 IReferenceClockImpl_AdviseTime,
111 IReferenceClockImpl_AdvisePeriodic,
112 IReferenceClockImpl_Unadvise
115 /* for ClassFactory */
116 HRESULT WINAPI DMUSIC_CreateReferenceClock (LPCGUID lpcGUID, IReferenceClock** ppRC, LPUNKNOWN pUnkOuter)
118 IReferenceClockImpl* clock;
120 if (IsEqualGUID (lpcGUID, &IID_IReferenceClock))
122 clock = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IReferenceClockImpl));
123 if (NULL == clock) {
124 *ppRC = NULL;
125 return E_OUTOFMEMORY;
127 clock->lpVtbl = &ReferenceClock_Vtbl;
128 clock->ref = 1;
129 clock->rtTime = 0;
130 clock->pClockInfo.dwSize = sizeof (DMUS_CLOCKINFO);
132 *ppRC = (IReferenceClock *) clock;
133 return S_OK;
135 WARN("No interface found\n");
137 return E_NOINTERFACE;