dbghelp: Use local declarations of r_debug and link_map structs.
[wine.git] / dlls / netcfgx / netcfg.c
blob90bfe750d68c867d4ff8342c3b19d6a44937d38f
1 /*
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
18 #include <stdio.h>
19 #include <stdarg.h>
20 #include <assert.h>
22 #define COBJMACROS
24 #include "netcfgx.h"
25 #include "wine/debug.h"
27 WINE_DEFAULT_DEBUG_CHANNEL( netcfgx );
30 typedef struct NetConfiguration
32 INetCfg INetCfg_iface;
33 INetCfgLock INetCfgLock_iface;
35 LONG ref;
36 } NetConfiguration;
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;
62 else
64 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
65 return E_NOINTERFACE;
68 IUnknown_AddRef((IUnknown*)*ppvObject);
70 return S_OK;
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);
80 return 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);
90 if (ref == 0)
92 HeapFree(GetProcessHeap(), 0, This);
95 return ref;
98 static HRESULT WINAPI netcfg_Initialize(INetCfg *iface, PVOID pvReserved)
100 NetConfiguration *This = impl_from_INetCfg(iface);
101 FIXME("%p %p\n", This, pvReserved);
103 return S_OK;
106 static HRESULT WINAPI netcfg_Uninitialize(INetCfg *iface)
108 NetConfiguration *This = impl_from_INetCfg(iface);
109 FIXME("%p\n", This);
111 return S_OK;
114 static HRESULT WINAPI netcfg_Apply(INetCfg *iface)
116 NetConfiguration *This = impl_from_INetCfg(iface);
117 FIXME("%p\n", This);
119 return E_NOTIMPL;
122 static HRESULT WINAPI netcfg_Cancel(INetCfg *iface)
124 NetConfiguration *This = impl_from_INetCfg(iface);
125 FIXME("%p\n", This);
127 return E_NOTIMPL;
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);
135 return E_NOTIMPL;
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);
143 return E_NOTIMPL;
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);
151 return E_NOTIMPL;
154 static const struct INetCfgVtbl NetCfgVtbl =
156 netcfg_QueryInterface,
157 netcfg_AddRef,
158 netcfg_Release,
159 netcfg_Initialize,
160 netcfg_Uninitialize,
161 netcfg_Apply,
162 netcfg_Cancel,
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);
195 return S_OK;
198 static HRESULT WINAPI netcfglock_ReleaseWriteLock(INetCfgLock *iface)
200 NetConfiguration *This = impl_from_INetCfgLock(iface);
201 FIXME("%p\n", This);
203 return S_OK;
206 static HRESULT WINAPI netcfglock_IsWriteLocked(INetCfgLock *iface, LPWSTR *ppszwClientDescription)
208 NetConfiguration *This = impl_from_INetCfgLock(iface);
209 FIXME("%p %p\n", This, ppszwClientDescription);
211 return E_NOTIMPL;
214 static const struct INetCfgLockVtbl NetCfgLockVtbl =
216 netcfglock_QueryInterface,
217 netcfglock_AddRef,
218 netcfglock_Release,
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));
229 if (!This)
230 return E_OUTOFMEMORY;
232 This->INetCfg_iface.lpVtbl = &NetCfgVtbl;
233 This->INetCfgLock_iface.lpVtbl = &NetCfgLockVtbl;
234 This->ref = 1;
236 *ppUnk = (IUnknown*)&This->INetCfg_iface;
238 return S_OK;