diff --git a/dll/win32/netcfgx/netcfg_iface.c b/dll/win32/netcfgx/netcfg_iface.c index 72122513843..52d5712e8b3 100644 --- a/dll/win32/netcfgx/netcfg_iface.c +++ b/dll/win32/netcfgx/netcfg_iface.c @@ -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)); } diff --git a/dll/win32/netcfgx/netcfgclass_iface.c b/dll/win32/netcfgx/netcfgclass_iface.c index 0de7828a9e6..43a4a672c25 100644 --- a/dll/win32/netcfgx/netcfgclass_iface.c +++ b/dll/win32/netcfgx/netcfgclass_iface.c @@ -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 = diff --git a/dll/win32/netcfgx/precomp.h b/dll/win32/netcfgx/precomp.h index 4823576c483..c461c4d1b33 100644 --- a/dll/win32/netcfgx/precomp.h +++ b/dll/win32/netcfgx/precomp.h @@ -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);