mirror of
https://github.com/reactos/reactos.git
synced 2024-09-28 05:26:58 +00:00
[NETSHELL] Read, write and display the 'Notify me when this connection...' option for network connections.
This commit is contained in:
parent
df36ee9fe2
commit
185a8fd835
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue