mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 05:52:56 +00:00
improved network control panel
more registry keys for the network configuration preliminary TCPIP property sheet svn path=/trunk/; revision=10551
This commit is contained in:
parent
1bf0775833
commit
e16725fbe4
6 changed files with 301 additions and 19 deletions
|
@ -69,6 +69,18 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E974-E325-11CE-BFC1-08002BE1
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E974-E325-11CE-BFC1-08002BE10318}","Class",0x00000000,"NetService"
|
HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E974-E325-11CE-BFC1-08002BE10318}","Class",0x00000000,"NetService"
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}",,0x00000000,"Network Protocol"
|
HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}",,0x00000000,"Network Protocol"
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}","Class",0x00000000,"NetTrans"
|
HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}","Class",0x00000000,"NetTrans"
|
||||||
|
; The following entries should be generated from .inf files during installation
|
||||||
|
; TCPIP Protocol
|
||||||
|
HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}\{RandomProtocolGUID_TCPIP}","Characteristics",0x00010001,0x00000080
|
||||||
|
HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}\{RandomProtocolGUID_TCPIP}","ComponentId",0x00000000,"ms_tcpip"
|
||||||
|
HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}\{RandomProtocolGUID_TCPIP}","Description",0x00000000,"Internet Protocol (TCP/IP)"
|
||||||
|
HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}\{RandomProtocolGUID_TCPIP}","InfPath",0x00000000,"BUGBUG_Create from Inffile.inf"
|
||||||
|
HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}\{RandomProtocolGUID_TCPIP}","InfSection",0x00000000,"BUGBUG_Create from Inffile.inf"
|
||||||
|
HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}\{RandomProtocolGUID_TCPIP}\Ndi","ClsId",0x00000000,"{A907657F-6FDF-11D0-8EFB-00C04FD912B2}"
|
||||||
|
HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}\{RandomProtocolGUID_TCPIP}\Ndi","HelpText",0x00000000,"Transmission Control Protocol/Internet Protocol"
|
||||||
|
HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}\{RandomProtocolGUID_TCPIP}\Ndi","Service",0x00000000,"Tcpip"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; NLS Files
|
; NLS Files
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","10000",0x00000000,"c_10000.nls"
|
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","10000",0x00000000,"c_10000.nls"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# $Id: Makefile,v 1.1 2004/07/18 22:37:07 kuehng Exp $
|
# $Id: Makefile,v 1.2 2004/08/15 16:50:30 kuehng Exp $
|
||||||
|
|
||||||
PATH_TO_TOP = ../../..
|
PATH_TO_TOP = ../../..
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ TARGET_PCH =
|
||||||
|
|
||||||
TARGET_CLEAN =
|
TARGET_CLEAN =
|
||||||
|
|
||||||
TARGET_OBJECTS = ncpa.o
|
TARGET_OBJECTS = ncpa.o tcpip_properties.o
|
||||||
|
|
||||||
DEP_OBJECTS = $(TARGET_OBJECTS)
|
DEP_OBJECTS = $(TARGET_OBJECTS)
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
/* $Id: ncpa.c,v 1.1 2004/07/18 22:37:07 kuehng Exp $
|
/* $Id: ncpa.c,v 1.2 2004/08/15 16:50:30 kuehng Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS Network Control Panel
|
* PROJECT: ReactOS Network Control Panel
|
||||||
* FILE: lib/cpl/system/ncpa.c
|
* FILE: lib/cpl/system/ncpa.c
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <iphlpapi.h>
|
||||||
#ifdef __REACTOS__
|
#ifdef __REACTOS__
|
||||||
//#include <Netcfgn.h>
|
//#include <Netcfgn.h>
|
||||||
#else
|
#else
|
||||||
|
@ -93,7 +93,9 @@ void EnumRegKeys(ENUMREGKEYCALLBACK *pCallback,void *pCookie,HKEY hBaseKey,TCHAR
|
||||||
ret = RegEnumKeyEx(hKey,i,tpszName,&dwNameLen,NULL,NULL,NULL,NULL);
|
ret = RegEnumKeyEx(hKey,i,tpszName,&dwNameLen,NULL,NULL,NULL,NULL);
|
||||||
if(ret != ERROR_SUCCESS)
|
if(ret != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
OutputDebugString(_T("EnumRegKeys: RegEnumKeyEx failed\r\n"));
|
OutputDebugString(_T("EnumRegKeys: RegEnumKeyEx failed for\r\n"));
|
||||||
|
OutputDebugString(tpszName);
|
||||||
|
OutputDebugString(_T("\r\n"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +130,7 @@ void InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc,LPARAM lP
|
||||||
|
|
||||||
LONG CALLBACK DisplayApplet(VOID);
|
LONG CALLBACK DisplayApplet(VOID);
|
||||||
BOOL CALLBACK NetworkPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
BOOL CALLBACK NetworkPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
//void DisplayTCPIPProperties(HWND hParent,IP_ADAPTER_INFO *pInfo);
|
void DisplayTCPIPProperties(HWND hParent,IP_ADAPTER_INFO *pInfo);
|
||||||
|
|
||||||
HINSTANCE hApplet = 0;
|
HINSTANCE hApplet = 0;
|
||||||
|
|
||||||
|
@ -155,6 +157,7 @@ BOOL FindNICClassKeyForCfgInstance(TCHAR *tpszCfgInst,TCHAR *tpszSubKeyOut)
|
||||||
if(RegOpenKey(HKEY_LOCAL_MACHINE,tpszSubKey,&hKey)!=ERROR_SUCCESS)
|
if(RegOpenKey(HKEY_LOCAL_MACHINE,tpszSubKey,&hKey)!=ERROR_SUCCESS)
|
||||||
continue;
|
continue;
|
||||||
dwType = REG_SZ;
|
dwType = REG_SZ;
|
||||||
|
dwSize = sizeof(tpszCfgInst2);
|
||||||
if(RegQueryValueEx(hKey,_T("NetCfgInstanceId"),NULL,&dwType,(BYTE*)tpszCfgInst2,&dwSize)!=ERROR_SUCCESS) {
|
if(RegQueryValueEx(hKey,_T("NetCfgInstanceId"),NULL,&dwType,(BYTE*)tpszCfgInst2,&dwSize)!=ERROR_SUCCESS) {
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
continue;
|
continue;
|
||||||
|
@ -177,6 +180,8 @@ void NICPropertyProtocolCallback(void *pCookie,HKEY hBaseKey,TCHAR *tpszSubKey)
|
||||||
DWORD dwType,dwSize;
|
DWORD dwType,dwSize;
|
||||||
TCHAR tpszDescription[MAX_PATH];
|
TCHAR tpszDescription[MAX_PATH];
|
||||||
TCHAR tpszNotifyObjectCLSID[MAX_PATH];
|
TCHAR tpszNotifyObjectCLSID[MAX_PATH];
|
||||||
|
TCHAR *tpszSubKeyCopy;
|
||||||
|
int nIndex;
|
||||||
// CLSID CLSID_NotifObj;
|
// CLSID CLSID_NotifObj;
|
||||||
// IUnknown *pUnk = NULL;
|
// IUnknown *pUnk = NULL;
|
||||||
// INetCfgComponentControl *pNetCfg;
|
// INetCfgComponentControl *pNetCfg;
|
||||||
|
@ -207,7 +212,7 @@ void NICPropertyProtocolCallback(void *pCookie,HKEY hBaseKey,TCHAR *tpszSubKey)
|
||||||
RegCloseKey(hNDIKey);
|
RegCloseKey(hNDIKey);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Thise code works on Windows... but not on Reactos
|
// This code works on Windows... but not on Reactos
|
||||||
//
|
//
|
||||||
|
|
||||||
// CLSIDFromString(tpszNotifyObjectCLSID,&CLSID_NotifObj);
|
// CLSIDFromString(tpszNotifyObjectCLSID,&CLSID_NotifObj);
|
||||||
|
@ -228,7 +233,9 @@ void NICPropertyProtocolCallback(void *pCookie,HKEY hBaseKey,TCHAR *tpszSubKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
SendDlgItemMessage(hwndDlg,IDC_COMPONENTSLIST,LB_ADDSTRING,0,(LPARAM)tpszDescription);
|
nIndex = SendDlgItemMessage(hwndDlg,IDC_COMPONENTSLIST,LB_ADDSTRING,0,(LPARAM)tpszDescription);
|
||||||
|
tpszSubKeyCopy = _tcsdup(tpszSubKey);
|
||||||
|
SendDlgItemMessage(hwndDlg,IDC_COMPONENTSLIST,LB_SETITEMDATA,nIndex,(LPARAM)tpszSubKeyCopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -248,7 +255,10 @@ BOOL CALLBACK NICPropertyPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
pPage = (PROPSHEETPAGE *)lParam;
|
pPage = (PROPSHEETPAGE *)lParam;
|
||||||
tpszCfgInstanceID = (TCHAR*)pPage->lParam;
|
tpszCfgInstanceID = (TCHAR*)pPage->lParam;
|
||||||
if(!FindNICClassKeyForCfgInstance(tpszCfgInstanceID,tpszSubKey))
|
if(!FindNICClassKeyForCfgInstance(tpszCfgInstanceID,tpszSubKey))
|
||||||
|
{
|
||||||
MessageBox(hwndDlg,_T("NIC Entry not found"),_T("Registry error"),MB_ICONSTOP);
|
MessageBox(hwndDlg,_T("NIC Entry not found"),_T("Registry error"),MB_ICONSTOP);
|
||||||
|
MessageBox(hwndDlg,tpszCfgInstanceID,tpszSubKey,MB_ICONSTOP);
|
||||||
|
}
|
||||||
|
|
||||||
if(RegOpenKey(HKEY_LOCAL_MACHINE,tpszSubKey,&hKey)!=ERROR_SUCCESS)
|
if(RegOpenKey(HKEY_LOCAL_MACHINE,tpszSubKey,&hKey)!=ERROR_SUCCESS)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -272,12 +282,92 @@ BOOL CALLBACK NICPropertyPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
switch(LOWORD(wParam))
|
switch(LOWORD(wParam))
|
||||||
{
|
{
|
||||||
case IDC_COMPONENTSLIST:
|
case IDC_COMPONENTSLIST:
|
||||||
|
if(HIWORD(wParam)==LBN_SELCHANGE)
|
||||||
|
{
|
||||||
|
TCHAR *tpszSubKey;
|
||||||
|
TCHAR tpszHelpKey[MAX_PATH];
|
||||||
|
TCHAR tpszHelpText[MAX_PATH];
|
||||||
|
HKEY hNDIKey;
|
||||||
|
DWORD dwType,dwSize;
|
||||||
|
HWND hListBox = GetDlgItem(hwndDlg,IDC_COMPONENTSLIST);
|
||||||
|
tpszSubKey = (TCHAR*)SendMessage(hListBox,LB_GETITEMDATA,SendMessage(hListBox,LB_GETCURSEL,0,0),0);
|
||||||
|
if(!tpszSubKey)
|
||||||
|
break;
|
||||||
|
_stprintf(tpszHelpKey,_T("%s\\Ndi"),tpszSubKey);
|
||||||
|
|
||||||
|
RegOpenKey(HKEY_LOCAL_MACHINE,tpszHelpKey,&hNDIKey);
|
||||||
|
dwType = REG_SZ;
|
||||||
|
dwSize = sizeof(tpszHelpText);
|
||||||
|
if(RegQueryValueEx(hNDIKey,_T("HelpText"),NULL,&dwType,(BYTE*)tpszHelpText,&dwSize)!= ERROR_SUCCESS)
|
||||||
|
;//return;
|
||||||
|
RegCloseKey(hNDIKey);
|
||||||
|
|
||||||
|
SetDlgItemText(hwndDlg,IDC_DESCRIPTION,tpszHelpText);
|
||||||
|
|
||||||
|
}
|
||||||
if(HIWORD(wParam)!=LBN_DBLCLK)
|
if(HIWORD(wParam)!=LBN_DBLCLK)
|
||||||
break;
|
break;
|
||||||
// drop though
|
// drop though
|
||||||
case IDC_PROPERTIES:
|
case IDC_PROPERTIES:
|
||||||
MessageBox(NULL,_T("This control panel is incomplete.\r\nUsually, the \"Notify Object\" for this Network component should be invoked here. Reactos lacks the infrastructure to do this right now.\r\n- C++\r\n- DDK Headers for notify objects\r\n- clean header structure, that allow Windows-Compatible COM C++ Code"),_T("Error"),MB_ICONSTOP);
|
{
|
||||||
// DisplayTCPIPProperties(hwndDlg,&Info[pPage->lParam]);
|
TCHAR *tpszSubKey;
|
||||||
|
TCHAR tpszNDIKey[MAX_PATH];
|
||||||
|
TCHAR tpszClsIDText[MAX_PATH];
|
||||||
|
TCHAR *tpszTCPIPClsID = _T("{A907657F-6FDF-11D0-8EFB-00C04FD912B2}");
|
||||||
|
HKEY hNDIKey;
|
||||||
|
DWORD dwType,dwSize;
|
||||||
|
HWND hListBox = GetDlgItem(hwndDlg,IDC_COMPONENTSLIST);
|
||||||
|
tpszSubKey = (TCHAR*)SendMessage(hListBox,LB_GETITEMDATA,SendMessage(hListBox,LB_GETCURSEL,0,0),0);
|
||||||
|
if(!tpszSubKey)
|
||||||
|
break;
|
||||||
|
_stprintf(tpszNDIKey,_T("%s\\Ndi"),tpszSubKey);
|
||||||
|
|
||||||
|
RegOpenKey(HKEY_LOCAL_MACHINE,tpszNDIKey,&hNDIKey);
|
||||||
|
dwType = REG_SZ;
|
||||||
|
dwSize = sizeof(tpszClsIDText);
|
||||||
|
if(RegQueryValueEx(hNDIKey,_T("ClsId"),NULL,&dwType,(BYTE*)tpszClsIDText,&dwSize)!= ERROR_SUCCESS)
|
||||||
|
;//return;
|
||||||
|
RegCloseKey(hNDIKey);
|
||||||
|
|
||||||
|
if(_tcscmp(tpszTCPIPClsID,tpszClsIDText)==0)
|
||||||
|
{
|
||||||
|
IP_ADAPTER_INFO Adapters[64];
|
||||||
|
IP_ADAPTER_INFO *pAdapter;
|
||||||
|
TCHAR *tpszCfgInstanceID;
|
||||||
|
DWORD dwSize = sizeof(Adapters);
|
||||||
|
memset(&Adapters,0x00,sizeof(Adapters));
|
||||||
|
if(GetAdaptersInfo(Adapters,&dwSize)!=ERROR_SUCCESS)
|
||||||
|
break;;
|
||||||
|
pAdapter = Adapters;
|
||||||
|
tpszCfgInstanceID = (TCHAR*)pPage->lParam;
|
||||||
|
while(pAdapter)
|
||||||
|
{
|
||||||
|
TCHAR tpszAdatperName[MAX_PATH];
|
||||||
|
swprintf(tpszAdatperName,L"%S",pAdapter->AdapterName);
|
||||||
|
OutputDebugString(_T("IPHLPAPI returned:\r\n"));
|
||||||
|
OutputDebugString(tpszAdatperName);
|
||||||
|
OutputDebugString(_T("\r\n"));
|
||||||
|
if(_tcscmp(tpszAdatperName,tpszCfgInstanceID)==0)
|
||||||
|
{
|
||||||
|
DisplayTCPIPProperties(hwndDlg,pAdapter);
|
||||||
|
break;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
OutputDebugString(_T("... which is not the TCPIP property sheet\r\n"));
|
||||||
|
}
|
||||||
|
pAdapter = pAdapter->Next;
|
||||||
|
if(!pAdapter)
|
||||||
|
{
|
||||||
|
MessageBox(NULL,_T("If you see this, then the IPHLPAPI.DLL probably needs more work because GetAdaptersInfo did not return the expected data."),_T("Error"),MB_ICONSTOP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
MessageBox(NULL,_T("This control panel is incomplete.\r\nUsually, the \"Notify Object\" for this Network component should be invoked here. Reactos lacks the infrastructure to do this right now.\r\n- C++\r\n- DDK Headers for notify objects\r\n- clean header structure, that allow Windows-Compatible COM C++ Code"),_T("Error"),MB_ICONSTOP);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -302,7 +392,6 @@ void DisplayNICProperties(HWND hParent,TCHAR *tpszCfgInstanceID)
|
||||||
return;
|
return;
|
||||||
if(RegQueryValueEx(hKey,_T("Name"),NULL,&dwType,(BYTE*)tpszName,&dwSize)!=ERROR_SUCCESS)
|
if(RegQueryValueEx(hKey,_T("Name"),NULL,&dwType,(BYTE*)tpszName,&dwSize)!=ERROR_SUCCESS)
|
||||||
_stprintf(tpszName,_T("[ERROR]"));
|
_stprintf(tpszName,_T("[ERROR]"));
|
||||||
//_stprintf(tpszName,_T("[ERROR]") _T(__FILE__) _T(" %d"),__LINE__ );
|
|
||||||
else
|
else
|
||||||
_tcscat(tpszName,_T(" Properties"));
|
_tcscat(tpszName,_T(" Properties"));
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
|
@ -311,7 +400,7 @@ void DisplayNICProperties(HWND hParent,TCHAR *tpszCfgInstanceID)
|
||||||
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
|
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
|
||||||
psh.dwSize = sizeof(PROPSHEETHEADER);
|
psh.dwSize = sizeof(PROPSHEETHEADER);
|
||||||
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW;
|
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW;
|
||||||
psh.hwndParent = NULL;
|
psh.hwndParent = hParent;
|
||||||
psh.hInstance = hApplet;
|
psh.hInstance = hApplet;
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDI_CPLSYSTEM));
|
psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDI_CPLSYSTEM));
|
||||||
|
@ -388,7 +477,7 @@ void DisplayNICStatus(HWND hParent,TCHAR *tpszCfgInstanceID)
|
||||||
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
|
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
|
||||||
psh.dwSize = sizeof(PROPSHEETHEADER);
|
psh.dwSize = sizeof(PROPSHEETHEADER);
|
||||||
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW;
|
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW;
|
||||||
psh.hwndParent = NULL;
|
psh.hwndParent = hParent;
|
||||||
psh.hInstance = hApplet;
|
psh.hInstance = hApplet;
|
||||||
// FIX THESE REACTOS HEADERS !!!!!!!!!
|
// FIX THESE REACTOS HEADERS !!!!!!!!!
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef __CPL_APPWIZ_H
|
#ifndef __NCPA_H
|
||||||
#define __CPL_APPWIZ_H
|
#define __NCPA_H
|
||||||
|
|
||||||
typedef LONG (CALLBACK *CPLAPPLET_PROC)(VOID);
|
typedef LONG (CALLBACK *CPLAPPLET_PROC)(VOID);
|
||||||
|
|
||||||
|
@ -13,8 +13,8 @@ typedef struct
|
||||||
|
|
||||||
extern HINSTANCE hApplet;
|
extern HINSTANCE hApplet;
|
||||||
|
|
||||||
void ShowLastWin32Error(HWND hWndOwner);
|
|
||||||
|
|
||||||
#endif /* __CPL_APPWIZ_H */
|
|
||||||
|
#endif // __NCPA_H
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -72,8 +72,8 @@ BEGIN
|
||||||
PUSHBUTTON "&Install", IDC_INSTALL, 9, 130, 65, 14, WS_DISABLED | WS_TABSTOP
|
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 "&Uninstall", IDC_UNINSTALL, 90, 130, 65, 14, WS_DISABLED | WS_TABSTOP
|
||||||
PUSHBUTTON "&Properties", IDC_PROPERTIES, 174, 130, 65, 14
|
PUSHBUTTON "&Properties", IDC_PROPERTIES, 174, 130, 65, 14
|
||||||
GROUPBOX "Description", -1, 9, 153, 230, 46, BS_GROUPBOX | WS_DISABLED
|
GROUPBOX "Description", -1, 9, 153, 230, 46, BS_GROUPBOX
|
||||||
LTEXT "Component Description goes here...", IDC_DESCRIPTION, 15, 165, 217, 28, WS_DISABLED | WS_GROUP
|
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_DISABLED | WS_TABSTOP
|
CHECKBOX "Show Icon in taskbar when connected", IDC_SHOWTASKBAR, 9, 206, 230, 12, BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
181
reactos/lib/cpl/ncpa/tcpip_properties.c
Normal file
181
reactos/lib/cpl/ncpa/tcpip_properties.c
Normal file
|
@ -0,0 +1,181 @@
|
||||||
|
/*
|
||||||
|
* ReactOS
|
||||||
|
* Copyright (C) 2004 ReactOS Team
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
/* $Id: tcpip_properties.c,v 1.1 2004/08/15 16:50:30 kuehng Exp $
|
||||||
|
*
|
||||||
|
* PROJECT: ReactOS Network Control Panel
|
||||||
|
* FILE: lib/cpl/system/tcpip_properties.c
|
||||||
|
* PURPOSE: ReactOS Network Control Panel
|
||||||
|
* PROGRAMMER: Gero Kuehn (reactos.filter@gkware.com)
|
||||||
|
* UPDATE HISTORY:
|
||||||
|
* 08-15-2004 Created
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
#include <windows.h>
|
||||||
|
#include <iptypes.h>
|
||||||
|
#include <iphlpapi.h>
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#include <commctrl.h>
|
||||||
|
#include <cpl.h>
|
||||||
|
#else
|
||||||
|
|
||||||
|
// this is missing on reactos...
|
||||||
|
#ifndef IPM_SETADDRESS
|
||||||
|
#define IPM_SETADDRESS (WM_USER+101)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include "resource.h"
|
||||||
|
#include "ncpa.h"
|
||||||
|
|
||||||
|
extern void InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc);
|
||||||
|
|
||||||
|
BOOL CALLBACK TCPIPPropertyPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
PROPSHEETPAGE *pPage = (PROPSHEETPAGE *)GetWindowLong(hwndDlg,GWL_USERDATA);
|
||||||
|
IP_ADAPTER_INFO *pInfo = NULL;
|
||||||
|
if(pPage)
|
||||||
|
pInfo = (IP_ADAPTER_INFO *)pPage->lParam;
|
||||||
|
switch(uMsg)
|
||||||
|
{
|
||||||
|
case WM_INITDIALOG:
|
||||||
|
{
|
||||||
|
pPage = (PROPSHEETPAGE *)lParam;
|
||||||
|
pInfo = (IP_ADAPTER_INFO *)pPage->lParam;
|
||||||
|
EnableWindow(GetDlgItem(hwndDlg,IDC_ADVANCED),FALSE);
|
||||||
|
SetWindowLong(hwndDlg,GWL_USERDATA,pPage->lParam);
|
||||||
|
|
||||||
|
if(pInfo->DhcpEnabled) {
|
||||||
|
CheckDlgButton(hwndDlg,IDC_USEDHCP,BST_CHECKED);
|
||||||
|
CheckDlgButton(hwndDlg,IDC_NODHCP,BST_UNCHECKED);
|
||||||
|
} else {
|
||||||
|
CheckDlgButton(hwndDlg,IDC_USEDHCP,BST_UNCHECKED);
|
||||||
|
CheckDlgButton(hwndDlg,IDC_NODHCP,BST_CHECKED);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
DWORD dwIPAddr;
|
||||||
|
DWORD b[4];
|
||||||
|
IP_ADDR_STRING *pString;
|
||||||
|
pString = &pInfo->IpAddressList;
|
||||||
|
while(pString->Next)
|
||||||
|
pString = pString->Next;
|
||||||
|
sscanf(pString->IpAddress.String,"%d.%d.%d.%d",&b[0],&b[1],&b[2],&b[3]);
|
||||||
|
dwIPAddr = b[0]<<24|b[1]<<16|b[2]<<8|b[3];
|
||||||
|
SendDlgItemMessage(hwndDlg,IDC_IPADDR,IPM_SETADDRESS,0,dwIPAddr);
|
||||||
|
sscanf(pString->IpMask.String,"%d.%d.%d.%d",&b[0],&b[1],&b[2],&b[3]);
|
||||||
|
dwIPAddr = b[0]<<24|b[1]<<16|b[2]<<8|b[3];
|
||||||
|
SendDlgItemMessage(hwndDlg,IDC_SUBNETMASK,IPM_SETADDRESS,0,dwIPAddr);
|
||||||
|
|
||||||
|
pString = &pInfo->GatewayList;
|
||||||
|
while(pString->Next)
|
||||||
|
pString = pString->Next;
|
||||||
|
sscanf(pString->IpAddress.String,"%d.%d.%d.%d",&b[0],&b[1],&b[2],&b[3]);
|
||||||
|
dwIPAddr = b[0]<<24|b[1]<<16|b[2]<<8|b[3];
|
||||||
|
SendDlgItemMessage(hwndDlg,IDC_DEFGATEWAY,IPM_SETADDRESS,0,dwIPAddr);
|
||||||
|
|
||||||
|
}
|
||||||
|
{
|
||||||
|
TCHAR pszRegKey[MAX_PATH];
|
||||||
|
HKEY hKey;
|
||||||
|
_stprintf(pszRegKey,_T("SYSTEM\\CurrentControlSet\\Services\\TCPIP\\Parameters\\Interfaces\\%S"),pInfo->AdapterName);
|
||||||
|
if(RegOpenKey(HKEY_LOCAL_MACHINE,pszRegKey,&hKey)==ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
char pszDNS[MAX_PATH];
|
||||||
|
DWORD dwSize = sizeof(pszDNS);
|
||||||
|
DWORD dwType = REG_SZ;
|
||||||
|
DWORD b[2][4];
|
||||||
|
DWORD dwIPAddr;
|
||||||
|
RegQueryValueExA(hKey,"NameServer",NULL,&dwType,(BYTE*)pszDNS,&dwSize);
|
||||||
|
RegCloseKey(hKey);
|
||||||
|
|
||||||
|
sscanf(pszDNS,"%d.%d.%d.%d,%d.%d.%d.%d",&b[0][0],&b[0][1],&b[0][2],&b[0][3],&b[1][0],&b[1][1],&b[1][2],&b[1][3]);
|
||||||
|
dwIPAddr = b[0][0]<<24|b[0][1]<<16|b[0][2]<<8|b[0][3];
|
||||||
|
SendDlgItemMessage(hwndDlg,IDC_DNS1,IPM_SETADDRESS,0,dwIPAddr);
|
||||||
|
dwIPAddr = b[1][0]<<24|b[1][1]<<16|b[1][2]<<8|b[1][3];
|
||||||
|
SendDlgItemMessage(hwndDlg,IDC_DNS2,IPM_SETADDRESS,0,dwIPAddr);
|
||||||
|
CheckDlgButton(hwndDlg,IDC_FIXEDDNS,TRUE);
|
||||||
|
EnableWindow(GetDlgItem(hwndDlg,IDC_DNS1),FALSE);
|
||||||
|
EnableWindow(GetDlgItem(hwndDlg,IDC_DNS2),FALSE);
|
||||||
|
EnableWindow(GetDlgItem(hwndDlg,IDC_AUTODNS),FALSE);
|
||||||
|
EnableWindow(GetDlgItem(hwndDlg,IDC_FIXEDDNS),FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_COMMAND:
|
||||||
|
switch(LOWORD(wParam))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DisplayTCPIPProperties(HWND hParent,IP_ADAPTER_INFO *pInfo)
|
||||||
|
{
|
||||||
|
PROPSHEETPAGE psp[1];
|
||||||
|
PROPSHEETHEADER psh;
|
||||||
|
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
|
||||||
|
psh.dwSize = sizeof(PROPSHEETHEADER);
|
||||||
|
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW;
|
||||||
|
psh.hwndParent = hParent;
|
||||||
|
psh.hInstance = hApplet;
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDI_CPLSYSTEM));
|
||||||
|
#else
|
||||||
|
psh.u1.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDI_CPLSYSTEM));
|
||||||
|
#endif
|
||||||
|
psh.pszCaption = NULL;//Caption;
|
||||||
|
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
psh.nStartPage = 0;
|
||||||
|
psh.ppsp = psp;
|
||||||
|
#else
|
||||||
|
psh.u2.nStartPage = 0;
|
||||||
|
psh.u3.ppsp = psp;
|
||||||
|
#endif
|
||||||
|
psh.pfnCallback = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
InitPropSheetPage(&psp[0], IDD_TCPIPPROPERTIES, TCPIPPropertyPageProc);
|
||||||
|
psp[0].lParam = (LPARAM)pInfo;
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
{
|
||||||
|
INITCOMMONCONTROLSEX cce;
|
||||||
|
cce.dwSize = sizeof(cce);
|
||||||
|
cce.dwICC = ICC_INTERNET_CLASSES;
|
||||||
|
InitCommonControlsEx(&cce);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
InitCommonControls();
|
||||||
|
MessageBox(hParent,_T("If the following Messagebox does not work... fix the reactos #include hell and call the InitCommonControlsEx instead"),_T("Info"),MB_OK);
|
||||||
|
#endif
|
||||||
|
if(PropertySheet(&psh)==-1)
|
||||||
|
{
|
||||||
|
MessageBox(hParent,_T("Unable to create property sheet"),_T("Error"),MB_ICONSTOP);
|
||||||
|
};
|
||||||
|
return;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue