mirror of
https://github.com/reactos/reactos.git
synced 2026-06-05 11:12:56 +08:00
[NETCFGX] Implement INetCfgClass_fnFindComponent() and INetCfgClass_fnEnumComponents()
This commit is contained in:
@@ -1,25 +1,11 @@
|
||||
#include "precomp.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const INetCfg * lpVtbl;
|
||||
const INetCfgLock * lpVtblLock;
|
||||
const INetCfgPnpReconfigCallback *lpVtblPnpReconfigCallback;
|
||||
LONG ref;
|
||||
BOOL bInitialized;
|
||||
HANDLE hMutex;
|
||||
NetCfgComponentItem *pNet;
|
||||
NetCfgComponentItem * pService;
|
||||
NetCfgComponentItem * pClient;
|
||||
NetCfgComponentItem * pProtocol;
|
||||
} INetCfgImpl, *LPINetCfgImpl;
|
||||
|
||||
static __inline LPINetCfgImpl impl_from_INetCfgLock(INetCfgLock *iface)
|
||||
static __inline INetCfgImpl* impl_from_INetCfgLock(INetCfgLock *iface)
|
||||
{
|
||||
return (INetCfgImpl*)((char *)iface - FIELD_OFFSET(INetCfgImpl, lpVtblLock));
|
||||
}
|
||||
|
||||
static __inline LPINetCfgImpl impl_from_INetCfgPnpReconfigCallback(INetCfgPnpReconfigCallback *iface)
|
||||
static __inline INetCfgImpl* impl_from_INetCfgPnpReconfigCallback(INetCfgPnpReconfigCallback *iface)
|
||||
{
|
||||
return (INetCfgImpl*)((char *)iface - FIELD_OFFSET(INetCfgImpl, lpVtblPnpReconfigCallback));
|
||||
}
|
||||
|
||||
@@ -170,11 +170,28 @@ INetCfgClass_fnFindComponent(
|
||||
LPCWSTR pszwComponentId,
|
||||
INetCfgComponent **pComponent)
|
||||
{
|
||||
// HRESULT hr;
|
||||
// INetCfgClassImpl *This = (INetCfgClassImpl *)iface;
|
||||
INetCfgClassImpl *This = (INetCfgClassImpl *)iface;
|
||||
NetCfgComponentItem *pHead;
|
||||
|
||||
if (IsEqualIID(&This->ClassGuid, &GUID_DEVCLASS_NET))
|
||||
pHead = ((INetCfgImpl*)(This->pNetCfg))->pNet;
|
||||
else if (IsEqualIID(&This->ClassGuid, &GUID_DEVCLASS_NETTRANS))
|
||||
pHead = ((INetCfgImpl*)(This->pNetCfg))->pProtocol;
|
||||
else if (IsEqualIID(&This->ClassGuid, &GUID_DEVCLASS_NETSERVICE))
|
||||
pHead = ((INetCfgImpl*)(This->pNetCfg))->pService;
|
||||
else if (IsEqualIID(&This->ClassGuid, &GUID_DEVCLASS_NETCLIENT))
|
||||
pHead = ((INetCfgImpl*)(This->pNetCfg))->pClient;
|
||||
else
|
||||
return E_NOINTERFACE;
|
||||
|
||||
/* TODO */
|
||||
while (pHead)
|
||||
{
|
||||
if (!_wcsicmp(pHead->szId, pszwComponentId))
|
||||
{
|
||||
return INetCfgComponent_Constructor(NULL, &IID_INetCfgComponent, (LPVOID*)pComponent, pHead, This->pNetCfg);
|
||||
}
|
||||
pHead = pHead->pNext;
|
||||
}
|
||||
|
||||
return S_FALSE;
|
||||
}
|
||||
@@ -185,10 +202,21 @@ INetCfgClass_fnEnumComponents(
|
||||
INetCfgClass *iface,
|
||||
IEnumNetCfgComponent **ppenumComponent)
|
||||
{
|
||||
// INetCfgClassImpl *This = (INetCfgClassImpl *)iface;
|
||||
INetCfgClassImpl *This = (INetCfgClassImpl *)iface;
|
||||
NetCfgComponentItem *pHead;
|
||||
|
||||
if (IsEqualIID(&This->ClassGuid, &GUID_DEVCLASS_NET))
|
||||
pHead = ((INetCfgImpl*)(This->pNetCfg))->pNet;
|
||||
else if (IsEqualIID(&This->ClassGuid, &GUID_DEVCLASS_NETTRANS))
|
||||
pHead = ((INetCfgImpl*)(This->pNetCfg))->pProtocol;
|
||||
else if (IsEqualIID(&This->ClassGuid, &GUID_DEVCLASS_NETSERVICE))
|
||||
pHead = ((INetCfgImpl*)(This->pNetCfg))->pService;
|
||||
else if (IsEqualIID(&This->ClassGuid, &GUID_DEVCLASS_NETCLIENT))
|
||||
pHead = ((INetCfgImpl*)(This->pNetCfg))->pClient;
|
||||
else
|
||||
return E_NOINTERFACE;
|
||||
|
||||
return E_NOINTERFACE;
|
||||
return IEnumNetCfgComponent_Constructor (NULL, &IID_IEnumNetCfgComponent, (LPVOID*)ppenumComponent, pHead, This->pNetCfg);
|
||||
}
|
||||
|
||||
static const INetCfgClassVtbl vt_NetCfgClass =
|
||||
|
||||
@@ -51,7 +51,21 @@ typedef struct tagNetCfgComponentItem
|
||||
LPWSTR pszBinding;
|
||||
struct tagNetCfgComponentItem * pNext;
|
||||
INetCfgComponentControl * pNCCC;
|
||||
}NetCfgComponentItem;
|
||||
} NetCfgComponentItem;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const INetCfg * lpVtbl;
|
||||
const INetCfgLock * lpVtblLock;
|
||||
const INetCfgPnpReconfigCallback *lpVtblPnpReconfigCallback;
|
||||
LONG ref;
|
||||
BOOL bInitialized;
|
||||
HANDLE hMutex;
|
||||
NetCfgComponentItem *pNet;
|
||||
NetCfgComponentItem * pService;
|
||||
NetCfgComponentItem * pClient;
|
||||
NetCfgComponentItem * pProtocol;
|
||||
} INetCfgImpl;
|
||||
|
||||
/* netcfg_iface.c */
|
||||
HRESULT WINAPI INetCfg_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
|
||||
|
||||
Reference in New Issue
Block a user