riched20: Initial support for changing font properties.
[wine/multimedia.git] / dlls / netprofm / list.c
blob783b9cdcc453fd06e7ee45edd9e889b9a55fdefa
1 /*
2 * Copyright 2014 Hans Leidekker for CodeWeavers
3 * Copyright 2015 Michael Müller
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #define COBJMACROS
22 #include "config.h"
23 #include <stdarg.h>
24 #include "windef.h"
25 #include "winbase.h"
26 #include "initguid.h"
27 #include "objbase.h"
28 #include "ocidl.h"
29 #include "netlistmgr.h"
30 #include "olectl.h"
32 #include "wine/debug.h"
33 #include "netprofm_private.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(netprofm);
37 struct list_manager
39 INetworkListManager INetworkListManager_iface;
40 INetworkCostManager INetworkCostManager_iface;
41 IConnectionPointContainer IConnectionPointContainer_iface;
42 LONG refs;
45 struct connection_point
47 IConnectionPoint IConnectionPoint_iface;
48 IConnectionPointContainer *container;
49 LONG refs;
50 IID iid;
53 static inline struct list_manager *impl_from_IConnectionPointContainer(IConnectionPointContainer *iface)
55 return CONTAINING_RECORD(iface, struct list_manager, IConnectionPointContainer_iface);
58 static inline struct list_manager *impl_from_INetworkCostManager(
59 INetworkCostManager *iface )
61 return CONTAINING_RECORD( iface, struct list_manager, INetworkCostManager_iface );
64 static inline struct connection_point *impl_from_IConnectionPoint(
65 IConnectionPoint *iface )
67 return CONTAINING_RECORD( iface, struct connection_point, IConnectionPoint_iface );
70 static HRESULT WINAPI connection_point_QueryInterface(
71 IConnectionPoint *iface,
72 REFIID riid,
73 void **obj )
75 struct connection_point *cp = impl_from_IConnectionPoint( iface );
76 TRACE( "%p, %s, %p\n", cp, debugstr_guid(riid), obj );
78 if (IsEqualGUID( riid, &IID_IConnectionPoint ) ||
79 IsEqualGUID( riid, &IID_IUnknown ))
81 *obj = iface;
83 else
85 FIXME( "interface %s not implemented\n", debugstr_guid(riid) );
86 return E_NOINTERFACE;
88 IConnectionPoint_AddRef( iface );
89 return S_OK;
92 static ULONG WINAPI connection_point_AddRef(
93 IConnectionPoint *iface )
95 struct connection_point *cp = impl_from_IConnectionPoint( iface );
96 return InterlockedIncrement( &cp->refs );
99 static ULONG WINAPI connection_point_Release(
100 IConnectionPoint *iface )
102 struct connection_point *cp = impl_from_IConnectionPoint( iface );
103 LONG refs = InterlockedDecrement( &cp->refs );
104 if (!refs)
106 TRACE( "destroying %p\n", cp );
107 IConnectionPointContainer_Release( cp->container );
108 HeapFree( GetProcessHeap(), 0, cp );
110 return refs;
113 static HRESULT WINAPI connection_point_GetConnectionInterface(
114 IConnectionPoint *iface,
115 IID *iid )
117 struct connection_point *cp = impl_from_IConnectionPoint( iface );
118 TRACE( "%p, %p\n", cp, iid );
120 if (!iid)
121 return E_POINTER;
123 memcpy( iid, &cp->iid, sizeof(*iid) );
124 return S_OK;
127 static HRESULT WINAPI connection_point_GetConnectionPointContainer(
128 IConnectionPoint *iface,
129 IConnectionPointContainer **container )
131 struct connection_point *cp = impl_from_IConnectionPoint( iface );
132 TRACE( "%p, %p\n", cp, container );
134 if (!container)
135 return E_POINTER;
137 IConnectionPointContainer_AddRef( cp->container );
138 *container = cp->container;
139 return S_OK;
142 static HRESULT WINAPI connection_point_Advise(
143 IConnectionPoint *iface,
144 IUnknown *sink,
145 DWORD *cookie )
147 struct connection_point *cp = impl_from_IConnectionPoint( iface );
148 FIXME( "%p, %p, %p - stub\n", cp, sink, cookie );
150 if (!sink || !cookie)
151 return E_POINTER;
153 return CONNECT_E_CANNOTCONNECT;
156 static HRESULT WINAPI connection_point_Unadvise(
157 IConnectionPoint *iface,
158 DWORD cookie )
160 struct connection_point *cp = impl_from_IConnectionPoint( iface );
161 FIXME( "%p, %d - stub\n", cp, cookie );
163 return E_POINTER;
166 static HRESULT WINAPI connection_point_EnumConnections(
167 IConnectionPoint *iface,
168 IEnumConnections **connections )
170 struct connection_point *cp = impl_from_IConnectionPoint( iface );
171 FIXME( "%p, %p - stub\n", cp, connections );
173 return E_NOTIMPL;
176 static const IConnectionPointVtbl connection_point_vtbl =
178 connection_point_QueryInterface,
179 connection_point_AddRef,
180 connection_point_Release,
181 connection_point_GetConnectionInterface,
182 connection_point_GetConnectionPointContainer,
183 connection_point_Advise,
184 connection_point_Unadvise,
185 connection_point_EnumConnections
188 static HRESULT connection_point_create(
189 IConnectionPoint **obj,
190 REFIID riid,
191 IConnectionPointContainer *container )
193 struct connection_point *cp;
194 TRACE( "%p, %s, %p\n", obj, debugstr_guid(riid), container );
196 if (!(cp = HeapAlloc( GetProcessHeap(), 0, sizeof(*cp) ))) return E_OUTOFMEMORY;
197 cp->IConnectionPoint_iface.lpVtbl = &connection_point_vtbl;
198 cp->container = container;
199 cp->refs = 1;
201 memcpy( &cp->iid, riid, sizeof(*riid) );
202 IConnectionPointContainer_AddRef( container );
204 *obj = &cp->IConnectionPoint_iface;
205 TRACE( "returning iface %p\n", *obj );
206 return S_OK;
209 static HRESULT WINAPI cost_manager_QueryInterface(
210 INetworkCostManager *iface,
211 REFIID riid,
212 void **obj )
214 struct list_manager *mgr = impl_from_INetworkCostManager( iface );
215 return INetworkListManager_QueryInterface( &mgr->INetworkListManager_iface, riid, obj );
218 static ULONG WINAPI cost_manager_AddRef(
219 INetworkCostManager *iface )
221 struct list_manager *mgr = impl_from_INetworkCostManager( iface );
222 return INetworkListManager_AddRef( &mgr->INetworkListManager_iface );
225 static ULONG WINAPI cost_manager_Release(
226 INetworkCostManager *iface )
228 struct list_manager *mgr = impl_from_INetworkCostManager( iface );
229 return INetworkListManager_Release( &mgr->INetworkListManager_iface );
232 static HRESULT WINAPI cost_manager_GetCost(
233 INetworkCostManager *iface, DWORD *pCost, NLM_SOCKADDR *pDestIPAddr)
235 FIXME( "%p, %p, %p\n", iface, pCost, pDestIPAddr );
237 if (!pCost) return E_POINTER;
239 *pCost = NLM_CONNECTION_COST_UNRESTRICTED;
240 return S_OK;
243 static HRESULT WINAPI cost_manager_GetDataPlanStatus(
244 INetworkCostManager *iface, NLM_DATAPLAN_STATUS *pDataPlanStatus,
245 NLM_SOCKADDR *pDestIPAddr)
247 FIXME( "%p, %p, %p\n", iface, pDataPlanStatus, pDestIPAddr );
248 return E_NOTIMPL;
251 static HRESULT WINAPI cost_manager_SetDestinationAddresses(
252 INetworkCostManager *iface, UINT32 length, NLM_SOCKADDR *pDestIPAddrList,
253 VARIANT_BOOL bAppend)
255 FIXME( "%p, %u, %p, %x\n", iface, length, pDestIPAddrList, bAppend );
256 return E_NOTIMPL;
259 static const INetworkCostManagerVtbl cost_manager_vtbl =
261 cost_manager_QueryInterface,
262 cost_manager_AddRef,
263 cost_manager_Release,
264 cost_manager_GetCost,
265 cost_manager_GetDataPlanStatus,
266 cost_manager_SetDestinationAddresses
269 static inline struct list_manager *impl_from_INetworkListManager(
270 INetworkListManager *iface )
272 return CONTAINING_RECORD( iface, struct list_manager, INetworkListManager_iface );
275 static ULONG WINAPI list_manager_AddRef(
276 INetworkListManager *iface )
278 struct list_manager *mgr = impl_from_INetworkListManager( iface );
279 return InterlockedIncrement( &mgr->refs );
282 static ULONG WINAPI list_manager_Release(
283 INetworkListManager *iface )
285 struct list_manager *mgr = impl_from_INetworkListManager( iface );
286 LONG refs = InterlockedDecrement( &mgr->refs );
287 if (!refs)
289 TRACE( "destroying %p\n", mgr );
290 HeapFree( GetProcessHeap(), 0, mgr );
292 return refs;
295 static HRESULT WINAPI list_manager_QueryInterface(
296 INetworkListManager *iface,
297 REFIID riid,
298 void **obj )
300 struct list_manager *mgr = impl_from_INetworkListManager( iface );
302 TRACE( "%p, %s, %p\n", mgr, debugstr_guid(riid), obj );
304 if (IsEqualGUID( riid, &IID_INetworkListManager ) ||
305 IsEqualGUID( riid, &IID_IUnknown ))
307 *obj = iface;
309 else if (IsEqualGUID( riid, &IID_INetworkCostManager ))
311 *obj = &mgr->INetworkCostManager_iface;
313 else if (IsEqualGUID( riid, &IID_IConnectionPointContainer ))
315 *obj = &mgr->IConnectionPointContainer_iface;
317 else
319 FIXME( "interface %s not implemented\n", debugstr_guid(riid) );
320 return E_NOINTERFACE;
322 INetworkListManager_AddRef( iface );
323 return S_OK;
326 static HRESULT WINAPI list_manager_GetTypeInfoCount(
327 INetworkListManager *iface,
328 UINT *count )
330 FIXME("\n");
331 return E_NOTIMPL;
334 static HRESULT WINAPI list_manager_GetTypeInfo(
335 INetworkListManager *iface,
336 UINT index,
337 LCID lcid,
338 ITypeInfo **info )
340 FIXME("\n");
341 return E_NOTIMPL;
344 static HRESULT WINAPI list_manager_GetIDsOfNames(
345 INetworkListManager *iface,
346 REFIID riid,
347 LPOLESTR *names,
348 UINT count,
349 LCID lcid,
350 DISPID *dispid )
352 FIXME("\n");
353 return E_NOTIMPL;
356 static HRESULT WINAPI list_manager_Invoke(
357 INetworkListManager *iface,
358 DISPID member,
359 REFIID riid,
360 LCID lcid,
361 WORD flags,
362 DISPPARAMS *params,
363 VARIANT *result,
364 EXCEPINFO *excep_info,
365 UINT *arg_err )
367 FIXME("\n");
368 return E_NOTIMPL;
371 static HRESULT WINAPI list_manager_GetNetworks(
372 INetworkListManager *iface,
373 NLM_ENUM_NETWORK Flags,
374 IEnumNetworks **ppEnumNetwork )
376 FIXME( "%p, %x, %p\n", iface, Flags, ppEnumNetwork );
377 return E_NOTIMPL;
380 static HRESULT WINAPI list_manager_GetNetwork(
381 INetworkListManager *iface,
382 GUID gdNetworkId,
383 INetwork **ppNetwork )
385 FIXME( "%p, %s, %p\n", iface, debugstr_guid(&gdNetworkId), ppNetwork );
386 return E_NOTIMPL;
389 static HRESULT WINAPI list_manager_GetNetworkConnections(
390 INetworkListManager *iface,
391 IEnumNetworkConnections **ppEnum )
393 FIXME( "%p, %p\n", iface, ppEnum );
394 return E_NOTIMPL;
397 static HRESULT WINAPI list_manager_GetNetworkConnection(
398 INetworkListManager *iface,
399 GUID gdNetworkConnectionId,
400 INetworkConnection **ppNetworkConnection )
402 FIXME( "%p, %s, %p\n", iface, debugstr_guid(&gdNetworkConnectionId),
403 ppNetworkConnection );
404 return E_NOTIMPL;
407 static HRESULT WINAPI list_manager_IsConnectedToInternet(
408 INetworkListManager *iface,
409 VARIANT_BOOL *pbIsConnected )
411 FIXME( "%p, %p\n", iface, pbIsConnected );
413 *pbIsConnected = VARIANT_TRUE;
414 return S_OK;
417 static HRESULT WINAPI list_manager_IsConnected(
418 INetworkListManager *iface,
419 VARIANT_BOOL *pbIsConnected )
421 FIXME( "%p, %p\n", iface, pbIsConnected );
423 *pbIsConnected = VARIANT_TRUE;
424 return S_OK;
427 static HRESULT WINAPI list_manager_GetConnectivity(
428 INetworkListManager *iface,
429 NLM_CONNECTIVITY *pConnectivity )
431 FIXME( "%p, %p\n", iface, pConnectivity );
433 *pConnectivity = NLM_CONNECTIVITY_IPV4_INTERNET;
434 return S_OK;
437 static const INetworkListManagerVtbl list_manager_vtbl =
439 list_manager_QueryInterface,
440 list_manager_AddRef,
441 list_manager_Release,
442 list_manager_GetTypeInfoCount,
443 list_manager_GetTypeInfo,
444 list_manager_GetIDsOfNames,
445 list_manager_Invoke,
446 list_manager_GetNetworks,
447 list_manager_GetNetwork,
448 list_manager_GetNetworkConnections,
449 list_manager_GetNetworkConnection,
450 list_manager_IsConnectedToInternet,
451 list_manager_IsConnected,
452 list_manager_GetConnectivity
455 static HRESULT WINAPI ConnectionPointContainer_QueryInterface(IConnectionPointContainer *iface,
456 REFIID riid, void **ppv)
458 struct list_manager *This = impl_from_IConnectionPointContainer( iface );
459 return INetworkListManager_QueryInterface(&This->INetworkListManager_iface, riid, ppv);
462 static ULONG WINAPI ConnectionPointContainer_AddRef(IConnectionPointContainer *iface)
464 struct list_manager *This = impl_from_IConnectionPointContainer( iface );
465 return INetworkListManager_AddRef(&This->INetworkListManager_iface);
468 static ULONG WINAPI ConnectionPointContainer_Release(IConnectionPointContainer *iface)
470 struct list_manager *This = impl_from_IConnectionPointContainer( iface );
471 return INetworkListManager_Release(&This->INetworkListManager_iface);
474 static HRESULT WINAPI ConnectionPointContainer_EnumConnectionPoints(IConnectionPointContainer *iface,
475 IEnumConnectionPoints **ppEnum)
477 struct list_manager *This = impl_from_IConnectionPointContainer( iface );
478 FIXME("(%p)->(%p): stub\n", This, ppEnum);
479 return E_NOTIMPL;
482 static HRESULT WINAPI ConnectionPointContainer_FindConnectionPoint(IConnectionPointContainer *iface,
483 REFIID riid, IConnectionPoint **cp)
485 struct list_manager *This = impl_from_IConnectionPointContainer( iface );
487 TRACE( "%p, %s, %p\n", This, debugstr_guid(riid), cp );
489 if (!riid || !cp)
490 return E_POINTER;
492 if (IsEqualGUID( riid, &IID_INetworkListManagerEvents ))
493 return connection_point_create( cp, riid, iface );
495 FIXME( "interface %s not implemented\n", debugstr_guid(riid) );
497 *cp = NULL;
498 return E_NOINTERFACE;
501 static const struct IConnectionPointContainerVtbl cpc_vtbl =
503 ConnectionPointContainer_QueryInterface,
504 ConnectionPointContainer_AddRef,
505 ConnectionPointContainer_Release,
506 ConnectionPointContainer_EnumConnectionPoints,
507 ConnectionPointContainer_FindConnectionPoint
510 HRESULT list_manager_create( void **obj )
512 struct list_manager *mgr;
514 TRACE( "%p\n", obj );
516 if (!(mgr = HeapAlloc( GetProcessHeap(), 0, sizeof(*mgr) ))) return E_OUTOFMEMORY;
517 mgr->INetworkListManager_iface.lpVtbl = &list_manager_vtbl;
518 mgr->INetworkCostManager_iface.lpVtbl = &cost_manager_vtbl;
519 mgr->IConnectionPointContainer_iface.lpVtbl = &cpc_vtbl;
520 mgr->refs = 1;
522 *obj = &mgr->INetworkListManager_iface;
523 TRACE( "returning iface %p\n", *obj );
524 return S_OK;