1 #include "precomp.h" 2 3 typedef struct 4 { 5 const INetCfgBindingPath *lpVtbl; 6 LONG ref; 7 } INetCfgBindingPathImpl; 8 9 typedef struct 10 { 11 const IEnumNetCfgBindingPath *lpVtbl; 12 LONG ref; 13 } IEnumNetCfgBindingPathImpl; 14 15 16 /*************************************************************** 17 * INetCfgBindingPath 18 */ 19 20 HRESULT 21 WINAPI 22 INetCfgBindingPath_fnQueryInterface( 23 INetCfgBindingPath *iface, 24 REFIID iid, 25 LPVOID *ppvObj) 26 { 27 INetCfgBindingPathImpl *This = (INetCfgBindingPathImpl*)iface; 28 *ppvObj = NULL; 29 30 if (IsEqualIID (iid, &IID_IUnknown) || 31 IsEqualIID (iid, &IID_INetCfgBindingPath)) 32 { 33 *ppvObj = This; 34 return S_OK; 35 } 36 37 return E_NOINTERFACE; 38 } 39 40 ULONG 41 WINAPI 42 INetCfgBindingPath_fnAddRef( 43 INetCfgBindingPath * iface) 44 { 45 INetCfgBindingPathImpl * This = (INetCfgBindingPathImpl*)iface; 46 ULONG refCount = InterlockedIncrement(&This->ref); 47 48 return refCount; 49 } 50 51 ULONG 52 WINAPI 53 INetCfgBindingPath_fnRelease( 54 INetCfgBindingPath *iface) 55 { 56 INetCfgBindingPathImpl *This = (INetCfgBindingPathImpl*)iface; 57 ULONG refCount = InterlockedDecrement(&This->ref); 58 59 if (!refCount) 60 { 61 CoTaskMemFree(This); 62 } 63 return refCount; 64 } 65 66 HRESULT 67 WINAPI 68 INetCfgBindingPath_fnIsSamePathAs( 69 INetCfgBindingPath *iface, 70 INetCfgBindingPath *pPath) 71 { 72 return E_NOTIMPL; 73 } 74 75 HRESULT 76 WINAPI 77 INetCfgBindingPath_fnIsSubPathOf( 78 INetCfgBindingPath *iface, 79 INetCfgBindingPath *pPath) 80 { 81 return E_NOTIMPL; 82 } 83 84 HRESULT 85 WINAPI 86 INetCfgBindingPath_fnIsEnabled( 87 INetCfgBindingPath *iface) 88 { 89 return E_NOTIMPL; 90 } 91 92 HRESULT 93 WINAPI 94 INetCfgBindingPath_fnEnable( 95 INetCfgBindingPath *iface, 96 BOOL fEnable) 97 { 98 return E_NOTIMPL; 99 } 100 101 HRESULT 102 WINAPI 103 INetCfgBindingPath_fnGetPathToken( 104 INetCfgBindingPath *iface, 105 LPWSTR *ppszwPathToken) 106 { 107 return E_NOTIMPL; 108 } 109 110 HRESULT 111 WINAPI 112 INetCfgBindingPath_fnGetOwner( 113 INetCfgBindingPath *iface, 114 INetCfgComponent **ppComponent) 115 { 116 return E_NOTIMPL; 117 } 118 119 HRESULT 120 WINAPI 121 INetCfgBindingPath_fnGetDepth( 122 INetCfgBindingPath *iface, 123 ULONG *pcInterfaces) 124 { 125 return E_NOTIMPL; 126 } 127 128 HRESULT 129 WINAPI 130 INetCfgBindingPath_fnEnumBindingInterfaces( 131 INetCfgBindingPath *iface, 132 IEnumNetCfgBindingInterface **ppenumInterface) 133 { 134 return IEnumNetCfgBindingInterface_Constructor(NULL, &IID_IEnumNetCfgBindingInterface, (LPVOID *)ppenumInterface); 135 } 136 137 static const INetCfgBindingPathVtbl vt_NetCfgBindingPath = 138 { 139 INetCfgBindingPath_fnQueryInterface, 140 INetCfgBindingPath_fnAddRef, 141 INetCfgBindingPath_fnRelease, 142 INetCfgBindingPath_fnIsSamePathAs, 143 INetCfgBindingPath_fnIsSubPathOf, 144 INetCfgBindingPath_fnIsEnabled, 145 INetCfgBindingPath_fnEnable, 146 INetCfgBindingPath_fnGetPathToken, 147 INetCfgBindingPath_fnGetOwner, 148 INetCfgBindingPath_fnGetDepth, 149 INetCfgBindingPath_fnEnumBindingInterfaces, 150 }; 151 152 HRESULT 153 WINAPI 154 INetCfgBindingPath_Constructor( 155 IUnknown *pUnkOuter, 156 REFIID riid, 157 LPVOID *ppv) 158 { 159 INetCfgBindingPathImpl *This; 160 161 if (!ppv) 162 return E_POINTER; 163 164 This = (INetCfgBindingPathImpl *)CoTaskMemAlloc(sizeof(INetCfgBindingPathImpl)); 165 if (!This) 166 return E_OUTOFMEMORY; 167 168 This->ref = 1; 169 This->lpVtbl = (const INetCfgBindingPath*)&vt_NetCfgBindingPath; 170 171 if (!SUCCEEDED (INetCfgBindingPath_QueryInterface ((INetCfgBindingPath*)This, riid, ppv))) 172 { 173 return E_NOINTERFACE; 174 } 175 176 INetCfgBindingPath_Release((INetCfgBindingPath*)This); 177 return S_OK; 178 } 179 180 181 /*************************************************************** 182 * IEnumNetCfgBindingPath 183 */ 184 185 HRESULT 186 WINAPI 187 IEnumNetCfgBindingPath_fnQueryInterface( 188 IEnumNetCfgBindingPath *iface, 189 REFIID iid, 190 LPVOID *ppvObj) 191 { 192 IEnumNetCfgBindingPathImpl *This = (IEnumNetCfgBindingPathImpl*)iface; 193 *ppvObj = NULL; 194 195 if (IsEqualIID (iid, &IID_IUnknown) || 196 IsEqualIID (iid, &IID_IEnumNetCfgBindingPath)) 197 { 198 *ppvObj = This; 199 return S_OK; 200 } 201 202 return E_NOINTERFACE; 203 } 204 205 206 ULONG 207 WINAPI 208 IEnumNetCfgBindingPath_fnAddRef( 209 IEnumNetCfgBindingPath *iface) 210 { 211 IEnumNetCfgBindingPathImpl *This = (IEnumNetCfgBindingPathImpl*)iface; 212 ULONG refCount = InterlockedIncrement(&This->ref); 213 214 return refCount; 215 } 216 217 ULONG 218 WINAPI 219 IEnumNetCfgBindingPath_fnRelease( 220 IEnumNetCfgBindingPath *iface) 221 { 222 IEnumNetCfgBindingPathImpl *This = (IEnumNetCfgBindingPathImpl*)iface; 223 ULONG refCount = InterlockedDecrement(&This->ref); 224 225 return refCount; 226 } 227 228 HRESULT 229 WINAPI 230 IEnumNetCfgBindingPath_fnNext( 231 IEnumNetCfgBindingPath *iface, 232 ULONG celt, 233 INetCfgBindingPath **rgelt, 234 ULONG *pceltFetched) 235 { 236 #if 0 237 IEnumNetCfgBindingPathImpl *This = (IEnumNetCfgBindingPathImpl*)iface; 238 HRESULT hr; 239 240 if (!iface || !rgelt) 241 return E_POINTER; 242 243 if (celt != 1) 244 return E_INVALIDARG; 245 246 if (!This->pCurrent) 247 return S_FALSE; 248 249 hr = INetCfgBindingPath_Constructor (NULL, &IID_INetCfgComponent, (LPVOID*)rgelt); 250 if (SUCCEEDED(hr)) 251 { 252 This->pCurrent = This->pCurrent->pNext; 253 if (pceltFetched) 254 *pceltFetched = 1; 255 } 256 return hr; 257 #endif 258 259 return E_NOTIMPL; 260 } 261 262 HRESULT 263 WINAPI 264 IEnumNetCfgBindingPath_fnSkip( 265 IEnumNetCfgBindingPath *iface, 266 ULONG celt) 267 { 268 #if 0 269 IEnumNetCfgBindingPathImpl *This = (IEnumNetCfgBindingPathImpl*)iface; 270 271 if (!This->pCurrent) 272 return S_FALSE; 273 274 while (celt-- > 0 && This->pCurrent) 275 This->pCurrent = This->pCurrent->pNext; 276 277 if (!celt) 278 return S_OK; 279 else 280 return S_FALSE; 281 #endif 282 283 return E_NOTIMPL; 284 } 285 286 HRESULT 287 WINAPI 288 IEnumNetCfgBindingPath_fnReset( 289 IEnumNetCfgBindingPath *iface) 290 { 291 #if 0 292 IEnumNetCfgBindingPathImpl *This = (IEnumNetCfgBindingPathImpl*)iface; 293 294 This->pCurrent = This->pHead; 295 return S_OK; 296 #endif 297 298 return E_NOTIMPL; 299 } 300 301 HRESULT 302 WINAPI 303 IEnumNetCfgBindingPath_fnClone( 304 IEnumNetCfgBindingPath *iface, 305 IEnumNetCfgBindingPath **ppenum) 306 { 307 return E_NOTIMPL; 308 } 309 310 static const IEnumNetCfgBindingPathVtbl vt_EnumNetCfgBindingPath = 311 { 312 IEnumNetCfgBindingPath_fnQueryInterface, 313 IEnumNetCfgBindingPath_fnAddRef, 314 IEnumNetCfgBindingPath_fnRelease, 315 IEnumNetCfgBindingPath_fnNext, 316 IEnumNetCfgBindingPath_fnSkip, 317 IEnumNetCfgBindingPath_fnReset, 318 IEnumNetCfgBindingPath_fnClone 319 }; 320 321 HRESULT 322 WINAPI 323 IEnumNetCfgBindingPath_Constructor(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppv, DWORD dwFlags) 324 { 325 IEnumNetCfgBindingPathImpl *This; 326 327 if (!ppv) 328 return E_POINTER; 329 330 This = (IEnumNetCfgBindingPathImpl *)CoTaskMemAlloc(sizeof(IEnumNetCfgBindingPathImpl)); 331 if (!This) 332 return E_OUTOFMEMORY; 333 334 This->ref = 1; 335 This->lpVtbl = (const IEnumNetCfgBindingPath*)&vt_EnumNetCfgBindingPath; 336 #if 0 337 This->pCurrent = pItem; 338 This->pHead = pItem; 339 This->pNCfg = pNCfg; 340 #endif 341 342 if (!SUCCEEDED (IEnumNetCfgBindingPath_QueryInterface((INetCfgBindingPath*)This, riid, ppv))) 343 { 344 IEnumNetCfgBindingPath_Release((INetCfg*)This); 345 return E_NOINTERFACE; 346 } 347 348 IEnumNetCfgBindingPath_Release((IEnumNetCfgBindingPath*)This); 349 return S_OK; 350 } 351