ReactOS
0.4.16-dev-1946-g52006dd
interface.c
Go to the documentation of this file.
1
/*
2
* PROJECT: ReactOS IF Monitor DLL
3
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4
* PURPOSE: NetSh Helper interface context functions
5
* COPYRIGHT: Copyright 2025 Eric Kohl <eric.kohl@reactos.org>
6
*/
7
8
#include "
precomp.h
"
9
10
#include <guiddef.h>
11
12
#define NDEBUG
13
#include <debug.h>
14
15
#include "
guid.h
"
16
#include "
resource.h
"
17
18
static
FN_HANDLE_CMD
InterfaceShowInterface
;
19
20
static
21
CMD_ENTRY
22
InterfaceShowCommands
[] =
23
{
24
{
L
"interface"
,
InterfaceShowInterface
,
IDS_HLP_INTERFACE_SHOW_INTERFACE
,
IDS_HLP_INTERFACE_SHOW_INTERFACE_EX
, 0}
25
};
26
27
static
28
CMD_GROUP_ENTRY
29
InterfaceGroups
[] =
30
{
31
{
L
"show"
,
IDS_HLP_INTERFACE_SHOW
,
sizeof
(
InterfaceShowCommands
) /
sizeof
(
CMD_ENTRY
), 0,
InterfaceShowCommands
,
NULL
},
32
};
33
34
35
static
36
DWORD
37
WINAPI
38
InterfaceShowInterface
(
39
LPCWSTR
pwszMachine,
40
LPWSTR
*
argv
,
41
DWORD
dwCurrentIndex
,
42
DWORD
dwArgCount
,
43
DWORD
dwFlags
,
44
LPCVOID
pvData
,
45
BOOL
*
pbDone
)
46
{
47
PrintMessage
(
L
"InterfaceShowInterface(): Not implemented yet!\n"
);
48
49
return
ERROR_SUCCESS
;
50
}
51
52
53
static
54
DWORD
55
WINAPI
56
InterfaceDumpFn
(
57
_In_
LPCWSTR
pwszRouter,
58
_In_
LPWSTR
*
ppwcArguments
,
59
_In_
DWORD
dwArgCount
,
60
_In_
LPCVOID
pvData
)
61
{
62
DPRINT
(
"InterfaceDumpFn(%S %p %lu %p)\n"
, pwszRouter,
ppwcArguments
,
dwArgCount
,
pvData
);
63
64
PrintMessageFromModule
(
hDllInstance
,
IDS_DUMP_HEADERLINE
);
65
PrintMessage
(
L
"# Interface Configuration\n"
);
66
PrintMessageFromModule
(
hDllInstance
,
IDS_DUMP_HEADERLINE
);
67
PrintMessage
(
L
"pushd interface\n"
);
68
PrintMessageFromModule
(
hDllInstance
,
IDS_DUMP_NEWLINE
);
69
70
PrintMessageFromModule
(
hDllInstance
,
IDS_DUMP_NEWLINE
);
71
PrintMessage
(
L
"popd\n"
);
72
PrintMessage
(
L
"# End of Interface Configuration\n"
);
73
PrintMessageFromModule
(
hDllInstance
,
IDS_DUMP_NEWLINE
);
74
75
return
ERROR_SUCCESS
;
76
}
77
78
79
DWORD
80
WINAPI
81
InterfaceStart
(
82
_In_
const
GUID
*pguidParent,
83
_In_
DWORD
dwVersion
)
84
{
85
NS_CONTEXT_ATTRIBUTES
ContextAttributes;
86
87
DPRINT
(
"InterfaceStart()\n"
);
88
89
ZeroMemory
(&ContextAttributes,
sizeof
(ContextAttributes));
90
ContextAttributes.
dwVersion
= 1;
91
ContextAttributes.
pwszContext
=
L
"interface"
;
92
ContextAttributes.
guidHelper
= GUID_IFMON_INTERFACE;
93
94
ContextAttributes.
ulNumTopCmds
= 0;
95
ContextAttributes.
pTopCmds
=
NULL
;
96
97
ContextAttributes.
ulNumGroups
=
sizeof
(
InterfaceGroups
) /
sizeof
(
CMD_GROUP_ENTRY
);
98
ContextAttributes.
pCmdGroups
=
InterfaceGroups
;
99
100
ContextAttributes.
pfnDumpFn
=
InterfaceDumpFn
;
101
102
RegisterContext
(&ContextAttributes);
103
104
return
ERROR_SUCCESS
;
105
}
106
107
108
DWORD
109
WINAPI
110
RegisterInterfaceHelper
(
VOID
)
111
{
112
NS_HELPER_ATTRIBUTES
HelperAttributes;
113
114
DPRINT
(
"RegisterInterfaceHelper()\n"
);
115
116
ZeroMemory
(&HelperAttributes,
sizeof
(HelperAttributes));
117
HelperAttributes.
dwVersion
= 1;
118
HelperAttributes.
guidHelper
= GUID_IFMON_INTERFACE;
119
HelperAttributes.
pfnStart
=
InterfaceStart
;
120
HelperAttributes.
pfnStop
=
NULL
;
121
RegisterHelper
(
NULL
, &HelperAttributes);
122
123
return
ERROR_SUCCESS
;
124
}
PrintMessage
VOID PrintMessage(DWORD dwMessage)
Definition:
arp.c:95
RegisterContext
DWORD WINAPI RegisterContext(_In_ const NS_CONTEXT_ATTRIBUTES *pChildContext)
Definition:
context.c:909
hDllInstance
static HINSTANCE hDllInstance
Definition:
clb.c:9
ERROR_SUCCESS
#define ERROR_SUCCESS
Definition:
deptool.c:10
NULL
#define NULL
Definition:
types.h:112
RegisterInterfaceHelper
DWORD WINAPI RegisterInterfaceHelper(VOID)
Definition:
interface.c:110
InterfaceShowCommands
static CMD_ENTRY InterfaceShowCommands[]
Definition:
interface.c:22
InterfaceShowInterface
static FN_HANDLE_CMD InterfaceShowInterface
Definition:
interface.c:18
InterfaceGroups
static CMD_GROUP_ENTRY InterfaceGroups[]
Definition:
interface.c:29
InterfaceDumpFn
static DWORD WINAPI InterfaceDumpFn(_In_ LPCWSTR pwszRouter, _In_ LPWSTR *ppwcArguments, _In_ DWORD dwArgCount, _In_ LPCVOID pvData)
Definition:
interface.c:56
InterfaceStart
DWORD WINAPI InterfaceStart(_In_ const GUID *pguidParent, _In_ DWORD dwVersion)
Definition:
interface.c:81
IDS_DUMP_NEWLINE
#define IDS_DUMP_NEWLINE
Definition:
resource.h:32
IDS_DUMP_HEADERLINE
#define IDS_DUMP_HEADERLINE
Definition:
resource.h:33
IDS_HLP_INTERFACE_SHOW
#define IDS_HLP_INTERFACE_SHOW
Definition:
resource.h:2
IDS_HLP_INTERFACE_SHOW_INTERFACE
#define IDS_HLP_INTERFACE_SHOW_INTERFACE
Definition:
resource.h:3
IDS_HLP_INTERFACE_SHOW_INTERFACE_EX
#define IDS_HLP_INTERFACE_SHOW_INTERFACE_EX
Definition:
resource.h:4
L
#define L(x)
Definition:
resources.c:13
BOOL
unsigned int BOOL
Definition:
ntddk_ex.h:94
DWORD
unsigned long DWORD
Definition:
ntddk_ex.h:95
guid.h
RegisterHelper
DWORD WINAPI RegisterHelper(_In_ const GUID *pguidParentHelper, _In_ const NS_HELPER_ATTRIBUTES *pHelperAttributes)
Definition:
helper.c:385
GUID
Definition:
shobjidl.idl:3021
void
Definition:
nsiface.idl:2307
ZeroMemory
#define ZeroMemory
Definition:
minwinbase.h:31
LPCVOID
CONST void * LPCVOID
Definition:
minwindef.h:164
argv
#define argv
Definition:
mplay32.c:18
PrintMessageFromModule
DWORD CDECL PrintMessageFromModule(_In_ HANDLE hModule, _In_ DWORD dwMsgId,...)
Definition:
netsh.c:523
dwFlags
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition:
netsh.h:141
pvData
_In_ LPWSTR _In_ DWORD _In_ LPCVOID pvData
Definition:
netsh.h:116
ppwcArguments
_In_ LPWSTR * ppwcArguments
Definition:
netsh.h:114
dwVersion
_In_ DWORD dwVersion
Definition:
netsh.h:85
dwArgCount
_In_ LPWSTR _In_ DWORD dwArgCount
Definition:
netsh.h:115
pbDone
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD _In_ LPCVOID _Out_ BOOL * pbDone
Definition:
netsh.h:143
dwCurrentIndex
_In_ LPWSTR _In_ DWORD dwCurrentIndex
Definition:
netsh.h:139
_In_
#define _In_
Definition:
no_sal2.h:158
DPRINT
#define DPRINT
Definition:
sndvol32.h:73
_CMD_ENTRY
Definition:
netsh.h:148
_CMD_GROUP_ENTRY
Definition:
netsh.h:158
_NS_CONTEXT_ATTRIBUTES
Definition:
netsh.h:184
_NS_CONTEXT_ATTRIBUTES::pwszContext
LPWSTR pwszContext
Definition:
netsh.h:194
_NS_CONTEXT_ATTRIBUTES::pTopCmds
CMD_ENTRY * pTopCmds
Definition:
netsh.h:199
_NS_CONTEXT_ATTRIBUTES::guidHelper
GUID guidHelper
Definition:
netsh.h:195
_NS_CONTEXT_ATTRIBUTES::dwVersion
DWORD dwVersion
Definition:
netsh.h:189
_NS_CONTEXT_ATTRIBUTES::ulNumTopCmds
ULONG ulNumTopCmds
Definition:
netsh.h:198
_NS_CONTEXT_ATTRIBUTES::pCmdGroups
CMD_GROUP_ENTRY * pCmdGroups
Definition:
netsh.h:201
_NS_CONTEXT_ATTRIBUTES::pfnDumpFn
PNS_CONTEXT_DUMP_FN pfnDumpFn
Definition:
netsh.h:203
_NS_CONTEXT_ATTRIBUTES::ulNumGroups
ULONG ulNumGroups
Definition:
netsh.h:200
_NS_HELPER_ATTRIBUTES
Definition:
netsh.h:168
_NS_HELPER_ATTRIBUTES::dwVersion
DWORD dwVersion
Definition:
netsh.h:173
_NS_HELPER_ATTRIBUTES::pfnStop
PNS_HELPER_STOP_FN pfnStop
Definition:
netsh.h:180
_NS_HELPER_ATTRIBUTES::guidHelper
GUID guidHelper
Definition:
netsh.h:178
_NS_HELPER_ATTRIBUTES::pfnStart
PNS_HELPER_START_FN pfnStart
Definition:
netsh.h:179
precomp.h
resource.h
WINAPI
#define WINAPI
Definition:
msvc.h:6
LPCWSTR
const WCHAR * LPCWSTR
Definition:
xmlstorage.h:185
LPWSTR
WCHAR * LPWSTR
Definition:
xmlstorage.h:184
dll
win32
ifmon
interface.c
Generated on Thu Dec 4 2025 06:04:19 for ReactOS by
1.9.6