Hi,
I’m new to the NDIS world & started playing around NDIS Filter driver (for learning purpose).
I’ve modified the ndislwf sample & started handling the OID_802_3_CURRENT_ADDRESS (@FilterOidRequest callback). I’m seeing this OID request is called during the initial stage & whenever I open “Network & sharing settings (Win10)”. In the callback, I override with a dummy MAC address & returning NDIS_STATUS_SUCCESS.
The particular code-snippet looks similar to the below code,
NDIS_STATUS
FilterOidRequest(
NDIS_HANDLE FilterModuleContext,
PNDIS_OID_REQUEST Request
)
{
NDIS_OID oid = Request->DATA.QUERY_INFORMATION.Oid;
if (oid == OID_802_3_CURRENT_ADDRESS && Request->RequestType == NdisRequestQueryInformation)
{
NDIS_STATUS newStatus = NDIS_STATUS_SUCCESS;
char overrideMac[6] = { 0xAA, 0xBB, 0xCC, 1, 2, 3 };
ULONG macAddrSz = 6;
if (Request->DATA.QUERY_INFORMATION.InformationBufferLength >= macAddrSz )
{
RtlCopyMemory(Request->DATA.QUERY_INFORMATION.InformationBuffer, overrideMac, macAddrSz );
Request->DATA.QUERY_INFORMATION.BytesWritten = macAddrSz ;
Request->DATA.QUERY_INFORMATION.BytesNeeded = macAddrSz ;
}
else
{
Request->DATA.QUERY_INFORMATION.BytesWritten = 0;
Request->DATA.QUERY_INFORMATION.BytesNeeded = macAddrSz ;
newStatus = NDIS_STATUS_INVALID_LENGTH;
}
return newStatus;
}
But nowhere the new MAC address is reflected (ipconfig /all, getmac, Get-NetAdapters …).
So, is it possible to change an adapter’s MAC address from NDIS Filter driver? If no, what is the purpose of “OID_802_3_CURRENT_ADDRESS”?
Thanks & Regards,
Gokul T V