2021-06-29 09:04:21 +02:00
|
|
|
/*
|
|
|
|
* nsiproxy.sys
|
|
|
|
*
|
|
|
|
* Copyright 2021 Huw Davies
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
NTSTATUS nsi_enumerate_all_ex( struct nsi_enumerate_all_ex *params ) DECLSPEC_HIDDEN;
|
2021-07-01 10:27:03 +02:00
|
|
|
NTSTATUS nsi_get_all_parameters_ex( struct nsi_get_all_parameters_ex *params ) DECLSPEC_HIDDEN;
|
2021-07-01 10:27:06 +02:00
|
|
|
NTSTATUS nsi_get_parameter_ex( struct nsi_get_parameter_ex *params ) DECLSPEC_HIDDEN;
|
2021-06-30 10:59:24 +02:00
|
|
|
|
2021-07-20 09:43:25 +02:00
|
|
|
BOOL convert_luid_to_unix_name( const NET_LUID *luid, const char **unix_name ) DECLSPEC_HIDDEN;
|
2021-07-20 09:43:24 +02:00
|
|
|
BOOL convert_unix_name_to_luid( const char *unix_name, NET_LUID *luid ) DECLSPEC_HIDDEN;
|
|
|
|
|
2021-08-02 10:19:04 +02:00
|
|
|
static inline BOOL convert_luid_to_index( const NET_LUID *luid, DWORD *index )
|
|
|
|
{
|
|
|
|
struct nsi_get_parameter_ex params;
|
|
|
|
params.unknown[0] = 0;
|
|
|
|
params.unknown[1] = 0;
|
|
|
|
params.first_arg = 1;
|
|
|
|
params.unknown2 = 0;
|
|
|
|
params.module = &NPI_MS_NDIS_MODULEID;
|
|
|
|
params.table = NSI_NDIS_IFINFO_TABLE;
|
|
|
|
params.key = luid;
|
|
|
|
params.key_size = sizeof(*luid);
|
|
|
|
params.param_type = NSI_PARAM_TYPE_STATIC;
|
|
|
|
params.data = index;
|
|
|
|
params.data_size = sizeof(*index);
|
|
|
|
params.data_offset = FIELD_OFFSET(struct nsi_ndis_ifinfo_static, if_index);
|
|
|
|
|
|
|
|
return !nsi_get_parameter_ex( ¶ms );
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline BOOL convert_index_to_luid( DWORD index, NET_LUID *luid )
|
|
|
|
{
|
|
|
|
struct nsi_get_parameter_ex params;
|
|
|
|
params.unknown[0] = 0;
|
|
|
|
params.unknown[1] = 0;
|
|
|
|
params.first_arg = 1;
|
|
|
|
params.unknown2 = 0;
|
|
|
|
params.module = &NPI_MS_NDIS_MODULEID;
|
|
|
|
params.table = NSI_NDIS_INDEX_LUID_TABLE;
|
|
|
|
params.key = &index;
|
|
|
|
params.key_size = sizeof(index);
|
|
|
|
params.param_type = NSI_PARAM_TYPE_STATIC;
|
|
|
|
params.data = luid;
|
|
|
|
params.data_size = sizeof(*luid);
|
|
|
|
params.data_offset = 0;
|
|
|
|
|
|
|
|
return !nsi_get_parameter_ex( ¶ms );
|
|
|
|
}
|
|
|
|
|
2021-06-30 10:59:24 +02:00
|
|
|
struct module_table
|
|
|
|
{
|
|
|
|
DWORD table;
|
|
|
|
DWORD sizes[4];
|
|
|
|
NTSTATUS (*enumerate_all)( void *key_data, DWORD key_size, void *rw_data, DWORD rw_size,
|
|
|
|
void *dynamic_data, DWORD dynamic_size,
|
|
|
|
void *static_data, DWORD static_size, DWORD_PTR *count );
|
2021-07-01 10:27:03 +02:00
|
|
|
NTSTATUS (*get_all_parameters)( const void *key, DWORD key_size, void *rw_data, DWORD rw_size,
|
|
|
|
void *dynamic_data, DWORD dynamic_size,
|
|
|
|
void *static_data, DWORD static_size );
|
2021-07-01 10:27:06 +02:00
|
|
|
NTSTATUS (*get_parameter)( const void *key, DWORD key_size, DWORD param_type,
|
|
|
|
void *data, DWORD data_size, DWORD data_offset );
|
2021-06-30 10:59:24 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct module
|
|
|
|
{
|
|
|
|
const NPI_MODULEID *module;
|
|
|
|
const struct module_table *tables;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern const struct module ndis_module DECLSPEC_HIDDEN;
|
2021-07-20 09:43:24 +02:00
|
|
|
extern const struct module ipv4_module DECLSPEC_HIDDEN;
|
|
|
|
extern const struct module ipv6_module DECLSPEC_HIDDEN;
|