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
);
31 static HINSTANCE msident_instance
;
34 IEnumUserIdentity IEnumUserIdentity_iface
;
38 static inline EnumUserIdentity
*impl_from_IEnumUserIdentity(IEnumUserIdentity
*iface
)
40 return CONTAINING_RECORD(iface
, EnumUserIdentity
, IEnumUserIdentity_iface
);
43 static HRESULT WINAPI
EnumUserIdentity_QueryInterface(IEnumUserIdentity
*iface
, REFIID riid
, void **ppv
)
45 EnumUserIdentity
*This
= impl_from_IEnumUserIdentity(iface
);
47 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
48 TRACE("(IID_IUnknown %p)\n", ppv
);
49 *ppv
= &This
->IEnumUserIdentity_iface
;
50 }else if(IsEqualGUID(&IID_IEnumUserIdentity
, riid
)) {
51 TRACE("(IID_IEnumUserIdentity %p)\n", ppv
);
52 *ppv
= &This
->IEnumUserIdentity_iface
;
54 WARN("(%s %p)\n", debugstr_guid(riid
), ppv
);
59 IUnknown_AddRef((IUnknown
*)*ppv
);
63 static ULONG WINAPI
EnumUserIdentity_AddRef(IEnumUserIdentity
*iface
)
65 EnumUserIdentity
*This
= impl_from_IEnumUserIdentity(iface
);
66 LONG ref
= InterlockedIncrement(&This
->ref
);
68 TRACE("(%p) ref=%d\n", This
, ref
);
73 static ULONG WINAPI
EnumUserIdentity_Release(IEnumUserIdentity
*iface
)
75 EnumUserIdentity
*This
= impl_from_IEnumUserIdentity(iface
);
76 LONG ref
= InterlockedDecrement(&This
->ref
);
78 TRACE("(%p) ref=%d\n", This
, ref
);
86 static HRESULT WINAPI
EnumUserIdentity_Next(IEnumUserIdentity
*iface
, ULONG celt
, IUnknown
**rgelt
, ULONG
*pceltFetched
)
88 EnumUserIdentity
*This
= impl_from_IEnumUserIdentity(iface
);
89 FIXME("(%p)->(%u %p %p)\n", This
, celt
, rgelt
, pceltFetched
);
93 static HRESULT WINAPI
EnumUserIdentity_Skip(IEnumUserIdentity
*iface
, ULONG celt
)
95 EnumUserIdentity
*This
= impl_from_IEnumUserIdentity(iface
);
96 FIXME("(%p)->(%u)\n", This
, celt
);
100 static HRESULT WINAPI
EnumUserIdentity_Reset(IEnumUserIdentity
*iface
)
102 EnumUserIdentity
*This
= impl_from_IEnumUserIdentity(iface
);
103 FIXME("(%p)->()\n", This
);
107 static HRESULT WINAPI
EnumUserIdentity_Clone(IEnumUserIdentity
*iface
, IEnumUserIdentity
**ppenum
)
109 EnumUserIdentity
*This
= impl_from_IEnumUserIdentity(iface
);
110 FIXME("(%p)->(%p)\n", This
, ppenum
);
114 static HRESULT WINAPI
EnumUserIdentity_GetCount(IEnumUserIdentity
*iface
, ULONG
*pnCount
)
116 EnumUserIdentity
*This
= impl_from_IEnumUserIdentity(iface
);
118 FIXME("(%p)->(%p)\n", This
, pnCount
);
124 static const IEnumUserIdentityVtbl EnumUserIdentityVtbl
= {
125 EnumUserIdentity_QueryInterface
,
126 EnumUserIdentity_AddRef
,
127 EnumUserIdentity_Release
,
128 EnumUserIdentity_Next
,
129 EnumUserIdentity_Skip
,
130 EnumUserIdentity_Reset
,
131 EnumUserIdentity_Clone
,
132 EnumUserIdentity_GetCount
135 static HRESULT WINAPI
UserIdentityManager_QueryInterface(IUserIdentityManager
*iface
, REFIID riid
, void **ppv
)
137 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
138 TRACE("(IID_IUnknown %p)\n", ppv
);
140 }else if(IsEqualGUID(&IID_IUserIdentityManager
, riid
)) {
141 TRACE("(IID_IUserIdentityManager %p)\n", ppv
);
144 WARN("(%s %p)\n", debugstr_guid(riid
), ppv
);
146 return E_NOINTERFACE
;
149 IUnknown_AddRef((IUnknown
*)*ppv
);
153 static ULONG WINAPI
UserIdentityManager_AddRef(IUserIdentityManager
*iface
)
159 static ULONG WINAPI
UserIdentityManager_Release(IUserIdentityManager
*iface
)
165 static HRESULT WINAPI
UserIdentityManager_EnumIdentities(IUserIdentityManager
*iface
, IEnumUserIdentity
**ppEnumUser
)
167 EnumUserIdentity
*ret
;
169 TRACE("(%p)\n", ppEnumUser
);
171 ret
= heap_alloc(sizeof(*ret
));
173 return E_OUTOFMEMORY
;
175 ret
->IEnumUserIdentity_iface
.lpVtbl
= &EnumUserIdentityVtbl
;
178 *ppEnumUser
= &ret
->IEnumUserIdentity_iface
;
182 static HRESULT WINAPI
UserIdentityManager_ManageIdentities(IUserIdentityManager
*iface
, HWND hwndParent
, DWORD dwFlags
)
184 FIXME("(%p %x)\n", hwndParent
, dwFlags
);
188 static HRESULT WINAPI
UserIdentityManager_Logon(IUserIdentityManager
*iface
, HWND hwndParent
,
189 DWORD dwFlags
, IUserIdentity
**ppIdentity
)
191 FIXME("(%p %x %p)\n", hwndParent
, dwFlags
, ppIdentity
);
192 return E_USER_CANCELLED
;
195 static HRESULT WINAPI
UserIdentityManager_Logoff(IUserIdentityManager
*iface
, HWND hwndParent
)
197 FIXME("(%p)\n", hwndParent
);
201 static HRESULT WINAPI
UserIdentityManager_GetIdentityByCookie(IUserIdentityManager
*iface
, GUID
*uidCookie
,
202 IUserIdentity
**ppIdentity
)
204 FIXME("(%p %p)\n", uidCookie
, ppIdentity
);
208 static const IUserIdentityManagerVtbl UserIdentityManagerVtbl
= {
209 UserIdentityManager_QueryInterface
,
210 UserIdentityManager_AddRef
,
211 UserIdentityManager_Release
,
212 UserIdentityManager_EnumIdentities
,
213 UserIdentityManager_ManageIdentities
,
214 UserIdentityManager_Logon
,
215 UserIdentityManager_Logoff
,
216 UserIdentityManager_GetIdentityByCookie
219 static IUserIdentityManager UserIdentityManager
= { &UserIdentityManagerVtbl
};
221 static HRESULT WINAPI
UserIdentityManager_CreateInstance(IClassFactory
*iface
, IUnknown
*outer
, REFIID riid
, void **ppv
)
225 return IUserIdentityManager_QueryInterface(&UserIdentityManager
, riid
, ppv
);
228 static HRESULT WINAPI
ClassFactory_QueryInterface(IClassFactory
*iface
, REFIID riid
, void **ppv
)
232 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
233 TRACE("(%p)->(IID_IUnknown %p)\n", iface
, ppv
);
235 }else if(IsEqualGUID(&IID_IClassFactory
, riid
)) {
236 TRACE("(%p)->(IID_IClassFactory %p)\n", iface
, ppv
);
241 IUnknown_AddRef((IUnknown
*)*ppv
);
245 FIXME("(%p)->(%s %p)\n", iface
, debugstr_guid(riid
), ppv
);
246 return E_NOINTERFACE
;
249 static ULONG WINAPI
ClassFactory_AddRef(IClassFactory
*iface
)
251 TRACE("(%p)\n", iface
);
255 static ULONG WINAPI
ClassFactory_Release(IClassFactory
*iface
)
257 TRACE("(%p)\n", iface
);
261 static HRESULT WINAPI
ClassFactory_LockServer(IClassFactory
*iface
, BOOL fLock
)
263 TRACE("(%p)->(%x)\n", iface
, fLock
);
267 static const IClassFactoryVtbl UserIdentityManagerCFVtbl
= {
268 ClassFactory_QueryInterface
,
270 ClassFactory_Release
,
271 UserIdentityManager_CreateInstance
,
272 ClassFactory_LockServer
275 static IClassFactory UserIdentityManagerCF
= { &UserIdentityManagerCFVtbl
};
277 /******************************************************************
278 * DllMain (msident.@)
280 BOOL WINAPI
DllMain(HINSTANCE hInstDLL
, DWORD fdwReason
, LPVOID lpv
)
282 TRACE("(%p %d %p)\n", hInstDLL
, fdwReason
, lpv
);
286 case DLL_WINE_PREATTACH
:
287 return FALSE
; /* prefer native version */
288 case DLL_PROCESS_ATTACH
:
289 msident_instance
= hInstDLL
;
290 DisableThreadLibraryCalls(hInstDLL
);
297 /***********************************************************************
298 * DllGetClassObject (msident.@)
300 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
)
302 if(IsEqualGUID(&CLSID_UserIdentityManager
, rclsid
)) {
303 TRACE("CLSID_UserIdentityManager\n");
304 return IClassFactory_QueryInterface(&UserIdentityManagerCF
, riid
, ppv
);
307 FIXME("%s %s %p\n", debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
308 return CLASS_E_CLASSNOTAVAILABLE
;
311 /***********************************************************************
312 * DllCanUnloadNow (msident.@)
314 HRESULT WINAPI
DllCanUnloadNow(void)
319 /***********************************************************************
320 * DllRegisterServer (msident.@)
322 HRESULT WINAPI
DllRegisterServer(void)
325 return __wine_register_resources(msident_instance
);
328 /***********************************************************************
329 * DllUnregisterServer (msident.@)
331 HRESULT WINAPI
DllUnregisterServer(void)
334 return __wine_unregister_resources(msident_instance
);