2 * Copyright 2014 Hans Leidekker 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
28 #include "netlistmgr.h"
30 #include "wine/debug.h"
31 #include "netprofm_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(netprofm
);
37 INetworkListManager INetworkListManager_iface
;
38 INetworkCostManager INetworkCostManager_iface
;
39 IConnectionPointContainer IConnectionPointContainer_iface
;
43 static inline struct list_manager
*impl_from_IConnectionPointContainer(IConnectionPointContainer
*iface
)
45 return CONTAINING_RECORD(iface
, struct list_manager
, IConnectionPointContainer_iface
);
48 static inline struct list_manager
*impl_from_INetworkCostManager(
49 INetworkCostManager
*iface
)
51 return CONTAINING_RECORD( iface
, struct list_manager
, INetworkCostManager_iface
);
54 static HRESULT WINAPI
cost_manager_QueryInterface(
55 INetworkCostManager
*iface
,
59 struct list_manager
*mgr
= impl_from_INetworkCostManager( iface
);
60 return INetworkListManager_QueryInterface( &mgr
->INetworkListManager_iface
, riid
, obj
);
63 static ULONG WINAPI
cost_manager_AddRef(
64 INetworkCostManager
*iface
)
66 struct list_manager
*mgr
= impl_from_INetworkCostManager( iface
);
67 return INetworkListManager_AddRef( &mgr
->INetworkListManager_iface
);
70 static ULONG WINAPI
cost_manager_Release(
71 INetworkCostManager
*iface
)
73 struct list_manager
*mgr
= impl_from_INetworkCostManager( iface
);
74 return INetworkListManager_Release( &mgr
->INetworkListManager_iface
);
77 static HRESULT WINAPI
cost_manager_GetCost(
78 INetworkCostManager
*iface
, DWORD
*pCost
, NLM_SOCKADDR
*pDestIPAddr
)
80 FIXME( "%p, %p, %p\n", iface
, pCost
, pDestIPAddr
);
82 if (!pCost
) return E_POINTER
;
84 *pCost
= NLM_CONNECTION_COST_UNRESTRICTED
;
88 static HRESULT WINAPI
cost_manager_GetDataPlanStatus(
89 INetworkCostManager
*iface
, NLM_DATAPLAN_STATUS
*pDataPlanStatus
,
90 NLM_SOCKADDR
*pDestIPAddr
)
92 FIXME( "%p, %p, %p\n", iface
, pDataPlanStatus
, pDestIPAddr
);
96 static HRESULT WINAPI
cost_manager_SetDestinationAddresses(
97 INetworkCostManager
*iface
, UINT32 length
, NLM_SOCKADDR
*pDestIPAddrList
,
100 FIXME( "%p, %u, %p, %x\n", iface
, length
, pDestIPAddrList
, bAppend
);
104 static const INetworkCostManagerVtbl cost_manager_vtbl
=
106 cost_manager_QueryInterface
,
108 cost_manager_Release
,
109 cost_manager_GetCost
,
110 cost_manager_GetDataPlanStatus
,
111 cost_manager_SetDestinationAddresses
114 static inline struct list_manager
*impl_from_INetworkListManager(
115 INetworkListManager
*iface
)
117 return CONTAINING_RECORD( iface
, struct list_manager
, INetworkListManager_iface
);
120 static ULONG WINAPI
list_manager_AddRef(
121 INetworkListManager
*iface
)
123 struct list_manager
*mgr
= impl_from_INetworkListManager( iface
);
124 return InterlockedIncrement( &mgr
->refs
);
127 static ULONG WINAPI
list_manager_Release(
128 INetworkListManager
*iface
)
130 struct list_manager
*mgr
= impl_from_INetworkListManager( iface
);
131 LONG refs
= InterlockedDecrement( &mgr
->refs
);
134 TRACE( "destroying %p\n", mgr
);
135 HeapFree( GetProcessHeap(), 0, mgr
);
140 static HRESULT WINAPI
list_manager_QueryInterface(
141 INetworkListManager
*iface
,
145 struct list_manager
*mgr
= impl_from_INetworkListManager( iface
);
147 TRACE( "%p, %s, %p\n", mgr
, debugstr_guid(riid
), obj
);
149 if (IsEqualGUID( riid
, &IID_INetworkListManager
) ||
150 IsEqualGUID( riid
, &IID_IUnknown
))
154 else if (IsEqualGUID( riid
, &IID_INetworkCostManager
))
156 *obj
= &mgr
->INetworkCostManager_iface
;
158 else if (IsEqualGUID( riid
, &IID_IConnectionPointContainer
))
160 *obj
= &mgr
->IConnectionPointContainer_iface
;
164 FIXME( "interface %s not implemented\n", debugstr_guid(riid
) );
165 return E_NOINTERFACE
;
167 INetworkListManager_AddRef( iface
);
171 static HRESULT WINAPI
list_manager_GetTypeInfoCount(
172 INetworkListManager
*iface
,
179 static HRESULT WINAPI
list_manager_GetTypeInfo(
180 INetworkListManager
*iface
,
189 static HRESULT WINAPI
list_manager_GetIDsOfNames(
190 INetworkListManager
*iface
,
201 static HRESULT WINAPI
list_manager_Invoke(
202 INetworkListManager
*iface
,
209 EXCEPINFO
*excep_info
,
216 static HRESULT WINAPI
list_manager_GetNetworks(
217 INetworkListManager
*iface
,
218 NLM_ENUM_NETWORK Flags
,
219 IEnumNetworks
**ppEnumNetwork
)
221 FIXME( "%p, %x, %p\n", iface
, Flags
, ppEnumNetwork
);
225 static HRESULT WINAPI
list_manager_GetNetwork(
226 INetworkListManager
*iface
,
228 INetwork
**ppNetwork
)
230 FIXME( "%p, %s, %p\n", iface
, debugstr_guid(&gdNetworkId
), ppNetwork
);
234 static HRESULT WINAPI
list_manager_GetNetworkConnections(
235 INetworkListManager
*iface
,
236 IEnumNetworkConnections
**ppEnum
)
238 FIXME( "%p, %p\n", iface
, ppEnum
);
242 static HRESULT WINAPI
list_manager_GetNetworkConnection(
243 INetworkListManager
*iface
,
244 GUID gdNetworkConnectionId
,
245 INetworkConnection
**ppNetworkConnection
)
247 FIXME( "%p, %s, %p\n", iface
, debugstr_guid(&gdNetworkConnectionId
),
248 ppNetworkConnection
);
252 static HRESULT WINAPI
list_manager_IsConnectedToInternet(
253 INetworkListManager
*iface
,
254 VARIANT_BOOL
*pbIsConnected
)
256 FIXME( "%p, %p\n", iface
, pbIsConnected
);
258 *pbIsConnected
= VARIANT_TRUE
;
262 static HRESULT WINAPI
list_manager_IsConnected(
263 INetworkListManager
*iface
,
264 VARIANT_BOOL
*pbIsConnected
)
266 FIXME( "%p, %p\n", iface
, pbIsConnected
);
268 *pbIsConnected
= VARIANT_TRUE
;
272 static HRESULT WINAPI
list_manager_GetConnectivity(
273 INetworkListManager
*iface
,
274 NLM_CONNECTIVITY
*pConnectivity
)
276 FIXME( "%p, %p\n", iface
, pConnectivity
);
278 *pConnectivity
= NLM_CONNECTIVITY_IPV4_INTERNET
;
282 static const INetworkListManagerVtbl list_manager_vtbl
=
284 list_manager_QueryInterface
,
286 list_manager_Release
,
287 list_manager_GetTypeInfoCount
,
288 list_manager_GetTypeInfo
,
289 list_manager_GetIDsOfNames
,
291 list_manager_GetNetworks
,
292 list_manager_GetNetwork
,
293 list_manager_GetNetworkConnections
,
294 list_manager_GetNetworkConnection
,
295 list_manager_IsConnectedToInternet
,
296 list_manager_IsConnected
,
297 list_manager_GetConnectivity
300 static HRESULT WINAPI
ConnectionPointContainer_QueryInterface(IConnectionPointContainer
*iface
,
301 REFIID riid
, void **ppv
)
303 struct list_manager
*This
= impl_from_IConnectionPointContainer( iface
);
304 return INetworkListManager_QueryInterface(&This
->INetworkListManager_iface
, riid
, ppv
);
307 static ULONG WINAPI
ConnectionPointContainer_AddRef(IConnectionPointContainer
*iface
)
309 struct list_manager
*This
= impl_from_IConnectionPointContainer( iface
);
310 return INetworkListManager_AddRef(&This
->INetworkListManager_iface
);
313 static ULONG WINAPI
ConnectionPointContainer_Release(IConnectionPointContainer
*iface
)
315 struct list_manager
*This
= impl_from_IConnectionPointContainer( iface
);
316 return INetworkListManager_Release(&This
->INetworkListManager_iface
);
319 static HRESULT WINAPI
ConnectionPointContainer_EnumConnectionPoints(IConnectionPointContainer
*iface
,
320 IEnumConnectionPoints
**ppEnum
)
322 struct list_manager
*This
= impl_from_IConnectionPointContainer( iface
);
323 FIXME("(%p)->(%p): stub\n", This
, ppEnum
);
327 static HRESULT WINAPI
ConnectionPointContainer_FindConnectionPoint(IConnectionPointContainer
*iface
,
328 REFIID riid
, IConnectionPoint
**cp
)
330 struct list_manager
*This
= impl_from_IConnectionPointContainer( iface
);
331 FIXME("(%p)->(%s %p): stub\n", This
, debugstr_guid(riid
), cp
);
335 static const struct IConnectionPointContainerVtbl cpc_vtbl
=
337 ConnectionPointContainer_QueryInterface
,
338 ConnectionPointContainer_AddRef
,
339 ConnectionPointContainer_Release
,
340 ConnectionPointContainer_EnumConnectionPoints
,
341 ConnectionPointContainer_FindConnectionPoint
344 HRESULT
list_manager_create( void **obj
)
346 struct list_manager
*mgr
;
348 TRACE( "%p\n", obj
);
350 if (!(mgr
= HeapAlloc( GetProcessHeap(), 0, sizeof(*mgr
) ))) return E_OUTOFMEMORY
;
351 mgr
->INetworkListManager_iface
.lpVtbl
= &list_manager_vtbl
;
352 mgr
->INetworkCostManager_iface
.lpVtbl
= &cost_manager_vtbl
;
353 mgr
->IConnectionPointContainer_iface
.lpVtbl
= &cpc_vtbl
;
356 *obj
= &mgr
->INetworkListManager_iface
;
357 TRACE( "returning iface %p\n", *obj
);