https://git.reactos.org/?p=reactos.git;a=commitdiff;h=185a8fd8350e6a38dbe66a...
commit 185a8fd8350e6a38dbe66a5a8061aaef991f0637 Author: Eric Kohl eric.kohl@reactos.org AuthorDate: Sun Sep 23 23:31:00 2018 +0200 Commit: Eric Kohl eric.kohl@reactos.org CommitDate: Sun Sep 23 23:31:00 2018 +0200
[NETSHELL] Read, write and display the 'Notify me when this connection...' option for network connections. --- dll/shellext/netshell/connectmanager.cpp | 20 ++++++++++++++++++-- dll/shellext/netshell/lanconnectui.cpp | 7 ++++++- 2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/dll/shellext/netshell/connectmanager.cpp b/dll/shellext/netshell/connectmanager.cpp index 1376c24d0d..8b33b59ce0 100644 --- a/dll/shellext/netshell/connectmanager.cpp +++ b/dll/shellext/netshell/connectmanager.cpp @@ -239,7 +239,7 @@ CNetConnection::GetProperties(NETCON_PROPERTIES **ppProps) HKEY hKey; LPOLESTR pStr; WCHAR szName[140]; - DWORD dwShowIcon, dwType, dwSize; + DWORD dwShowIcon, dwNotifyDisconnect, dwType, dwSize; NETCON_PROPERTIES * pProperties; HRESULT hr;
@@ -288,6 +288,16 @@ CNetConnection::GetProperties(NETCON_PROPERTIES **ppProps) else pProperties->dwCharacter &= ~NCCF_SHOW_ICON; } + + dwSize = sizeof(dwNotifyDisconnect); + if (RegQueryValueExW(hKey, L"IpCheckingEnabled", NULL, &dwType, (LPBYTE)&dwNotifyDisconnect, &dwSize) == ERROR_SUCCESS && dwType == REG_DWORD) + { + if (dwNotifyDisconnect) + pProperties->dwCharacter |= NCCF_NOTIFY_DISCONNECTED; + else + pProperties->dwCharacter &= ~NCCF_NOTIFY_DISCONNECTED; + } + dwSize = sizeof(szName); if (RegQueryValueExW(hKey, L"Name", NULL, &dwType, (LPBYTE)szName, &dwSize) == ERROR_SUCCESS) { @@ -503,7 +513,7 @@ NormalizeOperStatus( BOOL CNetConnectionManager::EnumerateINetConnections() { - DWORD dwSize, dwResult, dwIndex, dwAdapterIndex, dwShowIcon; + DWORD dwSize, dwResult, dwIndex, dwAdapterIndex, dwShowIcon, dwNotifyDisconnect; MIB_IFTABLE *pIfTable; MIB_IFROW IfEntry; IP_ADAPTER_INFO * pAdapterInfo; @@ -641,6 +651,12 @@ CNetConnectionManager::EnumerateINetConnections() if (dwShowIcon) pNew->Props.dwCharacter |= NCCF_SHOW_ICON; } + dwSize = sizeof(dwNotifyDisconnect); + if (RegQueryValueExW(hSubKey, L"IpCheckingEnabled", NULL, NULL, (LPBYTE)&dwNotifyDisconnect, &dwSize) == ERROR_SUCCESS) + { + if (dwNotifyDisconnect) + pNew->Props.dwCharacter |= NCCF_NOTIFY_DISCONNECTED; + } RegCloseKey(hSubKey); }
diff --git a/dll/shellext/netshell/lanconnectui.cpp b/dll/shellext/netshell/lanconnectui.cpp index b5ef94bbc5..6d1037f6bf 100644 --- a/dll/shellext/netshell/lanconnectui.cpp +++ b/dll/shellext/netshell/lanconnectui.cpp @@ -350,7 +350,7 @@ CNetConnectionPropertyUi::LANPropertiesUIDlg( PNET_ITEM pItem; CNetConnectionPropertyUi * This; LPPSHNOTIFY lppsn; - DWORD dwShowIcon; + DWORD dwShowIcon, dwNotifyDisconnect; HRESULT hr; WCHAR szKey[200]; LPOLESTR pStr; @@ -382,6 +382,10 @@ CNetConnectionPropertyUi::LANPropertiesUIDlg( else dwShowIcon = 0;
+ if (SendDlgItemMessageW(hwndDlg, IDC_NOTIFYNOCONNECTION, BM_GETCHECK, 0, 0) == BST_CHECKED) + dwNotifyDisconnect = 1; + else + dwNotifyDisconnect = 0;
if (StringFromCLSID((CLSID)This->m_pProperties->guidId, &pStr) == ERROR_SUCCESS) { @@ -390,6 +394,7 @@ CNetConnectionPropertyUi::LANPropertiesUIDlg( if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szKey, 0, KEY_WRITE, &hKey) == ERROR_SUCCESS) { RegSetValueExW(hKey, L"ShowIcon", 0, REG_DWORD, (LPBYTE)&dwShowIcon, sizeof(DWORD)); + RegSetValueExW(hKey, L"IpCheckingEnabled", 0, REG_DWORD, (LPBYTE)&dwNotifyDisconnect, sizeof(DWORD)); RegCloseKey(hKey); } }