Something went wrong. Try again.
Reactos
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071=== Introduction ===The netshell library is responsible for managing network connections. The user interface is accessedby 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 transportsand 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 explorernamespace extension. The code is currently placed in shfldr_netconnect.cThe enumeration of the available network connections is performed by the IShellFolder::EnumObjects(ISF_NetConnect_fnEnumObjects). It uses the INetConnectionManager interface implemented by netshellin 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 theIContextMenu::InvokeCommand function (ISF_NetConnect_IContextMenu3_InvokeCommand). At the momentthe actions "Status" / "Properties" are implemented.=== Status Dialog & Notification Area ===The status dialog is implemented by IOleCommandTarget interface(CLSID_ConnectionTray). This interface manages all status dialogsfor all available dialogs. The interface is implemented as a singleton to avoid multiple notification iconsappearing 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 setin the NETCON_PROPERTIES dwCharacter), and add them to notification area with Shell_NotifyIcon. For that purpose a hidden window is created (dialogprocedure 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 ofthe selected network connection to IOleCommandTarget::Exec function. The function then looks up the specified notification item and then sendsthe 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 callingINetConnection::GetUiObjectClassId of the current selected network connection. After obtaining the interface by calling CoCreateInstance, theselected network connection is stored as reference by calling INetConnectionPropertyUi::SetConnection. The next step is to callINetConnectionPropertyUi::AddPages to add custom property pages to the property sheet set. If the function succeeds, the caller can then invokePropertySheetW 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 DialogThe enumeration of network components (protocols, client, transport) is done by using the INetCfg api). Initialization is performed in InitializeLANPropertiesUIDlgfunction. 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 netmanservice and netshell contains the rpc proxy stubs for it. This means that until we are able toreimplement these stubs alongside all its unimplemented interfaces and objects, we can't replacethe system netshell with ours (INetConnectionManager and IEnumNetConnection are only the tipof the iceberg).However it is perfectly fine if one copies our netshell in a different folder and change theregistry settings to make it handle CLSID_NetworkConnections, CLSID_LanConnectionUi and CLSID_ConnectionTray.When doing so there are actually two options about how to test. One is leaving #define USE_CUSTOM_CONMGR 1as is and the other is setting is to 0. What this does is that when 0, the connections will be enumeratedin the shell folder and the tray using the system's INetConnectionManager (which resides in the system'snetman service and is accessible through the system's netshell.dll). This allows us to implement andtest 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 trayenumerate connections with our connection manager effectively testing it in windows as well.