4 * Copyright 2021 Huw Davies
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 NTSTATUS
nsi_enumerate_all_ex( struct nsi_enumerate_all_ex
*params
) DECLSPEC_HIDDEN
;
22 NTSTATUS
nsi_get_all_parameters_ex( struct nsi_get_all_parameters_ex
*params
) DECLSPEC_HIDDEN
;
23 NTSTATUS
nsi_get_parameter_ex( struct nsi_get_parameter_ex
*params
) DECLSPEC_HIDDEN
;
25 static inline NTSTATUS
nsi_enumerate_all( DWORD unk
, DWORD unk2
, const NPI_MODULEID
*module
, DWORD table
,
26 void *key_data
, DWORD key_size
, void *rw_data
, DWORD rw_size
,
27 void *dynamic_data
, DWORD dynamic_size
, void *static_data
, DWORD static_size
,
30 struct nsi_enumerate_all_ex params
;
33 params
.unknown
[0] = 0;
34 params
.unknown
[1] = 0;
35 params
.module
= module
;
37 params
.first_arg
= unk
;
38 params
.second_arg
= unk2
;
39 params
.key_data
= key_data
;
40 params
.key_size
= key_size
;
41 params
.rw_data
= rw_data
;
42 params
.rw_size
= rw_size
;
43 params
.dynamic_data
= dynamic_data
;
44 params
.dynamic_size
= dynamic_size
;
45 params
.static_data
= static_data
;
46 params
.static_size
= static_size
;
47 params
.count
= *count
;
49 status
= nsi_enumerate_all_ex( ¶ms
);
50 *count
= params
.count
;
54 BOOL
convert_luid_to_unix_name( const NET_LUID
*luid
, const char **unix_name
) DECLSPEC_HIDDEN
;
55 BOOL
convert_unix_name_to_luid( const char *unix_name
, NET_LUID
*luid
) DECLSPEC_HIDDEN
;
57 static inline BOOL
convert_luid_to_index( const NET_LUID
*luid
, DWORD
*index
)
59 struct nsi_get_parameter_ex params
;
60 params
.unknown
[0] = 0;
61 params
.unknown
[1] = 0;
64 params
.module
= &NPI_MS_NDIS_MODULEID
;
65 params
.table
= NSI_NDIS_IFINFO_TABLE
;
67 params
.key_size
= sizeof(*luid
);
68 params
.param_type
= NSI_PARAM_TYPE_STATIC
;
70 params
.data_size
= sizeof(*index
);
71 params
.data_offset
= FIELD_OFFSET(struct nsi_ndis_ifinfo_static
, if_index
);
73 return !nsi_get_parameter_ex( ¶ms
);
76 static inline BOOL
convert_index_to_luid( DWORD index
, NET_LUID
*luid
)
78 struct nsi_get_parameter_ex params
;
79 params
.unknown
[0] = 0;
80 params
.unknown
[1] = 0;
83 params
.module
= &NPI_MS_NDIS_MODULEID
;
84 params
.table
= NSI_NDIS_INDEX_LUID_TABLE
;
86 params
.key_size
= sizeof(index
);
87 params
.param_type
= NSI_PARAM_TYPE_STATIC
;
89 params
.data_size
= sizeof(*luid
);
90 params
.data_offset
= 0;
92 return !nsi_get_parameter_ex( ¶ms
);
99 NTSTATUS (*enumerate_all
)( void *key_data
, DWORD key_size
, void *rw_data
, DWORD rw_size
,
100 void *dynamic_data
, DWORD dynamic_size
,
101 void *static_data
, DWORD static_size
, DWORD_PTR
*count
);
102 NTSTATUS (*get_all_parameters
)( const void *key
, DWORD key_size
, void *rw_data
, DWORD rw_size
,
103 void *dynamic_data
, DWORD dynamic_size
,
104 void *static_data
, DWORD static_size
);
105 NTSTATUS (*get_parameter
)( const void *key
, DWORD key_size
, DWORD param_type
,
106 void *data
, DWORD data_size
, DWORD data_offset
);
111 const NPI_MODULEID
*module
;
112 const struct module_table
*tables
;
115 extern const struct module ndis_module DECLSPEC_HIDDEN
;
116 extern const struct module ipv4_module DECLSPEC_HIDDEN
;
117 extern const struct module ipv6_module DECLSPEC_HIDDEN
;
118 extern const struct module tcp_module DECLSPEC_HIDDEN
;