d3dcompiler_43: Use BOOL type where appropriate.
[wine.git] / dlls / msident / msident.c
blobc12c19b5102dce071bddd92c994f6cf9fd41639f
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 static inline void *heap_alloc(size_t len)
32 return HeapAlloc(GetProcessHeap(), 0, len);
35 static inline BOOL heap_free(void *mem)
37 return HeapFree(GetProcessHeap(), 0, mem);
40 static HINSTANCE msident_instance;
42 typedef struct {
43 IEnumUserIdentity IEnumUserIdentity_iface;
44 LONG ref;
45 } EnumUserIdentity;
47 static inline EnumUserIdentity *impl_from_IEnumUserIdentity(IEnumUserIdentity *iface)
49 return CONTAINING_RECORD(iface, EnumUserIdentity, IEnumUserIdentity_iface);
52 static HRESULT WINAPI EnumUserIdentity_QueryInterface(IEnumUserIdentity *iface, REFIID riid, void **ppv)
54 EnumUserIdentity *This = impl_from_IEnumUserIdentity(iface);
56 if(IsEqualGUID(&IID_IUnknown, riid)) {
57 TRACE("(IID_IUnknown %p)\n", ppv);
58 *ppv = &This->IEnumUserIdentity_iface;
59 }else if(IsEqualGUID(&IID_IEnumUserIdentity, riid)) {
60 TRACE("(IID_IEnumUserIdentity %p)\n", ppv);
61 *ppv = &This->IEnumUserIdentity_iface;
62 }else {
63 WARN("(%s %p)\n", debugstr_guid(riid), ppv);
64 *ppv = NULL;
65 return E_NOINTERFACE;
68 IUnknown_AddRef((IUnknown*)*ppv);
69 return S_OK;
72 static ULONG WINAPI EnumUserIdentity_AddRef(IEnumUserIdentity *iface)
74 EnumUserIdentity *This = impl_from_IEnumUserIdentity(iface);
75 LONG ref = InterlockedIncrement(&This->ref);
77 TRACE("(%p) ref=%d\n", This, ref);
79 return ref;
82 static ULONG WINAPI EnumUserIdentity_Release(IEnumUserIdentity *iface)
84 EnumUserIdentity *This = impl_from_IEnumUserIdentity(iface);
85 LONG ref = InterlockedDecrement(&This->ref);
87 TRACE("(%p) ref=%d\n", This, ref);
89 if(!ref)
90 heap_free(This);
92 return ref;
95 static HRESULT WINAPI EnumUserIdentity_Next(IEnumUserIdentity *iface, ULONG celt, IUnknown **rgelt, ULONG *pceltFetched)
97 EnumUserIdentity *This = impl_from_IEnumUserIdentity(iface);
98 FIXME("(%p)->(%u %p %p)\n", This, celt, rgelt, pceltFetched);
99 return E_NOTIMPL;
102 static HRESULT WINAPI EnumUserIdentity_Skip(IEnumUserIdentity *iface, ULONG celt)
104 EnumUserIdentity *This = impl_from_IEnumUserIdentity(iface);
105 FIXME("(%p)->(%u)\n", This, celt);
106 return E_NOTIMPL;
109 static HRESULT WINAPI EnumUserIdentity_Reset(IEnumUserIdentity *iface)
111 EnumUserIdentity *This = impl_from_IEnumUserIdentity(iface);
112 FIXME("(%p)->()\n", This);
113 return E_NOTIMPL;
116 static HRESULT WINAPI EnumUserIdentity_Clone(IEnumUserIdentity *iface, IEnumUserIdentity **ppenum)
118 EnumUserIdentity *This = impl_from_IEnumUserIdentity(iface);
119 FIXME("(%p)->(%p)\n", This, ppenum);
120 return E_NOTIMPL;
123 static HRESULT WINAPI EnumUserIdentity_GetCount(IEnumUserIdentity *iface, ULONG *pnCount)
125 EnumUserIdentity *This = impl_from_IEnumUserIdentity(iface);
127 FIXME("(%p)->(%p)\n", This, pnCount);
129 *pnCount = 0;
130 return S_OK;
133 static const IEnumUserIdentityVtbl EnumUserIdentityVtbl = {
134 EnumUserIdentity_QueryInterface,
135 EnumUserIdentity_AddRef,
136 EnumUserIdentity_Release,
137 EnumUserIdentity_Next,
138 EnumUserIdentity_Skip,
139 EnumUserIdentity_Reset,
140 EnumUserIdentity_Clone,
141 EnumUserIdentity_GetCount
144 static HRESULT WINAPI UserIdentityManager_QueryInterface(IUserIdentityManager *iface, REFIID riid, void **ppv)
146 if(IsEqualGUID(&IID_IUnknown, riid)) {
147 TRACE("(IID_IUnknown %p)\n", ppv);
148 *ppv = iface;
149 }else if(IsEqualGUID(&IID_IUserIdentityManager, riid)) {
150 TRACE("(IID_IUserIdentityManager %p)\n", ppv);
151 *ppv = iface;
152 }else {
153 WARN("(%s %p)\n", debugstr_guid(riid), ppv);
154 *ppv = NULL;
155 return E_NOINTERFACE;
158 IUnknown_AddRef((IUnknown*)*ppv);
159 return S_OK;
162 static ULONG WINAPI UserIdentityManager_AddRef(IUserIdentityManager *iface)
164 TRACE("\n");
165 return 2;
168 static ULONG WINAPI UserIdentityManager_Release(IUserIdentityManager *iface)
170 TRACE("\n");
171 return 1;
174 static HRESULT WINAPI UserIdentityManager_EnumIdentities(IUserIdentityManager *iface, IEnumUserIdentity **ppEnumUser)
176 EnumUserIdentity *ret;
178 TRACE("(%p)\n", ppEnumUser);
180 ret = heap_alloc(sizeof(*ret));
181 if(!ret)
182 return E_OUTOFMEMORY;
184 ret->IEnumUserIdentity_iface.lpVtbl = &EnumUserIdentityVtbl;
185 ret->ref = 1;
187 *ppEnumUser = &ret->IEnumUserIdentity_iface;
188 return S_OK;
191 static HRESULT WINAPI UserIdentityManager_ManageIdentities(IUserIdentityManager *iface, HWND hwndParent, DWORD dwFlags)
193 FIXME("(%p %x)\n", hwndParent, dwFlags);
194 return E_NOTIMPL;
197 static HRESULT WINAPI UserIdentityManager_Logon(IUserIdentityManager *iface, HWND hwndParent,
198 DWORD dwFlags, IUserIdentity **ppIdentity)
200 FIXME("(%p %x %p)\n", hwndParent, dwFlags, ppIdentity);
201 return E_USER_CANCELLED;
204 static HRESULT WINAPI UserIdentityManager_Logoff(IUserIdentityManager *iface, HWND hwndParent)
206 FIXME("(%p)\n", hwndParent);
207 return E_NOTIMPL;
210 static HRESULT WINAPI UserIdentityManager_GetIdentityByCookie(IUserIdentityManager *iface, GUID *uidCookie,
211 IUserIdentity **ppIdentity)
213 FIXME("(%p %p)\n", uidCookie, ppIdentity);
214 return E_NOTIMPL;
217 static const IUserIdentityManagerVtbl UserIdentityManagerVtbl = {
218 UserIdentityManager_QueryInterface,
219 UserIdentityManager_AddRef,
220 UserIdentityManager_Release,
221 UserIdentityManager_EnumIdentities,
222 UserIdentityManager_ManageIdentities,
223 UserIdentityManager_Logon,
224 UserIdentityManager_Logoff,
225 UserIdentityManager_GetIdentityByCookie
228 static IUserIdentityManager UserIdentityManager = { &UserIdentityManagerVtbl };
230 static HRESULT WINAPI UserIdentityManager_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
232 TRACE("\n");
234 return IUserIdentityManager_QueryInterface(&UserIdentityManager, riid, ppv);
237 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
239 *ppv = NULL;
241 if(IsEqualGUID(&IID_IUnknown, riid)) {
242 TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv);
243 *ppv = iface;
244 }else if(IsEqualGUID(&IID_IClassFactory, riid)) {
245 TRACE("(%p)->(IID_IClassFactory %p)\n", iface, ppv);
246 *ppv = iface;
249 if(*ppv) {
250 IUnknown_AddRef((IUnknown*)*ppv);
251 return S_OK;
254 FIXME("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
255 return E_NOINTERFACE;
258 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
260 TRACE("(%p)\n", iface);
261 return 2;
264 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
266 TRACE("(%p)\n", iface);
267 return 1;
270 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
272 TRACE("(%p)->(%x)\n", iface, fLock);
273 return S_OK;
276 static const IClassFactoryVtbl UserIdentityManagerCFVtbl = {
277 ClassFactory_QueryInterface,
278 ClassFactory_AddRef,
279 ClassFactory_Release,
280 UserIdentityManager_CreateInstance,
281 ClassFactory_LockServer
284 static IClassFactory UserIdentityManagerCF = { &UserIdentityManagerCFVtbl };
286 /******************************************************************
287 * DllMain (msident.@)
289 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
291 TRACE("(%p %d %p)\n", hInstDLL, fdwReason, lpv);
293 switch(fdwReason)
295 case DLL_WINE_PREATTACH:
296 return FALSE; /* prefer native version */
297 case DLL_PROCESS_ATTACH:
298 msident_instance = hInstDLL;
299 DisableThreadLibraryCalls(hInstDLL);
300 break;
303 return TRUE;
306 /***********************************************************************
307 * DllGetClassObject (msident.@)
309 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
311 if(IsEqualGUID(&CLSID_UserIdentityManager, rclsid)) {
312 TRACE("CLSID_UserIdentityManager\n");
313 return IClassFactory_QueryInterface(&UserIdentityManagerCF, riid, ppv);
316 FIXME("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
317 return CLASS_E_CLASSNOTAVAILABLE;
320 /***********************************************************************
321 * DllCanUnloadNow (msident.@)
323 HRESULT WINAPI DllCanUnloadNow(void)
325 return S_FALSE;
328 /***********************************************************************
329 * DllRegisterServer (msident.@)
331 HRESULT WINAPI DllRegisterServer(void)
333 TRACE("()\n");
334 return __wine_register_resources(msident_instance);
337 /***********************************************************************
338 * DllUnregisterServer (msident.@)
340 HRESULT WINAPI DllUnregisterServer(void)
342 TRACE("()\n");
343 return __wine_unregister_resources(msident_instance);