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
26 #include "wine/debug.h"
27 #include "wine/heap.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(msident
);
32 IEnumUserIdentity IEnumUserIdentity_iface
;
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
;
52 WARN("(%s %p)\n", debugstr_guid(riid
), ppv
);
57 IUnknown_AddRef((IUnknown
*)*ppv
);
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=%ld\n", This
, 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=%ld\n", This
, 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)->(%lu %p %p)\n", This
, celt
, rgelt
, pceltFetched
);
91 static HRESULT WINAPI
EnumUserIdentity_Skip(IEnumUserIdentity
*iface
, ULONG celt
)
93 EnumUserIdentity
*This
= impl_from_IEnumUserIdentity(iface
);
94 FIXME("(%p)->(%lu)\n", This
, celt
);
98 static HRESULT WINAPI
EnumUserIdentity_Reset(IEnumUserIdentity
*iface
)
100 EnumUserIdentity
*This
= impl_from_IEnumUserIdentity(iface
);
101 FIXME("(%p)->()\n", This
);
105 static HRESULT WINAPI
EnumUserIdentity_Clone(IEnumUserIdentity
*iface
, IEnumUserIdentity
**ppenum
)
107 EnumUserIdentity
*This
= impl_from_IEnumUserIdentity(iface
);
108 FIXME("(%p)->(%p)\n", This
, ppenum
);
112 static HRESULT WINAPI
EnumUserIdentity_GetCount(IEnumUserIdentity
*iface
, ULONG
*pnCount
)
114 EnumUserIdentity
*This
= impl_from_IEnumUserIdentity(iface
);
116 FIXME("(%p)->(%p)\n", This
, pnCount
);
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
);
138 }else if(IsEqualGUID(&IID_IUserIdentityManager
, riid
)) {
139 TRACE("(IID_IUserIdentityManager %p)\n", ppv
);
142 WARN("(%s %p)\n", debugstr_guid(riid
), ppv
);
144 return E_NOINTERFACE
;
147 IUnknown_AddRef((IUnknown
*)*ppv
);
151 static ULONG WINAPI
UserIdentityManager_AddRef(IUserIdentityManager
*iface
)
157 static ULONG WINAPI
UserIdentityManager_Release(IUserIdentityManager
*iface
)
163 static HRESULT WINAPI
UserIdentityManager_EnumIdentities(IUserIdentityManager
*iface
, IEnumUserIdentity
**ppEnumUser
)
165 EnumUserIdentity
*ret
;
167 TRACE("(%p)\n", ppEnumUser
);
169 ret
= heap_alloc(sizeof(*ret
));
171 return E_OUTOFMEMORY
;
173 ret
->IEnumUserIdentity_iface
.lpVtbl
= &EnumUserIdentityVtbl
;
176 *ppEnumUser
= &ret
->IEnumUserIdentity_iface
;
180 static HRESULT WINAPI
UserIdentityManager_ManageIdentities(IUserIdentityManager
*iface
, HWND hwndParent
, DWORD dwFlags
)
182 FIXME("(%p %lx)\n", hwndParent
, dwFlags
);
186 static HRESULT WINAPI
UserIdentityManager_Logon(IUserIdentityManager
*iface
, HWND hwndParent
,
187 DWORD dwFlags
, IUserIdentity
**ppIdentity
)
189 FIXME("(%p %lx %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
);
199 static HRESULT WINAPI
UserIdentityManager_GetIdentityByCookie(IUserIdentityManager
*iface
, GUID
*uidCookie
,
200 IUserIdentity
**ppIdentity
)
202 FIXME("(%p %p)\n", uidCookie
, ppIdentity
);
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
)
223 return IUserIdentityManager_QueryInterface(&UserIdentityManager
, riid
, ppv
);
226 static HRESULT WINAPI
ClassFactory_QueryInterface(IClassFactory
*iface
, REFIID riid
, void **ppv
)
230 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
231 TRACE("(%p)->(IID_IUnknown %p)\n", iface
, ppv
);
233 }else if(IsEqualGUID(&IID_IClassFactory
, riid
)) {
234 TRACE("(%p)->(IID_IClassFactory %p)\n", iface
, ppv
);
239 IUnknown_AddRef((IUnknown
*)*ppv
);
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
);
253 static ULONG WINAPI
ClassFactory_Release(IClassFactory
*iface
)
255 TRACE("(%p)\n", iface
);
259 static HRESULT WINAPI
ClassFactory_LockServer(IClassFactory
*iface
, BOOL fLock
)
261 TRACE("(%p)->(%x)\n", iface
, fLock
);
265 static const IClassFactoryVtbl UserIdentityManagerCFVtbl
= {
266 ClassFactory_QueryInterface
,
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
;