mf/samplegrabber: Handle paused state.
[wine.git] / dlls / msident / msident.c
blob44a65c3e4776e4008c30014880e4f43b1a0d5cd9
1 /*
2 * Copyright 2012 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #define COBJMACROS
21 #include "windows.h"
22 #include "initguid.h"
23 #include "msident.h"
24 #include "rpcproxy.h"
26 #include "wine/debug.h"
27 #include "wine/heap.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(msident);
31 typedef struct {
32 IEnumUserIdentity IEnumUserIdentity_iface;
33 LONG ref;
34 } EnumUserIdentity;
36 static inline EnumUserIdentity *impl_from_IEnumUserIdentity(IEnumUserIdentity *iface)
38 return CONTAINING_RECORD(iface, EnumUserIdentity, IEnumUserIdentity_iface);
41 static HRESULT WINAPI EnumUserIdentity_QueryInterface(IEnumUserIdentity *iface, REFIID riid, void **ppv)
43 EnumUserIdentity *This = impl_from_IEnumUserIdentity(iface);
45 if(IsEqualGUID(&IID_IUnknown, riid)) {
46 TRACE("(IID_IUnknown %p)\n", ppv);
47 *ppv = &This->IEnumUserIdentity_iface;
48 }else if(IsEqualGUID(&IID_IEnumUserIdentity, riid)) {
49 TRACE("(IID_IEnumUserIdentity %p)\n", ppv);
50 *ppv = &This->IEnumUserIdentity_iface;
51 }else {
52 WARN("(%s %p)\n", debugstr_guid(riid), ppv);
53 *ppv = NULL;
54 return E_NOINTERFACE;
57 IUnknown_AddRef((IUnknown*)*ppv);
58 return S_OK;
61 static ULONG WINAPI EnumUserIdentity_AddRef(IEnumUserIdentity *iface)
63 EnumUserIdentity *This = impl_from_IEnumUserIdentity(iface);
64 LONG ref = InterlockedIncrement(&This->ref);
66 TRACE("(%p) ref=%d\n", This, ref);
68 return ref;
71 static ULONG WINAPI EnumUserIdentity_Release(IEnumUserIdentity *iface)
73 EnumUserIdentity *This = impl_from_IEnumUserIdentity(iface);
74 LONG ref = InterlockedDecrement(&This->ref);
76 TRACE("(%p) ref=%d\n", This, ref);
78 if(!ref)
79 heap_free(This);
81 return ref;
84 static HRESULT WINAPI EnumUserIdentity_Next(IEnumUserIdentity *iface, ULONG celt, IUnknown **rgelt, ULONG *pceltFetched)
86 EnumUserIdentity *This = impl_from_IEnumUserIdentity(iface);
87 FIXME("(%p)->(%u %p %p)\n", This, celt, rgelt, pceltFetched);
88 return E_NOTIMPL;
91 static HRESULT WINAPI EnumUserIdentity_Skip(IEnumUserIdentity *iface, ULONG celt)
93 EnumUserIdentity *This = impl_from_IEnumUserIdentity(iface);
94 FIXME("(%p)->(%u)\n", This, celt);
95 return E_NOTIMPL;
98 static HRESULT WINAPI EnumUserIdentity_Reset(IEnumUserIdentity *iface)
100 EnumUserIdentity *This = impl_from_IEnumUserIdentity(iface);
101 FIXME("(%p)->()\n", This);
102 return E_NOTIMPL;
105 static HRESULT WINAPI EnumUserIdentity_Clone(IEnumUserIdentity *iface, IEnumUserIdentity **ppenum)
107 EnumUserIdentity *This = impl_from_IEnumUserIdentity(iface);
108 FIXME("(%p)->(%p)\n", This, ppenum);
109 return E_NOTIMPL;
112 static HRESULT WINAPI EnumUserIdentity_GetCount(IEnumUserIdentity *iface, ULONG *pnCount)
114 EnumUserIdentity *This = impl_from_IEnumUserIdentity(iface);
116 FIXME("(%p)->(%p)\n", This, pnCount);
118 *pnCount = 0;
119 return S_OK;
122 static const IEnumUserIdentityVtbl EnumUserIdentityVtbl = {
123 EnumUserIdentity_QueryInterface,
124 EnumUserIdentity_AddRef,
125 EnumUserIdentity_Release,
126 EnumUserIdentity_Next,
127 EnumUserIdentity_Skip,
128 EnumUserIdentity_Reset,
129 EnumUserIdentity_Clone,
130 EnumUserIdentity_GetCount
133 static HRESULT WINAPI UserIdentityManager_QueryInterface(IUserIdentityManager *iface, REFIID riid, void **ppv)
135 if(IsEqualGUID(&IID_IUnknown, riid)) {
136 TRACE("(IID_IUnknown %p)\n", ppv);
137 *ppv = iface;
138 }else if(IsEqualGUID(&IID_IUserIdentityManager, riid)) {
139 TRACE("(IID_IUserIdentityManager %p)\n", ppv);
140 *ppv = iface;
141 }else {
142 WARN("(%s %p)\n", debugstr_guid(riid), ppv);
143 *ppv = NULL;
144 return E_NOINTERFACE;
147 IUnknown_AddRef((IUnknown*)*ppv);
148 return S_OK;
151 static ULONG WINAPI UserIdentityManager_AddRef(IUserIdentityManager *iface)
153 TRACE("\n");
154 return 2;
157 static ULONG WINAPI UserIdentityManager_Release(IUserIdentityManager *iface)
159 TRACE("\n");
160 return 1;
163 static HRESULT WINAPI UserIdentityManager_EnumIdentities(IUserIdentityManager *iface, IEnumUserIdentity **ppEnumUser)
165 EnumUserIdentity *ret;
167 TRACE("(%p)\n", ppEnumUser);
169 ret = heap_alloc(sizeof(*ret));
170 if(!ret)
171 return E_OUTOFMEMORY;
173 ret->IEnumUserIdentity_iface.lpVtbl = &EnumUserIdentityVtbl;
174 ret->ref = 1;
176 *ppEnumUser = &ret->IEnumUserIdentity_iface;
177 return S_OK;
180 static HRESULT WINAPI UserIdentityManager_ManageIdentities(IUserIdentityManager *iface, HWND hwndParent, DWORD dwFlags)
182 FIXME("(%p %x)\n", hwndParent, dwFlags);
183 return E_NOTIMPL;
186 static HRESULT WINAPI UserIdentityManager_Logon(IUserIdentityManager *iface, HWND hwndParent,
187 DWORD dwFlags, IUserIdentity **ppIdentity)
189 FIXME("(%p %x %p)\n", hwndParent, dwFlags, ppIdentity);
190 return E_USER_CANCELLED;
193 static HRESULT WINAPI UserIdentityManager_Logoff(IUserIdentityManager *iface, HWND hwndParent)
195 FIXME("(%p)\n", hwndParent);
196 return E_NOTIMPL;
199 static HRESULT WINAPI UserIdentityManager_GetIdentityByCookie(IUserIdentityManager *iface, GUID *uidCookie,
200 IUserIdentity **ppIdentity)
202 FIXME("(%p %p)\n", uidCookie, ppIdentity);
203 return E_NOTIMPL;
206 static const IUserIdentityManagerVtbl UserIdentityManagerVtbl = {
207 UserIdentityManager_QueryInterface,
208 UserIdentityManager_AddRef,
209 UserIdentityManager_Release,
210 UserIdentityManager_EnumIdentities,
211 UserIdentityManager_ManageIdentities,
212 UserIdentityManager_Logon,
213 UserIdentityManager_Logoff,
214 UserIdentityManager_GetIdentityByCookie
217 static IUserIdentityManager UserIdentityManager = { &UserIdentityManagerVtbl };
219 static HRESULT WINAPI UserIdentityManager_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
221 TRACE("\n");
223 return IUserIdentityManager_QueryInterface(&UserIdentityManager, riid, ppv);
226 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
228 *ppv = NULL;
230 if(IsEqualGUID(&IID_IUnknown, riid)) {
231 TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv);
232 *ppv = iface;
233 }else if(IsEqualGUID(&IID_IClassFactory, riid)) {
234 TRACE("(%p)->(IID_IClassFactory %p)\n", iface, ppv);
235 *ppv = iface;
238 if(*ppv) {
239 IUnknown_AddRef((IUnknown*)*ppv);
240 return S_OK;
243 FIXME("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
244 return E_NOINTERFACE;
247 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
249 TRACE("(%p)\n", iface);
250 return 2;
253 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
255 TRACE("(%p)\n", iface);
256 return 1;
259 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
261 TRACE("(%p)->(%x)\n", iface, fLock);
262 return S_OK;
265 static const IClassFactoryVtbl UserIdentityManagerCFVtbl = {
266 ClassFactory_QueryInterface,
267 ClassFactory_AddRef,
268 ClassFactory_Release,
269 UserIdentityManager_CreateInstance,
270 ClassFactory_LockServer
273 static IClassFactory UserIdentityManagerCF = { &UserIdentityManagerCFVtbl };
275 /***********************************************************************
276 * DllGetClassObject (msident.@)
278 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
280 if(IsEqualGUID(&CLSID_UserIdentityManager, rclsid)) {
281 TRACE("CLSID_UserIdentityManager\n");
282 return IClassFactory_QueryInterface(&UserIdentityManagerCF, riid, ppv);
285 FIXME("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
286 return CLASS_E_CLASSNOTAVAILABLE;