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

nsiproxy: Implement NDIS ifinfo get_parameter for a few parameters.

parent 794ecdc5
...@@ -113,9 +113,7 @@ static void test_nsi_api( void ) ...@@ -113,9 +113,7 @@ static void test_nsi_api( void )
err = NsiGetParameter( 1, &NPI_MS_NDIS_MODULEID, NSI_NDIS_IFINFO_TABLE, luid_tbl + i, sizeof(*luid_tbl), err = NsiGetParameter( 1, &NPI_MS_NDIS_MODULEID, NSI_NDIS_IFINFO_TABLE, luid_tbl + i, sizeof(*luid_tbl),
NSI_PARAM_TYPE_RW, &get_rw.alias, sizeof(get_rw.alias), NSI_PARAM_TYPE_RW, &get_rw.alias, sizeof(get_rw.alias),
FIELD_OFFSET(struct nsi_ndis_ifinfo_rw, alias) ); FIELD_OFFSET(struct nsi_ndis_ifinfo_rw, alias) );
todo_wine
ok( !err, "got %d\n", err ); ok( !err, "got %d\n", err );
if (err) continue;
ok( get_rw.alias.Length == rw->alias.Length, "mismatch\n" ); ok( get_rw.alias.Length == rw->alias.Length, "mismatch\n" );
ok( !memcmp( get_rw.alias.String, rw->alias.String, rw->alias.Length ), "mismatch\n" ); ok( !memcmp( get_rw.alias.String, rw->alias.String, rw->alias.Length ), "mismatch\n" );
...@@ -362,12 +360,23 @@ static void test_ndis_ifinfo( void ) ...@@ -362,12 +360,23 @@ static void test_ndis_ifinfo( void )
ok( !err, "got %d\n", err ); ok( !err, "got %d\n", err );
ok( IsEqualGUID( &stat_tbl[0].if_guid, &stat_get.if_guid ), "mismatch\n" ); ok( IsEqualGUID( &stat_tbl[0].if_guid, &stat_get.if_guid ), "mismatch\n" );
err = NsiGetParameter( 1, &NPI_MS_NDIS_MODULEID, NSI_NDIS_IFINFO_TABLE, luid_tbl, sizeof(*luid_tbl),
NSI_PARAM_TYPE_STATIC, &stat_get.if_guid, sizeof(stat_get.if_guid),
FIELD_OFFSET(struct nsi_ndis_ifinfo_static, if_guid) );
ok( !err, "got %d\n", err );
ok( IsEqualGUID( &stat_tbl[0].if_guid, &stat_get.if_guid ), "mismatch\n" );
luid_get.Value = ~0u; luid_get.Value = ~0u;
err = NsiGetAllParameters( 1, &NPI_MS_NDIS_MODULEID, NSI_NDIS_IFINFO_TABLE, &luid_get, sizeof(luid_get), err = NsiGetAllParameters( 1, &NPI_MS_NDIS_MODULEID, NSI_NDIS_IFINFO_TABLE, &luid_get, sizeof(luid_get),
&rw_get, rw_size, &dyn_get, sizeof(dyn_get), &rw_get, rw_size, &dyn_get, sizeof(dyn_get),
&stat_get, sizeof(stat_get) ); &stat_get, sizeof(stat_get) );
ok( err == ERROR_FILE_NOT_FOUND, "got %d\n", err ); ok( err == ERROR_FILE_NOT_FOUND, "got %d\n", err );
err = NsiGetParameter( 1, &NPI_MS_NDIS_MODULEID, NSI_NDIS_IFINFO_TABLE, &luid_get, sizeof(luid_get),
NSI_PARAM_TYPE_STATIC, &stat_get.if_guid, sizeof(stat_get.if_guid),
FIELD_OFFSET(struct nsi_ndis_ifinfo_static, if_guid) );
ok( err == ERROR_FILE_NOT_FOUND, "got %d\n", err );
FreeMibTable( table ); FreeMibTable( table );
NsiFreeTable( luid_tbl_2, NULL, dyn_tbl_2, NULL ); NsiFreeTable( luid_tbl_2, NULL, dyn_tbl_2, NULL );
NsiFreeTable( luid_tbl, rw_tbl, dyn_tbl, stat_tbl ); NsiFreeTable( luid_tbl, rw_tbl, dyn_tbl, stat_tbl );
......
...@@ -515,6 +515,75 @@ static NTSTATUS ifinfo_get_all_parameters( const void *key, DWORD key_size, void ...@@ -515,6 +515,75 @@ static NTSTATUS ifinfo_get_all_parameters( const void *key, DWORD key_size, void
return status; 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;
}
static NTSTATUS ifinfo_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 );
EnterCriticalSection( &if_list_cs );
update_if_table();
entry = find_entry_from_luid( (const NET_LUID *)key );
if (entry)
{
switch (param_type)
{
case NSI_PARAM_TYPE_RW:
status = ifinfo_get_rw_parameter( entry, data, data_size, data_offset );
break;
case NSI_PARAM_TYPE_STATIC:
status = ifinfo_get_static_parameter( entry, data, data_size, data_offset );
break;
}
}
LeaveCriticalSection( &if_list_cs );
return status;
}
static const struct module_table tables[] = static const struct module_table tables[] =
{ {
{ {
...@@ -525,6 +594,7 @@ static const struct module_table tables[] = ...@@ -525,6 +594,7 @@ static const struct module_table tables[] =
}, },
ifinfo_enumerate_all, ifinfo_enumerate_all,
ifinfo_get_all_parameters, ifinfo_get_all_parameters,
ifinfo_get_parameter
}, },
{ ~0u } { ~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