Author: janderwald Date: Fri Aug 29 09:18:55 2008 New Revision: 35760
URL: http://svn.reactos.org/svn/reactos?rev=35760&view=rev Log: - Activate INetConnection::GetProperties code - Import from ncpa properties and status dialog - Implement INetConnectionProperty interface - Fix a bug & handle leak in registering code - Implement NcFreeNetconProperties - Make resources of netshell to be similar of Windows XP to allow netshell to be loaded - Add NCF constants from ncpa - Implement enumerating control/protocol and devices - items dont appear for some unknown reason - Load property dialog in the same way like Windows (using INetConnectionProperty) interface
Added: trunk/reactos/dll/win32/netshell/lanconnectui.c (with props) Modified: trunk/reactos/dll/win32/netshell/classfactory.c trunk/reactos/dll/win32/netshell/connectmanager.c trunk/reactos/dll/win32/netshell/lang/de-DE.rc trunk/reactos/dll/win32/netshell/lang/en-US.rc trunk/reactos/dll/win32/netshell/netshell.c trunk/reactos/dll/win32/netshell/netshell.rbuild trunk/reactos/dll/win32/netshell/netshell.rc trunk/reactos/dll/win32/netshell/netshell.spec 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/classfactory.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netshell/classfac... ============================================================================== --- trunk/reactos/dll/win32/netshell/classfactory.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/netshell/classfactory.c [iso-8859-1] Fri Aug 29 09:18:55 2008 @@ -21,7 +21,6 @@ IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
*ppvObj = NULL; - if(IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IClassFactory)) { *ppvObj = This;
Modified: trunk/reactos/dll/win32/netshell/connectmanager.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netshell/connectm... ============================================================================== --- trunk/reactos/dll/win32/netshell/connectmanager.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/netshell/connectmanager.c [iso-8859-1] Fri Aug 29 09:18:55 2008 @@ -211,17 +211,14 @@ INetConnection * iface, NETCON_PROPERTIES **ppProps) { -#if 0 + NETCON_PROPERTIES * pProperties; -#endif + INetConnectionImpl * This = (INetConnectionImpl*)iface;
if (!ppProps) return E_POINTER;
-#if 1 - *ppProps = &This->Props; -#else pProperties = CoTaskMemAlloc(sizeof(NETCON_PROPERTIES)); if (!pProperties) return E_OUTOFMEMORY; @@ -241,7 +238,6 @@ }
*ppProps = pProperties; -#endif return NOERROR; }
@@ -252,6 +248,15 @@ INetConnection * iface, CLSID *pclsid) { + + INetConnectionImpl * This = (INetConnectionImpl*)iface; + + if (This->Props.MediaType == NCM_LAN) + { + CopyMemory(pclsid, &CLSID_LANConnectUI, sizeof(CLSID)); + return S_OK; + } + return E_NOTIMPL; }
Added: trunk/reactos/dll/win32/netshell/lanconnectui.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netshell/lanconne... ============================================================================== --- trunk/reactos/dll/win32/netshell/lanconnectui.c (added) +++ trunk/reactos/dll/win32/netshell/lanconnectui.c [iso-8859-1] Fri Aug 29 09:18:55 2008 @@ -1,0 +1,456 @@ +#include <precomp.h> + +typedef enum +{ + NET_TYPE_CLIENT = 1, + NET_TYPE_SERVICE = 2, + NET_TYPE_PROTOCOL = 3 +}NET_TYPE; + +typedef struct +{ + NET_TYPE Type; + DWORD dwCharacteristics; + LPWSTR szHelp; +}NET_ITEM, *PNET_ITEM; + +typedef struct +{ + INetConnectionPropertyUi *lpVtbl; + INetConnection * pCon; + LONG ref; +}INetConnectionPropertyUiImpl, *LPINetConnectionPropertyUiImpl; + + +/// CLASSID +/// {7007ACC5-3202-11D1-AAD2-00805FC1270E} +/// open network properties and wlan properties + +HPROPSHEETPAGE +InitializePropertySheetPage(LPWSTR resname, DLGPROC dlgproc, LPARAM lParam, LPWSTR szTitle) +{ + PROPSHEETPAGEW ppage; + + memset(&ppage, 0x0, sizeof(PROPSHEETPAGEW)); + ppage.dwSize = sizeof(PROPSHEETPAGEW); + ppage.dwFlags = PSP_DEFAULT; + ppage.u.pszTemplate = resname; + ppage.pfnDlgProc = dlgproc; + ppage.lParam = lParam; + ppage.hInstance = netshell_hInstance; + ppage.pszTitle = szTitle; + if (szTitle) + { + ppage.dwFlags |= PSP_USETITLE; + } + return CreatePropertySheetPageW(&ppage); +} + +HRESULT +LaunchUIDlg(UINT * pResourceIDs, DLGPROC * pDlgs, UINT Count, NETCON_PROPERTIES * pProperties) +{ + HPROPSHEETPAGE * hpsp; + PROPSHEETHEADERW psh; + BOOL ret; + UINT Index, Offset; + + hpsp = CoTaskMemAlloc(Count * sizeof(HPROPSHEETPAGE)); + if (!hpsp) + return E_OUTOFMEMORY; + + ZeroMemory(hpsp, Count * sizeof(HPROPSHEETPAGE)); + + Index = 0; + Offset = 0; + do + { + hpsp[Offset] = InitializePropertySheetPage(MAKEINTRESOURCEW(pResourceIDs[Index]), pDlgs[Index], (LPARAM)pProperties, NULL); + if (hpsp[Offset]) + Offset++; + + }while(++Index < Count); + + if (!Offset) + { + CoTaskMemFree(hpsp); + return E_FAIL; + } + + + ZeroMemory(&psh, sizeof(PROPSHEETHEADERW)); + psh.dwSize = sizeof(PROPSHEETHEADERW); + psh.dwFlags = PSP_DEFAULT | PSH_PROPTITLE; + psh.pszCaption = pProperties->pszwName; + psh.hwndParent = NULL; + psh.u3.phpage = hpsp; + psh.nPages = Offset; + psh.hInstance = netshell_hInstance; + + + ret = PropertySheetW(&psh); + CoTaskMemFree(hpsp); + + if (ret < 0) + return E_FAIL; + else + return S_OK; +} + +VOID +AddItemToListView(HWND hDlgCtrl, PNET_ITEM pItem, LPWSTR szName) +{ + LVITEMW lvItem; + + ZeroMemory(&lvItem, sizeof(lvItem)); + lvItem.mask = LVIF_TEXT | LVIF_PARAM; + lvItem.pszText = szName; + lvItem.lParam = (LPARAM)pItem; + lvItem.iItem = ListView_GetItemCount(hDlgCtrl); + + SendMessageW(hDlgCtrl, LVM_INSERTITEMW, 0, (LPARAM)&lvItem); +} + +VOID +EnumClientServiceProtocol(HWND hDlgCtrl, HKEY hKey, UINT Type) +{ + DWORD dwIndex = 0; + DWORD dwSize; + DWORD dwRetVal; + DWORD dwCharacteristics; + WCHAR szName[60]; + WCHAR szText[40]; + WCHAR szHelp[200]; + HKEY hSubKey; + static WCHAR szNDI[] = L"\Ndi"; + PNET_ITEM pItem; + + do + { + szHelp[0] = L'\0'; + dwCharacteristics = 0; + szText[0] = L'\0'; + + dwSize = sizeof(szName)/sizeof(WCHAR); + if (RegEnumKeyExW(hKey, dwIndex++, szName, &dwSize, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) + { + /* Get Help Text */ + if (dwSize + (sizeof(szNDI)/sizeof(WCHAR)) + 1 < sizeof(szName)/sizeof(WCHAR)) + { + wcscpy(&szName[dwSize], szNDI); + if (RegOpenKeyExW(hKey, szName, 0, KEY_READ, &hSubKey) == ERROR_SUCCESS) + { +#if 0 + if (RegLoadMUIStringW(hSubKey, L"HelpText", szHelp, sizeof(szHelp)/sizeof(WCHAR), &dwRetVal, 0, NULL) == ERROR_SUCCESS) + szHelp[(sizeof(szHelp)/sizeof(WCHAR))-1] = L'\0'; +#else + DWORD dwType; + dwRetVal = sizeof(szHelp); + if (RegQueryValueExW(hSubKey, L"HelpText", NULL, &dwType, (LPBYTE)szHelp, &dwRetVal) == ERROR_SUCCESS) + szHelp[(sizeof(szHelp)/sizeof(WCHAR))-1] = L'\0'; +#endif + RegCloseKey(hSubKey); + } + szName[dwSize] = L'\0'; + } + /* Get Characteristics */ + if (RegOpenKeyExW(hKey, szName, 0, KEY_READ, &hSubKey) == ERROR_SUCCESS) + { + dwSize = sizeof(dwCharacteristics); + if (RegQueryValueExW(hSubKey, L"Characteristics", NULL, NULL, (LPBYTE)&dwCharacteristics, &dwSize) == ERROR_SUCCESS) + { + if (dwCharacteristics & NCF_HIDDEN) + { + RegCloseKey(hSubKey); + continue; + } + } + /* Get the Client/Procotol/Service name */ + dwSize = sizeof(szText); + if (RegQueryValueExW(hSubKey, L"Description", NULL, NULL, (LPBYTE)szText, &dwSize) == ERROR_SUCCESS) + { + szText[(sizeof(szText)/sizeof(WCHAR))-1] = L'\0'; + } + RegCloseKey(hSubKey); + } + + pItem = CoTaskMemAlloc(sizeof(NET_ITEM)); + if (!pItem) + continue; + + pItem->dwCharacteristics = dwCharacteristics; + pItem->Type = Type; + pItem->szHelp = CoTaskMemAlloc((wcslen(szHelp)+1)*sizeof(WCHAR)); + if (pItem->szHelp) + wcscpy(pItem->szHelp, szHelp); + + AddItemToListView(hDlgCtrl, pItem, szText); + } + else + break; + + }while(TRUE); + +} + + +VOID +InitializeLANPropertiesUIDlg(HWND hwndDlg) +{ + static WCHAR szNetClient[] = L"SYSTEM\CurrentControlSet\Control\Network\{4d36e973-e325-11ce-bfc1-08002be10318}"; + static WCHAR szNetService[] = L"SYSTEM\CurrentControlSet\Control\Network\{4d36e974-e325-11ce-bfc1-08002be10318}"; + static WCHAR szNetProtocol[] =L"System\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}"; + HKEY hKey; + HWND hDlgCtrl; + + hDlgCtrl = GetDlgItem(hwndDlg, IDC_COMPONENTSLIST); + /* Enumerate Clients */ + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szNetClient, 0, KEY_READ, &hKey) == ERROR_SUCCESS) + { + EnumClientServiceProtocol(hwndDlg, hKey, NET_TYPE_CLIENT); + RegCloseKey(hKey); + } + + /* Enumerate Service */ + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szNetService, 0, KEY_READ, &hKey) == ERROR_SUCCESS) + { + EnumClientServiceProtocol(hwndDlg, hKey, NET_TYPE_SERVICE); + RegCloseKey(hKey); + } + + /* Enumerate Protocol */ + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szNetProtocol, 0, KEY_READ, &hKey) == ERROR_SUCCESS) + { + EnumClientServiceProtocol(hwndDlg, hKey, NET_TYPE_PROTOCOL); + RegCloseKey(hKey); + } + + +} + + +INT_PTR +CALLBACK +LANPropertiesUIDlg( + HWND hwndDlg, + UINT uMsg, + WPARAM wParam, + LPARAM lParam +) +{ + PROPSHEETPAGE *page; + NETCON_PROPERTIES * pProperties = (NETCON_PROPERTIES*)GetWindowLongPtr(hwndDlg, DWLP_USER); + switch(uMsg) + { + case WM_INITDIALOG: + page = (PROPSHEETPAGE*)lParam; + pProperties = (NETCON_PROPERTIES*)page->lParam; + SendDlgItemMessageW(hwndDlg, IDC_NETCARDNAME, WM_SETTEXT, 0, (LPARAM)pProperties->pszwDeviceName); + if (pProperties->dwCharacter & NCCF_SHOW_ICON) + { + /* check show item on taskbar*/ + SendDlgItemMessageW(hwndDlg, IDC_SHOWTASKBAR, BM_SETCHECK, BST_CHECKED, 0); + } + if (pProperties->dwCharacter & NCCF_NOTIFY_DISCONNECTED) + { + /* check notify item */ + SendDlgItemMessageW(hwndDlg, IDC_NOTIFYNOCONNECTION, BM_SETCHECK, BST_CHECKED, 0); + } + InitializeLANPropertiesUIDlg(hwndDlg); + return TRUE; + } + return FALSE; +} + + +HRESULT +ShowLANConnectionPropertyDialog(NETCON_PROPERTIES * pProperties) +{ + UINT ResourceId[1] = { IDD_NETPROPERTIES }; + DLGPROC Dlgs[1] = {LANPropertiesUIDlg}; + INITCOMMONCONTROLSEX ic; + + + ic.dwSize = sizeof(INITCOMMONCONTROLSEX); + ic.dwICC = ICC_LISTVIEW_CLASSES; + InitCommonControlsEx(&ic); + + return LaunchUIDlg(ResourceId, Dlgs, 1, pProperties); +} + +INT_PTR +CALLBACK +LANStatusUIDlg( + HWND hwndDlg, + UINT uMsg, + WPARAM wParam, + LPARAM lParam +) +{ + NETCON_PROPERTIES * pProperties = (NETCON_PROPERTIES*)GetWindowLongPtr(hwndDlg, DWLP_USER); + switch(uMsg) + { + case WM_INITDIALOG: + pProperties = (NETCON_PROPERTIES*)lParam; + return TRUE; + } + return FALSE; +} + + +HRESULT +ShowLANConnectionStatusDialog(NETCON_PROPERTIES * pProperties) +{ + UINT ResourceId[1] = { IDD_NETSTATUS }; + DLGPROC Dlgs[1] = {LANStatusUIDlg}; + return LaunchUIDlg(ResourceId, Dlgs, 1, pProperties); +} + +static +HRESULT +WINAPI +INetConnectionPropertyUi_fnQueryInterface( + INetConnectionPropertyUi * iface, + REFIID iid, + LPVOID * ppvObj) +{ + INetConnectionPropertyUiImpl * This = (INetConnectionPropertyUiImpl*)iface; + *ppvObj = NULL; + + if (IsEqualIID (iid, &IID_IUnknown) || + IsEqualIID (iid, &IID_INetConnectionPropertyUi)) + { + *ppvObj = This; + IUnknown_AddRef(iface); + return S_OK; + } + + return E_NOINTERFACE; +} + +static +ULONG +WINAPI +INetConnectionPropertyUi_fnAddRef( + INetConnectionPropertyUi * iface) +{ + INetConnectionPropertyUiImpl * This = (INetConnectionPropertyUiImpl*)iface; + ULONG refCount = InterlockedIncrement(&This->ref); + + return refCount; +} + +static +ULONG +WINAPI +INetConnectionPropertyUi_fnRelease( + INetConnectionPropertyUi * iface) +{ + INetConnectionPropertyUiImpl * This = (INetConnectionPropertyUiImpl*)iface; + ULONG refCount = InterlockedDecrement(&This->ref); + + if (!refCount) + { + CoTaskMemFree (This); + } + return refCount; +} + +static +HRESULT +WINAPI +INetConnectionPropertyUi_fnSetConnection( + INetConnectionPropertyUi * iface, + INetConnection *pCon) +{ + INetConnectionPropertyUiImpl * This = (INetConnectionPropertyUiImpl*)iface; + + if (!pCon) + return E_POINTER; + + if (This->pCon) + INetConnection_Release(This->pCon); + + This->pCon = pCon; + INetConnection_AddRef(This->pCon); + return S_OK; +} + +static +HRESULT +WINAPI +INetConnectionPropertyUi_fnAddPages( + INetConnectionPropertyUi * iface, + HWND hwndParent, + LPFNADDPROPSHEETPAGE pfnAddPage, + LPARAM lParam) +{ + HPROPSHEETPAGE hProp; + NETCON_PROPERTIES * pProperties; + BOOL ret; + HRESULT hr; + INITCOMMONCONTROLSEX initEx; + INetConnectionPropertyUiImpl * This = (INetConnectionPropertyUiImpl*)iface; + + + initEx.dwSize = sizeof(initEx); + initEx.dwICC = ICC_LISTVIEW_CLASSES; + + + if(!InitCommonControlsEx(&initEx)) + return E_FAIL; + + + + hr = INetConnection_GetProperties(This->pCon, &pProperties); + if (FAILED(hr)) + return hr; + + hProp = InitializePropertySheetPage(MAKEINTRESOURCEW(IDD_NETPROPERTIES), LANPropertiesUIDlg, (LPARAM)pProperties, pProperties->pszwName); + if (hProp) + { + ret = (*pfnAddPage)(hProp, lParam); + if (ret) + { + return NOERROR; + } + DestroyPropertySheetPage(hProp); + } + return E_FAIL; +} + +static const INetConnectionPropertyUiVtbl vt_NetConnectionPropertyUi = +{ + INetConnectionPropertyUi_fnQueryInterface, + INetConnectionPropertyUi_fnAddRef, + INetConnectionPropertyUi_fnRelease, + INetConnectionPropertyUi_fnSetConnection, + INetConnectionPropertyUi_fnAddPages, +}; + +HRESULT WINAPI LanConnectUI_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv) +{ + INetConnectionPropertyUiImpl * This; + + if (!ppv) + return E_POINTER; + + if (pUnkOuter) + return CLASS_E_NOAGGREGATION; + + This = (INetConnectionPropertyUiImpl *) CoTaskMemAlloc(sizeof (INetConnectionPropertyUiImpl)); + if (!This) + return E_OUTOFMEMORY; + + This->ref = 1; + This->pCon = NULL; + This->lpVtbl = (INetConnectionPropertyUi*)&vt_NetConnectionPropertyUi; + + if (!SUCCEEDED (INetConnectionPropertyUi_fnQueryInterface ((INetConnectionPropertyUi*)This, riid, ppv))) + { + IUnknown_Release((IUnknown*)This); + return E_NOINTERFACE; + } + + IUnknown_Release((IUnknown*)This); + return S_OK; +}
Propchange: trunk/reactos/dll/win32/netshell/lanconnectui.c ------------------------------------------------------------------------------ svn:eol-style = native
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] Fri Aug 29 09:18:55 2008 @@ -1,4 +1,49 @@ LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL + +IDD_NETPROPERTIES DIALOGEX DISCARDABLE 0, 0, 246, 246 +STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION +CAPTION "Allgemein" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Verbindung herstellen über:", -1, 9,9,217,8 + EDITTEXT IDC_NETCARDNAME, 9, 21, 230, 12, WS_BORDER | WS_DISABLED | WS_TABSTOP + PUSHBUTTON "&Konfigurieren", IDC_CONFIGURE, 189, 38, 50, 14 + LTEXT "Diese &Verbindung verwendet folgende Elemente:", -1, 9, 59, 217, 8 + CONTROL "List3", IDC_COMPONENTSLIST, "SysListView32", LVS_REPORT | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP, 9, 71, 230, 55 + PUSHBUTTON "&Installieren", IDC_INSTALL, 9, 130, 65, 14, WS_DISABLED | WS_TABSTOP + PUSHBUTTON "&Deinstallieren", IDC_UNINSTALL, 90, 130, 65, 14, WS_DISABLED | WS_TABSTOP + PUSHBUTTON "&Eigenschaften", IDC_PROPERTIES, 174, 130, 65, 14 + GROUPBOX "Beschreibung", -1, 9, 153, 230, 46, BS_GROUPBOX + LTEXT "Hier wird die Beschreibung des Elementes stehen....", IDC_DESCRIPTION, 15, 165, 217, 28, WS_GROUP + CHECKBOX "&Symbol bei Verbindung im Infobereich anzeigen", IDC_SHOWTASKBAR, 9, 206, 230, 12, BS_AUTOCHECKBOX | WS_TABSTOP + 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 +CAPTION "Allgemein" +FONT 8, "MS Shell Dlg" +BEGIN + GROUPBOX "Allgemein", -1, 9, 8, 182, 58, BS_GROUPBOX + LTEXT "Status:", -1, 19, 20, 60, 8 + LTEXT "Dauer:", -1, 19, 34, 60, 8 + LTEXT "Übertragungsrate:", -1, 19, 48, 60, 8 + GROUPBOX "Aktivität", -1, 9, 74, 182, 70, BS_GROUPBOX + RTEXT "Gesendet", -1, 26, 90, 60, 8 + ICON IDI_HORIZONTAL, -1, 90, 85, 18, 20 + ICON IDI_NETSTAT, -1, 110, 85, 18, 20 + ICON IDI_HORIZONTAL, -1, 130, 85, 18, 20 + LTEXT "Empfangen", -1, 149, 90, 37, 8 + LTEXT "Bytes:", -1, 17, 115, 32, 8 + RTEXT "000.000.000", IDC_SEND, 63, 115, 44, 8 + ICON IDI_VERTICAL, -1, 110, 108, 18, 20 + RTEXT "000.000.000", IDC_RECEIVED, 139, 115, 44, 8 + PUSHBUTTON "E&igenschaften", IDC_STATUS_PROPERTIES, 10, 150, 50, 14 + PUSHBUTTON "&Deaktivieren", IDC_ENDISABLE, 66, 150, 50, 14 + RTEXT "",IDC_STATUS,83,20,98,8 + RTEXT "",IDC_DURATION,83,34,98,8 + RTEXT "",IDC_SPEED,83,48,98,8 +END
STRINGTABLE DISCARDABLE
Modified: trunk/reactos/dll/win32/netshell/lang/en-US.rc URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netshell/lang/en-... ============================================================================== --- trunk/reactos/dll/win32/netshell/lang/en-US.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/netshell/lang/en-US.rc [iso-8859-1] Fri Aug 29 09:18:55 2008 @@ -1,4 +1,50 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +IDD_NETPROPERTIES DIALOGEX DISCARDABLE 0, 0, 246, 246 +STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION +CAPTION "General" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Connect Using:", -1, 9,9,217,8 + EDITTEXT IDC_NETCARDNAME, 9, 21, 230, 12, WS_BORDER | WS_DISABLED | WS_TABSTOP + PUSHBUTTON "&Configure", IDC_CONFIGURE, 189, 38, 50, 14 + LTEXT "Components checked are used by this connection:", -1, 9, 59, 217, 8 + CONTROL "", IDC_COMPONENTSLIST, "SysListView32", LVS_LIST | LVS_SHAREIMAGELISTS | WS_BORDER | WS_TABSTOP, 9, 71, 230, 55 + PUSHBUTTON "&Install", IDC_INSTALL, 9, 130, 65, 14, WS_DISABLED | WS_TABSTOP + PUSHBUTTON "&Uninstall", IDC_UNINSTALL, 90, 130, 65, 14, WS_DISABLED | WS_TABSTOP + PUSHBUTTON "&Properties", IDC_PROPERTIES, 174, 130, 65, 14 + GROUPBOX "Description", -1, 9, 153, 230, 46, BS_GROUPBOX + LTEXT "Component Description goes here...", IDC_DESCRIPTION, 15, 165, 217, 28, WS_GROUP + CHECKBOX "Show Icon in taskbar when connected", IDC_SHOWTASKBAR, 9, 206, 230, 12, BS_AUTOCHECKBOX | WS_TABSTOP + CHECKBOX "Notify me when this connection has limited or no connectivity", IDC_NOTIFYNOCONNECTION, 9, 220, 230, 12, BS_AUTOCHECKBOX | WS_TABSTOP +END + +IDD_NETSTATUS DIALOGEX DISCARDABLE 0, 0, 200,180 +STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION +CAPTION "General" +FONT 8, "MS Shell Dlg" +BEGIN + GROUPBOX "Connection", -1, 9, 8, 182, 58, BS_GROUPBOX + LTEXT "Status:", -1, 19, 20, 60, 8 + LTEXT "Duration:", -1, 19, 34, 60, 8 + LTEXT "Speed:", -1, 19, 48, 60, 8 + GROUPBOX "Activity", -1, 9, 74, 182, 70, BS_GROUPBOX + RTEXT "Sent", -1, 26, 90, 60, 8 + ICON IDI_HORIZONTAL, -1, 90, 85, 18, 20 + ICON IDI_NETSTAT, -1, 110, 85, 18, 20 + ICON IDI_HORIZONTAL, -1, 130, 85, 18, 20 + LTEXT "Received", -1, 149, 90, 37, 8 + LTEXT "Bytes:", -1, 17, 115, 32, 8 + RTEXT "000.000.000", IDC_SEND, 63, 115, 44, 8 + ICON IDI_VERTICAL, -1, 110, 108, 18, 20 + RTEXT "000.000.000", IDC_RECEIVED, 139, 115, 44, 8 + PUSHBUTTON "&Properties", IDC_STATUS_PROPERTIES, 10, 150, 50, 14 + PUSHBUTTON "&Disable", IDC_ENDISABLE, 66, 150, 50, 14 + RTEXT "",IDC_STATUS,83,20,98,8 + RTEXT "",IDC_DURATION,83,34,98,8 + RTEXT "",IDC_SPEED,83,48,98,8 +END +
STRINGTABLE DISCARDABLE BEGIN
Modified: trunk/reactos/dll/win32/netshell/netshell.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netshell/netshell... ============================================================================== --- trunk/reactos/dll/win32/netshell/netshell.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/netshell/netshell.c [iso-8859-1] Fri Aug 29 09:18:55 2008 @@ -1,9 +1,12 @@ #include "precomp.h"
HINSTANCE netshell_hInstance; +const GUID CLSID_LANConnectUI = {0x7007ACC5, 0x3202, 0x11D1, {0xAA, 0xD2, 0x00, 0x80, 0x5F, 0xC1, 0x27, 0x0E}}; const GUID CLSID_NetworkConnections = {0x7007ACC7, 0x3202, 0x11D1, {0xAA, 0xD2, 0x00, 0x80, 0x5F, 0xC1, 0x27, 0x0E}}; const GUID GUID_DEVCLASS_NET = {0x4d36e972, 0xe325, 0x11ce, {0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18}}; + static const WCHAR szNetConnectClass[] = L"CLSID\{7007ACC7-3202-11D1-AAD2-00805FC1270E}"; +static const WCHAR szLanConnectUI[] = L"CLSID\{7007ACC5-3202-11D1-AA-D200805FC1270E}"; static const WCHAR szNamespaceKey[] = L"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel\NameSpace\{7007ACC7-3202-11D1-AAD2-00805FC1270E}";
static INTERFACE_TABLE InterfaceTable[] = @@ -15,6 +18,10 @@ { &CLSID_ConnectionManager, INetConnectionManager_Constructor + }, + { + &CLSID_LANConnectUI, + LanConnectUI_Constructor }, { NULL, @@ -51,7 +58,7 @@ DllRegisterServer(void) { HKEY hKey, hSubKey; - WCHAR szName[MAX_PATH] = {0}; + WCHAR szName[MAX_PATH+20] = {0}; WCHAR szNet[20]; UINT Length, Offset;
@@ -71,7 +78,7 @@ }
Length = swprintf(szNet, L",-%u", IDS_NETWORKCONNECTION); - Offset = GetModuleFileNameW(netshell_hInstance, &szName[1], MAX_PATH); + Offset = GetModuleFileNameW(netshell_hInstance, &szName[1], (sizeof(szName)/sizeof(WCHAR))-1); if (Offset + Length + 2 < MAX_PATH) { /* set localized name */ @@ -100,6 +107,7 @@ RegSetValueExW(hSubKey, L"Attributes",0, REG_BINARY, (const LPBYTE)&dwAttributes, sizeof(DWORD)); }
+ RegCloseKey(hKey); return S_OK; }
@@ -146,3 +154,12 @@
return hres; } + +VOID +STDCALL +NcFreeNetconProperties (NETCON_PROPERTIES* pProps) +{ + CoTaskMemFree(pProps->pszwName); + CoTaskMemFree(pProps->pszwDeviceName); + CoTaskMemFree(pProps); +}
Modified: trunk/reactos/dll/win32/netshell/netshell.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netshell/netshell... ============================================================================== --- trunk/reactos/dll/win32/netshell/netshell.rbuild [iso-8859-1] (original) +++ trunk/reactos/dll/win32/netshell/netshell.rbuild [iso-8859-1] Fri Aug 29 09:18:55 2008 @@ -17,6 +17,7 @@ <library>uuid</library> <library>advapi32</library> <library>setupapi</library> + <library>comctl32</library> <pch>precomp.h</pch> <file>netshell.c</file> <file>shfldr_netconnect.c</file> @@ -25,4 +26,5 @@ <file>classfactory.c</file> <file>connectmanager.c</file> <file>netshell.spec</file> + <file>lanconnectui.c</file> </module>
Modified: trunk/reactos/dll/win32/netshell/netshell.rc URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netshell/netshell... ============================================================================== --- trunk/reactos/dll/win32/netshell/netshell.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/netshell/netshell.rc [iso-8859-1] Fri Aug 29 09:18:55 2008 @@ -4,6 +4,17 @@
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+ +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "W32 subsystem kernel\0" +#define REACTOS_STR_INTERNAL_NAME "netshell.dll\0" +#define REACTOS_STR_ORIGINAL_FILENAME "netshell.dll\0" +#define REACTOS_STR_PRODUCT_VERSION "5.1.2600.3264\0" +#define REACTOS_STR_FILE_VERSION "5.1.2600.3264\0" + +#include <reactos/version.rc> + + IDI_SHELL_NETWORK_FOLDER ICON "res/netshell.ico"
#include "lang/de-DE.rc"
Modified: trunk/reactos/dll/win32/netshell/netshell.spec URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netshell/netshell... ============================================================================== --- trunk/reactos/dll/win32/netshell/netshell.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/netshell/netshell.spec [iso-8859-1] Fri Aug 29 09:18:55 2008 @@ -20,7 +20,7 @@ 19 stub HrRenameConnection 20 stub HrRunWizard 21 stub InvokeDunFile -22 stub NcFreeNetconProperties +22 stdcall NcFreeNetconProperties(ptr) 23 stub NcIsValidConnectionName 24 stub NetSetupAddRasConnection 25 stub NetSetupFinishInstall
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] Fri Aug 29 09:18:55 2008 @@ -38,6 +38,17 @@ #include "wine/unicode.h" #include "resource.h"
+#define NCF_VIRTUAL 0x1 +#define NCF_SOFTWARE_ENUMERATED 0x2 +#define NCF_PHYSICAL 0x4 +#define NCF_HIDDEN 0x8 +#define NCF_NO_SERVICE 0x10 +#define NCF_NOT_USER_REMOVABLE 0x20 +#define NCF_MULTIPORT_INSTANCED_ADAPTER 0x40 +#define NCF_HAS_UI 0x80 +#define NCF_FILTER 0x400 +#define NCF_NDIS_PROTOCOL 0x4000 + typedef struct { int colnameid; int pcsFlags; @@ -60,6 +71,7 @@ /* globals */ extern HINSTANCE netshell_hInstance; extern const GUID CLSID_NetworkConnections; +extern const GUID CLSID_LANConnectUI; extern const GUID GUID_DEVCLASS_NET;
@@ -80,4 +92,10 @@ /* connectmanager.c */ HRESULT WINAPI INetConnectionManager_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
+/* lanconnectui.c */ +HRESULT WINAPI LanConnectUI_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv); +HRESULT ShowLANConnectionStatusDialog(NETCON_PROPERTIES * pProperties); + +#define NCCF_NOTIFY_DISCONNECTED 0x100000 + #endif
Modified: trunk/reactos/dll/win32/netshell/resource.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netshell/resource... ============================================================================== --- trunk/reactos/dll/win32/netshell/resource.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/netshell/resource.h [iso-8859-1] Fri Aug 29 09:18:55 2008 @@ -2,15 +2,32 @@ /* icons */
#define IDI_SHELL_NETWORK_FOLDER 100 - +#define IDI_HORIZONTAL 101 +#define IDI_NETSTAT 102 +#define IDI_VERTICAL 103
/* dialogs */ - - - - +#define IDD_NETPROPERTIES 400 +#define IDD_NETSTATUS 401
/* dialog controls */ +#define IDC_NETCARDNAME 1000 +#define IDC_CONFIGURE 1001 +#define IDC_COMPONENTSLIST 2800 +#define IDC_INSTALL 1003 +#define IDC_UNINSTALL 1004 +#define IDC_PROPERTIES 1005 +#define IDC_DESCRIPTION 1006 +#define IDC_SHOWTASKBAR 1007 +#define IDC_NOTIFYNOCONNECTION 1008 + +#define IDC_SEND 1100 +#define IDC_RECEIVED 1101 +#define IDC_STATUS_PROPERTIES 1102 +#define IDC_ENDISABLE 1103 +#define IDC_STATUS 1104 +#define IDC_DURATION 1105 +#define IDC_SPEED 1106
/* resource constants */
Modified: trunk/reactos/dll/win32/netshell/shfldr_netconnect.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netshell/shfldr_n... ============================================================================== --- trunk/reactos/dll/win32/netshell/shfldr_netconnect.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/netshell/shfldr_netconnect.c [iso-8859-1] Fri Aug 29 09:18:55 2008 @@ -21,6 +21,8 @@ #include <precomp.h>
WINE_DEFAULT_DEBUG_CHANNEL (shell); + +#define MAX_PROPERTY_SHEET_PAGE (10)
/*********************************************************************** * IShellFolder implementation @@ -732,6 +734,19 @@ return MAKE_HRESULT(SEVERITY_SUCCESS, 0, 9); }
+BOOL +CALLBACK +PropSheetExCallback(HPROPSHEETPAGE hPage, LPARAM lParam) +{ + PROPSHEETHEADERW *pinfo = (PROPSHEETHEADERW *)lParam; + + if (pinfo->nPages < MAX_PROPERTY_SHEET_PAGE) + { + pinfo->u3.phpage[pinfo->nPages++] = hPage; + return TRUE; + } + return FALSE; +}
/************************************************************************** * ISF_NetConnect_IContextMenu_InvokeCommand() @@ -740,7 +755,61 @@ IContextMenu2 *iface, LPCMINVOKECOMMANDINFO lpcmi) { - //IGenericSFImpl * This = impl_from_IContextMenu2(iface); + 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)) + { + if (pProperties->MediaType == NCM_LAN) + { + hr = ShowLANConnectionStatusDialog(pProperties); + NcFreeNetconProperties(pProperties); + } + 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, 0, &IID_INetConnectionPropertyUi, (LPVOID)&pNCP); + if (SUCCEEDED(hr)) + { + hr = INetConnectionPropertyUi_SetConnection(pNCP, val->pItem); + if (SUCCEEDED(hr)) + { + memset(&pinfo, 0x0, sizeof(PROPSHEETHEADERW)); + pinfo.dwSize = sizeof(PROPSHEETHEADERW); + pinfo.dwFlags = PSH_NOCONTEXTHELP | PSH_PROPTITLE; + pinfo.u3.phpage = hppages; + pinfo.pszCaption = pProperties->pszwName; + + hr = INetConnectionPropertyUi_AddPages(pNCP, lpcmi->hwnd, PropSheetExCallback, (LPARAM)&pinfo); + if (SUCCEEDED(hr)) + { + if(PropertySheetW(&pinfo) < 0) + hr = E_FAIL; + } + } + } + } + NcFreeNetconProperties(pProperties); + return hr; + }
return S_OK; }