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"
28 WINE_DEFAULT_DEBUG_CHANNEL(msident
);
31 IEnumUserIdentity IEnumUserIdentity_iface
;
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
;
51 WARN("(%s %p)\n", debugstr_guid(riid
), ppv
);
56 IUnknown_AddRef((IUnknown
*)*ppv
);
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
);
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
);
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
);
90 static HRESULT WINAPI
EnumUserIdentity_Skip(IEnumUserIdentity
*iface
, ULONG celt
)
92 EnumUserIdentity
*This
= impl_from_IEnumUserIdentity(iface
);
93 FIXME("(%p)->(%lu)\n", This
, celt
);
97 static HRESULT WINAPI
EnumUserIdentity_Reset(IEnumUserIdentity
*iface
)
99 EnumUserIdentity
*This
= impl_from_IEnumUserIdentity(iface
);
100 FIXME("(%p)->()\n", This
);
104 static HRESULT WINAPI
EnumUserIdentity_Clone(IEnumUserIdentity
*iface
, IEnumUserIdentity
**ppenum
)
106 EnumUserIdentity
*This
= impl_from_IEnumUserIdentity(iface
);
107 FIXME("(%p)->(%p)\n", This
, ppenum
);
111 static HRESULT WINAPI
EnumUserIdentity_GetCount(IEnumUserIdentity
*iface
, ULONG
*pnCount
)
113 EnumUserIdentity
*This
= impl_from_IEnumUserIdentity(iface
);
115 FIXME("(%p)->(%p)\n", This
, pnCount
);
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
);
137 }else if(IsEqualGUID(&IID_IUserIdentityManager
, riid
)) {
138 TRACE("(IID_IUserIdentityManager %p)\n", ppv
);
141 WARN("(%s %p)\n", debugstr_guid(riid
), ppv
);
143 return E_NOINTERFACE
;
146 IUnknown_AddRef((IUnknown
*)*ppv
);
150 static ULONG WINAPI
UserIdentityManager_AddRef(IUserIdentityManager
*iface
)
156 static ULONG WINAPI
UserIdentityManager_Release(IUserIdentityManager
*iface
)
162 static HRESULT WINAPI
UserIdentityManager_EnumIdentities(IUserIdentityManager
*iface
, IEnumUserIdentity
**ppEnumUser
)
164 EnumUserIdentity
*ret
;
166 TRACE("(%p)\n", ppEnumUser
);
168 ret
= malloc(sizeof(*ret
));
170 return E_OUTOFMEMORY
;
172 ret
->IEnumUserIdentity_iface
.lpVtbl
= &EnumUserIdentityVtbl
;
175 *ppEnumUser
= &ret
->IEnumUserIdentity_iface
;
179 static HRESULT WINAPI
UserIdentityManager_ManageIdentities(IUserIdentityManager
*iface
, HWND hwndParent
, DWORD dwFlags
)
181 FIXME("(%p %lx)\n", hwndParent
, dwFlags
);
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
);
198 static HRESULT WINAPI
UserIdentityManager_GetIdentityByCookie(IUserIdentityManager
*iface
, GUID
*uidCookie
,
199 IUserIdentity
**ppIdentity
)
201 FIXME("(%p %p)\n", uidCookie
, ppIdentity
);
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
)
222 return IUserIdentityManager_QueryInterface(&UserIdentityManager
, riid
, ppv
);
225 static HRESULT WINAPI
ClassFactory_QueryInterface(IClassFactory
*iface
, REFIID riid
, void **ppv
)
229 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
230 TRACE("(%p)->(IID_IUnknown %p)\n", iface
, ppv
);
232 }else if(IsEqualGUID(&IID_IClassFactory
, riid
)) {
233 TRACE("(%p)->(IID_IClassFactory %p)\n", iface
, ppv
);
238 IUnknown_AddRef((IUnknown
*)*ppv
);
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
);
252 static ULONG WINAPI
ClassFactory_Release(IClassFactory
*iface
)
254 TRACE("(%p)\n", iface
);
258 static HRESULT WINAPI
ClassFactory_LockServer(IClassFactory
*iface
, BOOL fLock
)
260 TRACE("(%p)->(%x)\n", iface
, fLock
);
264 static const IClassFactoryVtbl UserIdentityManagerCFVtbl
= {
265 ClassFactory_QueryInterface
,
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
;