ReactOS  0.4.15-dev-1171-gab82533
lanstatusui.cpp
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Shell
3  * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
4  * PURPOSE: CLanStatus: Lan connection status dialog
5  * COPYRIGHT: Copyright 2008 Johannes Anderwald (johannes.anderwald@reactos.org)
6  */
7 
8 #include "precomp.h"
9 
10 #include <winsock.h>
11 
13  m_lpNetMan(NULL),
14  m_pHead(NULL)
15 {
16 }
17 
18 VOID
20  HWND hwndDlg,
21  MIB_IFROW *IfEntry,
22  LANSTATUSUI_CONTEXT *pContext)
23 {
24  WCHAR szFormat[MAX_PATH] = {0};
25  WCHAR szBuffer[MAX_PATH] = {0};
26  SYSTEMTIME TimeConnected;
27  DWORD DurationSeconds;
28  WCHAR Buffer[100];
29  WCHAR DayBuffer[30];
30  WCHAR LocBuffer[50];
31 
32 #if 0
33  ULONGLONG Ticks;
34 #else
35  DWORD Ticks;
36 #endif
37 
38  if (IfEntry->dwSpeed < 1000)
39  {
40  if (LoadStringW(netshell_hInstance, IDS_FORMAT_BIT, szFormat, sizeof(szFormat)/sizeof(WCHAR)))
41  {
42  swprintf(szBuffer, szFormat, IfEntry->dwSpeed);
43  SendDlgItemMessageW(hwndDlg, IDC_SPEED, WM_SETTEXT, 0, (LPARAM)szBuffer);
44  }
45  }
46  else if (IfEntry->dwSpeed < 1000000)
47  {
48  if (LoadStringW(netshell_hInstance, IDS_FORMAT_KBIT, szFormat, sizeof(szFormat)/sizeof(WCHAR)))
49  {
50  swprintf(szBuffer, szFormat, IfEntry->dwSpeed/1000);
51  SendDlgItemMessageW(hwndDlg, IDC_SPEED, WM_SETTEXT, 0, (LPARAM)szBuffer);
52  }
53  }
54  else if (IfEntry->dwSpeed < 1000000000)
55  {
56  if (LoadStringW(netshell_hInstance, IDS_FORMAT_MBIT, szFormat, sizeof(szFormat)/sizeof(WCHAR)))
57  {
58  swprintf(szBuffer, szFormat, IfEntry->dwSpeed/1000000);
59  SendDlgItemMessageW(hwndDlg, IDC_SPEED, WM_SETTEXT, 0, (LPARAM)szBuffer);
60  }
61  }
62  else
63  {
64  if (LoadStringW(netshell_hInstance, IDS_FORMAT_GBIT, szFormat, sizeof(szFormat)/sizeof(WCHAR)))
65  {
66  swprintf(szBuffer, szFormat, IfEntry->dwSpeed/1000000000);
67  SendDlgItemMessageW(hwndDlg, IDC_SPEED, WM_SETTEXT, 0, (LPARAM)szBuffer);
68  }
69  }
70 
71  if (StrFormatByteSizeW(IfEntry->dwInOctets, szBuffer, sizeof(szFormat)/sizeof(WCHAR)))
72  {
73  SendDlgItemMessageW(hwndDlg, IDC_RECEIVED, WM_SETTEXT, 0, (LPARAM)szBuffer);
74  }
75 
76  if (StrFormatByteSizeW(IfEntry->dwOutOctets, szBuffer, sizeof(szFormat)/sizeof(WCHAR)))
77  {
78  SendDlgItemMessageW(hwndDlg, IDC_SEND, WM_SETTEXT, 0, (LPARAM)szBuffer);
79  }
80 
81 #if 0
82  Ticks = GetTickCount64();
83 #else
84  Ticks = GetTickCount();
85 #endif
86 
87  DurationSeconds = Ticks / 1000;
88  TimeConnected.wSecond = (DurationSeconds % 60);
89  TimeConnected.wMinute = (DurationSeconds / 60) % 60;
90  TimeConnected.wHour = (DurationSeconds / (60 * 60)) % 24;
91  TimeConnected.wDay = DurationSeconds / (60 * 60 * 24);
92 
93  if (!GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &TimeConnected, L"HH':'mm':'ss", LocBuffer, sizeof(LocBuffer) / sizeof(LocBuffer[0])))
94  return;
95 
96  if (!TimeConnected.wDay)
97  {
98  SendDlgItemMessageW(hwndDlg, IDC_DURATION, WM_SETTEXT, 0, (LPARAM)LocBuffer);
99  }
100  else
101  {
102  if (TimeConnected.wDay == 1)
103  {
104  if (!LoadStringW(netshell_hInstance, IDS_DURATION_DAY, DayBuffer, sizeof(DayBuffer) / sizeof(DayBuffer[0])))
105  DayBuffer[0] = L'\0';
106  }
107  else
108  {
109  if (!LoadStringW(netshell_hInstance, IDS_DURATION_DAYS, DayBuffer, sizeof(DayBuffer) / sizeof(DayBuffer[0])))
110  DayBuffer[0] = L'\0';
111  }
112  swprintf(Buffer, DayBuffer, TimeConnected.wDay, LocBuffer);
114  }
115 
116 }
117 
118 VOID
120 {
121  MIB_IFROW IfEntry;
122  HICON hIcon, hOldIcon = NULL;
124  NETCON_PROPERTIES * pProperties = NULL;
125 
126  ZeroMemory(&IfEntry, sizeof(IfEntry));
127  IfEntry.dwIndex = pContext->dwAdapterIndex;
128  if (GetIfEntry(&IfEntry) != NO_ERROR)
129  {
130  return;
131  }
132 
133  hIcon = NULL;
135  {
136  if (pContext->dwInOctets == IfEntry.dwInOctets && pContext->dwOutOctets == IfEntry.dwOutOctets && pContext->Status != 0)
137  {
139  pContext->Status = 0;
140  }
141  else if (pContext->dwInOctets != IfEntry.dwInOctets && pContext->dwOutOctets != IfEntry.dwOutOctets && pContext->Status != 1)
142  {
144  pContext->Status = 1;
145  }
146  else if (pContext->dwInOctets != IfEntry.dwInOctets && pContext->Status != 2)
147  {
149  pContext->Status = 2;
150  }
151  else if (pContext->dwOutOctets != IfEntry.dwOutOctets && pContext->Status != 3)
152  {
154  pContext->Status = 3;
155  }
156  }
158  {
159  if (pContext->Status != 4)
160  {
162  pContext->Status = 4;
163  }
164  }
166  {
167  if (pContext->Status != 5)
168  {
170  pContext->Status = 5;
171  }
172  }
173 
174  if (hwndDlg && hIcon)
175  {
176  hOldIcon = (HICON)SendDlgItemMessageW(hwndDlg, IDC_NETSTAT, STM_SETICON, (WPARAM)hIcon, 0);
177  if (hOldIcon)
178  DestroyIcon(hOldIcon);
179  }
180 
181  ZeroMemory(&nid, sizeof(nid));
182  nid.cbSize = sizeof(nid);
183  nid.uID = pContext->uID;
184  nid.hWnd = pContext->hwndStatusDlg;
185  nid.uVersion = NOTIFYICON_VERSION;
186 
187  if (pContext->pNet->GetProperties(&pProperties) == S_OK)
188  {
189  if (pProperties->dwCharacter & NCCF_SHOW_ICON)
190  {
191  if (hwndDlg)
193  else
194  nid.hIcon = hIcon;
195 
196  if (nid.hIcon)
197  nid.uFlags |= NIF_ICON;
198 
199  nid.uFlags |= NIF_STATE;
200  nid.dwState = 0;
201  nid.dwStateMask = NIS_HIDDEN;
202 
203  if (pProperties->pszwName)
204  {
205  if (wcslen(pProperties->pszwName) * sizeof(WCHAR) < sizeof(nid.szTip))
206  {
207  nid.uFlags |= NIF_TIP;
208  wcscpy(nid.szTip, pProperties->pszwName);
209  }
210  else
211  {
212  CopyMemory(nid.szTip, pProperties->pszwName, sizeof(nid.szTip) - sizeof(WCHAR));
213  nid.szTip[(sizeof(nid.szTip)/sizeof(WCHAR))-1] = L'\0';
214  nid.uFlags |= NIF_TIP;
215  }
216  }
217  }
218  else
219  {
220  nid.uFlags |= NIF_STATE;
221  nid.dwState = NIS_HIDDEN;
222  nid.dwStateMask = NIS_HIDDEN;
223 
224  }
225  NcFreeNetconProperties(pProperties);
226  }
227 
229 
230  if (nid.uFlags & NIF_ICON)
232 
233  pContext->dwInOctets = IfEntry.dwInOctets;
234  pContext->dwOutOctets = IfEntry.dwOutOctets;
235 
236  if (hwndDlg)
237  UpdateLanStatusUiDlg(hwndDlg, &IfEntry, pContext);
238 }
239 
240 
241 VOID
243 {
244  WCHAR szBuffer[MAX_PATH] = {0};
245  NETCON_PROPERTIES * pProperties;
246 
247  if (pContext->pNet->GetProperties(&pProperties) != S_OK)
248  return;
249 
250  if (pProperties->Status == NCS_DISCONNECTED)
252  else if (pProperties->Status == NCS_MEDIA_DISCONNECTED)
254  else if (pProperties->Status == NCS_CONNECTING)
256  else if (pProperties->Status == NCS_CONNECTED)
258 
259  SendDlgItemMessageW(hwndDlg, IDC_STATUS, WM_SETTEXT, 0, (LPARAM)szBuffer);
260 
261  pContext->dwInOctets = 0;
262  pContext->dwOutOctets = 0;
263 
264  /* update adapter info */
265  pContext->Status = -1;
266  UpdateLanStatus(hwndDlg, pContext);
267  NcFreeNetconProperties(pProperties);
268 }
269 
270 static
271 VOID
273  HWND hDlgCtrl,
274  UINT ResId,
275  UINT SubItem,
276  UINT Size)
277 {
278  WCHAR szBuffer[200];
279  LVCOLUMNW lc;
280 
281  if (!LoadStringW(netshell_hInstance, ResId, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
282  return;
283 
284  memset(&lc, 0, sizeof(LV_COLUMN) );
286  lc.iSubItem = SubItem;
287  lc.fmt = LVCFMT_FIXED_WIDTH;
288  lc.cx = Size;
289  lc.cchTextMax = wcslen(szBuffer);
290  lc.pszText = szBuffer;
291 
292  (void)SendMessageW(hDlgCtrl, LVM_INSERTCOLUMNW, SubItem, (LPARAM)&lc);
293 }
294 
295 static
296 VOID
298  HWND hDlgCtrl,
299  PIP_ADDR_STRING pAddr,
300  INT Index)
301 {
302  LVITEMW li;
303  PIP_ADDR_STRING pCur;
304  WCHAR szBuffer[100];
305  UINT SubIndex;
306 
307  ZeroMemory(&li, sizeof(LVITEMW));
308  li.mask = LVIF_TEXT;
309  li.iItem = Index;
310  pCur = pAddr;
311  SubIndex = 0;
312 
313  do
314  {
315  if (SubIndex)
316  {
317  ZeroMemory(&li, sizeof(LVITEMW));
318  li.mask = LVIF_TEXT;
319  li.iItem = Index;
320  li.iSubItem = 0;
321  li.pszText = (LPWSTR)L"";
322  li.iItem = SendMessageW(hDlgCtrl, LVM_INSERTITEMW, 0, (LPARAM)&li);
323  }
324 
325  if (MultiByteToWideChar(CP_ACP, 0, pCur->IpAddress.String, -1, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
326  {
327  li.pszText = szBuffer;
328  li.iSubItem = 1;
329  li.iItem = Index++;
330  SendMessageW(hDlgCtrl, LVM_SETITEMW, 0, (LPARAM)&li);
331  }
332  SubIndex++;
333  pCur = pCur->Next;
334  } while (pCur && pCur->IpAddress.String[0]);
335 }
336 
337 static
338 INT
340  HWND hDlgCtrl,
341  UINT ResId)
342 {
343  LVITEMW li;
344  WCHAR szBuffer[100];
345 
346  ZeroMemory(&li, sizeof(LVITEMW));
347  li.mask = LVIF_TEXT;
348  li.iItem = ListView_GetItemCount(hDlgCtrl);
349  if (LoadStringW(netshell_hInstance, ResId, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
350  {
351  li.pszText = szBuffer;
352  return (INT)SendMessageW(hDlgCtrl, LVM_INSERTITEMW, 0, (LPARAM)&li);
353  }
354  return -1;
355 }
356 
357 static
358 BOOL
360  IN struct tm *pTM,
361  OUT LPWSTR szBuffer,
362  IN UINT nBufferSize)
363 {
364  SYSTEMTIME st;
365  CString strBufferDate;
366  CString strBufferTime;
367  UINT nCharDate, nCharTime;
368  BOOL bResult = FALSE;
369 
370  st.wYear = pTM->tm_year + 1900;
371  st.wMonth = pTM->tm_mon + 1;
372  st.wDay = pTM->tm_mday;
373  st.wHour = pTM->tm_hour;
374  st.wMinute = pTM->tm_min;
375  st.wSecond = pTM->tm_sec;
376 
377  /* Check required size before cpy/cat */
378  nCharDate = GetDateFormatW(LOCALE_USER_DEFAULT, 0, &st, NULL, NULL, 0) + 1;
379  nCharTime = GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &st, NULL, NULL, 0) + 1;
380 
381  if (GetDateFormatW(LOCALE_USER_DEFAULT, 0, &st, NULL, strBufferDate.GetBuffer(nCharDate), nCharDate) &&
382  GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &st, NULL, strBufferTime.GetBuffer(nCharTime), nCharTime))
383  {
384  StringCbCopy(szBuffer, nBufferSize, strBufferDate);
385  StringCbCat(szBuffer, nBufferSize, L" ");
386  StringCbCat(szBuffer, nBufferSize, strBufferTime);
387  bResult = TRUE;
388  }
389  strBufferDate.ReleaseBuffer();
390  strBufferTime.ReleaseBuffer();
391 
392  return bResult;
393 }
394 
395 INT_PTR
396 CALLBACK
398  HWND hwndDlg,
399  UINT uMsg,
400  WPARAM wParam,
401  LPARAM lParam
402 )
403 {
404  LANSTATUSUI_CONTEXT * pContext;
405  LVITEMW li;
406  WCHAR szBuffer[100];
407  PIP_ADAPTER_INFO pAdapterInfo, pCurAdapter;
408  PIP_PER_ADAPTER_INFO pPerAdapter;
409  DWORD dwSize;
410  HWND hDlgCtrl;
411  RECT rect;
412 
413  switch (uMsg)
414  {
415  case WM_INITDIALOG:
416  pContext = (LANSTATUSUI_CONTEXT*)lParam;
417 
418  hDlgCtrl = GetDlgItem(hwndDlg, IDC_DETAILS);
419 
420  /* get client rect */
421  GetClientRect(hDlgCtrl, &rect);
422 
423  /* calculate column width */
424  dwSize = rect.right / 2;
425 
427  InsertColumnToListView(hDlgCtrl, IDS_VALUE, 1, dwSize);
428 
429  dwSize = 0;
430  pCurAdapter = NULL;
431  pAdapterInfo = NULL;
433  {
434  pAdapterInfo = static_cast<PIP_ADAPTER_INFO>(CoTaskMemAlloc(dwSize));
435  if (pAdapterInfo)
436  {
437  if (GetAdaptersInfo(pAdapterInfo, &dwSize) == NO_ERROR)
438  {
439  pCurAdapter = pAdapterInfo;
440  while (pCurAdapter && pCurAdapter->Index != pContext->dwAdapterIndex)
441  pCurAdapter = pCurAdapter->Next;
442 
443  if (pCurAdapter->Index != pContext->dwAdapterIndex)
444  pCurAdapter = NULL;
445  }
446  }
447  }
448 
449  ZeroMemory(&li, sizeof(LVITEMW));
450  li.mask = LVIF_TEXT;
451  li.iSubItem = 1;
452  li.pszText = szBuffer;
453 
454  if (pCurAdapter)
455  {
457  if (li.iItem >= 0)
458  {
459  swprintf(szBuffer, L"%02x-%02x-%02x-%02x-%02x-%02x",pCurAdapter->Address[0], pCurAdapter->Address[1],
460  pCurAdapter->Address[2], pCurAdapter->Address[3], pCurAdapter->Address[4], pCurAdapter->Address[5]);
461  SendMessageW(hDlgCtrl, LVM_SETITEMW, 0, (LPARAM)&li);
462  }
463  li.iItem = InsertItemToListView(hDlgCtrl, IDS_IP_ADDRESS);
464  if (li.iItem >= 0)
465  if (MultiByteToWideChar(CP_ACP, 0, pCurAdapter->IpAddressList.IpAddress.String, -1, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
466  SendMessageW(hDlgCtrl, LVM_SETITEMW, 0, (LPARAM)&li);
467 
468  li.iItem = InsertItemToListView(hDlgCtrl, IDS_SUBNET_MASK);
469  if (li.iItem >= 0)
470  if (MultiByteToWideChar(CP_ACP, 0, pCurAdapter->IpAddressList.IpMask.String, -1, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
471  SendMessageW(hDlgCtrl, LVM_SETITEMW, 0, (LPARAM)&li);
472 
473  li.iItem = InsertItemToListView(hDlgCtrl, IDS_DEF_GATEWAY);
474  if (li.iItem >= 0 && pCurAdapter->GatewayList.IpAddress.String[0] != '0')
475  {
476  if (MultiByteToWideChar(CP_ACP, 0, pCurAdapter->GatewayList.IpAddress.String, -1, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
477  SendMessageW(hDlgCtrl, LVM_SETITEMW, 0, (LPARAM)&li);
478  }
479 
480  li.iItem = InsertItemToListView(hDlgCtrl, IDS_DHCP_SERVER);
481  if (li.iItem >= 0 && pCurAdapter->DhcpServer.IpAddress.String[0] != '0')
482  {
483  if (MultiByteToWideChar(CP_ACP, 0, pCurAdapter->DhcpServer.IpAddress.String, -1, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
484  SendMessageW(hDlgCtrl, LVM_SETITEMW, 0, (LPARAM)&li);
485  }
486 
487  li.iItem = InsertItemToListView(hDlgCtrl, IDS_LEASE_OBTAINED);
488  if (li.iItem >= 0 && pCurAdapter->LeaseObtained != NULL)
489  {
490  struct tm *leaseOptained;
491 
492  leaseOptained = localtime(&pCurAdapter->LeaseObtained);
493 
494  if (tmToStr(leaseOptained, szBuffer, _countof(szBuffer)))
495  SendMessageW(hDlgCtrl, LVM_SETITEMW, 0, (LPARAM)&li);
496  }
497 
498  li.iItem = InsertItemToListView(hDlgCtrl, IDS_LEASE_EXPIRES);
499  if (li.iItem >= 0 && pCurAdapter->LeaseExpires != NULL)
500  {
501  struct tm *leaseExpire;
502 
503  leaseExpire = localtime(&pCurAdapter->LeaseExpires);
504 
505  if (tmToStr(leaseExpire, szBuffer, _countof(szBuffer)))
506  SendMessageW(hDlgCtrl, LVM_SETITEMW, 0, (LPARAM)&li);
507  }
508  }
509 
510  dwSize = 0;
513  {
514  pPerAdapter = static_cast<PIP_PER_ADAPTER_INFO>(CoTaskMemAlloc(dwSize));
515  if (pPerAdapter)
516  {
517  if (GetPerAdapterInfo(pContext->dwAdapterIndex, pPerAdapter, &dwSize) == ERROR_SUCCESS)
518  {
519  if (li.iItem >= 0)
520  AddIPAddressToListView(hDlgCtrl, &pPerAdapter->DnsServerList, li.iItem);
521  }
522  CoTaskMemFree(pPerAdapter);
523  }
524  }
525 
526  if (pCurAdapter)
527  {
529  if (pCurAdapter->HaveWins)
530  {
531  AddIPAddressToListView(hDlgCtrl, &pCurAdapter->PrimaryWinsServer, li.iItem);
532  AddIPAddressToListView(hDlgCtrl, &pCurAdapter->SecondaryWinsServer, li.iItem+1);
533  }
534  }
535 
536  CoTaskMemFree(pAdapterInfo);
537  break;
538 
539  case WM_COMMAND:
540  if (LOWORD(wParam) == IDC_CLOSE)
541  {
542  EndDialog(hwndDlg, FALSE);
543  break;
544  }
545  }
546 
547  return FALSE;
548 }
549 
550 INT_PTR
551 CALLBACK
553  HWND hwndDlg,
554  UINT uMsg,
555  WPARAM wParam,
556  LPARAM lParam)
557 {
558  WCHAR szBuffer[100] = {0};
560  LANSTATUSUI_CONTEXT * pContext;
561  DWORD dwIpAddr;
562 
563 
564  switch (uMsg)
565  {
566  case WM_INITDIALOG:
568  pContext = (LANSTATUSUI_CONTEXT*)page->lParam;
569  SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pContext);
570  if (pContext->DHCPEnabled)
571  LoadStringW(netshell_hInstance, IDS_ASSIGNED_DHCP, szBuffer, sizeof(szBuffer)/sizeof(WCHAR));
572  else
573  LoadStringW(netshell_hInstance, IDS_ASSIGNED_MANUAL, szBuffer, sizeof(szBuffer)/sizeof(WCHAR));
574 
575  szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
576  SendDlgItemMessageW(hwndDlg, IDC_DETAILSTYPE, WM_SETTEXT, 0, (LPARAM)szBuffer);
577 
578 
579  dwIpAddr = ntohl(pContext->IpAddress);
580  swprintf(szBuffer, L"%u.%u.%u.%u", FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr),
581  THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
582  SendDlgItemMessageW(hwndDlg, IDC_DETAILSIP, WM_SETTEXT, 0, (LPARAM)szBuffer);
583 
584  dwIpAddr = ntohl(pContext->SubnetMask);
585  swprintf(szBuffer, L"%u.%u.%u.%u", FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr),
586  THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
587  SendDlgItemMessageW(hwndDlg, IDC_DETAILSSUBNET, WM_SETTEXT, 0, (LPARAM)szBuffer);
588 
589  dwIpAddr = ntohl(pContext->Gateway);
590  if (dwIpAddr)
591  {
592  swprintf(szBuffer, L"%u.%u.%u.%u", FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr),
593  THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
594  SendDlgItemMessageW(hwndDlg, IDC_DETAILSGATEWAY, WM_SETTEXT, 0, (LPARAM)szBuffer);
595  }
596  return TRUE;
597  case WM_COMMAND:
598  if (LOWORD(wParam) == IDC_DETAILS)
599  {
600  pContext = (LANSTATUSUI_CONTEXT*)GetWindowLongPtr(hwndDlg, DWLP_USER);
601  if (pContext)
602  {
604  LANStatusUiDetailsDlg, (LPARAM)pContext);
605  }
606  }
607  break;
608  default:
609  break;
610  }
611  return FALSE;
612 }
613 
614 VOID
616 {
617  HRESULT hr = pNet->Disconnect();
618  if (FAILED_UNEXPECTEDLY(hr))
619  return;
620 
622 
624  ZeroMemory(&nid, sizeof(nid));
625  nid.cbSize = sizeof(nid);
626  nid.uID = pContext->uID;
627  nid.hWnd = pContext->hwndDlg;
628  nid.uFlags = NIF_STATE;
629  nid.dwState = NIS_HIDDEN;
630  nid.dwStateMask = NIS_HIDDEN;
631 
633 }
634 
635 
636 INT_PTR
637 CALLBACK
639  HWND hwndDlg,
640  UINT uMsg,
641  WPARAM wParam,
642  LPARAM lParam)
643 {
645  LANSTATUSUI_CONTEXT * pContext;
646  LPPSHNOTIFY lppsn;
647 
648  switch (uMsg)
649  {
650  case WM_INITDIALOG:
652  pContext = (LANSTATUSUI_CONTEXT*)page->lParam;
653  pContext->hwndDlg = hwndDlg;
654  InitializeLANStatusUiDlg(hwndDlg, pContext);
655  SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pContext);
656  return TRUE;
657  case WM_COMMAND:
658  pContext = (LANSTATUSUI_CONTEXT*)GetWindowLongPtr(hwndDlg, DWLP_USER);
660  {
661  if (pContext)
662  {
663  ShowNetConnectionProperties(pContext->pNet, GetParent(pContext->hwndDlg));
664  BringWindowToTop(GetParent(pContext->hwndDlg));
665  }
666  break;
667  }
668  else if (LOWORD(wParam) == IDC_ENDISABLE)
669  {
670  DisableNetworkAdapter(pContext->pNet, pContext, hwndDlg);
671  break;
672  }
673  case WM_NOTIFY:
674  lppsn = (LPPSHNOTIFY) lParam;
675  if (lppsn->hdr.code == PSN_APPLY || lppsn->hdr.code == PSN_RESET)
676  {
677  pContext = (LANSTATUSUI_CONTEXT*)GetWindowLongPtr(hwndDlg, DWLP_USER);
679  pContext->hwndDlg = NULL;
680  return TRUE;
681  }
682  break;
683  }
684  return FALSE;
685 }
686 
687 VOID
689  LANSTATUSUI_CONTEXT * pContext,
690  NETCON_PROPERTIES * pProperties)
691 {
692  DWORD dwSize, dwAdapterIndex, dwResult;
693  LPOLESTR pStr;
694  IP_ADAPTER_INFO *pAdapterInfo, *pCurAdapter;
695 
696  if (FAILED(StringFromCLSID((CLSID)pProperties->guidId, &pStr)))
697  {
698  return;
699  }
700 
701  /* get the IfTable */
702  dwSize = 0;
703  dwResult = GetAdaptersInfo(NULL, &dwSize);
704  if (dwResult!= ERROR_BUFFER_OVERFLOW)
705  {
706  CoTaskMemFree(pStr);
707  return;
708  }
709 
710  pAdapterInfo = static_cast<PIP_ADAPTER_INFO>(CoTaskMemAlloc(dwSize));
711  if (!pAdapterInfo)
712  {
713  CoTaskMemFree(pAdapterInfo);
714  CoTaskMemFree(pStr);
715  return;
716  }
717 
718  if (GetAdaptersInfo(pAdapterInfo, &dwSize) != NO_ERROR)
719  {
720  CoTaskMemFree(pAdapterInfo);
721  CoTaskMemFree(pStr);
722  return;
723  }
724 
725  if (!GetAdapterIndexFromNetCfgInstanceId(pAdapterInfo, pStr, &dwAdapterIndex))
726  {
727  CoTaskMemFree(pAdapterInfo);
728  CoTaskMemFree(pStr);
729  return;
730  }
731 
732  pCurAdapter = pAdapterInfo;
733  while (pCurAdapter->Index != dwAdapterIndex)
734  pCurAdapter = pCurAdapter->Next;
735 
736 
737  pContext->IpAddress = inet_addr(pCurAdapter->IpAddressList.IpAddress.String);
738  pContext->SubnetMask = inet_addr(pCurAdapter->IpAddressList.IpMask.String);
739  pContext->Gateway = inet_addr(pCurAdapter->GatewayList.IpAddress.String);
740  pContext->DHCPEnabled = pCurAdapter->DhcpEnabled;
741  CoTaskMemFree(pStr);
742  CoTaskMemFree(pAdapterInfo);
743  pContext->dwAdapterIndex = dwAdapterIndex;
744 }
745 
746 static int CALLBACK
748 {
749  // NOTE: This callback is needed to set large icon correctly.
750  HICON hIcon;
751  switch (uMsg)
752  {
753  case PSCB_INITIALIZED:
754  {
756  SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
757  break;
758  }
759  }
760  return 0;
761 }
762 
763 VOID
765  LANSTATUSUI_CONTEXT *pContext,
766  HWND hwndDlg)
767 {
768  HPROPSHEETPAGE hppages[2];
769  PROPSHEETHEADERW pinfo;
770  NETCON_PROPERTIES * pProperties = NULL;
771 
772  ZeroMemory(&pinfo, sizeof(PROPSHEETHEADERW));
773  ZeroMemory(hppages, sizeof(hppages));
774  pinfo.dwSize = sizeof(PROPSHEETHEADERW);
775  pinfo.dwFlags = PSH_NOCONTEXTHELP | PSH_PROPTITLE | PSH_NOAPPLYNOW |
777  pinfo.phpage = hppages;
778  pinfo.hwndParent = hwndDlg;
781  pinfo.pfnCallback = PropSheetProc;
782 
783  if (pContext->pNet->GetProperties(&pProperties) == S_OK)
784  {
785  if (pProperties->pszwName)
786  {
787  pinfo.pszCaption = pProperties->pszwName;
788  pinfo.dwFlags |= PSH_PROPTITLE;
789  }
790  InitializePropertyDialog(pContext, pProperties);
791  if (pProperties->MediaType == NCM_LAN && pProperties->Status == NCS_CONNECTED)
792  {
794  if (hppages[0])
795  pinfo.nPages++;
796 
798  if (hppages[pinfo.nPages])
799  pinfo.nPages++;
800 
801  if (pinfo.nPages)
802  {
803  PropertySheetW(&pinfo);
804  }
805  }
806  else if (pProperties->Status == NCS_MEDIA_DISCONNECTED || pProperties->Status == NCS_DISCONNECTED ||
807  pProperties->Status == NCS_HARDWARE_DISABLED)
808  {
809  ShowNetConnectionProperties(pContext->pNet, pContext->hwndDlg);
810  }
811 
812  NcFreeNetconProperties(pProperties);
813  }
814 }
815 
816 INT_PTR
817 CALLBACK
819  HWND hwndDlg,
820  UINT uMsg,
821  WPARAM wParam,
822  LPARAM lParam)
823 {
824  LANSTATUSUI_CONTEXT * pContext;
825 
826  switch (uMsg)
827  {
828  case WM_INITDIALOG:
829  pContext = (LANSTATUSUI_CONTEXT *)lParam;
831  pContext->nIDEvent = SetTimer(hwndDlg, 0xFABC, 1000, NULL);
832  return TRUE;
833  case WM_TIMER:
834  pContext = (LANSTATUSUI_CONTEXT*)GetWindowLongPtr(hwndDlg, DWLP_USER);
835  if (wParam == (WPARAM)pContext->nIDEvent)
836  {
837  UpdateLanStatus(pContext->hwndDlg, pContext);
838  }
839  break;
840  case WM_SHOWSTATUSDLG:
841  if (LOWORD(lParam) == WM_LBUTTONDOWN)
842  {
843  pContext = (LANSTATUSUI_CONTEXT*)GetWindowLongPtr(hwndDlg, DWLP_USER);
844  if (!pContext)
845  break;
846 
847  if (pContext->hwndDlg)
848  {
849  ShowWindow(GetParent(pContext->hwndDlg), SW_SHOW);
850  BringWindowToTop(GetParent(pContext->hwndDlg));
851  }
852  else
853  {
854  ShowStatusPropertyDialog(pContext, hwndDlg);
855  }
856  break;
857  }
858  break;
859  }
860  return FALSE;
861 }
862 
863 HRESULT
865 {
867  HWND hwndDlg;
870  CComPtr<INetConnection> pNetCon;
871  NETCON_PROPERTIES* pProps;
872  HRESULT hr;
873  ULONG Count;
874  ULONG Index;
875  NOTIFICATION_ITEM * pItem, *pLast = NULL;
876  LANSTATUSUI_CONTEXT * pContext;
877 
878  TRACE("InitializeNetTaskbarNotifications\n");
879 
880  if (m_pHead)
881  {
882  pItem = m_pHead;
883  while (pItem)
884  {
885  hr = pItem->pNet->GetProperties(&pProps);
886  if (SUCCEEDED(hr))
887  {
888  ZeroMemory(&nid, sizeof(nid));
889  nid.cbSize = sizeof(nid);
890  nid.uID = pItem->uID;
891  nid.hWnd = pItem->hwndDlg;
892  nid.uFlags = NIF_STATE;
893  if (pProps->dwCharacter & NCCF_SHOW_ICON)
894  nid.dwState = 0;
895  else
896  nid.dwState = NIS_HIDDEN;
897 
898  nid.dwStateMask = NIS_HIDDEN;
900  NcFreeNetconProperties(pProps);
901  }
902  pItem = pItem->pNext;
903  }
904  return S_OK;
905  }
906  /* get an instance to of IConnectionManager */
907  hr = CNetConnectionManager_CreateInstance(IID_PPV_ARG(INetConnectionManager, &pNetConMan));
908  if (FAILED_UNEXPECTEDLY(hr))
909  return hr;
910 
911  hr = pNetConMan->EnumConnections(NCME_DEFAULT, &pEnumCon);
912  if (FAILED_UNEXPECTEDLY(hr))
913  return hr;
914 
915  Index = 1;
916  while (TRUE)
917  {
918  hr = pEnumCon->Next(1, &pNetCon, &Count);
919  if (hr != S_OK)
920  break;
921 
922  TRACE("new connection\n");
923  pItem = static_cast<NOTIFICATION_ITEM*>(CoTaskMemAlloc(sizeof(NOTIFICATION_ITEM)));
924  if (!pItem)
925  break;
926 
927  pContext = static_cast<LANSTATUSUI_CONTEXT*>(CoTaskMemAlloc(sizeof(LANSTATUSUI_CONTEXT)));
928  if (!pContext)
929  {
930  CoTaskMemFree(pItem);
931  break;
932  }
933 
934  ZeroMemory(pContext, sizeof(LANSTATUSUI_CONTEXT));
935  pContext->uID = Index;
936  pContext->pNet = pNetCon;
937  pItem->uID = Index;
938  pItem->pNext = NULL;
939  pItem->pNet = pNetCon;
940  pNetCon->AddRef();
942  if (!hwndDlg)
943  {
944  ERR("CreateDialogParamW failed\n");
945  continue;
946  }
947 
948  ZeroMemory(&nid, sizeof(nid));
949  nid.cbSize = sizeof(nid);
950  nid.uID = Index++;
952  nid.uVersion = NOTIFYICON_VERSION;
954  nid.hWnd = hwndDlg;
955 
956  hr = pNetCon->GetProperties(&pProps);
957  if (SUCCEEDED(hr))
958  {
959  CopyMemory(&pItem->guidItem, &pProps->guidId, sizeof(GUID));
960  if (!(pProps->dwCharacter & NCCF_SHOW_ICON))
961  {
962  nid.dwState = NIS_HIDDEN;
963  nid.dwStateMask = NIS_HIDDEN;
964  nid.uFlags |= NIF_STATE;
965  }
966  if (pProps->Status == NCS_MEDIA_DISCONNECTED || pProps->Status == NCS_DISCONNECTED || pProps->Status == NCS_HARDWARE_DISABLED)
968  else if (pProps->Status == NCS_CONNECTED)
970 
971  if (nid.hIcon)
972  nid.uFlags |= NIF_ICON;
973 
974  wcscpy(nid.szTip, pProps->pszwName);
975  nid.uFlags |= NIF_TIP;
976  }
977  pContext->hwndStatusDlg = hwndDlg;
978  pItem->hwndDlg = hwndDlg;
979 
981  {
982  if (pLast)
983  pLast->pNext = pItem;
984  else
985  m_pHead = pItem;
986 
987  pLast = pItem;
988  Index++;
989  }
990  else
991  {
992  ERR("Shell_NotifyIconW failed\n");
993  CoTaskMemFree(pItem);
994  }
995 
996  if (nid.uFlags & NIF_ICON)
998  }
999 
1000  m_lpNetMan = pNetConMan;
1001  return S_OK;
1002 }
1003 
1004 HRESULT
1006 {
1007  NOTIFICATION_ITEM *pItem;
1008 
1009  pItem = m_pHead;
1010  while (pItem)
1011  {
1012  if (IsEqualGUID(pItem->guidItem, *pguidCmdGroup))
1013  {
1014  SendMessageW(pItem->hwndDlg, WM_SHOWSTATUSDLG, 0, WM_LBUTTONDOWN);
1015  return S_OK;
1016  }
1017  pItem = pItem->pNext;
1018  }
1019 
1020  ERR("not found\n");
1021  return E_FAIL;
1022 }
1023 
1024 HRESULT
1025 WINAPI
1027  const GUID *pguidCmdGroup,
1028  ULONG cCmds,
1029  OLECMD *prgCmds,
1030  OLECMDTEXT *pCmdText)
1031 {
1032  MessageBoxW(NULL, pCmdText->rgwz, L"IOleCommandTarget_fnQueryStatus", MB_OK);
1033  return E_NOTIMPL;
1034 }
1035 
1036 HRESULT
1037 WINAPI
1039  const GUID *pguidCmdGroup,
1040  DWORD nCmdID,
1041  DWORD nCmdexecopt,
1042  VARIANT *pvaIn,
1043  VARIANT *pvaOut)
1044 {
1045  if (pguidCmdGroup)
1046  {
1047  if (IsEqualGUID(*pguidCmdGroup, CGID_ShellServiceObject))
1048  {
1050  }
1051  else
1052  {
1053  /* invoke status dialog */
1054  return ShowStatusDialogByCLSID(pguidCmdGroup);
1055  }
1056  }
1057  return S_OK;
1058 }
static VOID AddIPAddressToListView(HWND hDlgCtrl, PIP_ADDR_STRING pAddr, INT Index)
#define IDC_RECEIVED
Definition: resource.h:38
#define IDS_STATUS_UNREACHABLE
Definition: resource.h:82
HWND hwndParent
Definition: prsht.h:295
DWORD dwInOctets
Definition: ifmib.h:47
LPWSTR WINAPI StrFormatByteSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
Definition: string.c:2380
NOTIFICATION_ITEM * m_pHead
Definition: lanstatusui.h:51
#define STM_SETICON
Definition: winuser.h:2074
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define WM_SHOWSTATUSDLG
Definition: lanstatusui.h:6
#define IN
Definition: typedefs.h:39
#define NIF_MESSAGE
Definition: shellapi.h:102
static HICON
Definition: imagelist.c:84
BOOL GetAdapterIndexFromNetCfgInstanceId(PIP_ADAPTER_INFO pAdapterInfo, LPWSTR szNetCfg, PDWORD pIndex)
#define LR_SHARED
Definition: winuser.h:1090
IP_ADDR_STRING DhcpServer
Definition: iptypes.h:65
#define IMAGE_ICON
Definition: winuser.h:212
INetConnection * pNet
Definition: lanstatusui.h:19
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define LVCF_WIDTH
Definition: commctrl.h:2583
#define PSH_NOAPPLYNOW
Definition: prsht.h:47
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define IDI_NET_REC
Definition: resource.h:12
#define IDS_STATUS_DISCONNECTED
Definition: resource.h:83
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
#define IDS_STATUS_CONNECTED
Definition: resource.h:85
#define FIRST_IPADDRESS(x)
Definition: commctrl.h:4484
#define inet_addr(cp)
Definition: inet.h:98
#define ERROR_SUCCESS
Definition: deptool.c:10
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
HRESULT hr
Definition: shlfolder.c:183
#define LVCF_TEXT
Definition: commctrl.h:2584
WORD wMonth
Definition: winbase.h:884
struct _PSHNOTIFY * LPPSHNOTIFY
NOTIFYICONDATA nid
Definition: magnifier.c:44
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define TRUE
Definition: types.h:120
UINT DhcpEnabled
Definition: iptypes.h:61
#define ERROR_BUFFER_OVERFLOW
Definition: winerror.h:185
#define IDS_DEF_GATEWAY
Definition: resource.h:109
#define CP_ACP
Definition: compat.h:109
#define LOCALE_USER_DEFAULT
#define IDS_WINS_SERVERS
Definition: resource.h:114
INT_PTR CALLBACK LANStatusUiDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
#define LV_COLUMN
Definition: commctrl.h:2543
IP_ADDRESS_STRING IpAddress
Definition: iptypes.h:47
struct _IP_ADDR_STRING * Next
Definition: iptypes.h:46
HRESULT GetProperties([out] NETCON_PROPERTIES **ppProps)
#define IDI_NET_OFF
Definition: resource.h:11
static BOOL tmToStr(IN struct tm *pTM, OUT LPWSTR szBuffer, IN UINT nBufferSize)
#define CALLBACK
Definition: compat.h:35
#define FOURTH_IPADDRESS(x)
Definition: commctrl.h:4487
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
IP_ADDR_STRING SecondaryWinsServer
Definition: iptypes.h:68
char String[4 *4]
Definition: iptypes.h:42
HRESULT Disconnect()
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1223
#define ZeroMemory
Definition: winbase.h:1648
virtual HRESULT WINAPI Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
#define IDS_FORMAT_KBIT
Definition: resource.h:99
UINT_PTR WPARAM
Definition: windef.h:207
struct _PROPSHEETHEADERW PROPSHEETHEADERW
#define PSN_APPLY
Definition: prsht.h:117
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
int32_t INT_PTR
Definition: typedefs.h:64
#define PSH_USECALLBACK
Definition: prsht.h:48
static LPOLESTR
Definition: stg_prop.c:27
#define NO_ERROR
Definition: dderror.h:5
#define IID_PPV_ARG(Itype, ppType)
#define E_FAIL
Definition: ddrawi.h:102
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
VOID WINAPI NcFreeNetconProperties(NETCON_PROPERTIES *pProps)
Definition: netshell.cpp:119
HINSTANCE netshell_hInstance
Definition: netshell.cpp:12
int32_t INT
Definition: typedefs.h:58
#define SetWindowLongPtr
Definition: treelist.c:70
#define MIB_IF_OPER_STATUS_DISCONNECTED
Definition: ipifcons.h:248
ULONGLONG WINAPI GetTickCount64(VOID)
Definition: GetTickCount64.c:9
& rect
Definition: startmenu.cpp:1413
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define DWLP_MSGRESULT
Definition: winuser.h:864
#define IDS_DNS_SERVERS
Definition: resource.h:113
#define IDS_PROPERTY
Definition: resource.h:115
#define SECOND_IPADDRESS(x)
Definition: commctrl.h:4485
#define LVIF_TEXT
Definition: commctrl.h:2305
#define THIRD_IPADDRESS(x)
Definition: commctrl.h:4486
#define LVCF_SUBITEM
Definition: commctrl.h:2585
UINT code
Definition: winuser.h:3134
NMHDR hdr
Definition: prsht.h:330
#define MIB_IF_OPER_STATUS_NON_OPERATIONAL
Definition: ipifcons.h:246
WORD wYear
Definition: winbase.h:883
CComPtr< INetConnectionManager > m_lpNetMan
Definition: lanstatusui.h:50
#define IDS_SUBNET_MASK
Definition: resource.h:108
void ReleaseBuffer(_In_ int nNewLength=-1)
Definition: atlsimpstr.h:372
#define IDS_PHYSICAL_ADDRESS
Definition: resource.h:106
#define PSH_USEICONID
Definition: prsht.h:42
#define FALSE
Definition: types.h:117
DWORD dwSpeed
Definition: ifmib.h:41
LPCWSTR pszCaption
Definition: prsht.h:301
unsigned int BOOL
Definition: ntddk_ex.h:94
#define LVM_INSERTCOLUMNW
Definition: commctrl.h:2628
DWORD dwStateMask
Definition: shellapi.h:237
#define IDS_DURATION_DAYS
Definition: resource.h:102
int iSubItem
Definition: commctrl.h:2358
#define IDC_CLOSE
Definition: resource.h:52
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
VOID UpdateLanStatus(HWND hwndDlg, LANSTATUSUI_CONTEXT *pContext)
HANDLE WINAPI CopyImage(_In_ HANDLE, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:1956
PFNPROPSHEETCALLBACK pfnCallback
Definition: prsht.h:311
CHAR szTip[128]
Definition: shellapi.h:235
#define IDS_DURATION_DAY
Definition: resource.h:101
BOOL WINAPI BringWindowToTop(_In_ HWND)
WORD wMinute
Definition: winbase.h:888
static VOID InsertColumnToListView(HWND hDlgCtrl, UINT ResId, UINT SubItem, UINT Size)
#define NIF_TIP
Definition: shellapi.h:104
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
static int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2303
Definition: module.h:566
BYTE Address[MAX_ADAPTER_ADDRESS_LENGTH]
Definition: iptypes.h:58
VOID DisableNetworkAdapter(INetConnection *pNet, LANSTATUSUI_CONTEXT *pContext, HWND hwndDlg)
Definition: bufpool.h:45
HPROPSHEETPAGE InitializePropertySheetPage(LPWSTR resname, DLGPROC dlgproc, LPARAM lParam, LPWSTR szTitle)
Definition: netshell.cpp:29
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
Definition: propsheet.c:2905
#define SW_SHOW
Definition: winuser.h:769
#define IDC_DURATION
Definition: resource.h:42
#define NIF_ICON
Definition: shellapi.h:103
#define WM_SETTEXT
Definition: winuser.h:1599
#define IDS_LEASE_EXPIRES
Definition: resource.h:112
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define PSBTN_CANCEL
Definition: prsht.h:151
#define IDD_LAN_NETSTATUSDETAILS
Definition: resource.h:24
#define IDC_DETAILSIP
Definition: resource.h:47
time_t LeaseObtained
Definition: iptypes.h:69
#define IDI_NET_TRANSREC
Definition: resource.h:14
#define TRACE(s)
Definition: solgame.cpp:4
#define StringCbCat
Definition: strsafe.h:334
#define MIB_IF_OPER_STATUS_UNREACHABLE
Definition: ipifcons.h:247
INT_PTR CALLBACK LANStatusUiAdvancedDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define IDC_SEND
Definition: resource.h:37
#define PSH_PROPTITLE
Definition: prsht.h:40
LONG HRESULT
Definition: typedefs.h:79
uint64_t ULONGLONG
Definition: typedefs.h:67
HINSTANCE hInstance
Definition: prsht.h:296
#define _countof(array)
Definition: sndvol32.h:68
#define WM_TIMER
Definition: winuser.h:1724
DWORD WINAPI GetPerAdapterInfo(ULONG IfIndex, PIP_PER_ADAPTER_INFO pPerAdapterInfo, PULONG pOutBufLen)
#define IDI_NET_IDLE
Definition: resource.h:10
LPWSTR pszText
Definition: commctrl.h:2361
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
#define MAX_PATH
Definition: compat.h:34
#define swprintf(buf, format,...)
Definition: sprintf.c:56
#define WINAPI
Definition: msvc.h:6
#define IDS_STATUS_CONNECTING
Definition: resource.h:84
#define CopyMemory
Definition: winbase.h:1646
static const UCHAR Index[8]
Definition: usbohci.c:18
LPWSTR pszText
Definition: commctrl.h:2563
LPCWSTR pszIcon
Definition: prsht.h:299
Definition: netcon.h:71
#define IDC_SPEED
Definition: resource.h:43
VOID UpdateLanStatusUiDlg(HWND hwndDlg, MIB_IFROW *IfEntry, LANSTATUSUI_CONTEXT *pContext)
Definition: lanstatusui.cpp:19
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDC_DETAILS
Definition: resource.h:50
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
DWORD dwSize
Definition: prsht.h:293
DWORD dwFlags
Definition: prsht.h:294
WORD wSecond
Definition: winbase.h:889
UINT mask
Definition: commctrl.h:2356
#define PSNRET_NOERROR
Definition: prsht.h:129
#define IDC_STATUS
Definition: resource.h:41
#define StringCbCopy
Definition: strsafe.h:155
#define IDS_VALUE
Definition: resource.h:25
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
IP_ADDR_STRING DnsServerList
Definition: iptypes.h:77
#define DWLP_USER
Definition: winuser.h:866
#define IDI_NET_TRANS
Definition: resource.h:13
Definition: time.h:76
_CRTIMP struct tm *__cdecl localtime(const time_t *_Time)
Definition: time.h:424
#define WM_COMMAND
Definition: winuser.h:1722
#define IDS_FORMAT_BIT
Definition: resource.h:97
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
VOID ShowStatusPropertyDialog(LANSTATUSUI_CONTEXT *pContext, HWND hwndDlg)
INT WINAPI GetDateFormatW(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCWSTR lpFormat, LPWSTR lpDateStr, INT cchOut)
Definition: lcformat.c:979
UINT uCallbackMessage
Definition: shellapi.h:229
#define IDS_FORMAT_MBIT
Definition: resource.h:98
HPROPSHEETPAGE * phpage
Definition: prsht.h:309
#define IDD_LAN_NETSTATUSADVANCED
Definition: resource.h:23
int cchTextMax
Definition: commctrl.h:2564
#define ERR(fmt,...)
Definition: debug.h:110
#define IDC_DETAILSSUBNET
Definition: resource.h:48
#define IDS_ASSIGNED_DHCP
Definition: resource.h:103
WORD wDay
Definition: winbase.h:886
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HWND WINAPI GetParent(_In_ HWND)
#define LVM_INSERTITEMW
Definition: commctrl.h:2400
#define LVCF_FMT
Definition: commctrl.h:2582
#define S_OK
Definition: intsafe.h:51
#define LR_COPYFROMRESOURCE
Definition: winuser.h:1089
virtual HRESULT WINAPI QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD *prgCmds, OLECMDTEXT *pCmdText)
static INT InsertItemToListView(HWND hDlgCtrl, UINT ResId)
#define IDS_IP_ADDRESS
Definition: resource.h:107
#define PSCB_INITIALIZED
Definition: prsht.h:75
DWORD dwOutOctets
Definition: ifmib.h:53
#define IDS_LEASE_OBTAINED
Definition: resource.h:111
HICON hIcon
Definition: msconfig.c:44
#define PSN_RESET
Definition: prsht.h:118
HRESULT WINAPI CNetConnectionManager_CreateInstance(REFIID riid, LPVOID *ppv)
#define IDD_LAN_NETSTATUS
Definition: resource.h:21
IP_MASK_STRING IpMask
Definition: iptypes.h:48
IP_ADDR_STRING GatewayList
Definition: iptypes.h:64
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define E_NOTIMPL
Definition: ddrawi.h:99
NETCON_MEDIATYPE MediaType
Definition: netcon.h:87
WORD wHour
Definition: winbase.h:887
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
DWORD WINAPI GetIfEntry(PMIB_IFROW pIfRow)
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define MB_OK
Definition: winuser.h:784
#define IDC_ENDISABLE
Definition: resource.h:40
#define IDD_STATUS
Definition: resource.h:22
HRESULT ShowStatusDialogByCLSID(const GUID *pguidCmdGroup)
#define IDC_DETAILSTYPE
Definition: resource.h:46
HRESULT InitializeNetTaskbarNotifications()
#define MultiByteToWideChar
Definition: compat.h:110
#define NIM_ADD
Definition: shellapi.h:91
#define MIB_IF_OPER_STATUS_CONNECTED
Definition: ipifcons.h:250
IP_ADDR_STRING PrimaryWinsServer
Definition: iptypes.h:67
#define LVM_SETITEMW
Definition: commctrl.h:2393
DWORD WINAPI GetAdaptersInfo(PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen)
#define IDC_DETAILSGATEWAY
Definition: resource.h:49
#define OUT
Definition: typedefs.h:40
HWND WINAPI CreateDialogParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
NETCON_STATUS Status
Definition: netcon.h:86
unsigned int ULONG
Definition: retypes.h:1
#define IDC_STATUS_PROPERTIES
Definition: resource.h:39
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
#define LoadImage
Definition: winuser.h:5790
DWORD dwIndex
Definition: ifmib.h:38
INT_PTR CALLBACK LANStatusDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
VOID InitializePropertyDialog(LANSTATUSUI_CONTEXT *pContext, NETCON_PROPERTIES *pProperties)
#define LoadIcon
Definition: winuser.h:5788
#define GetWindowLongPtr
Definition: treelist.c:73
INTERNAL_IF_OPER_STATUS dwOperStatus
Definition: ifmib.h:45
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define PropSheet_PressButton(d, i)
Definition: prsht.h:348
INT WINAPI GetTimeFormatW(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCWSTR lpFormat, LPWSTR lpTimeStr, INT cchOut)
Definition: lcformat.c:1079
#define memset(x, y, z)
Definition: compat.h:39
#define MIB_IF_OPER_STATUS_OPERATIONAL
Definition: ipifcons.h:251
#define IDS_DHCP_SERVER
Definition: resource.h:110
VOID InitializeLANStatusUiDlg(HWND hwndDlg, LANSTATUSUI_CONTEXT *pContext)
#define IDS_FORMAT_GBIT
Definition: resource.h:100
#define WM_INITDIALOG
Definition: winuser.h:1721
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define IDC_NETSTAT
Definition: resource.h:44
BOOL WINAPI Shell_NotifyIconW(DWORD dwMessage, PNOTIFYICONDATAW pnid)
Definition: systray.cpp:128
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
INT_PTR CALLBACK LANStatusUiDetailsDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
#define IDS_ASSIGNED_MANUAL
Definition: resource.h:104
#define PROPSHEETPAGE
Definition: prsht.h:389
time_t LeaseExpires
Definition: iptypes.h:70
struct _IP_ADAPTER_INFO * Next
Definition: iptypes.h:53
#define WM_NOTIFY
Definition: richedit.h:61
#define NIM_MODIFY
Definition: shellapi.h:92
HRESULT ShowNetConnectionProperties(INetConnection *pNetConnect, HWND hwnd)
#define SUCCEEDED(hr)
Definition: intsafe.h:49
#define ICON_BIG
Definition: tnclass.cpp:51
IP_ADDR_STRING IpAddressList
Definition: iptypes.h:63
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2412
#define ntohl(x)
Definition: module.h:203