Commit ecbd9978 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

nsiproxy: Implement NDIS index to luid get_parameter.

parent 8eef4a87
......@@ -382,9 +382,39 @@ static void test_ndis_ifinfo( void )
NsiFreeTable( luid_tbl, rw_tbl, dyn_tbl, stat_tbl );
}
static void test_ndis_index_luid( void )
{
DWORD err, count, i;
NET_LUID *luids, luid;
DWORD index;
/* index -> luid map. NsiAllocateAndGetTable and NsiGetAllParameters fail */
/* first get the luids */
err = NsiAllocateAndGetTable( 1, &NPI_MS_NDIS_MODULEID, NSI_NDIS_IFINFO_TABLE, (void **)&luids, sizeof(*luids),
NULL, 0, NULL, 0, NULL, 0, &count, 0 );
ok( !err, "got %d\n", err );
for (i = 0; i < count; i++)
{
ConvertInterfaceLuidToIndex( luids + i, &index );
err = NsiGetParameter( 1, &NPI_MS_NDIS_MODULEID, NSI_NDIS_INDEX_LUID_TABLE, &index, sizeof(index),
NSI_PARAM_TYPE_STATIC, &luid, sizeof(luid), 0 );
ok( !err, "got %d\n", err );
ok( luid.Value == luids[i].Value, "%d: luid mismatch\n", i );
}
NsiFreeTable( luids, NULL, NULL, NULL );
index = ~0u;
err = NsiGetParameter( 1, &NPI_MS_NDIS_MODULEID, NSI_NDIS_INDEX_LUID_TABLE, &index, sizeof(index),
NSI_PARAM_TYPE_STATIC, &luid, sizeof(luid), 0 );
ok( err == ERROR_FILE_NOT_FOUND, "got %d\n", err );
}
START_TEST( nsi )
{
test_nsi_api();
test_ndis_ifinfo();
test_ndis_index_luid();
}
......@@ -584,6 +584,31 @@ static NTSTATUS ifinfo_get_parameter( const void *key, DWORD key_size, DWORD par
return status;
}
static NTSTATUS index_luid_get_parameter( const void *key, DWORD key_size, DWORD param_type,
void *data, DWORD data_size, DWORD data_offset )
{
struct if_entry *entry;
NTSTATUS status = STATUS_OBJECT_NAME_NOT_FOUND;
TRACE( "%p %d %d %p %d %d\n", key, key_size, param_type, data, data_size, data_offset );
if (param_type != NSI_PARAM_TYPE_STATIC || data_size != sizeof(NET_LUID) || data_offset != 0)
return STATUS_INVALID_PARAMETER;
EnterCriticalSection( &if_list_cs );
update_if_table();
entry = find_entry_from_index( *(DWORD *)key );
if (entry)
{
*(NET_LUID *)data = entry->if_luid;
status = STATUS_SUCCESS;
}
LeaveCriticalSection( &if_list_cs );
return status;
}
static const struct module_table tables[] =
{
{
......@@ -596,6 +621,16 @@ static const struct module_table tables[] =
ifinfo_get_all_parameters,
ifinfo_get_parameter
},
{
NSI_NDIS_INDEX_LUID_TABLE,
{
sizeof(DWORD), 0,
0, sizeof(NET_LUID)
},
NULL,
NULL,
index_luid_get_parameter
},
{ ~0u }
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment