mirror of
https://github.com/reactos/reactos.git
synced 2026-06-06 21:51:53 +08:00
[NETCFGX] Rewrite the TCPIP notify object and improve the Components interface to the notify object
In order to make the notify object interfaces available to the component interface, the TCPIP notify objects initialization needed to be rewritten. The Initialize method must retrieve the information for all network interfaces from the registry and the SetContext method selects the interface that will be modified by the RaisePropertyUi method. This is required to make the PropertyUi interface optional. The notify object can now be initialized and used without conflicts with the PropertyUi interface. I also improved the ApplyRegistryChanges and ApplyPnpChanges methods. They have improved checks property changes, e.g. only changed properties are written to the registry. TODO: - Fix the alternate configuration and filter settings. - Do not use fixed sized property string buffers. - Improve checks for changed properties.
This commit is contained in:
@@ -19,6 +19,8 @@ typedef struct
|
||||
INetCfg * pNCfg;
|
||||
} IEnumNetCfgComponentImpl;
|
||||
|
||||
HRESULT CreateNotifyObject(INetCfgComponentImpl * This, INetCfgComponent * iface);
|
||||
|
||||
static __inline INetCfgComponentImpl* impl_from_INetCfgComponentBindings(INetCfgComponentBindings *iface)
|
||||
{
|
||||
return (INetCfgComponentImpl*)((char *)iface - FIELD_OFFSET(INetCfgComponentImpl, lpVtblBindings));
|
||||
@@ -552,10 +554,9 @@ INetCfgComponent_fnOpenParamKey(
|
||||
|
||||
|
||||
HRESULT
|
||||
CreateNotificationObject(
|
||||
INetCfgComponentImpl * This,
|
||||
INetCfgComponent * iface,
|
||||
IUnknown *pUnk)
|
||||
CreateNotifyObject(
|
||||
INetCfgComponentImpl *This,
|
||||
INetCfgComponent *iface)
|
||||
{
|
||||
WCHAR szName[150];
|
||||
HKEY hKey;
|
||||
@@ -564,11 +565,15 @@ CreateNotificationObject(
|
||||
LPOLESTR pStr;
|
||||
INetCfgComponentControl *pControl;
|
||||
INetCfgComponentPropertyUi *pPropertyUi;
|
||||
INetCfgComponentSetup *pSetup;
|
||||
HRESULT hr;
|
||||
LONG lRet;
|
||||
CLSID ClassGUID;
|
||||
CLSID InstanceGUID;
|
||||
|
||||
if (This->pItem->pControl)
|
||||
return S_OK;
|
||||
|
||||
wcscpy(szName,L"SYSTEM\\CurrentControlSet\\Control\\Network\\");
|
||||
|
||||
/* get the Class GUID */
|
||||
@@ -616,39 +621,21 @@ CreateNotificationObject(
|
||||
if (FAILED(hr))
|
||||
return E_FAIL;
|
||||
|
||||
hr = INetCfgComponentPropertyUi_QueryInterface(pControl, &IID_INetCfgComponentPropertyUi, (LPVOID*)&pPropertyUi);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
INetCfgComponentPropertyUi_Release(pControl);
|
||||
return hr;
|
||||
}
|
||||
|
||||
hr = INetCfgComponentPropertyUi_QueryPropertyUi(pPropertyUi, pUnk);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
INetCfgComponentControl_Release(pControl);
|
||||
INetCfgComponentPropertyUi_Release(pPropertyUi);
|
||||
return hr;
|
||||
}
|
||||
|
||||
hr = INetCfgComponentControl_Initialize(pControl, iface, This->pNCfg, FALSE);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
INetCfgComponentControl_Release(pControl);
|
||||
INetCfgComponentPropertyUi_Release(pPropertyUi);
|
||||
return hr;
|
||||
}
|
||||
|
||||
hr = INetCfgComponentPropertyUi_SetContext(pPropertyUi, pUnk);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
INetCfgComponentControl_Release(pControl);
|
||||
INetCfgComponentPropertyUi_Release(pPropertyUi);
|
||||
return hr;
|
||||
}
|
||||
|
||||
This->pItem->pControl = pControl;
|
||||
This->pItem->pPropertyUi = pPropertyUi;
|
||||
|
||||
hr = INetCfgComponentControl_QueryInterface(pControl, &IID_INetCfgComponentPropertyUi, (LPVOID*)&pPropertyUi);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
This->pItem->pPropertyUi = pPropertyUi;
|
||||
}
|
||||
|
||||
hr = INetCfgComponentControl_QueryInterface(pControl, &IID_INetCfgComponentSetup, (LPVOID*)&pSetup);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
This->pItem->pSetup = pSetup;
|
||||
}
|
||||
|
||||
INetCfgComponentControl_Initialize(pControl, iface, This->pNCfg, FALSE);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@@ -686,15 +673,17 @@ INetCfgComponent_fnRaisePropertyUi(
|
||||
INT_PTR iResult;
|
||||
INetCfgComponentImpl * This = (INetCfgComponentImpl*)iface;
|
||||
|
||||
if (!This->pItem->pPropertyUi)
|
||||
{
|
||||
hr = CreateNotificationObject(This,iface, pUnk);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
}
|
||||
hr = CreateNotifyObject(This, iface);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
if (dwFlags == NCRP_QUERY_PROPERTY_UI)
|
||||
return S_OK;
|
||||
if (This->pItem->pPropertyUi == NULL)
|
||||
return E_FAIL;
|
||||
|
||||
if (dwFlags & NCRP_QUERY_PROPERTY_UI)
|
||||
return INetCfgComponentPropertyUi_QueryPropertyUi(This->pItem->pPropertyUi, pUnk);
|
||||
|
||||
hr = INetCfgComponentPropertyUi_SetContext(This->pItem->pPropertyUi, pUnk);
|
||||
|
||||
dwDefPages = 0;
|
||||
Pages = 0;
|
||||
@@ -734,6 +723,8 @@ INetCfgComponent_fnRaisePropertyUi(
|
||||
hr = S_FALSE;
|
||||
}
|
||||
|
||||
INetCfgComponentPropertyUi_SetContext(This->pItem->pPropertyUi, NULL);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ typedef struct tagNetCfgComponentItem
|
||||
LPWSTR pszBinding;
|
||||
INetCfgComponentControl *pControl;
|
||||
INetCfgComponentPropertyUi *pPropertyUi;
|
||||
INetCfgComponentSetup *pSetup;
|
||||
struct tagNetCfgComponentItem *pNext;
|
||||
} NetCfgComponentItem;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user