include: Add STORAGE_HOTPLUG_INFO structure.
[wine.git] / dlls / msident / msident.c
blob86c05536e158ad62961b6cb1c51819643358bcf6
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"
28 WINE_DEFAULT_DEBUG_CHANNEL(msident);
30 typedef struct {
31 IEnumUserIdentity IEnumUserIdentity_iface;
32 LONG ref;
33 } EnumUserIdentity;
35 static inline EnumUserIdentity *impl_from_IEnumUserIdentity(IEnumUserIdentity *iface)
37 return CONTAINING_RECORD(iface, EnumUserIdentity, IEnumUserIdentity_iface);
40 static HRESULT WINAPI EnumUserIdentity_QueryInterface(IEnumUserIdentity *iface, REFIID riid, void **ppv)
42 EnumUserIdentity *This = impl_from_IEnumUserIdentity(iface);
44 if(IsEqualGUID(&IID_IUnknown, riid)) {
45 TRACE("(IID_IUnknown %p)\n", ppv);
46 *ppv = &This->IEnumUserIdentity_iface;
47 }else if(IsEqualGUID(&IID_IEnumUserIdentity, riid)) {
48 TRACE("(IID_IEnumUserIdentity %p)\n", ppv);
49 *ppv = &This->IEnumUserIdentity_iface;
50 }else {
51 WARN("(%s %p)\n", debugstr_guid(riid), ppv);
52 *ppv = NULL;
53 return E_NOINTERFACE;
56 IUnknown_AddRef((IUnknown*)*ppv);
57 return S_OK;
60 static ULONG WINAPI EnumUserIdentity_AddRef(IEnumUserIdentity *iface)
62 EnumUserIdentity *This = impl_from_IEnumUserIdentity(iface);
63 LONG ref = InterlockedIncrement(&This->ref);
65 TRACE("(%p) ref=%ld\n", This, ref);
67 return ref;
70 static ULONG WINAPI EnumUserIdentity_Release(IEnumUserIdentity *iface)
72 EnumUserIdentity *This = impl_from_IEnumUserIdentity(iface);
73 LONG ref = InterlockedDecrement(&This->ref);
75 TRACE("(%p) ref=%ld\n", This, ref);
77 if(!ref)
78 free(This);
80 return ref;
83 static HRESULT WINAPI EnumUserIdentity_Next(IEnumUserIdentity *iface, ULONG celt, IUnknown **rgelt, ULONG *pceltFetched)
85 EnumUserIdentity *This = impl_from_IEnumUserIdentity(iface);
86 FIXME("(%p)->(%lu %p %p)\n", This, celt, rgelt, pceltFetched);
87 return E_NOTIMPL;
90 static HRESULT WINAPI EnumUserIdentity_Skip(IEnumUserIdentity *iface, ULONG celt)
92 EnumUserIdentity *This = impl_from_IEnumUserIdentity(iface);
93 FIXME("(%p)->(%lu)\n", This, celt);
94 return E_NOTIMPL;
97 static HRESULT WINAPI EnumUserIdentity_Reset(IEnumUserIdentity *iface)
99 EnumUserIdentity *This = impl_from_IEnumUserIdentity(iface);
100 FIXME("(%p)->()\n", This);
101 return E_NOTIMPL;
104 static HRESULT WINAPI EnumUserIdentity_Clone(IEnumUserIdentity *iface, IEnumUserIdentity **ppenum)
106 EnumUserIdentity *This = impl_from_IEnumUserIdentity(iface);
107 FIXME("(%p)->(%p)\n", This, ppenum);
108 return E_NOTIMPL;
111 static HRESULT WINAPI EnumUserIdentity_GetCount(IEnumUserIdentity *iface, ULONG *pnCount)
113 EnumUserIdentity *This = impl_from_IEnumUserIdentity(iface);
115 FIXME("(%p)->(%p)\n", This, pnCount);
117 *pnCount = 0;
118 return S_OK;
121 static const IEnumUserIdentityVtbl EnumUserIdentityVtbl = {
122 EnumUserIdentity_QueryInterface,
123 EnumUserIdentity_AddRef,
124 EnumUserIdentity_Release,
125 EnumUserIdentity_Next,
126 EnumUserIdentity_Skip,
127 EnumUserIdentity_Reset,
128 EnumUserIdentity_Clone,
129 EnumUserIdentity_GetCount
132 static HRESULT WINAPI UserIdentityManager_QueryInterface(IUserIdentityManager *iface, REFIID riid, void **ppv)
134 if(IsEqualGUID(&IID_IUnknown, riid)) {
135 TRACE("(IID_IUnknown %p)\n", ppv);
136 *ppv = iface;
137 }else if(IsEqualGUID(&IID_IUserIdentityManager, riid)) {
138 TRACE("(IID_IUserIdentityManager %p)\n", ppv);
139 *ppv = iface;
140 }else {
141 WARN("(%s %p)\n", debugstr_guid(riid), ppv);
142 *ppv = NULL;
143 return E_NOINTERFACE;
146 IUnknown_AddRef((IUnknown*)*ppv);
147 return S_OK;
150 static ULONG WINAPI UserIdentityManager_AddRef(IUserIdentityManager *iface)
152 TRACE("\n");
153 return 2;
156 static ULONG WINAPI UserIdentityManager_Release(IUserIdentityManager *iface)
158 TRACE("\n");
159 return 1;
162 static HRESULT WINAPI UserIdentityManager_EnumIdentities(IUserIdentityManager *iface, IEnumUserIdentity **ppEnumUser)
164 EnumUserIdentity *ret;
166 TRACE("(%p)\n", ppEnumUser);
168 ret = malloc(sizeof(*ret));
169 if(!ret)
170 return E_OUTOFMEMORY;
172 ret->IEnumUserIdentity_iface.lpVtbl = &EnumUserIdentityVtbl;
173 ret->ref = 1;
175 *ppEnumUser = &ret->IEnumUserIdentity_iface;
176 return S_OK;
179 static HRESULT WINAPI UserIdentityManager_ManageIdentities(IUserIdentityManager *iface, HWND hwndParent, DWORD dwFlags)
181 FIXME("(%p %lx)\n", hwndParent, dwFlags);
182 return E_NOTIMPL;
185 static HRESULT WINAPI UserIdentityManager_Logon(IUserIdentityManager *iface, HWND hwndParent,
186 DWORD dwFlags, IUserIdentity **ppIdentity)
188 FIXME("(%p %lx %p)\n", hwndParent, dwFlags, ppIdentity);
189 return E_USER_CANCELLED;
192 static HRESULT WINAPI UserIdentityManager_Logoff(IUserIdentityManager *iface, HWND hwndParent)
194 FIXME("(%p)\n", hwndParent);
195 return E_NOTIMPL;
198 static HRESULT WINAPI UserIdentityManager_GetIdentityByCookie(IUserIdentityManager *iface, GUID *uidCookie,
199 IUserIdentity **ppIdentity)
201 FIXME("(%p %p)\n", uidCookie, ppIdentity);
202 return E_NOTIMPL;
205 static const IUserIdentityManagerVtbl UserIdentityManagerVtbl = {
206 UserIdentityManager_QueryInterface,
207 UserIdentityManager_AddRef,
208 UserIdentityManager_Release,
209 UserIdentityManager_EnumIdentities,
210 UserIdentityManager_ManageIdentities,
211 UserIdentityManager_Logon,
212 UserIdentityManager_Logoff,
213 UserIdentityManager_GetIdentityByCookie
216 static IUserIdentityManager UserIdentityManager = { &UserIdentityManagerVtbl };
218 static HRESULT WINAPI UserIdentityManager_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
220 TRACE("\n");
222 return IUserIdentityManager_QueryInterface(&UserIdentityManager, riid, ppv);
225 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
227 *ppv = NULL;
229 if(IsEqualGUID(&IID_IUnknown, riid)) {
230 TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv);
231 *ppv = iface;
232 }else if(IsEqualGUID(&IID_IClassFactory, riid)) {
233 TRACE("(%p)->(IID_IClassFactory %p)\n", iface, ppv);
234 *ppv = iface;
237 if(*ppv) {
238 IUnknown_AddRef((IUnknown*)*ppv);
239 return S_OK;
242 FIXME("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
243 return E_NOINTERFACE;
246 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
248 TRACE("(%p)\n", iface);
249 return 2;
252 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
254 TRACE("(%p)\n", iface);
255 return 1;
258 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
260 TRACE("(%p)->(%x)\n", iface, fLock);
261 return S_OK;
264 static const IClassFactoryVtbl UserIdentityManagerCFVtbl = {
265 ClassFactory_QueryInterface,
266 ClassFactory_AddRef,
267 ClassFactory_Release,
268 UserIdentityManager_CreateInstance,
269 ClassFactory_LockServer
272 static IClassFactory UserIdentityManagerCF = { &UserIdentityManagerCFVtbl };
274 /***********************************************************************
275 * DllGetClassObject (msident.@)
277 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
279 if(IsEqualGUID(&CLSID_UserIdentityManager, rclsid)) {
280 TRACE("CLSID_UserIdentityManager\n");
281 return IClassFactory_QueryInterface(&UserIdentityManagerCF, riid, ppv);
284 FIXME("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
285 return CLASS_E_CLASSNOTAVAILABLE;