[PATCH 6/6] nsiproxy: Implement NDIS ifinfo get_parameter for a few parameters.

Huw Davies huw at codeweavers.com
Thu Jul 1 03:45:22 CDT 2021


On Thu, Jul 01, 2021 at 09:27:08AM +0100, Huw Davies wrote:
> diff --git a/dlls/nsiproxy.sys/ndis.c b/dlls/nsiproxy.sys/ndis.c
> index 8e5eccbbf23..647fd650cd3 100644
> --- a/dlls/nsiproxy.sys/ndis.c
> +++ b/dlls/nsiproxy.sys/ndis.c
> @@ -515,6 +515,75 @@ static NTSTATUS ifinfo_get_all_parameters( const void *key, DWORD key_size, void
>      return status;
>  }
>  
> +static NTSTATUS ifinfo_get_rw_parameter( struct if_entry *entry, void *data, DWORD data_size, DWORD data_offset )
> +{
> +    switch (data_offset)
> +    {
> +    case FIELD_OFFSET( struct nsi_ndis_ifinfo_rw, alias ):
> +    {
> +        IF_COUNTED_STRING *str = (IF_COUNTED_STRING *)data;
> +        if (data_size != sizeof(*str)) return STATUS_INVALID_PARAMETER;
> +        if_counted_string_init( str, entry->if_name );
> +        return STATUS_SUCCESS;
> +    }
> +    default:
> +        FIXME( "Offset %#x not handled\n", data_offset );
> +    }
> +
> +    return STATUS_INVALID_PARAMETER;
> +}
> +
> +static NTSTATUS ifinfo_get_static_parameter( struct if_entry *entry, void *data, DWORD data_size, DWORD data_offset )
> +{
> +    switch (data_offset)
> +    {
> +    case FIELD_OFFSET( struct nsi_ndis_ifinfo_static, if_index ):
> +        if (data_size != sizeof(DWORD)) return STATUS_INVALID_PARAMETER;
> +        *(DWORD *)data = entry->if_index;
> +        return STATUS_SUCCESS;
> +
> +    case FIELD_OFFSET( struct nsi_ndis_ifinfo_static, if_guid ):
> +        if (data_size != sizeof(GUID)) return STATUS_INVALID_PARAMETER;
> +        *(GUID *)data = entry->if_guid;
> +        return STATUS_SUCCESS;
> +
> +    default:
> +        FIXME( "Offset %#x not handled\n", data_offset );
> +    }
> +    return STATUS_INVALID_PARAMETER;
> +}

I should add, that while this doesn't look particularly scalable, I
think these should be the only parameters that iphlpapi will need from
this table.  In addition, the only other use of NsiGetParameter() that
I've come across will be for a single parameter in the index -> luid
table [1].  So bearing that in mind, I decided to keep it simple and not
implement a more generic solution.

Huw.

[1] Essentially these are all used to implement the some of the
ConvertInterface*() functions.



More information about the wine-devel mailing list