[NETCFGX] Call DhcpFallbackRefreshParams when the alternate configuration has been changed

This commit is contained in:
Eric Kohl
2026-04-06 14:13:07 +02:00
parent 4b9adaa971
commit b2e9439a53
+22
View File
@@ -6,6 +6,8 @@
#include <dhcpcsdk.h>
#include <dhcpcapi.h>
typedef DWORD (WINAPI *PDHCPFALLBACKREFRESHPARAMS)(PWSTR pAdapterName);
typedef struct
{
DWORD EnableSecurityFilters;
@@ -3789,6 +3791,7 @@ INetCfgComponentControl_fnApplyPnpChanges(
INetCfgPnpReconfigCallback *pICallback)
{
TcpipSettings *pCurrentConfig, *pOldConfig;
LPOLESTR pAdapterName;
ULONG NTEInstance;
DWORD DhcpApiVersion;
DWORD dwSize;
@@ -3797,6 +3800,11 @@ INetCfgComponentControl_fnApplyPnpChanges(
TcpipConfNotifyImpl *This = (TcpipConfNotifyImpl*)iface;
if (FAILED(StringFromCLSID(&This->NetCfgInstanceId, &pAdapterName)))
{
return E_FAIL;
}
pCurrentConfig = This->pCurrentConfig;
pOldConfig = This->pOldConfig;
@@ -3895,6 +3903,20 @@ INetCfgComponentControl_fnApplyPnpChanges(
CreateIpForwardEntry(&RouterMib);
}
/* Notify the DHCP client of the changed alternate configuration */
if (!RtlEqualMemory(&pCurrentConfig->AltConfig, &pOldConfig->AltConfig, sizeof(AlternateConfiguration)))
{
HMODULE hDhcpModule = LoadLibraryW(L"dhcpcsvc.dll");
if (hDhcpModule)
{
PDHCPFALLBACKREFRESHPARAMS pFunc = (PDHCPFALLBACKREFRESHPARAMS)GetProcAddress(hDhcpModule, "DhcpFallbackRefreshParams");
(pFunc)(pAdapterName);
FreeLibrary(hDhcpModule);
}
}
return S_OK;
}