[NETCFGX][UUID] Add private interface used by WinXPs ifmon.dll

When I loaded WinXPs ifmon.dll into our netsh.exe and ran the 'interface ip show address'
command ifmon tried to query an unknown interface. Google found a name for the GUID:
INetCfgComponentPrivate.
I implemented the three standard methods of the interface and ran some more tests.
After adding a 4th method with tree parameters to the interface, there are no more
failures.
This commit is contained in:
Eric Kohl
2025-10-26 16:36:55 +01:00
parent d6db7fb409
commit 59afe4b0a2
2 changed files with 71 additions and 4 deletions

View File

@@ -3,7 +3,8 @@
typedef struct
{
const INetCfgComponent *lpVtbl;
const INetCfgComponentBindings *lpVtblComponentBindings;
const INetCfgComponentBindings *lpVtblBindings;
const INetCfgComponentPrivate *lpVtblPrivate;
LONG ref;
NetCfgComponentItem * pItem;
INetCfgComponentPropertyUi * pProperty;
@@ -21,9 +22,13 @@ typedef struct
static __inline INetCfgComponentImpl* impl_from_INetCfgComponentBindings(INetCfgComponentBindings *iface)
{
return (INetCfgComponentImpl*)((char *)iface - FIELD_OFFSET(INetCfgComponentImpl, lpVtblComponentBindings));
return (INetCfgComponentImpl*)((char *)iface - FIELD_OFFSET(INetCfgComponentImpl, lpVtblBindings));
}
static __inline INetCfgComponentImpl* impl_from_INetCfgComponentPrivate(INetCfgComponentPrivate *iface)
{
return (INetCfgComponentImpl*)((char *)iface - FIELD_OFFSET(INetCfgComponentImpl, lpVtblPrivate));
}
/***************************************************************
* INetCfgComponentBindings
@@ -179,6 +184,59 @@ static const INetCfgComponentBindingsVtbl vt_NetCfgComponentBindings =
INetCfgComponentBindings_fnMoveAfter,
};
/***************************************************************
* INetCfgComponentPrivate
*/
HRESULT
WINAPI
INetCfgComponentPrivate_fnQueryInterface(
INetCfgComponentPrivate *iface,
REFIID iid,
LPVOID *ppvObj)
{
INetCfgComponentImpl *This = impl_from_INetCfgComponentPrivate(iface);
return INetCfgComponent_QueryInterface((INetCfgComponent*)This, iid, ppvObj);
}
ULONG
WINAPI
INetCfgComponentPrivate_fnAddRef(
INetCfgComponentPrivate *iface)
{
INetCfgComponentImpl *This = impl_from_INetCfgComponentPrivate(iface);
return INetCfgComponent_AddRef((INetCfgComponent*)This);
}
ULONG
WINAPI
INetCfgComponentPrivate_fnRelease(
INetCfgComponentPrivate *iface)
{
INetCfgComponentImpl *This = impl_from_INetCfgComponentPrivate(iface);
return INetCfgComponent_Release((INetCfgComponent*)This);
}
HRESULT
WINAPI
INetCfgComponentPrivate_fnUnknown1(
INetCfgComponentPrivate *iface,
DWORD dwParam1,
DWORD dwParam2)
{
// INetCfgComponentImpl *This = impl_from_INetCfgComponentPrivate(iface);
ERR("INetCfgComponentPrivate_fnUnknown1(%p %lx %lx)\n", iface, dwParam1, dwParam2);
return S_OK;
}
static const INetCfgComponentPrivateVtbl vt_NetCfgComponentPrivate =
{
INetCfgComponentPrivate_fnQueryInterface,
INetCfgComponentPrivate_fnAddRef,
INetCfgComponentPrivate_fnRelease,
INetCfgComponentPrivate_fnUnknown1,
};
/***************************************************************
* INetCfgComponent
*/
@@ -202,10 +260,17 @@ INetCfgComponent_fnQueryInterface(
}
else if (IsEqualIID (iid, &IID_INetCfgComponentBindings))
{
*ppvObj = (LPVOID)&This->lpVtblComponentBindings;
*ppvObj = (LPVOID)&This->lpVtblBindings;
INetCfgComponentBindings_AddRef(iface);
return S_OK;
}
else if (IsEqualIID (iid, &IID_INetCfgComponentPrivate))
{
TRACE("IID_INetCfgComponentPrivate\n");
*ppvObj = (LPVOID)&This->lpVtblPrivate;
INetCfgComponentPrivate_AddRef(iface);
return S_OK;
}
return E_NOINTERFACE;
}
@@ -693,7 +758,8 @@ INetCfgComponent_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv, N
This->ref = 1;
This->lpVtbl = (const INetCfgComponent*)&vt_NetCfgComponent;
This->lpVtblComponentBindings = (const INetCfgComponentBindings*)&vt_NetCfgComponentBindings;
This->lpVtblBindings = (const INetCfgComponentBindings*)&vt_NetCfgComponentBindings;
This->lpVtblPrivate = (const INetCfgComponentPrivate*)&vt_NetCfgComponentPrivate;
This->pProperty = NULL;
This->pItem = pItem;
This->pNCfg = pNCfg;

View File

@@ -22,6 +22,7 @@ DEFINE_GUID(IID_INetCfgClass, 0xC0E8AE97,0x306E,0x11D1,0xAA,0xCF,
DEFINE_GUID(IID_INetCfgComponent, 0xC0E8AE99,0x306E,0x11D1,0xAA,0xCF,0x00,0x80,0x5F,0xC1,0x27,0x0E);
DEFINE_GUID(IID_INetCfgClassSetup, 0xC0E8AE9D,0x306E,0x11D1,0xAA,0xCF,0x00,0x80,0x5F,0xC1,0x27,0x0E);
DEFINE_GUID(IID_INetCfgComponentBindings, 0xC0E8AE9E,0x306E,0x11D1,0xAA,0xCF,0x00,0x80,0x5F,0xC1,0x27,0x0E);
DEFINE_GUID(IID_INetCfgComponentPrivate, 0x98133273,0x4B20,0x11D1,0xAB,0x01,0x00,0x80,0x5F,0xC1,0x27,0x0E);
DEFINE_GUID(IID_INetCfgLock, 0xC0E8AE9F,0x306E,0x11D1,0xAA,0xCF,0x00,0x80,0x5F,0xC1,0x27,0x0E);
DEFINE_GUID(IID_INetConnectionPropertyUi2, 0xC08956B9,0x1CD3,0x11D1,0xB1,0xC5,0x00,0x80,0x5F,0xC1,0x27,0x0E);
DEFINE_GUID(IID_INetCfgPnpReconfigCallback, 0x8D84BD35,0xE227,0x11D2,0xB7,0x00,0x00,0xA0,0xC9,0x8A,0x6A,0x85);