2 * Copyright 2014 Alistair Leslie-Hughes
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
25 #include "wine/debug.h"
27 WINE_DEFAULT_DEBUG_CHANNEL( netcfgx
);
30 typedef struct NetConfiguration
32 INetCfg INetCfg_iface
;
33 INetCfgLock INetCfgLock_iface
;
38 static inline NetConfiguration
*impl_from_INetCfg(INetCfg
*iface
)
40 return CONTAINING_RECORD(iface
, NetConfiguration
, INetCfg_iface
);
43 static inline NetConfiguration
*impl_from_INetCfgLock(INetCfgLock
*iface
)
45 return CONTAINING_RECORD(iface
, NetConfiguration
, INetCfgLock_iface
);
48 static HRESULT WINAPI
netcfg_QueryInterface(INetCfg
*iface
, REFIID riid
, void **ppvObject
)
50 NetConfiguration
*This
= impl_from_INetCfg(iface
);
51 TRACE("%p %s %p\n", This
, debugstr_guid(riid
), ppvObject
);
53 if (IsEqualGUID(riid
, &IID_INetCfg
) ||
54 IsEqualGUID(riid
, &IID_IUnknown
))
56 *ppvObject
= &This
->INetCfg_iface
;
58 else if(IsEqualGUID(riid
, &IID_INetCfgLock
))
60 *ppvObject
= &This
->INetCfgLock_iface
;
64 FIXME("Unsupported interface %s\n", debugstr_guid(riid
));
68 IUnknown_AddRef((IUnknown
*)*ppvObject
);
73 static ULONG WINAPI
netcfg_AddRef(INetCfg
*iface
)
75 NetConfiguration
*This
= impl_from_INetCfg(iface
);
76 ULONG ref
= InterlockedIncrement(&This
->ref
);
78 TRACE("%p ref=%u\n", This
, ref
);
83 static ULONG WINAPI
netcfg_Release(INetCfg
*iface
)
85 NetConfiguration
*This
= impl_from_INetCfg(iface
);
86 ULONG ref
= InterlockedDecrement(&This
->ref
);
88 TRACE("%p ref=%u\n", This
, ref
);
92 HeapFree(GetProcessHeap(), 0, This
);
98 static HRESULT WINAPI
netcfg_Initialize(INetCfg
*iface
, PVOID pvReserved
)
100 NetConfiguration
*This
= impl_from_INetCfg(iface
);
101 FIXME("%p %p\n", This
, pvReserved
);
106 static HRESULT WINAPI
netcfg_Uninitialize(INetCfg
*iface
)
108 NetConfiguration
*This
= impl_from_INetCfg(iface
);
114 static HRESULT WINAPI
netcfg_Apply(INetCfg
*iface
)
116 NetConfiguration
*This
= impl_from_INetCfg(iface
);
122 static HRESULT WINAPI
netcfg_Cancel(INetCfg
*iface
)
124 NetConfiguration
*This
= impl_from_INetCfg(iface
);
130 static HRESULT WINAPI
netcfg_EnumComponents(INetCfg
*iface
, const GUID
*pguidClass
, IEnumNetCfgComponent
**ppenumComponent
)
132 NetConfiguration
*This
= impl_from_INetCfg(iface
);
133 FIXME("%p %s %p\n", This
, debugstr_guid(pguidClass
), ppenumComponent
);
138 static HRESULT WINAPI
netcfg_FindComponent(INetCfg
*iface
, LPCWSTR pszwInfId
, INetCfgComponent
**pComponent
)
140 NetConfiguration
*This
= impl_from_INetCfg(iface
);
141 FIXME("%p %s %p\n", This
, debugstr_w(pszwInfId
), pComponent
);
146 static HRESULT WINAPI
netcfg_QueryNetCfgClass(INetCfg
*iface
, const GUID
*pguidClass
, REFIID riid
, void **ppvObject
)
148 NetConfiguration
*This
= impl_from_INetCfg(iface
);
149 FIXME("%p %s %p\n", This
, debugstr_guid(pguidClass
), ppvObject
);
154 static const struct INetCfgVtbl NetCfgVtbl
=
156 netcfg_QueryInterface
,
163 netcfg_EnumComponents
,
164 netcfg_FindComponent
,
165 netcfg_QueryNetCfgClass
169 static HRESULT WINAPI
netcfglock_QueryInterface(INetCfgLock
*iface
, REFIID riid
,void **ppvObject
)
171 NetConfiguration
*This
= impl_from_INetCfgLock(iface
);
173 return netcfg_QueryInterface(&This
->INetCfg_iface
, riid
, ppvObject
);
176 static ULONG WINAPI
netcfglock_AddRef(INetCfgLock
*iface
)
178 NetConfiguration
*This
= impl_from_INetCfgLock(iface
);
180 return netcfg_AddRef(&This
->INetCfg_iface
);
183 static ULONG WINAPI
netcfglock_Release(INetCfgLock
*iface
)
185 NetConfiguration
*This
= impl_from_INetCfgLock(iface
);
186 return netcfg_Release(&This
->INetCfg_iface
);
189 static HRESULT WINAPI
netcfglock_AcquireWriteLock(INetCfgLock
*iface
, DWORD cmsTimeout
,
190 LPCWSTR pszwClientDescription
, LPWSTR
*ppszwClientDescription
)
192 NetConfiguration
*This
= impl_from_INetCfgLock(iface
);
193 FIXME("%p %d %s %p\n", This
, cmsTimeout
, debugstr_w(pszwClientDescription
), ppszwClientDescription
);
198 static HRESULT WINAPI
netcfglock_ReleaseWriteLock(INetCfgLock
*iface
)
200 NetConfiguration
*This
= impl_from_INetCfgLock(iface
);
206 static HRESULT WINAPI
netcfglock_IsWriteLocked(INetCfgLock
*iface
, LPWSTR
*ppszwClientDescription
)
208 NetConfiguration
*This
= impl_from_INetCfgLock(iface
);
209 FIXME("%p %p\n", This
, ppszwClientDescription
);
214 static const struct INetCfgLockVtbl NetCfgLockVtbl
=
216 netcfglock_QueryInterface
,
219 netcfglock_AcquireWriteLock
,
220 netcfglock_ReleaseWriteLock
,
221 netcfglock_IsWriteLocked
224 HRESULT
INetCfg_CreateInstance(IUnknown
**ppUnk
)
226 NetConfiguration
*This
;
228 This
= HeapAlloc(GetProcessHeap(), 0, sizeof(NetConfiguration
));
230 return E_OUTOFMEMORY
;
232 This
->INetCfg_iface
.lpVtbl
= &NetCfgVtbl
;
233 This
->INetCfgLock_iface
.lpVtbl
= &NetCfgLockVtbl
;
236 *ppUnk
= (IUnknown
*)&This
->INetCfg_iface
;