reactos/dll/shellext/netshell
Jérôme Gardou ed61512236 [CMAKE] Get rid of add_compile_flags_language macro
in favor of add_compile_options and the like with generator expressions
Also take this as an opportunity to remove the C++11 standard hack, GCC 8 now defaults to C++14
2020-10-20 21:44:54 +02:00
..
lang [TRANSLATION] Improve Chinese Traditional (zh-TW) translation (#3065) 2020-08-18 14:26:04 +03:00
res Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
CMakeLists.txt [CMAKE] Get rid of add_compile_flags_language macro 2020-10-20 21:44:54 +02:00
connectmanager.cpp [NETSHELL] Disable the 'Delete' menu item for physical network interfaces 2020-04-10 19:39:47 +02:00
connectmanager.h [NETSHELL] Use ATL 2018-11-18 14:01:54 +02:00
enumlist.cpp [NETSHELL] Rewrite how pidls are created and accessed. 2018-11-18 14:01:54 +02:00
lanconnectui.cpp [NETSHELL] Improvements to the network setup (2a/x) 2019-06-20 22:08:39 +02:00
lanconnectui.h [NETSHELL] Use smart pointers and IID_PPV_ARG 2018-11-18 14:01:54 +02:00
lanstatusui.cpp [NETSHELL] Remove erroneous DNS Server line and fix date/time format (#2655) 2020-04-29 00:18:55 +03:00
lanstatusui.h [NETSHELL] Use smart pointers and IID_PPV_ARG 2018-11-18 14:01:54 +02:00
netshell.cpp [NETSHELL] Use ATL 2018-11-18 14:01:54 +02:00
netshell.rc [TRANSLATIONS] Update/Add Portuguese translations. 2019-05-26 21:19:31 +02:00
netshell.spec Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
precomp.h [NETSHELL] Optionally use the system's CLSID_ConnectionManager 2018-11-18 14:01:54 +02:00
README [NETSHELL] Fix '0' typo, in a text 2018-11-19 09:57:42 +02:00
resource.h Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
setup.cpp [NETSHELL] Improvements to the network setup (1/x) 2019-06-17 01:18:05 +02:00
shfldr_netconnect.cpp [DEVMGR][NETCFGX][MSCONFIG][NETSHELL] Fix and improve icons (#1143) 2018-12-19 20:07:17 +09:00
shfldr_netconnect.h [NETSHELL] Use smart pointers and IID_PPV_ARG 2018-11-18 14:01:54 +02:00

=== Introduction ===

The netshell library is responsible for managing network connections. The user interface is accessed
by opening the control panel and selecting the "Network Connections" folder.
The netshell library provides COM interfaces to enumerate available network adapters, network protocols, network clients and network transports
and receive detailed information about them. However, it cannot configure these components. For configuration, look in the netcfgx documentation
(Hint: INetCfg)

=== Interface ===

The user interface is exposed by implementing the IShellFolder interface as required by explorer
namespace extension. The code is currently placed in shfldr_netconnect.c

The enumeration of the available network connections is performed by the IShellFolder::EnumObjects
(ISF_NetConnect_fnEnumObjects). It uses the INetConnectionManager interface implemented by netshell 
in connectmanager.c to enumerate all available network connections.

The context menu of network connection items is populated by the IContextMenu::QueryContextMenu 
(ISF_NetConnect_IContextMenu3_QueryContextMenu) which is obtained by IShellFolder::GetUIObjectOf. The actions are performed by the 
IContextMenu::InvokeCommand function (ISF_NetConnect_IContextMenu3_InvokeCommand). At the moment
the actions "Status" / "Properties" are implemented.

=== Status Dialog & Notification Area ===

The status dialog is implemented by IOleCommandTarget interface(CLSID_ConnectionTray). This interface manages all status dialogs
for all available dialogs. The interface is implemented as a singleton to avoid multiple notification icons
appearing in the Notification area of the explorer. Every time the IShellFolder object is created (ISF_NetConnect_Constructor), 
it creates a reference to IOleCommandTarget interface and calls its IOleCommandTarget::Exec function with CGID_ShellServiceObject.
This causes IOleCommandTarget interface to enumerate all available network connections, check if they should be shown (NCCF_SHOW_ICON flag set
in the NETCON_PROPERTIES dwCharacter), and add them to notification area with Shell_NotifyIcon. For that purpose a hidden window is created (dialog
procedure is LANStatusDlg) which receives WM_SHOWSTATUSDLG msg when it shall show display the status dialog.

When a user wants to display the status dialog by clicking on the context menu of network connection item, the IShellFolder sends the NetCfgInstanceId of
the selected network connection to IOleCommandTarget::Exec function. The function then looks up the specified notification item and then sends
the WM_SHOWSTATUSDLG msg to specific window.

=== Network Connections Property Dialog ===

The network connections property dialog is implemented by the INetConnectionPropertyUi2 interface. The class id is obtained by calling
INetConnection::GetUiObjectClassId of the current selected network connection. After obtaining the interface by calling CoCreateInstance, the
selected network connection is stored as reference by calling INetConnectionPropertyUi::SetConnection. The next step is to call 
INetConnectionPropertyUi::AddPages to add custom property pages to the property sheet set. If the function succeeds, the caller can then invoke
PropertySheetW function to display the properties. 
	Note: If the context doesn't match, i.e. the INetConnectionPropertyUi2 cannot work together
		with current INetConnection, then it should fail INetConnectionPropertyUi::AddPages
	Note: The function ShowNetConnectionProperties in shlfdr_netconnect.c shows how to invoke the Network Connections Property Dialog

The enumeration of network components (protocols, client, transport) is done by using the INetCfg api). Initialization is performed in InitializeLANPropertiesUIDlg
function. When a user accepts changes, it calls INetCfg::Apply or when it aborts the changes INetCfg::Cancel.

=== Known Issues ===
* Status changes of an adapter are not automatically updated because the information is cached
* There seems to be an icon problem which makes icon blink in the status dialog

=== Testing in windows ===

Unfortunately in windows the CLSID_ConnectionManager class is implemented in the netman 
service and netshell contains the rpc proxy stubs for it. This means that until we are able to
reimplement these stubs alongside all its unimplemented interfaces and objects, we can't replace
the system netshell with ours (INetConnectionManager and IEnumNetConnection are only the tip
of the iceberg). 
However it is perfectly fine if one copies our netshell in a different folder and change the 
registry settings to make it handle CLSID_ConnectionFolder, CLSID_LanConnectionUi and CLSID_ConnectionTray.
When doing so there are actually two options about how to test. One is leaving #define USE_CUSTOM_CONMGR 1
as is and the other is setting is to 0. What this does is that when 0, the connections will be enumerated 
in the shell folder and the tray using the system's INetConnectionManager (which resides in the system's
netman service and is accessible through the system's netshell.dll). This allows us to implement and
test our three components against the correct implementation of INetConnectionManager.
The other option is setting USE_CUSTOM_CONMGR to 1 which will make the shell folder and the tray
enumerate connections with our connection manager effectively testing it in windows as well.