Author: janderwald
Date: Wed Sep 17 08:58:48 2008
New Revision: 36284
URL:
http://svn.reactos.org/svn/reactos?rev=36284&view=rev
Log:
- Check for null in IConnection_Constructor
- Implement INetConnectionConnectUi interface
- Add a dialog which serves a proxy dialog
- Add tray icons for connection which want to displayed in the tray
- Start implement network connection status dialog
Modified:
trunk/reactos/dll/win32/netshell/connectmanager.c
trunk/reactos/dll/win32/netshell/lanconnectui.c
trunk/reactos/dll/win32/netshell/lang/de-DE.rc
trunk/reactos/dll/win32/netshell/lanstatusui.c
trunk/reactos/dll/win32/netshell/precomp.h
trunk/reactos/dll/win32/netshell/resource.h
trunk/reactos/dll/win32/netshell/shfldr_netconnect.c
Modified: trunk/reactos/dll/win32/netshell/connectmanager.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netshell/connect…
==============================================================================
--- trunk/reactos/dll/win32/netshell/connectmanager.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netshell/connectmanager.c [iso-8859-1] Wed Sep 17 08:58:48
2008
@@ -301,13 +301,19 @@
CopyMemory(&This->Props, &pItem->Props, sizeof(NETCON_PROPERTIES));
- This->Props.pszwName =
CoTaskMemAlloc((wcslen(pItem->Props.pszwName)+1)*sizeof(WCHAR));
- if (This->Props.pszwName)
- wcscpy(This->Props.pszwName, pItem->Props.pszwName);
-
- This->Props.pszwDeviceName =
CoTaskMemAlloc((wcslen(pItem->Props.pszwDeviceName)+1)*sizeof(WCHAR));
- if (This->Props.pszwDeviceName)
- wcscpy(This->Props.pszwDeviceName, pItem->Props.pszwDeviceName);
+ if (pItem->Props.pszwName)
+ {
+ This->Props.pszwName =
CoTaskMemAlloc((wcslen(pItem->Props.pszwName)+1)*sizeof(WCHAR));
+ if (This->Props.pszwName)
+ wcscpy(This->Props.pszwName, pItem->Props.pszwName);
+ }
+
+ if (pItem->Props.pszwDeviceName)
+ {
+ This->Props.pszwDeviceName =
CoTaskMemAlloc((wcslen(pItem->Props.pszwDeviceName)+1)*sizeof(WCHAR));
+ if (This->Props.pszwDeviceName)
+ wcscpy(This->Props.pszwDeviceName, pItem->Props.pszwDeviceName);
+ }
*ppv = (INetConnection *)This;
@@ -449,7 +455,7 @@
IEnumNetConnection_fnClone
};
-static
+
BOOL
GetAdapterIndexFromNetCfgInstanceId(PIP_ADAPTER_INFO pAdapterInfo, LPWSTR szNetCfg,
PDWORD pIndex)
{
@@ -473,7 +479,6 @@
}
return FALSE;
}
-
static
BOOL
@@ -543,6 +548,7 @@
dwIndex = 0;
do
{
+
ZeroMemory(&DevInfo, sizeof(SP_DEVINFO_DATA));
DevInfo.cbSize = sizeof(DevInfo);
@@ -566,9 +572,10 @@
break;
}
RegCloseKey(hSubKey);
+
/* get the current adapter index from NetCfgInstanceId */
if (!GetAdapterIndexFromNetCfgInstanceId(pAdapterInfo, szNetCfg,
&dwAdapterIndex))
- break;
+ continue;
/* get detailed adapter info */
ZeroMemory(&IfEntry, sizeof(IfEntry));
Modified: trunk/reactos/dll/win32/netshell/lanconnectui.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netshell/lanconn…
==============================================================================
--- trunk/reactos/dll/win32/netshell/lanconnectui.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netshell/lanconnectui.c [iso-8859-1] Wed Sep 17 08:58:48 2008
@@ -24,6 +24,7 @@
{
INetConnectionPropertyUi2 *lpVtbl;
INetLanConnectionUiInfo * lpLanConUiInfoVtbl;
+ INetConnectionConnectUi * lpNetConnectionConnectUi;
INetConnection * pCon;
INetCfgLock *NCfgLock;
INetCfg * pNCfg;
@@ -35,6 +36,12 @@
{
return (LPINetConnectionPropertyUiImpl)((char *)iface -
FIELD_OFFSET(INetConnectionPropertyUiImpl, lpLanConUiInfoVtbl));
}
+
+static LPINetConnectionPropertyUiImpl __inline
impl_from_NetConnectionConnectUi(INetConnectionConnectUi *iface)
+{
+ return (LPINetConnectionPropertyUiImpl)((char *)iface -
FIELD_OFFSET(INetConnectionPropertyUiImpl, lpNetConnectionConnectUi));
+}
+
HPROPSHEETPAGE
InitializePropertySheetPage(LPWSTR resname, DLGPROC dlgproc, LPARAM lParam, LPWSTR
szTitle)
@@ -389,7 +396,7 @@
REFIID iid,
LPVOID * ppvObj)
{
- //LPOLESTR pStr;
+ LPOLESTR pStr;
INetConnectionPropertyUiImpl * This = (INetConnectionPropertyUiImpl*)iface;
*ppvObj = NULL;
@@ -407,9 +414,16 @@
IUnknown_AddRef(iface);
return S_OK;
}
- //StringFromCLSID(iid, &pStr);
- //MessageBoxW(NULL, pStr, L"INetConnectionPropertyUi_fnQueryInterface",
MB_OK);
- //CoTaskMemFree(pStr);
+ else if (IsEqualIID(iid, &IID_INetConnectionConnectUi))
+ {
+ *ppvObj = &This->lpNetConnectionConnectUi;
+ IUnknown_AddRef(iface);
+ return S_OK;
+ }
+
+ StringFromCLSID(iid, &pStr);
+ MessageBoxW(NULL, pStr, L"INetConnectionPropertyUi_fnQueryInterface",
MB_OK);
+ CoTaskMemFree(pStr);
return E_NOINTERFACE;
}
@@ -587,6 +601,109 @@
INetLanConnectionUiInfo_fnRelease,
INetLanConnectionUiInfo_fnGetDeviceGuid,
};
+
+static
+HRESULT
+STDCALL
+INetConnectionConnectUi_fnQueryInterface(
+ INetConnectionConnectUi * iface,
+ REFIID iid,
+ LPVOID * ppvObj)
+{
+ INetConnectionPropertyUiImpl * This = impl_from_NetConnectionConnectUi(iface);
+ return INetConnectionPropertyUi_QueryInterface((INetConnectionPropertyUi*)This, iid,
ppvObj);
+}
+
+static
+ULONG
+STDCALL
+INetConnectionConnectUi_fnAddRef(
+ INetConnectionConnectUi * iface)
+{
+ INetConnectionPropertyUiImpl * This = impl_from_NetConnectionConnectUi(iface);
+ return INetConnectionPropertyUi_AddRef((INetConnectionPropertyUi*)This);
+}
+
+static
+ULONG
+STDCALL
+INetConnectionConnectUi_fnRelease(
+ INetConnectionConnectUi * iface)
+{
+ INetConnectionPropertyUiImpl * This = impl_from_NetConnectionConnectUi(iface);
+ return INetConnectionPropertyUi_Release((INetConnectionPropertyUi*)This);
+}
+
+static
+HRESULT
+STDCALL
+INetConnectionConnectUi_fnSetConnection(
+ INetConnectionConnectUi * iface,
+ INetConnection* pCon)
+{
+ INetConnectionPropertyUiImpl * This = impl_from_NetConnectionConnectUi(iface);
+ if (This->pCon)
+ INetConnection_Release(This->pCon);
+
+ if (!pCon)
+ return E_POINTER;
+
+ This->pCon = pCon;
+ INetConnection_AddRef(pCon);
+ return S_OK;
+}
+
+static
+HRESULT
+STDCALL
+INetConnectionConnectUi_fnConnect(
+ INetConnectionConnectUi * iface,
+ HWND hwndParent,
+ DWORD dwFlags)
+{
+ INetConnectionPropertyUiImpl * This = impl_from_NetConnectionConnectUi(iface);
+
+ if (!This->pCon)
+ return E_POINTER; //FIXME
+
+
+ if (dwFlags & NCUC_NO_UI)
+ {
+ return INetConnection_Connect(This->pCon);
+ }
+
+ return E_FAIL;
+}
+
+static
+HRESULT
+STDCALL
+INetConnectionConnectUi_fnDisconnect(
+ INetConnectionConnectUi * iface,
+ HWND hwndParent,
+ DWORD dwFlags)
+{
+ WCHAR szBuffer[100];
+ swprintf(szBuffer, L"INetConnectionConnectUi_fnDisconnect flags %x\n",
dwFlags);
+ MessageBoxW(NULL, szBuffer, NULL, MB_OK);
+
+ return S_OK;
+}
+
+
+static const INetConnectionConnectUiVtbl vt_NetConnectionConnectUi =
+{
+ INetConnectionConnectUi_fnQueryInterface,
+ INetConnectionConnectUi_fnAddRef,
+ INetConnectionConnectUi_fnRelease,
+ INetConnectionConnectUi_fnSetConnection,
+ INetConnectionConnectUi_fnConnect,
+ INetConnectionConnectUi_fnDisconnect,
+
+};
+
+
+
HRESULT WINAPI LanConnectUI_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID *
ppv)
{
INetConnectionPropertyUiImpl * This;
@@ -608,6 +725,7 @@
This->pProperties = NULL;
This->lpVtbl = (INetConnectionPropertyUi2*)&vt_NetConnectionPropertyUi;
This->lpLanConUiInfoVtbl =
(INetLanConnectionUiInfo*)&vt_NetLanConnectionUiInfo;
+ This->lpNetConnectionConnectUi =
(INetConnectionConnectUi*)&vt_NetConnectionConnectUi;
if (!SUCCEEDED (INetConnectionPropertyUi2_fnQueryInterface
((INetConnectionPropertyUi2*)This, riid, ppv)))
{
Modified: trunk/reactos/dll/win32/netshell/lang/de-DE.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netshell/lang/de…
==============================================================================
--- trunk/reactos/dll/win32/netshell/lang/de-DE.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netshell/lang/de-DE.rc [iso-8859-1] Wed Sep 17 08:58:48 2008
@@ -19,8 +19,15 @@
CHECKBOX "&Benachrichtigen, wenn diese Verbindung eingeschränkte
oder\nkeine Konnektivität besitzt", IDC_NOTIFYNOCONNECTION, 9, 220, 230, 24,
BS_AUTOCHECKBOX | WS_TABSTOP
END
-IDD_NETSTATUS DIALOGEX DISCARDABLE 0, 0, 200,180
-STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION
+IDD_STATUS DIALOGEX DISCARDABLE 0, 0, 200, 280
+STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Allgemein"
+FONT 8, "MS Shell Dlg"
+BEGIN
+END
+
+IDD_LAN_NETSTATUS DIALOGEX DISCARDABLE 0, 0, 200, 180
+STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Allgemein"
FONT 8, "MS Shell Dlg"
BEGIN
@@ -71,4 +78,10 @@
IDS_NET_DELETE "Löschen"
IDS_NET_RENAME "Umbenennen"
IDS_NET_PROPERTIES "Eigenschaften"
+
+ IDS_FORMAT_BIT "%u Bit/s"
+ IDS_FORMAT_KBIT "%u KBit/s"
+ IDS_FORMAT_MBIT "%u MBit/s"
+ IDS_FORMAT_GBIT "%u GBit/s"
+
END
Modified: trunk/reactos/dll/win32/netshell/lanstatusui.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netshell/lanstat…
==============================================================================
--- trunk/reactos/dll/win32/netshell/lanstatusui.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netshell/lanstatusui.c [iso-8859-1] Wed Sep 17 08:58:48 2008
@@ -1,35 +1,355 @@
#include <precomp.h>
-
/// CLSID
/// HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{7007ACCF-3202-11D1-AAD2-00805FC1270E}
// IID B722BCCB-4E68-101B-A2BC-00AA00404770
+
+#define WM_SHOWSTATUSDLG (WM_USER+10)
typedef struct
{
IOleCommandTarget * lpVtbl;
+ INetConnectionManager * lpNetMan;
LONG ref;
}ILanStatusImpl, *LPILanStatusImpl;
+typedef struct
+{
+ INetConnection *pNet;
+ HWND hwndDlg;
+}LANSTATUSUI_CONTEXT;
+
+VOID
+UpdateLanStatusUIDlg(HWND hwndDlg, MIB_IFROW * IfEntry)
+{
+ WCHAR szFormat[MAX_PATH] = {0};
+ WCHAR szBuffer[MAX_PATH] = {0};
+
+ if (IfEntry->dwSpeed < 1000)
+ {
+ if (LoadStringW(netshell_hInstance, IDS_FORMAT_BIT, szFormat,
sizeof(szFormat)/sizeof(WCHAR)))
+ {
+ swprintf(szBuffer, szFormat, IfEntry->dwSpeed);
+ SendDlgItemMessageW(hwndDlg, IDC_SPEED, WM_SETTEXT, 0, (LPARAM)szBuffer);
+ }
+ }
+ else if (IfEntry->dwSpeed < 1000000)
+ {
+ if (LoadStringW(netshell_hInstance, IDS_FORMAT_KBIT, szFormat,
sizeof(szFormat)/sizeof(WCHAR)))
+ {
+ swprintf(szBuffer, szFormat, IfEntry->dwSpeed/1000);
+ SendDlgItemMessageW(hwndDlg, IDC_SPEED, WM_SETTEXT, 0, (LPARAM)szBuffer);
+ }
+ }
+ else if (IfEntry->dwSpeed < 1000000000)
+ {
+ if (LoadStringW(netshell_hInstance, IDS_FORMAT_MBIT, szFormat,
sizeof(szFormat)/sizeof(WCHAR)))
+ {
+ swprintf(szBuffer, szFormat, IfEntry->dwSpeed/1000000);
+ SendDlgItemMessageW(hwndDlg, IDC_SPEED, WM_SETTEXT, 0, (LPARAM)szBuffer);
+ }
+ }
+ else
+ {
+ if (LoadStringW(netshell_hInstance, IDS_FORMAT_KBIT, szFormat,
sizeof(szFormat)/sizeof(WCHAR)))
+ {
+ swprintf(szBuffer, szFormat, IfEntry->dwSpeed/1000000000);
+ SendDlgItemMessageW(hwndDlg, IDC_SPEED, WM_SETTEXT, 0, (LPARAM)szBuffer);
+ }
+ }
+
+ if (StrFormatByteSizeW(IfEntry->dwInOctets, szBuffer,
sizeof(szFormat)/sizeof(WCHAR)))
+ {
+ SendDlgItemMessageW(hwndDlg, IDC_RECEIVED, WM_SETTEXT, 0, (LPARAM)szBuffer);
+ }
+
+ if (StrFormatByteSizeW(IfEntry->dwOutOctets, szBuffer,
sizeof(szFormat)/sizeof(WCHAR)))
+ {
+ SendDlgItemMessageW(hwndDlg, IDC_SEND, WM_SETTEXT, 0, (LPARAM)szBuffer);
+ }
+
+ //FIXME
+ //set duration
+
+}
+
+VOID
+InitializeLANStatusUiDlg(HWND hwndDlg, INetConnection * pNet)
+{
+ WCHAR szBuffer[MAX_PATH] = {0};
+ NETCON_PROPERTIES * pProperties = NULL;
+ MIB_IFROW IfEntry;
+ DWORD dwSize, dwAdapterIndex, dwResult;
+ LPOLESTR pStr;
+ IP_ADAPTER_INFO * pAdapterInfo;
+
+ if (INetConnection_GetProperties(pNet, &pProperties) != NOERROR)
+ return;
+
+ if (pProperties->Status == NCS_DISCONNECTED)
+ LoadStringW(netshell_hInstance, IDS_STATUS_UNREACHABLE, szBuffer, MAX_PATH);
+ else if (pProperties->Status == NCS_MEDIA_DISCONNECTED)
+ LoadStringW(netshell_hInstance, IDS_STATUS_DISCONNECTED, szBuffer, MAX_PATH);
+ else if (pProperties->Status == NCS_CONNECTING)
+ LoadStringW(netshell_hInstance, IDS_STATUS_CONNECTING, szBuffer, MAX_PATH);
+ else if (pProperties->Status == NCS_CONNECTED)
+ LoadStringW(netshell_hInstance, IDS_STATUS_CONNECTED, szBuffer, MAX_PATH);
+
+ SendDlgItemMessageW(hwndDlg, IDC_STATUS, WM_SETTEXT, 0, (LPARAM)szBuffer);
+
+ if (FAILED(StringFromCLSID(&pProperties->guidId, &pStr)))
+ {
+ NcFreeNetconProperties(pProperties);
+ return;
+ }
+ NcFreeNetconProperties(pProperties);
+
+ /* get the IfTable */
+ dwSize = 0;
+ dwResult = GetAdaptersInfo(NULL, &dwSize);
+ if (dwResult!= ERROR_BUFFER_OVERFLOW)
+ {
+ CoTaskMemFree(pStr);
+ return;
+ }
+
+ pAdapterInfo = (PIP_ADAPTER_INFO)CoTaskMemAlloc(dwSize);
+ if (!pAdapterInfo)
+ {
+ CoTaskMemFree(pAdapterInfo);
+ CoTaskMemFree(pStr);
+ return;
+ }
+
+ if (GetAdaptersInfo(pAdapterInfo, &dwSize) != NO_ERROR)
+ {
+ CoTaskMemFree(pAdapterInfo);
+ CoTaskMemFree(pStr);
+ return;
+ }
+
+ if (!GetAdapterIndexFromNetCfgInstanceId(pAdapterInfo, pStr, &dwAdapterIndex))
+ {
+ CoTaskMemFree(pAdapterInfo);
+ CoTaskMemFree(pStr);
+ return;
+ }
+ CoTaskMemFree(pStr);
+
+ /* get detailed adapter info */
+ ZeroMemory(&IfEntry, sizeof(IfEntry));
+ IfEntry.dwIndex = dwAdapterIndex;
+ if(GetIfEntry(&IfEntry) != NO_ERROR)
+ {
+ CoTaskMemFree(pAdapterInfo);
+ return;
+ }
+
+ UpdateLanStatusUIDlg(hwndDlg, &IfEntry);
+
+ CoTaskMemFree(pAdapterInfo);
+}
INT_PTR
CALLBACK
-LANStatusUIDlg(
+LANStatusUiDlg(
HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
+ PROPSHEETPAGE *page;
+ LANSTATUSUI_CONTEXT * pContext;
+ LPPSHNOTIFY lppsn;
+
switch(uMsg)
{
case WM_INITDIALOG:
+ page = (PROPSHEETPAGE*)lParam;
+ pContext = (LANSTATUSUI_CONTEXT*)page->lParam;
+ InitializeLANStatusUiDlg(hwndDlg, pContext->pNet);
+ SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pContext);
return TRUE;
+ case WM_COMMAND:
+ pContext = (LANSTATUSUI_CONTEXT*)GetWindowLongPtr(hwndDlg, DWLP_USER);
+ if (LOWORD(wParam) == IDC_STATUS_PROPERTIES)
+ {
+ //FIXME
+ // show net connection property dialog
+ //
+ if (pContext)
+ ShowNetConnectionProperties(pContext->pNet, pContext->hwndDlg);
+ break;
+ }
+ else if (LOWORD(wParam) == IDC_ENDISABLE)
+ {
+ //FIXME
+ // disable network adapter
+ break;
+ }
+ case WM_NOTIFY:
+ lppsn = (LPPSHNOTIFY) lParam;
+ if (lppsn->hdr.code == PSN_APPLY || lppsn->hdr.code == PSN_RESET)
+ {
+ pContext = (LANSTATUSUI_CONTEXT*)GetWindowLongPtr(hwndDlg, DWLP_USER);
+ DestroyWindow(pContext->hwndDlg);
+ pContext->hwndDlg = NULL;
+ return PSNRET_NOERROR;
+ }
+ break;
}
return FALSE;
}
-
-
+VOID
+ShowStatusPropertyDialog(
+ LANSTATUSUI_CONTEXT * pContext,
+ HWND hwndDlg)
+{
+ HPROPSHEETPAGE hppages[2];
+ PROPSHEETHEADERW pinfo;
+ NETCON_PROPERTIES * pProperties = NULL;
+ HWND hwnd;
+
+ ZeroMemory(&pinfo, sizeof(PROPSHEETHEADERW));
+ ZeroMemory(hppages, sizeof(hppages));
+ pinfo.dwSize = sizeof(PROPSHEETHEADERW);
+ pinfo.dwFlags = PSH_NOCONTEXTHELP | PSH_PROPTITLE | PSH_NOAPPLYNOW | PSH_MODELESS;
+ pinfo.u3.phpage = hppages;
+ pinfo.hwndParent = hwndDlg;
+
+ if (INetConnection_GetProperties(pContext->pNet, &pProperties) == NOERROR)
+ {
+ if (pProperties->pszwName)
+ {
+ pinfo.pszCaption = pProperties->pszwName;
+ pinfo.dwFlags |= PSH_PROPTITLE;
+ }
+
+ if (pProperties->MediaType == NCM_LAN)
+ {
+ hppages[0] = InitializePropertySheetPage(MAKEINTRESOURCEW(IDD_LAN_NETSTATUS),
LANStatusUiDlg, (LPARAM)pContext, NULL);
+ if (hppages[0])
+ pinfo.nPages++;
+
+ if (pinfo.nPages)
+ {
+ hwnd = (HWND)PropertySheetW(&pinfo);
+ if (hwnd)
+ {
+ pContext->hwndDlg = hwnd;
+ }
+ }
+ }
+ NcFreeNetconProperties(pProperties);
+ }
+}
+
+INT_PTR
+CALLBACK
+LANStatusDlg(
+ HWND hwndDlg,
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam
+)
+{
+ LANSTATUSUI_CONTEXT * pContext;
+
+ switch(uMsg)
+ {
+ case WM_INITDIALOG:
+ pContext =
(LANSTATUSUI_CONTEXT*)CoTaskMemAlloc(sizeof(LANSTATUSUI_CONTEXT));
+ if (!pContext)
+ return FALSE;
+ pContext->hwndDlg = NULL;
+ pContext->pNet = (INetConnection*)lParam;
+ SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pContext);
+ return TRUE;
+ case WM_SHOWSTATUSDLG:
+ if (LOWORD(lParam) == WM_LBUTTONDOWN)
+ {
+ pContext = (LANSTATUSUI_CONTEXT*)GetWindowLongPtr(hwndDlg, DWLP_USER);
+ if (!pContext)
+ break;
+
+ if (pContext->hwndDlg)
+ {
+ ShowWindow(pContext->hwndDlg, SW_SHOW);
+ BringWindowToTop(pContext->hwndDlg);
+ }
+ else
+ {
+ ShowStatusPropertyDialog(pContext, hwndDlg);
+ }
+ break;
+ }
+ break;
+ }
+ return FALSE;
+}
+static
+HRESULT
+InitializeNetConnectTray(
+ ILanStatusImpl * This)
+{
+ NOTIFYICONDATAW nid;
+ HWND hwndDlg;
+ INetConnectionManager * INetConMan;
+ IEnumNetConnection * IEnumCon;
+ INetConnection * INetCon;
+ NETCON_PROPERTIES* pProps;
+ HRESULT hr;
+ ULONG Count;
+ ULONG Index;
+
+ /* get an instance to of IConnectionManager */
+ hr = INetConnectionManager_Constructor(NULL, &IID_INetConnectionManager,
(LPVOID*)&INetConMan);
+ if (FAILED(hr))
+ return hr;
+
+ hr = INetConnectionManager_EnumConnections(INetConMan, NCME_DEFAULT, &IEnumCon);
+ if (FAILED(hr))
+ {
+ INetConnectionManager_Release(INetConMan);
+ return hr;
+ }
+
+ Index = 1;
+ do
+ {
+ hr = IEnumNetConnection_Next(IEnumCon, 1, &INetCon, &Count);
+ if (hr == S_OK)
+ {
+ hwndDlg = CreateDialogParamW(netshell_hInstance,
MAKEINTRESOURCEW(IDD_STATUS), NULL, LANStatusDlg, (LPARAM)INetCon);
+ if (hwndDlg)
+ {
+ ZeroMemory(&nid, sizeof(nid));
+ nid.cbSize = sizeof(nid);
+ nid.uID = Index++;
+ nid.uFlags = NIF_ICON | NIF_MESSAGE;
+ nid.u.uVersion = 3;
+ nid.uCallbackMessage = WM_SHOWSTATUSDLG;
+ nid.hWnd = hwndDlg;
+ nid.hIcon = LoadIcon(netshell_hInstance,
MAKEINTRESOURCE(IDI_SHELL_NETWORK_FOLDER)); //FIXME
+ hr = INetConnection_GetProperties(INetCon, &pProps);
+ if (SUCCEEDED(hr))
+ {
+ if (!(pProps->dwCharacter & NCCF_SHOW_ICON))
+ {
+ nid.dwState = NIS_HIDDEN;
+ }
+ }
+ if (Shell_NotifyIconW(NIM_ADD, &nid))
+ Index++;
+ }
+ }
+ }while(hr == S_OK);
+
+ This->lpNetMan = INetConMan;
+ IEnumNetConnection_Release(IEnumCon);
+ return S_OK;
+}
static
HRESULT
WINAPI
@@ -48,7 +368,7 @@
IUnknown_AddRef(iface);
return S_OK;
}
-
+ MessageBoxW(NULL, L"IOleCommandTarget_fnQueryInterface", NULL, MB_OK);
return E_NOINTERFACE;
}
@@ -90,7 +410,8 @@
OLECMD *prgCmds,
OLECMDTEXT *pCmdText)
{
- MessageBoxW(NULL, L"IOleCommandTarget_fnQueryStatus", NULL, MB_OK);
+ MessageBoxW(NULL, L"222222222222222222222",
L"IOleCommandTarget_fnQueryStatus", MB_OK);
+ MessageBoxW(NULL, pCmdText->rgwz, L"IOleCommandTarget_fnQueryStatus",
MB_OK);
return E_NOTIMPL;
}
@@ -105,24 +426,13 @@
VARIANT *pvaIn,
VARIANT *pvaOut)
{
- NOTIFYICONDATA nid;
- HWND hwndDlg;
- //ILanStatusImpl * This = (ILanStatusImpl*)iface;
-
- hwndDlg = CreateDialogW(netshell_hInstance, MAKEINTRESOURCEW(IDD_NETSTATUS), NULL,
LANStatusUIDlg);
+ ILanStatusImpl * This = (ILanStatusImpl*)iface;
+
if (pguidCmdGroup)
{
if (IsEqualIID(pguidCmdGroup, &CGID_ShellServiceObject))
{
- nid.cbSize = sizeof(nid);
- nid.uID = 100;
- nid.uFlags = NIF_ICON;
- nid.u.uVersion = NOTIFYICON_VERSION;
- nid.hWnd = hwndDlg;
- nid.hIcon = LoadIcon(netshell_hInstance,
MAKEINTRESOURCE(IDI_SHELL_NETWORK_FOLDER));
-
- Shell_NotifyIcon(NIM_ADD, &nid);
- return S_OK;
+ return InitializeNetConnectTray(This);
}
}
return S_OK;
@@ -155,13 +465,13 @@
This->ref = 1;
This->lpVtbl = (IOleCommandTarget*)&vt_OleCommandTarget;
-
- if (!SUCCEEDED (IOleCommandTarget_fnQueryInterface ((IOleCommandTarget*)This, riid,
ppv)))
+ This->lpNetMan = NULL;
+
+ if (FAILED(IOleCommandTarget_fnQueryInterface ((IOleCommandTarget*)This, riid,
ppv)))
{
IOleCommandTarget_Release((IUnknown*)This);
return E_NOINTERFACE;
}
-
IOleCommandTarget_Release((IUnknown*)This);
return S_OK;
}
Modified: trunk/reactos/dll/win32/netshell/precomp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netshell/precomp…
==============================================================================
--- trunk/reactos/dll/win32/netshell/precomp.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netshell/precomp.h [iso-8859-1] Wed Sep 17 08:58:48 2008
@@ -81,6 +81,7 @@
/* shfldr_netconnect.c */
+HRESULT ShowNetConnectionProperties(INetConnection * pNetConnect, HWND hwnd);
HRESULT WINAPI ISF_NetConnect_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID *
ppv);
/* enumlist.c */
@@ -96,8 +97,10 @@
/* connectmanager.c */
HRESULT WINAPI INetConnectionManager_Constructor (IUnknown * pUnkOuter, REFIID riid,
LPVOID * ppv);
+BOOL GetAdapterIndexFromNetCfgInstanceId(PIP_ADAPTER_INFO pAdapterInfo, LPWSTR szNetCfg,
PDWORD pIndex);
/* lanconnectui.c */
+HPROPSHEETPAGE InitializePropertySheetPage(LPWSTR resname, DLGPROC dlgproc, LPARAM
lParam, LPWSTR szTitle);
HRESULT WINAPI LanConnectUI_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID *
ppv);
/* lanstatusui.c */
Modified: trunk/reactos/dll/win32/netshell/resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netshell/resourc…
==============================================================================
--- trunk/reactos/dll/win32/netshell/resource.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netshell/resource.h [iso-8859-1] Wed Sep 17 08:58:48 2008
@@ -8,7 +8,9 @@
/* dialogs */
#define IDD_NETPROPERTIES 400
-#define IDD_NETSTATUS 401
+#define IDD_LAN_NETSTATUS 401
+#define IDD_STATUS 402
+
/* dialog controls */
#define IDC_NETCARDNAME 1000
@@ -55,3 +57,9 @@
#define IDS_NET_DELETE 10105
#define IDS_NET_RENAME 10106
#define IDS_NET_PROPERTIES 10107
+
+#define IDS_FORMAT_BIT 10200
+#define IDS_FORMAT_MBIT 10201
+#define IDS_FORMAT_KBIT 10202
+#define IDS_FORMAT_GBIT 10203
+
Modified: trunk/reactos/dll/win32/netshell/shfldr_netconnect.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netshell/shfldr_…
==============================================================================
--- trunk/reactos/dll/win32/netshell/shfldr_netconnect.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netshell/shfldr_netconnect.c [iso-8859-1] Wed Sep 17 08:58:48
2008
@@ -745,30 +745,76 @@
pinfo->u3.phpage[pinfo->nPages++] = hPage;
return TRUE;
}
- return FALSE;
-}
+ return FALSE;
+}
+
+HRESULT
+ShowNetConnectionProperties(
+ INetConnection * pNetConnect,
+ HWND hwnd)
+{
+ HRESULT hr;
+ CLSID ClassID;
+ PROPSHEETHEADERW pinfo;
+ HPROPSHEETPAGE hppages[MAX_PROPERTY_SHEET_PAGE];
+ INetConnectionPropertyUi * pNCP;
+ NETCON_PROPERTIES * pProperties;
+
+ if (INetConnection_GetProperties(pNetConnect, &pProperties) != NOERROR)
+ return E_FAIL;
+
+ hr = INetConnection_GetUiObjectClassId(pNetConnect, &ClassID);
+ if (FAILED(hr))
+ {
+ NcFreeNetconProperties(pProperties);
+ return hr;
+ }
+
+ hr = CoCreateInstance(&ClassID, NULL, CLSCTX_INPROC_SERVER,
&IID_INetConnectionPropertyUi, (LPVOID)&pNCP);
+ if (FAILED(hr))
+ {
+ NcFreeNetconProperties(pProperties);
+ return hr;
+ }
+
+ hr = INetConnectionPropertyUi_SetConnection(pNCP, pNetConnect);
+ if (SUCCEEDED(hr))
+ {
+ ZeroMemory(&pinfo, sizeof(PROPSHEETHEADERW));
+ ZeroMemory(hppages, sizeof(hppages));
+ pinfo.dwSize = sizeof(PROPSHEETHEADERW);
+ pinfo.dwFlags = PSH_NOCONTEXTHELP | PSH_PROPTITLE | PSH_NOAPPLYNOW;
+ pinfo.u3.phpage = hppages;
+ pinfo.hwndParent = hwnd;
+
+ pinfo.pszCaption = pProperties->pszwName;
+ hr = INetConnectionPropertyUi_AddPages(pNCP, hwnd, PropSheetExCallback,
(LPARAM)&pinfo);
+ if (SUCCEEDED(hr))
+ {
+ if(PropertySheetW(&pinfo) < 0)
+ hr = E_FAIL;
+ }
+ }
+ INetConnectionPropertyUi_Release(pNCP);
+ NcFreeNetconProperties(pProperties);
+ return hr;
+}
+
/**************************************************************************
* ISF_NetConnect_IContextMenu_InvokeCommand()
*/
static HRESULT WINAPI ISF_NetConnect_IContextMenu2_InvokeCommand(
- IContextMenu2 *iface,
- LPCMINVOKECOMMANDINFO lpcmi)
+ IContextMenu2 *iface,
+ LPCMINVOKECOMMANDINFO lpcmi)
{
IGenericSFImpl * This = impl_from_IContextMenu2(iface);
VALUEStruct * val;
- NETCON_PROPERTIES * pProperties;
HRESULT hr = S_OK;
- PROPSHEETHEADERW pinfo;
- CLSID ClassID;
- HPROPSHEETPAGE hppages[MAX_PROPERTY_SHEET_PAGE];
- INetConnectionPropertyUi * pNCP;
+
val = _ILGetValueStruct(This->apidl);
if (!val)
- return E_FAIL;
-
- if (INetConnection_GetProperties((INetConnection*)val->pItem, &pProperties) !=
NOERROR)
return E_FAIL;
if (lpcmi->lpVerb == MAKEINTRESOURCEA(IDS_NET_STATUS))
@@ -777,44 +823,14 @@
if (pProperties->MediaType == NCM_LAN)
{
hr = ShowLANConnectionStatusDialog(pProperties);
- NcFreeNetconProperties(pProperties);
}
#endif
return hr;
}
else if (lpcmi->lpVerb == MAKEINTRESOURCEA(IDS_NET_PROPERTIES))
{
- hr = INetConnection_GetUiObjectClassId(val->pItem, &ClassID);
- if (SUCCEEDED(hr))
- {
- /* FIXME perform version checks */
- hr = CoCreateInstance(&ClassID, NULL, CLSCTX_INPROC_SERVER,
&IID_INetConnectionPropertyUi, (LPVOID)&pNCP);
- if (SUCCEEDED(hr))
- {
- hr = INetConnectionPropertyUi_SetConnection(pNCP, val->pItem);
- if (SUCCEEDED(hr))
- {
- ZeroMemory(&pinfo, sizeof(PROPSHEETHEADERW));
- ZeroMemory(hppages, sizeof(hppages));
- pinfo.dwSize = sizeof(PROPSHEETHEADERW);
- pinfo.dwFlags = PSH_NOCONTEXTHELP | PSH_PROPTITLE | PSH_NOAPPLYNOW;
- pinfo.u3.phpage = hppages;
- pinfo.hwndParent = lpcmi->hwnd;
-
- pinfo.pszCaption = pProperties->pszwName;
- hr = INetConnectionPropertyUi_AddPages(pNCP, lpcmi->hwnd,
PropSheetExCallback, (LPARAM)&pinfo);
- if (SUCCEEDED(hr))
- {
- if(PropertySheetW(&pinfo) < 0)
- hr = E_FAIL;
- }
- }
- INetConnectionPropertyUi_Release(pNCP);
- }
-
- }
- NcFreeNetconProperties(pProperties);
- return hr;
+ /* FIXME perform version checks */
+ return ShowNetConnectionProperties(val->pItem, lpcmi->hwnd);
}
return S_OK;