Signed-off-by: Huw Davies huw@codeweavers.com --- dlls/nsi/nsi.c | 9 ++++++++ dlls/nsi/nsi.spec | 2 +- dlls/nsi/tests/nsi.c | 50 ++++++++++++++++++++++++++++++++++++++++++++ include/wine/nsi.h | 3 +++ 4 files changed, 63 insertions(+), 1 deletion(-)
diff --git a/dlls/nsi/nsi.c b/dlls/nsi/nsi.c index d55445a3dd7..3691dd5ad2b 100644 --- a/dlls/nsi/nsi.c +++ b/dlls/nsi/nsi.c @@ -42,3 +42,12 @@ void WINAPI NsiFreeTable( void *key_data, void *rw_data, void *dynamic_data, voi { FIXME( "%p %p %p %p: stub\n", key_data, rw_data, dynamic_data, static_data ); } + +DWORD WINAPI NsiGetAllParameters( DWORD unk, const NPI_MODULEID *module, DWORD table, const void *key, DWORD key_size, + void *rw_data, DWORD rw_size, void *dynamic_data, DWORD dynamic_size, + void *static_data, DWORD static_size ) +{ + FIXME( "%d %p %d %p %d %p %d %p %d %p %d: stub\n", unk, module, table, key, key_size, + rw_data, rw_size, dynamic_data, dynamic_size, static_data, static_size ); + return ERROR_CALL_NOT_IMPLEMENTED; +} diff --git a/dlls/nsi/nsi.spec b/dlls/nsi/nsi.spec index fc2db9e35c1..7db46c83e94 100644 --- a/dlls/nsi/nsi.spec +++ b/dlls/nsi/nsi.spec @@ -8,7 +8,7 @@ @ stub NsiEnumerateObjectsAllPersistentParametersWithMask @ stub NsiFreePersistentDataWithMaskTable @ stdcall NsiFreeTable(ptr ptr ptr ptr) -@ stub NsiGetAllParameters +@ stdcall NsiGetAllParameters(long ptr long ptr long ptr long ptr long ptr long) @ stub NsiGetAllParametersEx @ stub NsiGetAllPersistentParametersWithMask @ stub NsiObjectSecurity diff --git a/dlls/nsi/tests/nsi.c b/dlls/nsi/tests/nsi.c index 0cdb1993f1c..e0c0fcf168b 100644 --- a/dlls/nsi/tests/nsi.c +++ b/dlls/nsi/tests/nsi.c @@ -33,6 +33,54 @@ static int bounded( ULONG64 val, ULONG64 lo, ULONG64 hi ) return lo <= val && val <= hi; }
+static void test_nsi_api( void ) +{ + DWORD rw_sizes[] = { FIELD_OFFSET(struct nsi_ndis_ifinfo_rw, name2), FIELD_OFFSET(struct nsi_ndis_ifinfo_rw, unk), + sizeof(struct nsi_ndis_ifinfo_rw) }; + struct nsi_ndis_ifinfo_rw *rw_tbl, *rw, get_rw; + struct nsi_ndis_ifinfo_dynamic *dyn_tbl, *dyn, get_dyn; + struct nsi_ndis_ifinfo_static *stat_tbl, *stat, get_stat; + DWORD err, count, i, rw_size; + NET_LUID *luid_tbl; + + /* Use the NDIS ifinfo table to test various api */ + for (i = 0; i < ARRAY_SIZE(rw_sizes); i++) + { + err = NsiAllocateAndGetTable( 1, &NPI_MS_NDIS_MODULEID, NSI_NDIS_IFINFO_TABLE, (void **)&luid_tbl, sizeof(*luid_tbl), + (void **)&rw_tbl, rw_sizes[i], (void **)&dyn_tbl, sizeof(*dyn_tbl), + (void **)&stat_tbl, sizeof(*stat_tbl), &count, 0 ); + if (!err) break; + } +todo_wine + ok( !err, "got %d\n", err ); + if (err) return; + rw_size = rw_sizes[i]; + + for (i = 0; i < count; i++) + { + winetest_push_context( "%d", i ); + rw = (struct nsi_ndis_ifinfo_rw *)((BYTE *)rw_tbl + i * rw_size); + dyn = dyn_tbl + i; + stat = stat_tbl + i; + + err = NsiGetAllParameters( 1, &NPI_MS_NDIS_MODULEID, NSI_NDIS_IFINFO_TABLE, luid_tbl + i, sizeof(*luid_tbl), + &get_rw, rw_size, &get_dyn, sizeof(get_dyn), &get_stat, sizeof(get_stat) ); + ok( !err, "got %d\n", err ); + /* test a selection of members */ + ok( IsEqualGUID( &get_rw.network_guid, &rw->network_guid ), "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( get_rw.phys_addr.Length == rw->phys_addr.Length, "mismatch\n" ); + ok( !memcmp( get_rw.phys_addr.Address, rw->phys_addr.Address, IF_MAX_PHYS_ADDRESS_LENGTH ), "mismatch\n" ); + ok( get_dyn.oper_status == dyn->oper_status, "mismatch\n" ); + ok( get_stat.if_index == stat->if_index, "mismatch\n" ); + ok( IsEqualGUID( &get_stat.if_guid, &stat->if_guid ), "mismatch\n" ); + winetest_pop_context(); + } + + NsiFreeTable( luid_tbl, rw_tbl, dyn_tbl, stat_tbl ); +} + static void test_ndis_ifinfo( void ) { DWORD rw_sizes[] = { FIELD_OFFSET(struct nsi_ndis_ifinfo_rw, name2), FIELD_OFFSET(struct nsi_ndis_ifinfo_rw, unk), @@ -145,5 +193,7 @@ todo_wine
START_TEST( nsi ) { + test_nsi_api(); + test_ndis_ifinfo(); } diff --git a/include/wine/nsi.h b/include/wine/nsi.h index 362eaed0c4e..547ed91ce41 100644 --- a/include/wine/nsi.h +++ b/include/wine/nsi.h @@ -97,5 +97,8 @@ DWORD WINAPI NsiAllocateAndGetTable( DWORD unk, const NPI_MODULEID *module, DWOR void **rw_data, DWORD rw_size, void **dynamic_data, DWORD dynamic_size, void **static_data, DWORD static_size, DWORD *count, DWORD unk2 ); void WINAPI NsiFreeTable( void *key_data, void *rw_data, void *dynamic_data, void *static_data ); +DWORD WINAPI NsiGetAllParameters( DWORD unk, const NPI_MODULEID *module, DWORD table, const void *key, DWORD key_size, + void *rw_data, DWORD rw_size, void *dynamic_data, DWORD dynamic_size, + void *static_data, DWORD static_size );
#endif /* __WINE_NSI_H */