https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e57f103d53d35b0093112f73102ca106a51830e7

commit e57f103d53d35b0093112f73102ca106a51830e7
Author:     Eric Kohl <[email protected]>
AuthorDate: Wed Jun 19 22:38:31 2019 +0200
Commit:     Eric Kohl <[email protected]>
CommitDate: Wed Jun 19 22:38:31 2019 +0200

    [NETCFGX] Add the interfaces INetCfgBindingInterface and 
IEnumNetCfgBindingInterface (stubs only).
---
 dll/win32/netcfgx/CMakeLists.txt                 |   1 +
 dll/win32/netcfgx/netcfgbindinginterface_iface.c | 301 +++++++++++++++++++++++
 dll/win32/netcfgx/netcfgbindingpath_iface.c      |   2 +-
 dll/win32/netcfgx/precomp.h                      |   4 +
 4 files changed, 307 insertions(+), 1 deletion(-)

diff --git a/dll/win32/netcfgx/CMakeLists.txt b/dll/win32/netcfgx/CMakeLists.txt
index 79ff37cc4d..bde3f69f9d 100644
--- a/dll/win32/netcfgx/CMakeLists.txt
+++ b/dll/win32/netcfgx/CMakeLists.txt
@@ -9,6 +9,7 @@ list(APPEND SOURCE
     classfactory.c
     installer.c
     netcfg_iface.c
+    netcfgbindinginterface_iface.c
     netcfgbindingpath_iface.c
     inetcfgcomp_iface.c
     tcpipconf_notify.c
diff --git a/dll/win32/netcfgx/netcfgbindinginterface_iface.c 
b/dll/win32/netcfgx/netcfgbindinginterface_iface.c
new file mode 100644
index 0000000000..7258399d01
--- /dev/null
+++ b/dll/win32/netcfgx/netcfgbindinginterface_iface.c
@@ -0,0 +1,301 @@
+#include "precomp.h"
+
+typedef struct
+{
+    const INetCfgBindingInterface *lpVtbl;
+    LONG ref;
+} INetCfgBindingInterfaceImpl;
+
+typedef struct
+{
+    const IEnumNetCfgBindingInterface *lpVtbl;
+    LONG ref;
+} IEnumNetCfgBindingInterfaceImpl;
+
+
+/***************************************************************
+ * INetCfgBindingInterface
+ */
+
+HRESULT
+WINAPI
+INetCfgBindingInterface_fnQueryInterface(
+    INetCfgBindingInterface *iface,
+    REFIID iid,
+    LPVOID *ppvObj)
+{
+    INetCfgBindingInterfaceImpl *This = (INetCfgBindingInterfaceImpl*)iface;
+    *ppvObj = NULL;
+
+    if (IsEqualIID (iid, &IID_IUnknown) ||
+        IsEqualIID (iid, &IID_INetCfgBindingInterface))
+    {
+        *ppvObj = This;
+        return S_OK;
+    }
+
+    return E_NOINTERFACE;
+}
+
+ULONG
+WINAPI
+INetCfgBindingInterface_fnAddRef(
+    INetCfgBindingInterface *iface)
+{
+    INetCfgBindingInterfaceImpl *This = (INetCfgBindingInterfaceImpl*)iface;
+    ULONG refCount = InterlockedIncrement(&This->ref);
+
+    return refCount;
+}
+
+ULONG
+WINAPI
+INetCfgBindingInterface_fnRelease(
+    INetCfgBindingInterface *iface)
+{
+    INetCfgBindingInterfaceImpl *This = (INetCfgBindingInterfaceImpl*)iface;
+    ULONG refCount = InterlockedDecrement(&This->ref);
+
+    if (!refCount)
+    {
+       CoTaskMemFree(This);
+    }
+    return refCount;
+}
+
+HRESULT
+WINAPI
+INetCfgBindingInterface_fnGetName(
+    INetCfgBindingInterface *iface,
+    LPWSTR *ppszwInterfaceName)
+{
+    return E_NOTIMPL;
+}
+
+HRESULT
+WINAPI
+INetCfgBindingInterface_fnGetUpperComponent(
+    INetCfgBindingInterface *iface,
+    INetCfgComponent **ppnccItem)
+{
+    return E_NOTIMPL;
+}
+
+HRESULT
+WINAPI
+INetCfgBindingInterface_fnGetLowerComponent(
+    INetCfgBindingInterface *iface,
+    INetCfgComponent **ppnccItem)
+{
+    return E_NOTIMPL;
+}
+
+static const INetCfgBindingInterfaceVtbl vt_NetCfgBindingInterface =
+{
+    INetCfgBindingInterface_fnQueryInterface,
+    INetCfgBindingInterface_fnAddRef,
+    INetCfgBindingInterface_fnRelease,
+    INetCfgBindingInterface_fnGetName,
+    INetCfgBindingInterface_fnGetUpperComponent,
+    INetCfgBindingInterface_fnGetLowerComponent,
+};
+
+HRESULT
+WINAPI
+INetCfgBindingInterface_Constructor(
+    IUnknown *pUnkOuter,
+    REFIID riid,
+    LPVOID *ppv)
+{
+    INetCfgBindingInterfaceImpl *This;
+
+    if (!ppv)
+        return E_POINTER;
+
+    This = (INetCfgBindingInterfaceImpl 
*)CoTaskMemAlloc(sizeof(INetCfgBindingInterfaceImpl));
+    if (!This)
+        return E_OUTOFMEMORY;
+
+    This->ref = 1;
+    This->lpVtbl = (const INetCfgBindingInterface*)&vt_NetCfgBindingInterface;
+
+    if 
(!SUCCEEDED(INetCfgBindingInterface_QueryInterface((INetCfgBindingInterface*)This,
 riid, ppv)))
+    {
+        return E_NOINTERFACE;
+    }
+
+    INetCfgBindingInterface_Release((INetCfgBindingInterface*)This);
+    return S_OK;
+}
+
+
+/***************************************************************
+ * IEnumNetCfgBindingInterface
+ */
+
+HRESULT
+WINAPI
+IEnumNetCfgBindingInterface_fnQueryInterface(
+    IEnumNetCfgBindingInterface *iface,
+    REFIID iid,
+    LPVOID *ppvObj)
+{
+    IEnumNetCfgBindingInterfaceImpl *This = 
(IEnumNetCfgBindingInterfaceImpl*)iface;
+    *ppvObj = NULL;
+
+    if (IsEqualIID (iid, &IID_IUnknown) ||
+        IsEqualIID (iid, &IID_IEnumNetCfgBindingInterface))
+    {
+        *ppvObj = This;
+        return S_OK;
+    }
+
+    return E_NOINTERFACE;
+}
+
+
+ULONG
+WINAPI
+IEnumNetCfgBindingInterface_fnAddRef(
+    IEnumNetCfgBindingInterface *iface)
+{
+    IEnumNetCfgBindingInterfaceImpl *This = 
(IEnumNetCfgBindingInterfaceImpl*)iface;
+    ULONG refCount = InterlockedIncrement(&This->ref);
+
+    return refCount;
+}
+
+ULONG
+WINAPI
+IEnumNetCfgBindingInterface_fnRelease(
+    IEnumNetCfgBindingInterface *iface)
+{
+    IEnumNetCfgBindingInterfaceImpl *This = 
(IEnumNetCfgBindingInterfaceImpl*)iface;
+    ULONG refCount = InterlockedDecrement(&This->ref);
+
+    return refCount;
+}
+
+HRESULT
+WINAPI
+IEnumNetCfgBindingInterface_fnNext(
+    IEnumNetCfgBindingInterface *iface,
+    ULONG celt,
+    INetCfgBindingInterface **rgelt,
+    ULONG *pceltFetched)
+{
+#if 0
+    IEnumNetCfgBindingInterfaceImpl *This = 
(IEnumNetCfgBindingInterfaceImpl*)iface;
+    HRESULT hr;
+
+    if (!iface || !rgelt)
+        return E_POINTER;
+
+    if (celt != 1)
+        return E_INVALIDARG;
+
+    if (!This->pCurrent)
+        return S_FALSE;
+
+    hr = INetCfgBindingInterface_Constructor(NULL, 
&IID_INetCfgBindingInterface, (LPVOID*)rgelt);
+    if (SUCCEEDED(hr))
+    {
+        This->pCurrent = This->pCurrent->pNext;
+        if (pceltFetched)
+            *pceltFetched = 1;
+    }
+    return hr;
+#endif
+
+    return E_NOTIMPL;
+}
+
+HRESULT
+WINAPI
+IEnumNetCfgBindingInterface_fnSkip(
+    IEnumNetCfgBindingInterface *iface,
+    ULONG celt)
+{
+#if 0
+    IEnumNetCfgBindingInterfaceImpl *This = 
(IEnumNetCfgBindingInterfaceImpl*)iface;
+
+    if (!This->pCurrent)
+        return S_FALSE;
+
+    while (celt-- > 0 && This->pCurrent)
+        This->pCurrent = This->pCurrent->pNext;
+
+    if (!celt)
+        return S_OK;
+    else
+        return S_FALSE;
+#endif
+
+    return E_NOTIMPL;
+}
+
+HRESULT
+WINAPI
+IEnumNetCfgBindingInterface_fnReset(
+    IEnumNetCfgBindingInterface *iface)
+{
+#if 0
+    IEnumNetCfgBindingInterfaceImpl *This = 
(IEnumNetCfgBindingInterfaceImpl*)iface;
+
+    This->pCurrent = This->pHead;
+    return S_OK;
+#endif
+
+    return E_NOTIMPL;
+}
+
+HRESULT
+WINAPI
+IEnumNetCfgBindingInterface_fnClone(
+    IEnumNetCfgBindingInterface *iface,
+    IEnumNetCfgBindingInterface **ppenum)
+{
+    return E_NOTIMPL;
+}
+
+static const IEnumNetCfgBindingInterfaceVtbl vt_EnumNetCfgBindingInterface =
+{
+    IEnumNetCfgBindingInterface_fnQueryInterface,
+    IEnumNetCfgBindingInterface_fnAddRef,
+    IEnumNetCfgBindingInterface_fnRelease,
+    IEnumNetCfgBindingInterface_fnNext,
+    IEnumNetCfgBindingInterface_fnSkip,
+    IEnumNetCfgBindingInterface_fnReset,
+    IEnumNetCfgBindingInterface_fnClone
+};
+
+HRESULT
+WINAPI
+IEnumNetCfgBindingInterface_Constructor(IUnknown *pUnkOuter, REFIID riid, 
LPVOID *ppv)
+{
+    IEnumNetCfgBindingInterfaceImpl *This;
+
+    if (!ppv)
+        return E_POINTER;
+
+    This = (IEnumNetCfgBindingInterfaceImpl 
*)CoTaskMemAlloc(sizeof(IEnumNetCfgBindingInterfaceImpl));
+    if (!This)
+        return E_OUTOFMEMORY;
+
+    This->ref = 1;
+    This->lpVtbl = (const 
IEnumNetCfgBindingInterface*)&vt_EnumNetCfgBindingInterface;
+#if 0
+    This->pCurrent = pItem;
+    This->pHead = pItem;
+    This->pNCfg = pNCfg;
+#endif
+
+    if (!SUCCEEDED 
(IEnumNetCfgBindingInterface_QueryInterface((INetCfgBindingInterface*)This, 
riid, ppv)))
+    {
+        IEnumNetCfgBindingInterface_Release((INetCfg*)This);
+        return E_NOINTERFACE;
+    }
+
+    IEnumNetCfgBindingInterface_Release((IEnumNetCfgBindingInterface*)This);
+    return S_OK;
+}
diff --git a/dll/win32/netcfgx/netcfgbindingpath_iface.c 
b/dll/win32/netcfgx/netcfgbindingpath_iface.c
index ad5f982cb4..6ca2ad27ed 100644
--- a/dll/win32/netcfgx/netcfgbindingpath_iface.c
+++ b/dll/win32/netcfgx/netcfgbindingpath_iface.c
@@ -131,7 +131,7 @@ INetCfgBindingPath_fnEnumBindingInterfaces(
     INetCfgBindingPath *iface,
     IEnumNetCfgBindingInterface **ppenumInterface)
 {
-    return E_NOTIMPL;
+    return IEnumNetCfgBindingInterface_Constructor(NULL, 
&IID_IEnumNetCfgBindingInterface, (LPVOID *)ppenumInterface);
 }
 
 static const INetCfgBindingPathVtbl vt_NetCfgBindingPath =
diff --git a/dll/win32/netcfgx/precomp.h b/dll/win32/netcfgx/precomp.h
index efb5d6439f..4230377bd8 100644
--- a/dll/win32/netcfgx/precomp.h
+++ b/dll/win32/netcfgx/precomp.h
@@ -64,6 +64,10 @@ extern HINSTANCE netcfgx_hInstance;
 HRESULT WINAPI INetCfgComponent_Constructor (IUnknown * pUnkOuter, REFIID 
riid, LPVOID * ppv, NetCfgComponentItem * pItem,INetCfg * iface);
 HRESULT WINAPI IEnumNetCfgComponent_Constructor (IUnknown * pUnkOuter, REFIID 
riid, LPVOID * ppv, NetCfgComponentItem * pItem, INetCfg * iface);
 
+/* netcfgbindinginterface_iface.c */
+HRESULT WINAPI INetCfgBindingInterface_Constructor(IUnknown *pUnkOuter, REFIID 
riid, LPVOID *ppv);
+HRESULT WINAPI IEnumNetCfgBindingInterface_Constructor(IUnknown *pUnkOuter, 
REFIID riid, LPVOID *ppv);
+
 /* netcfgbindingpath_iface.c */
 HRESULT WINAPI INetCfgBindingPath_Constructor(IUnknown *pUnkOuter, REFIID 
riid, LPVOID *ppv);
 HRESULT WINAPI IEnumNetCfgBindingPath_Constructor(IUnknown *pUnkOuter, REFIID 
riid, LPVOID *ppv, DWORD dwFlags);

Reply via email to