ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
October 2008
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
25 participants
517 discussions
Start a n
N
ew thread
[janderwald] 36790: * Convert ncpa to a simple wrapper which invokes netshell.dll IShellFolder * Delete obsolete code
by janderwald@svn.reactos.org
Author: janderwald Date: Fri Oct 17 08:19:04 2008 New Revision: 36790 URL:
http://svn.reactos.org/svn/reactos?rev=36790&view=rev
Log: * Convert ncpa to a simple wrapper which invokes netshell.dll IShellFolder * Delete obsolete code Removed: trunk/reactos/dll/cpl/ncpa/lang/ trunk/reactos/dll/cpl/ncpa/ncpa.h trunk/reactos/dll/cpl/ncpa/ncpa.rc trunk/reactos/dll/cpl/ncpa/resource.h trunk/reactos/dll/cpl/ncpa/resources/ trunk/reactos/dll/cpl/ncpa/rsrc.rc trunk/reactos/dll/cpl/ncpa/tcpip_properties.c Modified: trunk/reactos/dll/cpl/ncpa/ncpa.c trunk/reactos/dll/cpl/ncpa/ncpa.rbuild Modified: trunk/reactos/dll/cpl/ncpa/ncpa.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/ncpa/ncpa.c?rev=36…
============================================================================== --- trunk/reactos/dll/cpl/ncpa/ncpa.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/ncpa/ncpa.c [iso-8859-1] Fri Oct 17 08:19:04 2008 @@ -1,20 +1,3 @@ -/* - * Copyright 2004 Gero Kuehn - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ /* * PROJECT: ReactOS Network Control Panel * FILE: lib/cpl/system/ncpa.c @@ -24,1029 +7,25 @@ * 07-18-2004 Created */ -/* - * Read this first ! - * - * This file contains a first attempt for reactos network configuration - * - * - It is not complete. - * - It does not work the way it works on Windows. - * - * A lot of code that can be found here now, will probably be relocated into the OS core or some - * protocol Co-Installers or Notify Objects later when all the required COM - * and "netcfgx.dll" infrastructure (esp. headers and Interfaces) get implemented step by step. - * - * This code is only a first approach to provide a usable network configuration dialogs for - * the new network support in Reactos. - * - * If you intend to extend this code by more, please contact me to avoid duplicate work. - * There are already resources and code for TCP/IP configuration that are not - * mature enough for committing them to CVS yet. - */ - #include <stdlib.h> #include <stdio.h> #include <stdarg.h> -#include <tchar.h> #include <windows.h> -#include <iphlpapi.h> -#include <commctrl.h> +#include <shellapi.h> #include <cpl.h> -#include <wine/debug.h> -WINE_DEFAULT_DEBUG_CHANNEL(ncpa); -#ifndef _UNICODE -#define debugstr_aw debugstr_a -#else -#define debugstr_aw debugstr_w -#endif -#include "resource.h" -#include "ncpa.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 void (ENUMREGKEYCALLBACK)(void *pCookie,HKEY hBaseKey,TCHAR *pszSubKey); - -static LONG CALLBACK DisplayApplet(VOID); -static INT_PTR CALLBACK NetworkPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); -void DisplayTCPIPProperties(HWND hParent,IP_ADAPTER_INFO *pInfo); - -HINSTANCE hApplet = 0; -HWND hCPLWindow; - -/* Applets */ -static APPLET Applets[] = -{ - {IDI_CPLSYSTEM, IDS_CPLSYSTEMNAME, IDS_CPLSYSTEMDESCRIPTION, DisplayApplet} -}; - - -/* useful utilities */ -static VOID -EnumRegKeys(ENUMREGKEYCALLBACK *pCallback,PVOID pCookie,HKEY hBaseKey,TCHAR *tpszRegPath) -{ - HKEY hKey; - INT i; - LONG ret; - TCHAR tpszName[MAX_PATH]; - DWORD dwNameLen = sizeof(tpszName); - - if(RegOpenKeyEx(hBaseKey,tpszRegPath,0,KEY_ENUMERATE_SUB_KEYS,&hKey)!=ERROR_SUCCESS) - { - WARN("EnumRegKeys failed (key not found): %S\n", tpszRegPath); - return; - } - - for(i=0;;i++) - { - TCHAR pszNewPath[MAX_PATH]; - ret = RegEnumKeyEx(hKey,i,tpszName,&dwNameLen,NULL,NULL,NULL,NULL); - if(ret != ERROR_SUCCESS) - { - WARN("EnumRegKeys: RegEnumKeyEx failed for %S (rc 0x%lx)\n", tpszName, ret); - break; - } - - _stprintf(pszNewPath,_T("%s\\%s"),tpszRegPath,tpszName); - TRACE("EnumRegKeys: Calling user supplied enum function\n"); - pCallback(pCookie,hBaseKey,pszNewPath); - - dwNameLen = sizeof(tpszName); - } - - RegCloseKey(hKey); -} - -void -InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc,LPARAM lParam) -{ - ZeroMemory(psp, sizeof(PROPSHEETPAGE)); - psp->dwSize = sizeof(PROPSHEETPAGE); - psp->dwFlags = PSP_DEFAULT; - psp->hInstance = hApplet; - psp->pszTemplate = MAKEINTRESOURCE(idDlg); - psp->pfnDlgProc = DlgProc; - psp->lParam = lParam; -} - - - -static BOOL -FindNICClassKeyForCfgInstance(TCHAR *tpszCfgInst,TCHAR *tpszSubKeyOut) -{ - int i; - TCHAR tpszSubKey[MAX_PATH]; - TCHAR tpszCfgInst2[MAX_PATH]; - HKEY hKey; - DWORD dwType,dwSize; - - for (i = 0; i < 100; i++) - { - _stprintf(tpszSubKey,_T("SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\%04d"),i); - if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,tpszSubKey,0,KEY_QUERY_VALUE,&hKey)!=ERROR_SUCCESS) - continue; - dwType = REG_SZ; - dwSize = sizeof(tpszCfgInst2); - if(RegQueryValueEx(hKey,_T("NetCfgInstanceId"),NULL,&dwType,(BYTE*)tpszCfgInst2,&dwSize)!=ERROR_SUCCESS) { - RegCloseKey(hKey); - continue; - } - RegCloseKey(hKey); - if(_tcscmp(tpszCfgInst,tpszCfgInst2)==0) { - _tcscpy(tpszSubKeyOut,tpszSubKey); - return TRUE; - } - } - return FALSE; -} - - -static void -NICPropertyProtocolCallback(void *pCookie,HKEY hBaseKey,TCHAR *tpszSubKey) -{ - HWND hwndDlg; - DWORD dwCharacteristics; - HKEY hKey,hNDIKey; - DWORD dwType,dwSize; - TCHAR tpszDescription[MAX_PATH]; - TCHAR tpszNotifyObjectCLSID[MAX_PATH]; - TCHAR *tpszSubKeyCopy; - int nIndex; - - UNREFERENCED_PARAMETER(hBaseKey); - -// CLSID CLSID_NotifObj; -// IUnknown *pUnk = NULL; -// INetCfgComponentControl *pNetCfg; -// INetCfgComponentPropertyUi *pNetCfgPropUI; - hwndDlg = (HWND)pCookie; - - if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,tpszSubKey,0,KEY_QUERY_VALUE,&hKey)!=ERROR_SUCCESS) - return; - - dwType = REG_DWORD; - dwSize = sizeof(dwCharacteristics); - if(RegQueryValueEx(hKey,_T("Characteristics"),NULL,&dwType,(BYTE*)&dwCharacteristics,&dwSize)!= ERROR_SUCCESS) - return; - - if(dwCharacteristics & NCF_HIDDEN) - { - RegCloseKey(hKey); - return; - } - - dwType = REG_SZ; - dwSize = sizeof(tpszDescription); - if(RegQueryValueEx(hKey,_T("Description"),NULL,&dwType,(BYTE*)tpszDescription,&dwSize)!= ERROR_SUCCESS) - return; - - RegOpenKeyEx(hKey,_T("Ndi"),0,KEY_QUERY_VALUE,&hNDIKey); - dwType = REG_SZ; - dwSize = sizeof(tpszNotifyObjectCLSID); - if(RegQueryValueEx(hNDIKey,_T("ClsId"),NULL,&dwType,(BYTE*)tpszNotifyObjectCLSID,&dwSize)!= ERROR_SUCCESS) - ;//return; - - RegCloseKey(hNDIKey); - - // - // This code works on Windows... but not on Reactos - // - -// CLSIDFromString(tpszNotifyObjectCLSID,&CLSID_NotifObj); -// CoCreateInstance(&CLSID_NotifObj,NULL,CLSCTX_INPROC_SERVER,&IID_IUnknown,(void**)&pUnk); -// pUnk->lpVtbl->QueryInterface(pUnk,&IID_INetCfgComponentControl,(void**)&pNetCfg); -// pUnk->lpVtbl->QueryInterface(pUnk,&IID_INetCfgComponentPropertyUi,(void**)&pNetCfgPropUI); - { - /* - HRESULT hr; - hr = pNetCfg->lpVtbl->Initialize(pNetCfg,&NetCfgComponent,&NetCfg,FALSE); - hr = pNetCfgPropUI->lpVtbl->QueryPropertyUi(pNetCfgPropUI,(INetCfg*)&NetCfg); - hr = pNetCfgPropUI->lpVtbl->SetContext(pNetCfgPropUI,(INetCfg*)&NetCfgComponent); - DWORD dwNumPages = 10; - HPROPSHEETPAGE *bOut = NULL; - UINT nPages; - hr = pNetCfgPropUI->MergePropPages(&dwNumPages,(BYTE**)&bOut,&nPages,GetDesktopWindow(),NULL); - */ - } - - RegCloseKey(hKey); - nIndex = (int) SendDlgItemMessage(hwndDlg,IDC_COMPONENTSLIST,LB_ADDSTRING,0,(LPARAM)tpszDescription); - tpszSubKeyCopy = _tcsdup(tpszSubKey); - SendDlgItemMessage(hwndDlg,IDC_COMPONENTSLIST,LB_SETITEMDATA,nIndex,(LPARAM)tpszSubKeyCopy); -} - - - -static INT_PTR CALLBACK -NICPropertyPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - PGLOBAL_NCPA_DATA pGlobalData = (PGLOBAL_NCPA_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER); - - switch(uMsg) - { - case WM_INITDIALOG: - { - DWORD dwType,dwSize; - TCHAR tpszSubKey[MAX_PATH]; - TCHAR tpszDisplayName[MAX_PATH]; - HKEY hKey; - - pGlobalData = (PGLOBAL_NCPA_DATA)((LPPROPSHEETPAGE)lParam)->lParam; - if (pGlobalData == NULL) - return FALSE; - - SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData); - - if(!FindNICClassKeyForCfgInstance(pGlobalData->CurrentAdapterName, tpszSubKey)) - { - WARN("NIC Entry not found for '%s'\n", debugstr_w(pGlobalData->CurrentAdapterName)); - MessageBox(hwndDlg,_T("NIC Entry not found"),_T("Registry error"),MB_ICONSTOP); - MessageBox(hwndDlg,pGlobalData->CurrentAdapterName,tpszSubKey,MB_ICONSTOP); - } - - if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,tpszSubKey,0,KEY_QUERY_VALUE,&hKey)!=ERROR_SUCCESS) - return 0; - dwType = REG_SZ; - dwSize = sizeof(tpszDisplayName); - if(RegQueryValueEx(hKey,_T("DriverDesc"),NULL,&dwType,(BYTE*)tpszDisplayName,&dwSize)!= ERROR_SUCCESS) - return 0; - RegCloseKey(hKey); - - SetDlgItemText(hwndDlg,IDC_NETCARDNAME,tpszDisplayName); - EnableWindow(GetDlgItem(hwndDlg,IDC_CONFIGURE),FALSE); - - //SetDlgItemTextA(hwndDlg,IDC_NETCARDNAME,Info[pPage->lParam].Description); - EnumRegKeys(NICPropertyProtocolCallback,hwndDlg,HKEY_LOCAL_MACHINE,_T("SYSTEM\\CurrentControlSet\\Control\\Network\\{4d36e973-e325-11ce-bfc1-08002be10318}")); - EnumRegKeys(NICPropertyProtocolCallback,hwndDlg,HKEY_LOCAL_MACHINE,_T("SYSTEM\\CurrentControlSet\\Control\\Network\\{4d36e974-e325-11ce-bfc1-08002be10318}")); - EnumRegKeys(NICPropertyProtocolCallback,hwndDlg,HKEY_LOCAL_MACHINE,_T("System\\CurrentControlSet\\Control\\Network\\{4D36E975-E325-11CE-BFC1-08002BE10318}")); - - SendDlgItemMessage(hwndDlg, IDC_COMPONENTSLIST, LB_SETCURSEL, 0, 0); - SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_COMPONENTSLIST, LBN_SELCHANGE), 0); - } - break; - case WM_COMMAND: - switch(LOWORD(wParam)) - { - 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); - - RegOpenKeyEx(HKEY_LOCAL_MACHINE,tpszHelpKey,0,KEY_QUERY_VALUE,&hNDIKey); - dwType = REG_SZ; - dwSize = sizeof(tpszHelpText); - - tpszHelpText[0] = _T('\0'); - if (RegLoadMUIString(hNDIKey, _T("HelpText"),tpszHelpText,dwSize,&dwSize,0,NULL) !=ERROR_SUCCESS) - { - DWORD dwResult; - dwResult = GetSystemDirectory(tpszHelpKey, dwSize / sizeof(TCHAR)); - if (dwResult < dwSize && dwResult != 0) - { - if (RegLoadMUIString(hNDIKey, _T("HelpText"),tpszHelpText,dwSize,&dwSize,0,tpszHelpKey) !=ERROR_SUCCESS) - tpszHelpText[0] = _T('\0'); - } - } - RegCloseKey(hNDIKey); - - SetDlgItemText(hwndDlg,IDC_DESCRIPTION,tpszHelpText); - } - if(HIWORD(wParam)!=LBN_DBLCLK) - break; - // drop though - case IDC_PROPERTIES: - { - if(pGlobalData->pCurrentAdapterInfo) - { - DisplayTCPIPProperties(hwndDlg, pGlobalData->pCurrentAdapterInfo); - } - else - { - FIXME("If you see this, then the IPHLPAPI.DLL probably needs more work because GetAdaptersInfo did not return the expected data.\n"); - 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); - } - } - break; - } - break; - } - return FALSE; -} - - -static void -DisplayNICProperties(HWND hParent, GLOBAL_NCPA_DATA* pGlobalData) -{ - PROPSHEETPAGE psp[1]; - PROPSHEETHEADER psh; - TCHAR tpszSubKey[MAX_PATH]; - HKEY hKey; - DWORD dwType = REG_SZ; - TCHAR tpszName[MAX_PATH]; - DWORD dwSize = sizeof(tpszName); - TCHAR tpszCfgInstanceID[MAX_ADAPTER_NAME_LENGTH]; - -#ifndef _UNICODE - WideCharToMultiByte(CP_UTF8, 0, pGlobalData->CurrentAdapterName, -1, tpszCfgInstanceID, MAX_ADAPTER_NAME_LENGTH, 0, 0); -#else - wcscpy(tpszCfgInstanceID, pGlobalData->CurrentAdapterName); -#endif - - // Get the "Name" for this Connection - _stprintf(tpszSubKey,_T("System\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\%s\\Connection"),tpszCfgInstanceID); - if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,tpszSubKey,0,KEY_QUERY_VALUE,&hKey)!=ERROR_SUCCESS) - return; - if(RegQueryValueEx(hKey,_T("Name"),NULL,&dwType,(BYTE*)tpszName,&dwSize)!=ERROR_SUCCESS) - _stprintf(tpszName,_T("[ERROR]")); - else - _tcscat(tpszName,_T(" Properties")); - RegCloseKey(hKey); - - ZeroMemory(&psh, sizeof(PROPSHEETHEADER)); - psh.dwSize = sizeof(PROPSHEETHEADER); - psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW; - psh.hwndParent = hParent; - psh.hInstance = hApplet; - psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDI_CPLSYSTEM)); - psh.pszCaption = tpszName; - psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE); - psh.nStartPage = 0; - psh.ppsp = psp; - psh.pfnCallback = NULL; - - InitPropSheetPage(&psp[0], IDD_NETPROPERTIES, NICPropertyPageProc, (LPARAM)pGlobalData); - PropertySheet(&psh); - return; -} - -void RefreshNICInfo(HWND hwndDlg, PGLOBAL_NCPA_DATA pGlobalData) -{ - ULONG BufferSize; - DWORD ErrRet = 0; - - if (pGlobalData->pFirstAdapterInfo) - HeapFree(GetProcessHeap(), 0, pGlobalData->pFirstAdapterInfo); - - BufferSize = sizeof(IP_ADAPTER_INFO); - pGlobalData->pFirstAdapterInfo = (PIP_ADAPTER_INFO) HeapAlloc(GetProcessHeap(), 0, BufferSize); - - if (GetAdaptersInfo(pGlobalData->pFirstAdapterInfo, &BufferSize) == ERROR_BUFFER_OVERFLOW) - { - HeapFree(GetProcessHeap(), 0, pGlobalData->pFirstAdapterInfo); - pGlobalData->pFirstAdapterInfo = (PIP_ADAPTER_INFO) HeapAlloc(GetProcessHeap(), 0, BufferSize); - } - - if ((ErrRet = GetAdaptersInfo(pGlobalData->pFirstAdapterInfo, &BufferSize)) != NO_ERROR) - { - ERR("error adapterinfo\n"); - MessageBox(hwndDlg, _T("error adapterinfo") ,_T("ncpa.cpl"),MB_ICONSTOP); - - if (pGlobalData->pFirstAdapterInfo) - HeapFree(GetProcessHeap(), 0, pGlobalData->pFirstAdapterInfo); - } -} - -void UpdateCurrentAdapterInfo(HWND hwndDlg, PGLOBAL_NCPA_DATA pGlobalData) -{ - PIP_INTERFACE_INFO pInfo; - ULONG BufferSize = 0; - DWORD dwRetVal = 0; - - if (!pGlobalData->pCurrentAdapterInfo) - return; - - BufferSize = sizeof(IP_INTERFACE_INFO); - pInfo = (PIP_INTERFACE_INFO) HeapAlloc(GetProcessHeap(), 0, BufferSize); - if (ERROR_INSUFFICIENT_BUFFER == GetInterfaceInfo(pInfo, &BufferSize)) - { - HeapFree(GetProcessHeap(), 0, pInfo); - pInfo = (PIP_INTERFACE_INFO) HeapAlloc(GetProcessHeap(), 0, BufferSize); - } - - dwRetVal = GetInterfaceInfo(pInfo, &BufferSize); - if (NO_ERROR == dwRetVal) - { - DWORD i; - - for (i = 0; i < pInfo->NumAdapters; i++) - { - if (0 == wcscmp(pGlobalData->CurrentAdapterName, pInfo->Adapter[i].Name)) - { - if (pInfo->Adapter[i].Index != pGlobalData->pCurrentAdapterInfo->Index) - { - RefreshNICInfo(hwndDlg, pGlobalData); - - pGlobalData->pCurrentAdapterInfo = pGlobalData->pFirstAdapterInfo; - while (pGlobalData->pCurrentAdapterInfo) - { - if (pGlobalData->pCurrentAdapterInfo->Index == pInfo->Adapter[i].Index) - return; - - pGlobalData->pCurrentAdapterInfo = pGlobalData->pCurrentAdapterInfo->Next; - } - } - } - } - } - else if (ERROR_NO_DATA == dwRetVal) - WARN("There are no network adapters with IPv4 enabled on the local system\n"); - else - ERR("GetInterfaceInfo failed.\n"); -} - -static VOID -UpdateNICStatusData(HWND hwndDlg, PGLOBAL_NCPA_DATA pGlobalData) -{ - DWORD dwRet = NO_ERROR; - - if (pGlobalData->pCurrentAdapterInfo) - { - if (NULL == pGlobalData->pIfTable) - { - pGlobalData->IfTableSize = sizeof(MIB_IFTABLE); - pGlobalData->pIfTable = (PMIB_IFTABLE)HeapAlloc(GetProcessHeap(), 0, pGlobalData->IfTableSize); - if (NULL == pGlobalData->pIfTable) - { - static BOOL firstError = TRUE; - if (firstError) - { - firstError = FALSE; - WARN("Out of memory - could not allocate MIB_IFTABLE(1)"); - return; - } - } - } - - /* Call GetIfTable once to see if we have a large enough buffer */ - dwRet = GetIfTable(pGlobalData->pIfTable, &pGlobalData->IfTableSize, FALSE); - if (ERROR_INSUFFICIENT_BUFFER == dwRet) - { - HeapFree(GetProcessHeap(), 0, pGlobalData->pIfTable); - - pGlobalData->pIfTable = (PMIB_IFTABLE)HeapAlloc(GetProcessHeap(), 0, pGlobalData->IfTableSize); - if (NULL == pGlobalData->pIfTable) - { - static BOOL firstError = TRUE; - if (firstError) - { - firstError = FALSE; - WARN("Out of memory - could not allocate MIB_IFTABLE(2)"); - } - - pGlobalData->IfTableSize = 0; - return; - } - - dwRet = GetIfTable(pGlobalData->pIfTable, &pGlobalData->IfTableSize, FALSE); - if (NO_ERROR != dwRet) - { - HeapFree(GetProcessHeap(), 0, pGlobalData->pIfTable); - pGlobalData->pIfTable = NULL; - pGlobalData->IfTableSize = 0; - return; - } - } - } - - if (NO_ERROR == dwRet) - { - DWORD i; - DWORD PktsOut = 0; - DWORD PktsIn = 0; - DWORD Mbps = 0; - DWORD OperStatus = IF_OPER_STATUS_DISCONNECTED; - PMIB_IFROW pIfRow = NULL; - TCHAR Buffer[256], LocBuffer[256], szDecimalSep[3]; - SYSTEMTIME TimeConnected; - NUMBERFMT fmt; - - memset(&TimeConnected, 0, sizeof(TimeConnected)); - - if (pGlobalData->pCurrentAdapterInfo) - { - UpdateCurrentAdapterInfo(hwndDlg, pGlobalData); - - for (i = 0; i < pGlobalData->pIfTable->dwNumEntries; i++) - { - pIfRow = (PMIB_IFROW)&pGlobalData->pIfTable->table[i]; - - if (pIfRow->dwIndex == pGlobalData->pCurrentAdapterInfo->Index) - { - DWORD DurationSeconds; - ULONGLONG Ticks; - - PktsOut = pIfRow->dwOutOctets; - PktsIn = pIfRow->dwInOctets; - Mbps = pIfRow->dwSpeed; - OperStatus = pIfRow->dwOperStatus; - - /* TODO: For some unknown reason, this doesn't correspond to the Windows duration */ - Ticks = GetTickCount64(); - DurationSeconds = Ticks / 1000; - TimeConnected.wSecond = (DurationSeconds % 60); - TimeConnected.wMinute = (DurationSeconds / 60) % 60; - TimeConnected.wHour = (DurationSeconds / (60 * 60)) % 24; - TimeConnected.wDay = DurationSeconds / (60 * 60 * 24); - - break; - } - } - } - - memset(&fmt, 0x0, sizeof(fmt)); - if (GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, szDecimalSep, sizeof(szDecimalSep) / sizeof(szDecimalSep[0]))) - fmt.lpThousandSep = szDecimalSep; - fmt.Grouping = 3; - fmt.lpDecimalSep = _T(""); - - _stprintf(Buffer, L"%u", PktsOut); - GetNumberFormat(LOCALE_USER_DEFAULT, 0, Buffer, &fmt, LocBuffer, sizeof(LocBuffer) / sizeof(LocBuffer[0])); - SendDlgItemMessage(hwndDlg, IDC_SEND, WM_SETTEXT, 0, (LPARAM)LocBuffer); - - _stprintf(Buffer, L"%u", PktsIn); - GetNumberFormat(LOCALE_USER_DEFAULT, 0, Buffer, &fmt, LocBuffer, sizeof(LocBuffer) / sizeof(LocBuffer[0])); - SendDlgItemMessage(hwndDlg, IDC_RECEIVED, WM_SETTEXT, 0, (LPARAM)LocBuffer); - - switch (OperStatus) - { - case IF_OPER_STATUS_NON_OPERATIONAL: - OperStatus = IDS_STATUS_NON_OPERATIONAL; - break; - - case IF_OPER_STATUS_UNREACHABLE: - OperStatus = IDS_STATUS_UNREACHABLE; - break; - - case IF_OPER_STATUS_DISCONNECTED: - OperStatus = IDS_STATUS_DISCONNECTED; - break; - - case IF_OPER_STATUS_CONNECTING: - OperStatus = IDS_STATUS_CONNECTING; - break; - - case IF_OPER_STATUS_CONNECTED: - OperStatus = IDS_STATUS_CONNECTED; - break; - - case IF_OPER_STATUS_OPERATIONAL: - /* TODO: Find sub status, waiting for DHCP address, etc. */ - OperStatus = IDS_STATUS_OPERATIONAL; - break; - - default: - WARN("Unknown operation status: %d\n", OperStatus); - OperStatus = IDS_STATUS_OPERATIONAL; - break; - } - LoadString(hApplet, OperStatus, LocBuffer, sizeof(LocBuffer) / sizeof(LocBuffer[0])); - SendDlgItemMessage(hwndDlg, IDC_STATUS, WM_SETTEXT, 0, (LPARAM)LocBuffer); - - GetTimeFormat(LOCALE_USER_DEFAULT, 0, &TimeConnected, L"HH':'mm':'ss", LocBuffer, sizeof(LocBuffer) / sizeof(LocBuffer[0])); - if (0 == TimeConnected.wDay) - { - SendDlgItemMessage(hwndDlg, IDC_DURATION, WM_SETTEXT, 0, (LPARAM)LocBuffer); - } - else - { - TCHAR DayBuffer[256]; - if (1 == TimeConnected.wDay) - { - LoadString(hApplet, IDS_DURATION_DAY, DayBuffer, sizeof(DayBuffer) / sizeof(DayBuffer[0])); - } - else - { - LoadString(hApplet, IDS_DURATION_DAYS, DayBuffer, sizeof(DayBuffer) / sizeof(DayBuffer[0])); - } - _sntprintf(Buffer, 256, DayBuffer, TimeConnected.wDay, LocBuffer); - SendDlgItemMessage(hwndDlg, IDC_DURATION, WM_SETTEXT, 0, (LPARAM)Buffer); - } - - LoadString(hApplet, IDS_SPEED_MBPS, LocBuffer, sizeof(LocBuffer) / sizeof(LocBuffer[0])); - _sntprintf(Buffer, 256, LocBuffer, Mbps / 1000000); - SendDlgItemMessage(hwndDlg, IDC_SPEED, WM_SETTEXT, 0, (LPARAM)Buffer); - } - else - { - static BOOL firstError = TRUE; - if (firstError) - { - firstError = FALSE; - ERR("GetIfTable failed with error code: %d\n", dwRet); - return; - } - } -} - -static INT_PTR CALLBACK -NICStatusPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - PGLOBAL_NCPA_DATA pGlobalData; - pGlobalData = (PGLOBAL_NCPA_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER); - - switch(uMsg) - { - case WM_INITDIALOG: - { - pGlobalData = (PGLOBAL_NCPA_DATA)((LPPROPSHEETPAGE)lParam)->lParam; - if (pGlobalData == NULL) - return FALSE; - - SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData); - - EnableWindow(GetDlgItem(hwndDlg,IDC_ENDISABLE),FALSE); - pGlobalData->hStatsUpdateTimer = SetTimer(hwndDlg, 1, 1000, NULL); - UpdateNICStatusData(hwndDlg, pGlobalData); - } - break; - case WM_COMMAND: - switch(LOWORD(wParam)) - { - case IDC_PROPERTIES: - { - DisplayNICProperties(hwndDlg, pGlobalData); - } - break; - } - break; - case WM_TIMER: - { - UpdateNICStatusData(hwndDlg, pGlobalData); - } - break; - case WM_DESTROY: - { - KillTimer(hwndDlg, pGlobalData->hStatsUpdateTimer); - pGlobalData->hStatsUpdateTimer = 0; - - if (pGlobalData->pIfTable) - { - HeapFree(GetProcessHeap(), 0, pGlobalData->pIfTable); - pGlobalData->pIfTable = NULL; - pGlobalData->IfTableSize = 0; - } - } - break; - } - return FALSE; -} - -static INT_PTR CALLBACK -NICSupportPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - PGLOBAL_NCPA_DATA pGlobalData; - pGlobalData = (PGLOBAL_NCPA_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER); - - switch(uMsg) - { - case WM_INITDIALOG: - { - pGlobalData = (PGLOBAL_NCPA_DATA)((LPPROPSHEETPAGE)lParam)->lParam; - if (pGlobalData == NULL) - return FALSE; - - SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData); - - if (pGlobalData->pCurrentAdapterInfo) - { - TCHAR Buffer[64]; - - if (pGlobalData->pCurrentAdapterInfo->DhcpEnabled) - LoadString(hApplet, IDS_ASSIGNED_DHCP, Buffer, sizeof(Buffer) / sizeof(TCHAR)); - else - LoadString(hApplet, IDS_ASSIGNED_MANUAL, Buffer, sizeof(Buffer) / sizeof(TCHAR)); - - SendDlgItemMessage(hwndDlg, IDC_DETAILSTYPE, WM_SETTEXT, 0, (LPARAM)Buffer); - _stprintf(Buffer, _T("%S"), pGlobalData->pCurrentAdapterInfo->IpAddressList.IpAddress.String); - SendDlgItemMessage(hwndDlg, IDC_DETAILSIP, WM_SETTEXT, 0, (LPARAM)Buffer); - _stprintf(Buffer, _T("%S"), pGlobalData->pCurrentAdapterInfo->IpAddressList.IpMask.String); - SendDlgItemMessage(hwndDlg, IDC_DETAILSSUBNET, WM_SETTEXT, 0, (LPARAM)Buffer); - _stprintf(Buffer, _T("%S"), pGlobalData->pCurrentAdapterInfo->GatewayList.IpAddress.String); - SendDlgItemMessage(hwndDlg, IDC_DETAILSGATEWAY, WM_SETTEXT, 0, (LPARAM)Buffer); - } - } - break; - case WM_COMMAND: - switch(LOWORD(wParam)) - { - case IDC_PROPERTIES: - { - } - break; - case IDC_DETAILS: - { - FIXME("Not implemented: show detail window\n"); - MessageBox(hwndDlg,_T("not implemented: show detail window"),_T("ncpa.cpl"),MB_ICONSTOP); - } - break; - } - break; - } - return FALSE; -} - -static VOID -DisplayNICStatus(HWND hParent,TCHAR *tpszCfgInstanceID) -{ - PROPSHEETPAGE psp[2]; - PROPSHEETHEADER psh; - TCHAR tpszSubKey[MAX_PATH]; - HKEY hKey; - DWORD dwType = REG_SZ; - TCHAR tpszName[MAX_PATH]; - DWORD dwSize = sizeof(tpszName); - PGLOBAL_NCPA_DATA pGlobalData; - PIP_ADAPTER_INFO pInfo; - WCHAR wcsAdapterName[MAX_ADAPTER_NAME]; - - pGlobalData = (PGLOBAL_NCPA_DATA)GetWindowLongPtr(hParent, DWLP_USER); - -#ifndef _UNICODE - MultiByteToWideChar(CP_UTF8, 0, tpszCfgInstanceID, -1, pGlobalData->CurrentAdapterName, MAX_ADAPTER_NAME); -#else - wcscpy(pGlobalData->CurrentAdapterName, tpszCfgInstanceID); -#endif - - // Get the "Name" for this Connection - _stprintf(tpszSubKey,_T("System\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\%s\\Connection"),tpszCfgInstanceID); - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,tpszSubKey,0,KEY_QUERY_VALUE,&hKey)!=ERROR_SUCCESS) - return; - - if (RegQueryValueEx(hKey,_T("Name"),NULL,&dwType,(BYTE*)tpszName,&dwSize)!=ERROR_SUCCESS) - _stprintf(tpszName,_T("[ERROR]")); - //_stprintf(tpszName,_T("[ERROR]") _T(__FILE__) _T(" %d"),__LINE__ ); - else - _tcscat(tpszName,_T(" Status")); - RegCloseKey(hKey); - - ZeroMemory(&psh, sizeof(PROPSHEETHEADER)); - psh.dwSize = sizeof(PROPSHEETHEADER); - psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW; - psh.hwndParent = hParent; - psh.hInstance = hApplet; - // FIX THESE REACTOS HEADERS !!!!!!!!! - psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDI_CPLSYSTEM)); - psh.pszCaption = tpszName;//Caption; - psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE); - psh.nStartPage = 0; - psh.ppsp = psp; - psh.pfnCallback = NULL; - - RefreshNICInfo(hParent, pGlobalData); - - pGlobalData->pCurrentAdapterInfo = NULL; - pInfo = pGlobalData->pFirstAdapterInfo; - while (pInfo) - { - MultiByteToWideChar(CP_UTF8, 0, pInfo->AdapterName, -1, wcsAdapterName, MAX_ADAPTER_NAME); - if (0 == wcscmp(wcsAdapterName, pGlobalData->CurrentAdapterName)) - { - pGlobalData->pCurrentAdapterInfo = pInfo; - break; - } - - pInfo = pInfo->Next; - } - - InitPropSheetPage(&psp[0], IDD_CARDPROPERTIES, NICStatusPageProc, (LPARAM)pGlobalData); - InitPropSheetPage(&psp[1], IDD_CARDSUPPORT, NICSupportPageProc, (LPARAM)pGlobalData); - - PropertySheet(&psh); - return; -} - -// -// IPHLPAPI does not provide a list of all adapters -// -#if 0 -static VOID -EnumAdapters(HWND hwndDlg) -{ - TCHAR pszText[MAX_ADAPTER_NAME_LENGTH + 4]; - IP_ADAPTER_INFO *pInfo; - ULONG size; - INT nIndex; - - size=sizeof(Info); - if(GetAdaptersInfo(Info,&size)!=ERROR_SUCCESS) - { - WARN("IPHLPAPI.DLL failed to provide Adapter information\n"); - MessageBox(hwndDlg,L"IPHLPAPI.DLL failed to provide Adapter information",L"Error",MB_ICONSTOP); - return; - } - - pInfo = &Info[0]; - while(pInfo) - { - swprintf(pszText,L"%S",Info[0].Description); - nIndex = SendDlgItemMessage(hwndDlg,IDC_NETCARDLIST,LB_ADDSTRING,0,(LPARAM)pszText); - SendDlgItemMessage(hwndDlg,IDC_NETCARDLIST,LB_SETITEMDATA,nIndex,(LPARAM)pInfo); - pInfo = pInfo->Next; - } -} -#endif - - - -static void -NetAdapterCallback(void *pCookie,HKEY hBaseKey,TCHAR *tpszSubKey) -{ - TCHAR tpszDisplayName[MAX_PATH]; - //TCHAR tpszDeviceID[MAX_PATH]; - TCHAR tpszCfgInstanceID[MAX_PATH]; - TCHAR *ptpszCfgInstanceID; - HKEY hKey; - DWORD dwType = REG_SZ; - DWORD dwSize = sizeof(tpszDisplayName); - int nIndex; - HWND hwndDlg = (HWND)pCookie; - DWORD dwCharacteristics; - - TRACE("NetAdapterCallback: %s\n", debugstr_aw(tpszSubKey)); - - if(RegOpenKeyEx(hBaseKey,tpszSubKey,0,KEY_QUERY_VALUE,&hKey)!=ERROR_SUCCESS) - return; - - TRACE("NetAdapterCallback: Reading Characteristics\n"); - dwType = REG_DWORD; - dwSize = sizeof(dwCharacteristics); - if(RegQueryValueEx(hKey,_T("Characteristics"),NULL,&dwType,(BYTE*)&dwCharacteristics,&dwSize)!=ERROR_SUCCESS) - dwCharacteristics = 0; - if (dwCharacteristics & NCF_HIDDEN) - return; - if (!(dwCharacteristics & NCF_VIRTUAL) && !(dwCharacteristics & NCF_PHYSICAL)) - return; - - TRACE("NetAdapterCallback: Reading DriverDesc\n"); - dwType = REG_SZ; - dwSize = sizeof(tpszDisplayName); - if (RegQueryValueEx(hKey,_T("DriverDesc"),NULL,&dwType,(BYTE*)tpszDisplayName,&dwSize)!= ERROR_SUCCESS) - _tcscpy(tpszDisplayName,_T("Unnamed Adapter")); - TRACE("Network card: '%s'\n", debugstr_aw(tpszDisplayName)); - - // get the link to the Enum Subkey (currently unused) - //dwType = REG_SZ; - //dwSize = sizeof(tpszDeviceID); - //if(RegQueryValueEx(hKey,_T("MatchingDeviceId"),NULL,&dwType,(BYTE*)tpszDeviceID,&dwSize) != ERROR_SUCCESS) { - // WARN("Missing MatchingDeviceId Entry\n"); - // MessageBox(hwndDlg,_T("Missing MatchingDeviceId Entry"),_T("Registry Problem"),MB_ICONSTOP); - // return; - //} - - // get the card configuration GUID - dwType = REG_SZ; - dwSize = sizeof(tpszCfgInstanceID); - if(RegQueryValueEx(hKey,_T("NetCfgInstanceId"),NULL,&dwType,(BYTE*)tpszCfgInstanceID,&dwSize) != ERROR_SUCCESS) - { - ERR("Missing NetCfgInstanceId Entry\n"); - MessageBox(hwndDlg,_T("Missing NetCfgInstanceId Entry"),_T("Registry Problem"),MB_ICONSTOP); - return; - } - - ptpszCfgInstanceID = _tcsdup(tpszCfgInstanceID); - // - // **TODO** **FIXME** TBD - // At this point, we should verify, if the device listed here - // really represents a device that is currently connected to the system - // - // How is this done properly ? - - nIndex = (int) SendDlgItemMessage(hwndDlg,IDC_NETCARDLIST,LB_ADDSTRING,0,(LPARAM)tpszDisplayName); - SendDlgItemMessage(hwndDlg,IDC_NETCARDLIST,LB_SETITEMDATA,nIndex,(LPARAM)ptpszCfgInstanceID); - RegCloseKey(hKey); -} - - -static void -EnumAdapters(HWND hwndDlg) -{ - LPTSTR lpRegPath = _T("SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}"); - - EnumRegKeys(NetAdapterCallback,hwndDlg,HKEY_LOCAL_MACHINE,lpRegPath); - return; -} - - -static INT_PTR CALLBACK -NetworkPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - NMHDR* pnmh; - int nIndex; - switch(uMsg) - { - case WM_INITDIALOG: - { - PGLOBAL_NCPA_DATA pGlobalData = (PGLOBAL_NCPA_DATA)((LPPROPSHEETPAGE)lParam)->lParam; - if (pGlobalData == NULL) - return FALSE; - - SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData); - - EnableWindow(GetDlgItem(hwndDlg,IDC_ADD),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_REMOVE),FALSE); - - EnumAdapters(hwndDlg); - SendDlgItemMessage(hwndDlg,IDC_NETCARDLIST,LB_SETCURSEL,0,0); - } - break; - - case WM_NOTIFY: - pnmh=(NMHDR*)lParam; - switch(pnmh->code) - { - case PSN_APPLY: - case PSN_RESET: - while(SendDlgItemMessage(hwndDlg,IDC_NETCARDLIST,LB_GETCOUNT,0,0)>0) - { - TCHAR *tpszString; - - tpszString = (TCHAR*)SendDlgItemMessage(hwndDlg,IDC_NETCARDLIST,LB_GETITEMDATA,0,0); - if(tpszString) - free(tpszString); - SendDlgItemMessage(hwndDlg,IDC_NETCARDLIST,LB_DELETESTRING,0,0); - } - break; - } - break; - - case WM_COMMAND: - switch(LOWORD(wParam)) - { - case IDC_NETCARDLIST: - if(HIWORD(wParam)==LBN_DBLCLK) { - nIndex = (int) SendDlgItemMessage(hwndDlg,IDC_NETCARDLIST,LB_GETCURSEL,0,0); - if(nIndex!=-1) - DisplayNICStatus(hwndDlg,(TCHAR*)SendDlgItemMessage(hwndDlg,IDC_NETCARDLIST,LB_GETITEMDATA,nIndex,0)); - } - break; - - case IDC_PROPERTIES: - nIndex = (int) SendDlgItemMessage(hwndDlg,IDC_NETCARDLIST,LB_GETCURSEL,0,0); - if(nIndex!=-1) - DisplayNICStatus(hwndDlg,(TCHAR*)SendDlgItemMessage(hwndDlg,IDC_NETCARDLIST,LB_GETITEMDATA,nIndex,0)); - break; - } - break; - } - - return FALSE; -} - - - -/* First Applet */ -static LONG CALLBACK +LONG CALLBACK DisplayApplet(VOID) { - PGLOBAL_NCPA_DATA pGlobalData; - PROPSHEETPAGE psp[1]; - PROPSHEETHEADER psh = {0}; - TCHAR Caption[1024]; - int Ret; + WCHAR szParameters[160]; + //FIXME + // use correct path + //::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\::{7007ACC7-3202-11D1-AAD2-00805FC1270E} - LoadString(hApplet, IDS_CPLSYSTEMNAME, Caption, sizeof(Caption) / sizeof(TCHAR)); + wcscpy(szParameters, L"/n,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{7007ACC7-3202-11D1-AAD2-00805FC1270E}"); - pGlobalData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GLOBAL_NCPA_DATA)); - if (pGlobalData == NULL) - return 0; - - psh.dwSize = sizeof(PROPSHEETHEADER); - psh.dwFlags = PSH_PROPSHEETPAGE; - psh.hwndParent = hCPLWindow; - psh.hInstance = hApplet; - psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDI_CPLSYSTEM)); - psh.pszCaption = Caption; - psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE); - psh.nStartPage = 0; - psh.ppsp = psp; - psh.pfnCallback = NULL; - - InitPropSheetPage(&psp[0], IDD_PROPPAGENETWORK, NetworkPageProc, (LPARAM)pGlobalData); - - Ret = PropertySheet(&psh); - - HeapFree(GetProcessHeap(), 0, pGlobalData); - - return (LONG)(Ret != -1); + return (int) ShellExecuteW(NULL, L"open", L"explorer.exe", szParameters, NULL, SW_SHOWDEFAULT) > 32; } /* Control Panel Callback */ @@ -1056,6 +35,7 @@ UNREFERENCED_PARAMETER(hwndCPl); switch (uMsg) { + case CPL_INIT: { return TRUE; @@ -1063,23 +43,11 @@ case CPL_GETCOUNT: { - return sizeof(Applets)/sizeof(APPLET); + return 1; } - - case CPL_INQUIRE: - { - CPLINFO *CPlInfo = (CPLINFO*)lParam2; - CPlInfo->lData = 0; - CPlInfo->idIcon = Applets[(int)lParam1].idIcon; - CPlInfo->idName = Applets[(int)lParam1].idName; - CPlInfo->idInfo = Applets[(int)lParam1].idDescription; - break; - } - case CPL_DBLCLK: { - hCPLWindow = hwndCPl; - Applets[(int)lParam1].AppletProc(); + DisplayApplet(); break; } } @@ -1096,7 +64,6 @@ { case DLL_PROCESS_ATTACH: case DLL_THREAD_ATTACH: - hApplet = hinstDLL; break; } Removed: trunk/reactos/dll/cpl/ncpa/ncpa.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/ncpa/ncpa.h?rev=36…
============================================================================== --- trunk/reactos/dll/cpl/ncpa/ncpa.h [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/ncpa/ncpa.h (removed) @@ -1,28 +1,0 @@ -#ifndef __NCPA_H -#define __NCPA_H - -typedef LONG (CALLBACK *CPLAPPLET_PROC)(VOID); - -typedef struct -{ - int idIcon; - int idName; - int idDescription; - CPLAPPLET_PROC AppletProc; -} APPLET, *PAPPLET; - -typedef struct -{ - WCHAR CurrentAdapterName[MAX_ADAPTER_NAME]; - UINT_PTR hStatsUpdateTimer; - PMIB_IFTABLE pIfTable; - DWORD IfTableSize; - PIP_ADAPTER_INFO pFirstAdapterInfo; - PIP_ADAPTER_INFO pCurrentAdapterInfo; -} GLOBAL_NCPA_DATA, *PGLOBAL_NCPA_DATA; - -extern HINSTANCE hApplet; - -#endif // __NCPA_H - -/* EOF */ Modified: trunk/reactos/dll/cpl/ncpa/ncpa.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/ncpa/ncpa.rbuild?r…
============================================================================== --- trunk/reactos/dll/cpl/ncpa/ncpa.rbuild [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/ncpa/ncpa.rbuild [iso-8859-1] Fri Oct 17 08:19:04 2008 @@ -5,15 +5,8 @@ <include base="ncpa">.</include> <define name="_WIN32_IE">0x600</define> <define name="_WIN32_WINNT">0x600</define> - <library>wine</library> <library>kernel32</library> <library>advapi32</library> - <library>user32</library> - <library>comctl32</library> - <library>iphlpapi</library> - <library>ws2_32</library> - <library>dhcpcsvc</library> + <library>shell32</library> <file>ncpa.c</file> - <file>tcpip_properties.c</file> - <file>ncpa.rc</file> </module> Removed: trunk/reactos/dll/cpl/ncpa/ncpa.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/ncpa/ncpa.rc?rev=3…
============================================================================== --- trunk/reactos/dll/cpl/ncpa/ncpa.rc [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/ncpa/ncpa.rc (removed) @@ -1,18 +1,0 @@ -/* $Id$ */ - -#include <windows.h> -#include "resource.h" - -LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL - -#define REACTOS_VERSION_DLL -#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Network Control Panel\0" -#define REACTOS_STR_INTERNAL_NAME "ncpa\0" -#define REACTOS_STR_ORIGINAL_FILENAME "ncpa.cpl\0" - -IDI_CPLSYSTEM ICON "resources/applet.ico" -IDI_HORIZONTAL ICON "resources/HORIZ.ICO" -IDI_VERTICAL ICON "resources/VERTIC.ICO" -IDI_NETSTAT ICON "resources/NETCONN.ICO" - -#include "rsrc.rc" Removed: trunk/reactos/dll/cpl/ncpa/resource.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/ncpa/resource.h?re…
============================================================================== --- trunk/reactos/dll/cpl/ncpa/resource.h [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/ncpa/resource.h (removed) @@ -1,86 +1,0 @@ -#ifndef __CPL_RESOURCE_H -#define __CPL_RESOURCE_H - -/* metrics */ -#define PROPSHEETWIDTH 246 -#define PROPSHEETHEIGHT 228 -#define PROPSHEETPADDING 6 -#define SYSTEM_COLUMN (0 * PROPSHEETPADDING) -// this is not supported by the MS Resource compiler: -//#define LABELLINE(x) 0 //(((PROPSHEETPADDING + 2) * x) + (x + 2)) - -#define ICONSIZE 16 - -/* ids */ - -#define IDI_CPLSYSTEM 100 -#define IDI_HORIZONTAL 101 -#define IDI_VERTICAL 102 -#define IDI_NETSTAT 103 - -#define IDD_PROPPAGENETWORK 100 -#define IDD_CARDPROPERTIES 101 -#define IDD_NETPROPERTIES 102 -#define IDD_TCPIPPROPERTIES 103 -#define IDD_CARDSUPPORT 104 - -#define IDS_CPLSYSTEMNAME 1001 -#define IDS_CPLSYSTEMDESCRIPTION 2001 -#define IDS_ASSIGNED_DHCP 2501 -#define IDS_ASSIGNED_MANUAL 2502 -#define IDS_ERROR 3001 -#define IDS_ENTER_VALID_IPADDRESS 3002 -#define IDS_ENTER_VALID_SUBNET 3003 -#define IDS_CANNOT_LOAD_CONFIG 3004 -#define IDS_CANNOT_CREATE_PROPSHEET 3005 -#define IDS_OUT_OF_MEMORY 3006 -#define IDS_CANNOT_SAVE_CHANGES 3007 -#define IDS_STATUS_NON_OPERATIONAL 4001 -#define IDS_STATUS_UNREACHABLE 4002 -#define IDS_STATUS_DISCONNECTED 4003 -#define IDS_STATUS_CONNECTING 4004 -#define IDS_STATUS_CONNECTED 4005 -#define IDS_STATUS_OPERATIONAL 4006 -#define IDS_SPEED_MBPS 4007 -#define IDS_DURATION_DAY 4008 -#define IDS_DURATION_DAYS 4009 - - -/* controls */ -#define IDC_NETCARDLIST 100 -#define IDC_ADD 101 -#define IDC_REMOVE 102 -#define IDC_PROPERTIES 103 - -#define IDC_NETCARDNAME 104 -#define IDC_CONFIGURE 105 -#define IDC_COMPONENTSLIST 106 -#define IDC_INSTALL 107 -#define IDC_UNINSTALL 108 -//#define IDC_PROPERTIES 109 -#define IDC_DESCRIPTION 110 -#define IDC_SHOWTASKBAR 111 -#define IDC_SEND 112 -#define IDC_RECEIVED 113 -#define IDC_ENDISABLE 114 -#define IDC_USEDHCP 115 -#define IDC_NODHCP 116 -#define IDC_AUTODNS 117 -#define IDC_FIXEDDNS 118 -#define IDC_ADVANCED 119 -#define IDC_IPADDR 120 -#define IDC_SUBNETMASK 121 -#define IDC_DEFGATEWAY 122 -#define IDC_DNS1 123 -#define IDC_DNS2 124 -#define IDC_DETAILS 125 -#define IDC_DETAILSIP 126 -#define IDC_DETAILSTYPE 127 -#define IDC_DETAILSSUBNET 128 -#define IDC_DETAILSGATEWAY 129 -#define IDC_STATUS 130 -#define IDC_DURATION 131 -#define IDC_SPEED 132 -#endif /* __CPL_RESOURCE_H */ - -/* EOF */ Removed: trunk/reactos/dll/cpl/ncpa/rsrc.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/ncpa/rsrc.rc?rev=3…
============================================================================== --- trunk/reactos/dll/cpl/ncpa/rsrc.rc [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/ncpa/rsrc.rc (removed) @@ -1,23 +1,0 @@ -#include <windows.h> -#include "resource.h" - -#include "lang/bg-BG.rc" -#include "lang/cs-CZ.rc" -#include "lang/da-DK.rc" -#include "lang/de-DE.rc" -#include "lang/el-GR.rc" -#include "lang/en-US.rc" -#include "lang/es-ES.rc" -#include "lang/fr-FR.rc" -#include "lang/hu-HU.rc" -#include "lang/id-ID.rc" -#include "lang/it-IT.rc" -#include "lang/ja-JP.rc" -#include "lang/no-NO.rc" -#include "lang/nl-NL.rc" -#include "lang/pl-PL.rc" -#include "lang/ru-RU.rc" -#include "lang/sk-SK.rc" -#include "lang/sv-SE.rc" -#include "lang/uk-UA.rc" -#include "lang/zh-CN.rc" Removed: trunk/reactos/dll/cpl/ncpa/tcpip_properties.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/ncpa/tcpip_propert…
============================================================================== --- trunk/reactos/dll/cpl/ncpa/tcpip_properties.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/ncpa/tcpip_properties.c (removed) @@ -1,560 +1,0 @@ -/* - * PROJECT: ReactOS Network Control Panel - * LICENSE: GPL - See COPYING in the top level directory - * FILE: lib/cpl/system/tcpip_properties.c - * PURPOSE: ReactOS Network Control Panel - * COPYRIGHT: Copyright 2004 Gero Kuehn (reactos.filter(a)gkware.com) - * Copyright 2006 Ge van Geldorp <gvg(a)reactos.org> - */ - -#include <assert.h> -#include <stdlib.h> -#include <stdio.h> -#include <stdarg.h> -#include <tchar.h> -#include <windows.h> -#include <iptypes.h> -#include <iphlpapi.h> -#include <commctrl.h> -#include <dhcpcapi.h> -#include <prsht.h> - - -#ifdef _MSC_VER -#include <cpl.h> -#endif - -#include "resource.h" -#include "ncpa.h" - -#include <wine/debug.h> -WINE_DEFAULT_DEBUG_CHANNEL(ncpa); - -typedef struct _TCPIP_PROPERTIES_DATA { - DWORD AdapterIndex; - char *AdapterName; - BOOL DhcpEnabled; - DWORD IpAddress; - DWORD SubnetMask; - DWORD Gateway; - DWORD Dns1; - DWORD Dns2; - BOOL OldDhcpEnabled; - DWORD OldIpAddress; - DWORD OldSubnetMask; - DWORD OldGateway; - DWORD OldDns1; - DWORD OldDns2; -} TCPIP_PROPERTIES_DATA, *PTCPIP_PROPERTIES_DATA; - -void InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc, LPARAM lParam); - -DWORD APIENTRY DhcpNotifyConfigChange(LPWSTR ServerName, LPWSTR AdapterName, - BOOL NewIpAddress, DWORD IpIndex, - DWORD IpAddress, DWORD SubnetMask, - int DhcpAction); - - -static void -ManualDNS(HWND Dlg, BOOL Enabled, UINT uCmd) { - PTCPIP_PROPERTIES_DATA DlgData = - (PTCPIP_PROPERTIES_DATA) GetWindowLongPtrW(Dlg, GWL_USERDATA); - - if (! DlgData->OldDhcpEnabled && - (uCmd == IDC_USEDHCP || uCmd == IDC_NODHCP)) { - if (INADDR_NONE != DlgData->OldIpAddress) { - SendDlgItemMessage(Dlg, IDC_IPADDR, IPM_SETADDRESS, 0, - ntohl(DlgData->OldIpAddress)); - } - if (INADDR_NONE != DlgData->OldSubnetMask) { - SendDlgItemMessage(Dlg, IDC_SUBNETMASK, IPM_SETADDRESS, 0, - ntohl(DlgData->OldSubnetMask)); - } - if (INADDR_NONE != DlgData->OldGateway) { - SendDlgItemMessage(Dlg, IDC_DEFGATEWAY, IPM_SETADDRESS, 0, - ntohl(DlgData->OldGateway)); - } - } - - if (INADDR_NONE != DlgData->OldDns1 && - (uCmd == IDC_FIXEDDNS || uCmd == IDC_AUTODNS || IDC_NODHCP)) { - SendDlgItemMessage(Dlg, IDC_DNS1, IPM_SETADDRESS, 0, - ntohl(DlgData->OldDns1)); - if (INADDR_NONE != DlgData->OldDns2) { - SendDlgItemMessage(Dlg, IDC_DNS2, IPM_SETADDRESS, 0, - ntohl(DlgData->OldDns2)); - } - } - - CheckDlgButton(Dlg, IDC_FIXEDDNS, - Enabled ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(Dlg, IDC_AUTODNS, - Enabled ? BST_UNCHECKED : BST_CHECKED); - EnableWindow(GetDlgItem(Dlg, IDC_DNS1), Enabled); - EnableWindow(GetDlgItem(Dlg, IDC_DNS2), FALSE/*Enabled*/); - if (! Enabled) { - SendDlgItemMessage(Dlg, IDC_DNS1, IPM_CLEARADDRESS, 0, 0); - SendDlgItemMessage(Dlg, IDC_DNS2, IPM_CLEARADDRESS, 0, 0); - - } -} - -static void -EnableDHCP(HWND Dlg, BOOL Enabled, UINT uCmd) { - CheckDlgButton(Dlg, IDC_USEDHCP, Enabled ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(Dlg, IDC_NODHCP, Enabled ? BST_UNCHECKED : BST_CHECKED); - EnableWindow(GetDlgItem(Dlg, IDC_IPADDR), ! Enabled); - EnableWindow(GetDlgItem(Dlg, IDC_SUBNETMASK), ! Enabled); - EnableWindow(GetDlgItem(Dlg, IDC_DEFGATEWAY), ! Enabled); - EnableWindow(GetDlgItem(Dlg, IDC_AUTODNS), Enabled); - if (Enabled) { - SendDlgItemMessage(Dlg, IDC_IPADDR, IPM_CLEARADDRESS, 0, 0); - SendDlgItemMessage(Dlg, IDC_SUBNETMASK, IPM_CLEARADDRESS, 0, 0); - SendDlgItemMessage(Dlg, IDC_DEFGATEWAY, IPM_CLEARADDRESS, 0, 0); - } else { - ManualDNS(Dlg, TRUE, uCmd); - } -} - -static void -ShowError(HWND Parent, UINT MsgId) -{ - WCHAR Error[32], Msg[64]; - - if (0 == LoadStringW((HINSTANCE) GetWindowLongPtrW(Parent, GWLP_HINSTANCE), - IDS_ERROR, Error, sizeof(Error) / sizeof(Error[0]))) { - wcscpy(Error, L"Error"); - } - if (0 == LoadStringW((HINSTANCE) GetWindowLongPtrW(Parent, GWLP_HINSTANCE), - MsgId, Msg, sizeof(Msg) / sizeof(Msg[0]))) { - wcscpy(Msg, L"Unknown error"); - } - ERR("%s\n", debugstr_w(Msg)); - MessageBoxW(Parent, Msg, Error, MB_OK | MB_ICONSTOP); -} - -static -BOOL GetAddressFromField( HWND hwndDlg, UINT CtlId, - DWORD *dwIPAddr, - const char **AddressString ) { - LRESULT lResult; - struct in_addr inIPAddr; - - *AddressString = NULL; - - lResult = SendMessage(GetDlgItem(hwndDlg, CtlId), IPM_GETADDRESS, 0, - (ULONG_PTR)dwIPAddr); - if( lResult != 4 ) return FALSE; - - *dwIPAddr = htonl(*dwIPAddr); - inIPAddr.s_addr = *dwIPAddr; - *AddressString = inet_ntoa(inIPAddr); - if( !*AddressString ) return FALSE; - - return TRUE; -} - -static BOOL -ValidateAndStore(HWND Dlg, PTCPIP_PROPERTIES_DATA DlgData) -{ - DWORD IpAddress; - MIB_IPFORWARDROW RowToAdd = { 0 }, RowToRem = { 0 }; - - DlgData->DhcpEnabled = (BST_CHECKED == - IsDlgButtonChecked(Dlg, IDC_USEDHCP)); - if (! DlgData->DhcpEnabled) { - DhcpReleaseIpAddressLease( DlgData->AdapterIndex ); - - if (4 != SendMessageW(GetDlgItem(Dlg, IDC_IPADDR), IPM_GETADDRESS, - 0, (LPARAM) &IpAddress)) { - ShowError(Dlg, IDS_ENTER_VALID_IPADDRESS); - SetFocus(GetDlgItem(Dlg, IDC_IPADDR)); - return FALSE; - } - DlgData->IpAddress = htonl(IpAddress); - if (4 != SendMessageW(GetDlgItem(Dlg, IDC_SUBNETMASK), IPM_GETADDRESS, - 0, (LPARAM) &IpAddress)) { - ShowError(Dlg, IDS_ENTER_VALID_SUBNET); - SetFocus(GetDlgItem(Dlg, IDC_SUBNETMASK)); - return FALSE; - } - DlgData->SubnetMask = htonl(IpAddress); - if (4 != SendMessageW(GetDlgItem(Dlg, IDC_DEFGATEWAY), IPM_GETADDRESS, - 0, (LPARAM) &IpAddress)) { - DlgData->Gateway = INADDR_NONE; - } else { - DlgData->Gateway = htonl(IpAddress); - } - DhcpStaticRefreshParams - ( DlgData->AdapterIndex, DlgData->IpAddress, DlgData->SubnetMask ); - - RowToRem.dwForwardMask = 0; - RowToRem.dwForwardMetric1 = 1; - RowToRem.dwForwardNextHop = DlgData->OldGateway; - - DeleteIpForwardEntry( &RowToRem ); - - RowToAdd.dwForwardMask = 0; - RowToAdd.dwForwardMetric1 = 1; - RowToAdd.dwForwardNextHop = DlgData->Gateway; - - CreateIpForwardEntry( &RowToAdd ); - assert(BST_CHECKED == IsDlgButtonChecked(Dlg, IDC_FIXEDDNS)); - } else { - DlgData->IpAddress = INADDR_NONE; - DlgData->SubnetMask = INADDR_NONE; - DlgData->Gateway = INADDR_NONE; - DhcpLeaseIpAddress( DlgData->AdapterIndex ); - } - - if (BST_CHECKED == IsDlgButtonChecked(Dlg, IDC_FIXEDDNS)) { - if (4 != SendMessageW(GetDlgItem(Dlg, IDC_DNS1), IPM_GETADDRESS, - 0, (LPARAM) &IpAddress)) { - DlgData->Dns1 = INADDR_NONE; - } else { - DlgData->Dns1 = htonl(IpAddress); - } - if (4 != SendMessageW(GetDlgItem(Dlg, IDC_DNS2), IPM_GETADDRESS, - 0, (LPARAM) &IpAddress)) { - DlgData->Dns2 = INADDR_NONE; - } else { - DlgData->Dns2 = htonl(IpAddress); - } - } else { - DlgData->Dns1 = INADDR_NONE; - DlgData->Dns2 = INADDR_NONE; - } - - return TRUE; -} - -static BOOL -InternTCPIPSettings(HWND Dlg, PTCPIP_PROPERTIES_DATA DlgData) { - /*BOOL Changed; - BOOL IpChanged; - int DhcpAction; - LPWSTR AdapterName;*/ - BOOL SetIpAddressByDhcp; - BOOL SetDnsByDhcp; - TCHAR pszRegKey[MAX_PATH]; - const char *AddressString; - char emptyString[]="\0"; - DWORD Address = 0; - LONG rc; - HKEY hKey = NULL; - BOOL ret = FALSE; - - if (! ValidateAndStore(Dlg, DlgData)) { - /* Should never happen, we should have validated at PSN_KILLACTIVE */ - assert(FALSE); - return FALSE; - } - - SetIpAddressByDhcp = IsDlgButtonChecked(Dlg, IDC_USEDHCP); - SetDnsByDhcp = IsDlgButtonChecked(Dlg, IDC_AUTODNS); - - /* Save parameters in HKLM\SYSTEM\CurrentControlSet\Services\{GUID}\Parameters\Tcpip */ - _stprintf(pszRegKey,_T("SYSTEM\\CurrentControlSet\\Services\\%S\\Parameters\\Tcpip"), DlgData->AdapterName); - rc = RegOpenKey(HKEY_LOCAL_MACHINE, pszRegKey, &hKey); - if (rc != ERROR_SUCCESS) - goto cleanup; - if (SetIpAddressByDhcp) - AddressString = "0.0.0.0"; - else if (!GetAddressFromField(Dlg, IDC_IPADDR, &Address, &AddressString)) - goto cleanup; - rc = RegSetValueExA(hKey, "IPAddress", 0, REG_SZ, (const BYTE*)AddressString, strlen(AddressString) + 1); - if (rc != ERROR_SUCCESS) - goto cleanup; - if (!SetIpAddressByDhcp && !GetAddressFromField(Dlg, IDC_SUBNETMASK, &Address, &AddressString)) - goto cleanup; - rc = RegSetValueExA(hKey, "SubnetMask", 0, REG_SZ, (const BYTE*)AddressString, strlen(AddressString) + 1); - if (rc != ERROR_SUCCESS) - goto cleanup; - if (!SetIpAddressByDhcp && !GetAddressFromField(Dlg, IDC_DEFGATEWAY, &Address, &AddressString)) - goto cleanup; - rc = RegSetValueExA(hKey, "DefaultGateway", 0, REG_SZ, (const BYTE*)AddressString, strlen(AddressString) + 1); - if (rc != ERROR_SUCCESS) - goto cleanup; - RegCloseKey(hKey); - - /* Save parameters in HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters */ - rc = RegOpenKey(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters"), &hKey); - if (rc != ERROR_SUCCESS) - goto cleanup; - if (DlgData->Dns1 == INADDR_NONE) - { - rc = RegSetValueExA(hKey, "NameServer",0, REG_SZ, (const BYTE*)emptyString, strlen(emptyString) + 1); - if (rc != ERROR_SUCCESS && rc != ERROR_FILE_NOT_FOUND) - goto cleanup; - } - else - { - if (!GetAddressFromField(Dlg, IDC_DNS1, &Address, &AddressString)) - goto cleanup; - rc = RegSetValueExA(hKey, "NameServer", 0, REG_SZ, (const BYTE*)AddressString, strlen(AddressString) + 1); - if (rc != ERROR_SUCCESS) - goto cleanup; - } - - ret = TRUE; - -cleanup: - if (hKey != NULL) - RegCloseKey(hKey); - return ret; -#if 0 - Changed = FALSE; - if (DlgData->DhcpEnabled) { - Changed = ! DlgData->OldDhcpEnabled; - IpChanged = FALSE; - DhcpAction = 1; - } else { - Changed = DlgData->OldDhcpEnabled || - DlgData->IpAddress != DlgData->OldIpAddress || - DlgData->SubnetMask != DlgData->OldSubnetMask; - IpChanged = DlgData->OldDhcpEnabled || - DlgData->IpAddress != DlgData->OldIpAddress; - DhcpAction = 2; - } - - if (Changed) { - AdapterName = HeapAlloc(GetProcessHeap(), 0, - (strlen(DlgData->AdapterName) + 1) * - sizeof(WCHAR)); - if (NULL == AdapterName) { - ShowError(Dlg, IDS_OUT_OF_MEMORY); - return FALSE; - } - MultiByteToWideChar(CP_THREAD_ACP, 0, DlgData->AdapterName, -1, - AdapterName, strlen(DlgData->AdapterName) + 1); - if (0 == DhcpNotifyConfigChange(NULL, AdapterName, IpChanged, - DlgData->AdapterIndex, - DlgData->IpAddress, - DlgData->SubnetMask, DhcpAction)) { - HeapFree(GetProcessHeap(), 0, AdapterName); - ShowError(Dlg, IDS_CANNOT_SAVE_CHANGES); - return FALSE; - } - HeapFree(GetProcessHeap(), 0, AdapterName); - } - - /* FIXME Save default gateway and DNS entries */ - return TRUE; -#endif -} - -static INT_PTR CALLBACK -TCPIPPropertyPageProc(HWND Dlg, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - LPPROPSHEETPAGEW Page; - PTCPIP_PROPERTIES_DATA DlgData; - LPNMHDR Nmhdr; - - DlgData = (PTCPIP_PROPERTIES_DATA) GetWindowLongPtrW(Dlg, GWL_USERDATA); - switch(uMsg) { - case WM_INITDIALOG: - Page = (LPPROPSHEETPAGEW) lParam; - DlgData = (PTCPIP_PROPERTIES_DATA) Page->lParam; - SetWindowLongPtrW(Dlg, GWL_USERDATA, Page->lParam); - - EnableWindow(GetDlgItem(Dlg, IDC_ADVANCED), FALSE); - - EnableDHCP(Dlg, DlgData->OldDhcpEnabled, 0); - - if (! DlgData->OldDhcpEnabled) - { - if (INADDR_NONE != DlgData->OldIpAddress) { - SendDlgItemMessage(Dlg, IDC_IPADDR, IPM_SETADDRESS, 0, - ntohl(DlgData->OldIpAddress)); - } - if (INADDR_NONE != DlgData->OldSubnetMask) { - SendDlgItemMessage(Dlg, IDC_SUBNETMASK, IPM_SETADDRESS, 0, - ntohl(DlgData->OldSubnetMask)); - } - if (INADDR_NONE != DlgData->OldGateway) { - SendDlgItemMessage(Dlg, IDC_DEFGATEWAY, IPM_SETADDRESS, 0, - ntohl(DlgData->OldGateway)); - } - } - - if (INADDR_NONE != DlgData->OldDns1) { - SendDlgItemMessage(Dlg, IDC_DNS1, IPM_SETADDRESS, 0, - ntohl(DlgData->OldDns1)); - if (INADDR_NONE != DlgData->OldDns2) { - SendDlgItemMessage(Dlg, IDC_DNS2, IPM_SETADDRESS, 0, - ntohl(DlgData->OldDns2)); - } - } - - if (DlgData->OldDhcpEnabled) - { - ManualDNS(Dlg, INADDR_NONE != DlgData->OldDns1, 0); - } - - break; - - case WM_COMMAND: - switch(LOWORD(wParam)) { - case IDC_FIXEDDNS: - ManualDNS(Dlg, TRUE, LOWORD(wParam)); - return TRUE; - - case IDC_AUTODNS: - ManualDNS(Dlg, FALSE, LOWORD(wParam)); - return TRUE; - - case IDC_USEDHCP: - EnableDHCP(Dlg, TRUE, LOWORD(wParam)); - return TRUE; - - case IDC_NODHCP: - EnableDHCP(Dlg, FALSE, LOWORD(wParam)); - return TRUE; - } - break; - - case WM_NOTIFY: - Nmhdr = (LPNMHDR) lParam; - - switch(Nmhdr->code) { - case PSN_KILLACTIVE: - /* Do validation here, must set FALSE to continue */ - SetWindowLongPtrW(Dlg, DWL_MSGRESULT, - (LONG_PTR) ! ValidateAndStore(Dlg, DlgData)); - return TRUE; - - case PSN_APPLY: - /* Set the IP Address and DNS Information so we won't - * be doing all this for nothing */ - SetWindowLongPtrW(Dlg, DWL_MSGRESULT, - InternTCPIPSettings(Dlg, DlgData) ? - PSNRET_NOERROR : PSNRET_INVALID); - return TRUE; - } - break; - } - - return FALSE; -} - -static BOOL -LoadDataFromInfo(PTCPIP_PROPERTIES_DATA DlgData, IP_ADAPTER_INFO *Info) -{ - IP_ADDR_STRING *pString; - WCHAR RegKey[MAX_PATH]; - HKEY hKey; - char Dns[MAX_PATH]; - DWORD Size; - DWORD Type; - DWORD dwError; - char *NextDnsServer; - - DlgData->AdapterName = Info->AdapterName; - DlgData->AdapterIndex = Info->Index; - - DlgData->OldDhcpEnabled = Info->DhcpEnabled; - - pString = &Info->IpAddressList; - while (NULL != pString->Next) { - pString = pString->Next; - } - DlgData->OldIpAddress = inet_addr(pString->IpAddress.String); - DlgData->OldSubnetMask = inet_addr(pString->IpMask.String); - pString = &Info->GatewayList; - while (NULL != pString->Next) { - pString = pString->Next; - } - DlgData->OldGateway = inet_addr(pString->IpAddress.String); - - DlgData->OldDns1 = INADDR_NONE; - DlgData->OldDns2 = INADDR_NONE; - swprintf(RegKey, - L"SYSTEM\\CurrentControlSet\\Services\\TCPIP\\Parameters\\Interfaces\\%S", - Info->AdapterName); - dwError = RegOpenKeyW(HKEY_LOCAL_MACHINE, RegKey, &hKey); - if (dwError != ERROR_SUCCESS) - { - /* Try and fall back on the NameServer in Parameters */ - swprintf(RegKey, - L"SYSTEM\\CurrentControlSet\\Services\\TCPIP\\Parameters\\"); - } - dwError = RegOpenKeyW(HKEY_LOCAL_MACHINE, RegKey, &hKey); - if (ERROR_SUCCESS == dwError) { - Size = sizeof(Dns); - RegQueryValueExA(hKey, "NameServer", NULL, &Type, (BYTE *)Dns, - &Size); - RegCloseKey(hKey); - - if ('\0' != Dns[0]) { - DlgData->OldDns1 = inet_addr(Dns); - NextDnsServer = strchr(Dns, ','); - if (NULL != NextDnsServer && '\0' != *NextDnsServer) { - DlgData->OldDns2 = inet_addr(NextDnsServer); - } - } - } - - return TRUE; -} - -void -DisplayTCPIPProperties(HWND hParent, IP_ADAPTER_INFO *pInfo) -{ - PROPSHEETPAGEW psp[1]; - PROPSHEETHEADERW psh; - INITCOMMONCONTROLSEX cce; - TCPIP_PROPERTIES_DATA DlgData; - LPTSTR tpszCaption = NULL; - INT StrLen; - - HWND hListBox = GetDlgItem(hParent, IDC_COMPONENTSLIST); - int iListBoxIndex = (int) SendMessage(hListBox, LB_GETCURSEL, 0, 0); - - if(iListBoxIndex != LB_ERR) - { - StrLen = SendMessage(hListBox, LB_GETTEXTLEN, iListBoxIndex, 0); - - if (StrLen != LB_ERR) - { - TCHAR suffix[] = _T(" Properties"); - INT HeapSize = ((StrLen + 1) + (_tcslen(suffix) + 1)) * sizeof(TCHAR); - tpszCaption = (LPTSTR)HeapAlloc(GetProcessHeap(), 0, HeapSize); - SendMessage(hListBox, LB_GETTEXT, iListBoxIndex, (LPARAM)tpszCaption); - _tcscat(tpszCaption, suffix); - } - } - - if (! LoadDataFromInfo(&DlgData, pInfo)) - { - ShowError(hParent, IDS_CANNOT_LOAD_CONFIG); - return; - } - - cce.dwSize = sizeof(INITCOMMONCONTROLSEX); - cce.dwICC = ICC_INTERNET_CLASSES; - InitCommonControlsEx(&cce); - - ZeroMemory(&psh, sizeof(PROPSHEETHEADER)); - psh.dwSize = sizeof(PROPSHEETHEADER); - psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW; - psh.hwndParent = hParent; - psh.hInstance = hApplet; - psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDI_CPLSYSTEM)); - psh.pszCaption = tpszCaption; - psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE); - psh.nStartPage = 0; - psh.ppsp = psp; - psh.pfnCallback = NULL; - - InitPropSheetPage(&psp[0], IDD_TCPIPPROPERTIES, TCPIPPropertyPageProc, (LPARAM) &DlgData); - - if (PropertySheetW(&psh) == -1) - { - ShowError(hParent, IDS_CANNOT_CREATE_PROPSHEET); - } - - if (tpszCaption != NULL) - HeapFree(GetProcessHeap(), 0, tpszCaption); - - return; -}
16 years, 2 months
1
0
0
0
[tkreuzer] 36789: Win32 structure cleanup part 3 / x: - rename DESKTOP_OBJECT to DESKTOP
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Fri Oct 17 08:09:56 2008 New Revision: 36789 URL:
http://svn.reactos.org/svn/reactos?rev=36789&view=rev
Log: Win32 structure cleanup part 3 / x: - rename DESKTOP_OBJECT to DESKTOP Modified: trunk/reactos/subsystems/win32/win32k/include/desktop.h trunk/reactos/subsystems/win32/win32k/include/msgqueue.h trunk/reactos/subsystems/win32/win32k/include/win32.h trunk/reactos/subsystems/win32/win32k/include/winsta.h trunk/reactos/subsystems/win32/win32k/main/dllmain.c trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c trunk/reactos/subsystems/win32/win32k/ntuser/misc.c trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c trunk/reactos/subsystems/win32/win32k/ntuser/painting.c trunk/reactos/subsystems/win32/win32k/ntuser/sysparams.c trunk/reactos/subsystems/win32/win32k/ntuser/window.c trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c Modified: trunk/reactos/subsystems/win32/win32k/include/desktop.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/desktop.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/desktop.h [iso-8859-1] Fri Oct 17 08:09:56 2008 @@ -4,7 +4,7 @@ #include "msgqueue.h" #include "window.h" -typedef struct _DESKTOP_OBJECT +typedef struct _DESKTOP { CSHORT Type; CSHORT Size; @@ -26,9 +26,9 @@ HANDLE hDesktopHeap; PSECTION_OBJECT DesktopHeapSection; PDESKTOPINFO DesktopInfo; -} DESKTOP_OBJECT, *PDESKTOP_OBJECT; - -extern PDESKTOP_OBJECT InputDesktop; +} DESKTOP, *PDESKTOP; + +extern PDESKTOP InputDesktop; extern HDESK InputDesktopHandle; extern PWINDOWCLASS DesktopWindowClass; extern HDC ScreenDeviceContext; @@ -63,7 +63,7 @@ IntDesktopObjectDelete(PWIN32_DELETEMETHOD_PARAMETERS Parameters); VOID FASTCALL -IntGetDesktopWorkArea(PDESKTOP_OBJECT Desktop, PRECT Rect); +IntGetDesktopWorkArea(PDESKTOP Desktop, PRECT Rect); LRESULT CALLBACK IntDesktopWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); @@ -86,19 +86,19 @@ VOID FASTCALL IntSetFocusMessageQueue(PUSER_MESSAGE_QUEUE NewQueue); -PDESKTOP_OBJECT FASTCALL +PDESKTOP FASTCALL IntGetActiveDesktop(VOID); NTSTATUS FASTCALL -co_IntShowDesktop(PDESKTOP_OBJECT Desktop, ULONG Width, ULONG Height); - -NTSTATUS FASTCALL -IntHideDesktop(PDESKTOP_OBJECT Desktop); +co_IntShowDesktop(PDESKTOP Desktop, ULONG Width, ULONG Height); + +NTSTATUS FASTCALL +IntHideDesktop(PDESKTOP Desktop); HDESK FASTCALL -IntGetDesktopObjectHandle(PDESKTOP_OBJECT DesktopObject); - -BOOL IntSetThreadDesktop(IN PDESKTOP_OBJECT DesktopObject, +IntGetDesktopObjectHandle(PDESKTOP DesktopObject); + +BOOL IntSetThreadDesktop(IN PDESKTOP DesktopObject, IN BOOL FreeOnFailure); NTSTATUS FASTCALL @@ -106,7 +106,7 @@ HDESK Desktop, KPROCESSOR_MODE AccessMode, ACCESS_MASK DesiredAccess, - PDESKTOP_OBJECT *Object); + PDESKTOP *Object); NTSTATUS FASTCALL IntParseDesktopPath(PEPROCESS Process, Modified: trunk/reactos/subsystems/win32/win32k/include/msgqueue.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/msgqueue.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/msgqueue.h [iso-8859-1] Fri Oct 17 08:09:56 2008 @@ -116,7 +116,7 @@ LIST_ENTRY LocalDispatchingMessagesHead; /* Desktop that the message queue is attached to */ - struct _DESKTOP_OBJECT *Desktop; + struct _DESKTOP *Desktop; } USER_MESSAGE_QUEUE, *PUSER_MESSAGE_QUEUE; BOOL FASTCALL Modified: trunk/reactos/subsystems/win32/win32k/include/win32.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/win32.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/win32.h [iso-8859-1] Fri Oct 17 08:09:56 2008 @@ -32,7 +32,7 @@ LIST_ENTRY WindowListHead; LIST_ENTRY W32CallbackListHead; struct _KBL* KeyboardLayout; - struct _DESKTOP_OBJECT* Desktop; + struct _DESKTOP* Desktop; HANDLE hDesktop; BOOLEAN IsExiting; SINGLE_LIST_ENTRY ReferencesList; Modified: trunk/reactos/subsystems/win32/win32k/include/winsta.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/winsta.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/winsta.h [iso-8859-1] Fri Oct 17 08:09:56 2008 @@ -47,7 +47,7 @@ WALLPAPER_MODE WallpaperMode; ULONG Flags; - struct _DESKTOP_OBJECT* ActiveDesktop; + struct _DESKTOP* ActiveDesktop; PCLIPBOARDSYSTEM Clipboard; DWORD ClipboardSequenceNumber; Modified: trunk/reactos/subsystems/win32/win32k/main/dllmain.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ma…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/main/dllmain.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/main/dllmain.c [iso-8859-1] Fri Oct 17 08:09:56 2008 @@ -243,7 +243,7 @@ if (hDesk != NULL) { - PDESKTOP_OBJECT DesktopObject; + PDESKTOP DesktopObject; Win32Thread->Desktop = NULL; Status = ObReferenceObjectByHandle(hDesk, 0, Modified: trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1] Fri Oct 17 08:09:56 2008 @@ -41,13 +41,13 @@ static VOID IntFreeDesktopHeap( - IN OUT PDESKTOP_OBJECT Desktop + IN OUT PDESKTOP Desktop ); /* GLOBALS *******************************************************************/ /* Currently active desktop */ -PDESKTOP_OBJECT InputDesktop = NULL; +PDESKTOP InputDesktop = NULL; HDESK InputDesktopHandle = NULL; HDC ScreenDeviceContext = NULL; BOOL g_PaintDesktopVersion = FALSE; @@ -90,7 +90,7 @@ OUT PVOID *Object) { NTSTATUS Status; - PDESKTOP_OBJECT Desktop; + PDESKTOP Desktop; OBJECT_ATTRIBUTES ObjectAttributes; PLIST_ENTRY NextEntry, ListHead; PWINSTATION_OBJECT WinStaObject = (PWINSTATION_OBJECT)ParseObject; @@ -102,7 +102,7 @@ while (NextEntry != ListHead) { /* Get the current desktop */ - Desktop = CONTAINING_RECORD(NextEntry, DESKTOP_OBJECT, ListEntry); + Desktop = CONTAINING_RECORD(NextEntry, DESKTOP, ListEntry); /* Get its name */ DesktopName = GET_DESKTOP_NAME(Desktop); @@ -155,7 +155,7 @@ &ObjectAttributes, KernelMode, NULL, - sizeof(DESKTOP_OBJECT), + sizeof(DESKTOP), 0, 0, (PVOID)&Desktop); @@ -177,7 +177,7 @@ VOID STDCALL IntDesktopObjectDelete(PWIN32_DELETEMETHOD_PARAMETERS Parameters) { - PDESKTOP_OBJECT Desktop = (PDESKTOP_OBJECT)Parameters->Object; + PDESKTOP Desktop = (PDESKTOP)Parameters->Object; DPRINT("Deleting desktop (0x%X)\n", Desktop); @@ -194,7 +194,7 @@ InitDesktopImpl(VOID) { /* Set Desktop Object Attributes */ - ExDesktopObjectType->TypeInfo.DefaultNonPagedPoolCharge = sizeof(DESKTOP_OBJECT); + ExDesktopObjectType->TypeInfo.DefaultNonPagedPoolCharge = sizeof(DESKTOP); ExDesktopObjectType->TypeInfo.GenericMapping = IntDesktopMapping; return STATUS_SUCCESS; } @@ -420,7 +420,7 @@ HDESK Desktop, KPROCESSOR_MODE AccessMode, ACCESS_MASK DesiredAccess, - PDESKTOP_OBJECT *Object) + PDESKTOP *Object) { NTSTATUS Status; @@ -439,7 +439,7 @@ } VOID FASTCALL -IntGetDesktopWorkArea(PDESKTOP_OBJECT Desktop, PRECT Rect) +IntGetDesktopWorkArea(PDESKTOP Desktop, PRECT Rect) { PRECT Ret; @@ -468,7 +468,7 @@ } } -PDESKTOP_OBJECT FASTCALL +PDESKTOP FASTCALL IntGetActiveDesktop(VOID) { return InputDesktop; @@ -478,7 +478,7 @@ * returns or creates a handle to the desktop object */ HDESK FASTCALL -IntGetDesktopObjectHandle(PDESKTOP_OBJECT DesktopObject) +IntGetDesktopObjectHandle(PDESKTOP DesktopObject) { NTSTATUS Status; HDESK Ret; @@ -516,7 +516,7 @@ PUSER_MESSAGE_QUEUE FASTCALL IntGetFocusMessageQueue(VOID) { - PDESKTOP_OBJECT pdo = IntGetActiveDesktop(); + PDESKTOP pdo = IntGetActiveDesktop(); if (!pdo) { DPRINT("No active desktop\n"); @@ -529,7 +529,7 @@ IntSetFocusMessageQueue(PUSER_MESSAGE_QUEUE NewQueue) { PUSER_MESSAGE_QUEUE Old; - PDESKTOP_OBJECT pdo = IntGetActiveDesktop(); + PDESKTOP pdo = IntGetActiveDesktop(); if (!pdo) { DPRINT("No active desktop\n"); @@ -555,7 +555,7 @@ HWND FASTCALL IntGetDesktopWindow(VOID) { - PDESKTOP_OBJECT pdo = IntGetActiveDesktop(); + PDESKTOP pdo = IntGetActiveDesktop(); if (!pdo) { DPRINT("No active desktop\n"); @@ -566,7 +566,7 @@ PWINDOW_OBJECT FASTCALL UserGetDesktopWindow(VOID) { - PDESKTOP_OBJECT pdo = IntGetActiveDesktop(); + PDESKTOP pdo = IntGetActiveDesktop(); if (!pdo) { @@ -581,7 +581,7 @@ HWND FASTCALL IntGetCurrentThreadDesktopWindow(VOID) { PTHREADINFO pti = PsGetCurrentThreadWin32Thread(); - PDESKTOP_OBJECT pdo = pti->Desktop; + PDESKTOP pdo = pti->Desktop; if (NULL == pdo) { DPRINT1("Thread doesn't have a desktop\n"); @@ -648,7 +648,7 @@ NTSTATUS FASTCALL -co_IntShowDesktop(PDESKTOP_OBJECT Desktop, ULONG Width, ULONG Height) +co_IntShowDesktop(PDESKTOP Desktop, ULONG Width, ULONG Height) { CSR_API_MESSAGE Request; @@ -661,7 +661,7 @@ } NTSTATUS FASTCALL -IntHideDesktop(PDESKTOP_OBJECT Desktop) +IntHideDesktop(PDESKTOP Desktop) { #if 0 CSRSS_API_REQUEST Request; @@ -693,7 +693,7 @@ static HWND* FASTCALL -UserBuildShellHookHwndList(PDESKTOP_OBJECT Desktop) +UserBuildShellHookHwndList(PDESKTOP Desktop) { ULONG entries=0; PSHELL_HOOK_WINDOW Current; @@ -726,7 +726,7 @@ */ VOID co_IntShellHookNotify(WPARAM Message, LPARAM lParam) { - PDESKTOP_OBJECT Desktop = IntGetActiveDesktop(); + PDESKTOP Desktop = IntGetActiveDesktop(); HWND* HwndList; static UINT MsgType = 0; @@ -784,7 +784,7 @@ BOOL IntRegisterShellHookWindow(HWND hWnd) { PTHREADINFO pti = PsGetCurrentThreadWin32Thread(); - PDESKTOP_OBJECT Desktop = pti->Desktop; + PDESKTOP Desktop = pti->Desktop; PSHELL_HOOK_WINDOW Entry; DPRINT("IntRegisterShellHookWindow\n"); @@ -816,7 +816,7 @@ BOOL IntDeRegisterShellHookWindow(HWND hWnd) { PTHREADINFO pti = PsGetCurrentThreadWin32Thread(); - PDESKTOP_OBJECT Desktop = pti->Desktop; + PDESKTOP Desktop = pti->Desktop; PSHELL_HOOK_WINDOW Current; LIST_FOR_EACH(Current, &Desktop->ShellHookWindows, SHELL_HOOK_WINDOW, ListEntry) @@ -833,7 +833,7 @@ } static VOID -IntFreeDesktopHeap(IN OUT PDESKTOP_OBJECT Desktop) +IntFreeDesktopHeap(IN OUT PDESKTOP Desktop) { if (Desktop->DesktopHeapSection != NULL) { @@ -886,7 +886,7 @@ { OBJECT_ATTRIBUTES ObjectAttributes; PWINSTATION_OBJECT WinStaObject; - PDESKTOP_OBJECT DesktopObject; + PDESKTOP DesktopObject; UNICODE_STRING DesktopName; NTSTATUS Status; HDESK Desktop; @@ -1219,7 +1219,7 @@ BOOL fInherit, ACCESS_MASK dwDesiredAccess) { - PDESKTOP_OBJECT Object; + PDESKTOP Object; NTSTATUS Status; HDESK Desktop; DECLARE_RETURN(HDESK); @@ -1296,7 +1296,7 @@ BOOL STDCALL NtUserCloseDesktop(HDESK hDesktop) { - PDESKTOP_OBJECT Object; + PDESKTOP Object; NTSTATUS Status; DECLARE_RETURN(BOOL); @@ -1571,7 +1571,7 @@ BOOL STDCALL NtUserSwitchDesktop(HDESK hDesktop) { - PDESKTOP_OBJECT DesktopObject; + PDESKTOP DesktopObject; NTSTATUS Status; DECLARE_RETURN(BOOL); @@ -1653,7 +1653,7 @@ { NTSTATUS Status; PETHREAD Thread; - PDESKTOP_OBJECT DesktopObject; + PDESKTOP DesktopObject; HDESK Ret, hThreadDesktop; OBJECT_HANDLE_INFORMATION HandleInformation; DECLARE_RETURN(HDESK); @@ -1728,7 +1728,7 @@ } static NTSTATUS -IntUnmapDesktopView(IN PDESKTOP_OBJECT DesktopObject) +IntUnmapDesktopView(IN PDESKTOP DesktopObject) { PW32THREADINFO ti; PW32HEAP_USER_MAPPING HeapMapping, *PrevLink = &PsGetCurrentProcessWin32Process()->HeapMappings.Next; @@ -1776,7 +1776,7 @@ } static NTSTATUS -IntMapDesktopView(IN PDESKTOP_OBJECT DesktopObject) +IntMapDesktopView(IN PDESKTOP DesktopObject) { PW32THREADINFO ti; PW32HEAP_USER_MAPPING HeapMapping, *PrevLink = &PsGetCurrentProcessWin32Process()->HeapMappings.Next; @@ -1854,10 +1854,10 @@ } BOOL -IntSetThreadDesktop(IN PDESKTOP_OBJECT DesktopObject, +IntSetThreadDesktop(IN PDESKTOP DesktopObject, IN BOOL FreeOnFailure) { - PDESKTOP_OBJECT OldDesktop; + PDESKTOP OldDesktop; PTHREADINFO W32Thread; NTSTATUS Status; BOOL MapHeap; @@ -1942,7 +1942,7 @@ BOOL STDCALL NtUserSetThreadDesktop(HDESK hDesktop) { - PDESKTOP_OBJECT DesktopObject; + PDESKTOP DesktopObject; NTSTATUS Status; DECLARE_RETURN(BOOL); Modified: trunk/reactos/subsystems/win32/win32k/ntuser/misc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/misc.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/misc.c [iso-8859-1] Fri Oct 17 08:09:56 2008 @@ -101,7 +101,7 @@ NTSTATUS Status; PTHRDCARETINFO CaretInfo; GUITHREADINFO SafeGui; - PDESKTOP_OBJECT Desktop; + PDESKTOP Desktop; PUSER_MESSAGE_QUEUE MsgQueue; PETHREAD Thread = NULL; DECLARE_RETURN(BOOLEAN); Modified: trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] Fri Oct 17 08:09:56 2008 @@ -1575,7 +1575,7 @@ VOID FASTCALL MsqDestroyMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue) { - PDESKTOP_OBJECT desk; + PDESKTOP desk; /* remove the message queue from any desktops */ if ((desk = InterlockedExchangePointer((PVOID*)&MessageQueue->Desktop, 0))) Modified: trunk/reactos/subsystems/win32/win32k/ntuser/painting.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/painting.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/painting.c [iso-8859-1] Fri Oct 17 08:09:56 2008 @@ -714,7 +714,7 @@ HWND FASTCALL co_IntFixCaret(PWINDOW_OBJECT Window, LPRECT lprc, UINT flags) { - PDESKTOP_OBJECT Desktop; + PDESKTOP Desktop; PTHRDCARETINFO CaretInfo; HWND hWndCaret; PWINDOW_OBJECT WndCaret; Modified: trunk/reactos/subsystems/win32/win32k/ntuser/sysparams.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/sysparams.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/sysparams.c [iso-8859-1] Fri Oct 17 08:09:56 2008 @@ -466,7 +466,7 @@ { RECT *rc; PTHREADINFO pti = PsGetCurrentThreadWin32Thread(); - PDESKTOP_OBJECT Desktop = pti->Desktop; + PDESKTOP Desktop = pti->Desktop; if(!Desktop) { @@ -484,7 +484,7 @@ case SPI_GETWORKAREA: { PTHREADINFO pti = PsGetCurrentThreadWin32Thread(); - PDESKTOP_OBJECT Desktop = pti->Desktop; + PDESKTOP Desktop = pti->Desktop; if(!Desktop) { Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] Fri Oct 17 08:09:56 2008 @@ -753,7 +753,7 @@ IntGetFocusWindow(VOID) { PUSER_MESSAGE_QUEUE Queue; - PDESKTOP_OBJECT pdo = IntGetActiveDesktop(); + PDESKTOP pdo = IntGetActiveDesktop(); if( !pdo ) return NULL; @@ -1229,7 +1229,7 @@ if (hwndParent || !dwThreadId) { - PDESKTOP_OBJECT Desktop; + PDESKTOP Desktop; PWINDOW_OBJECT Parent, Window; if(!hwndParent) Modified: trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c [iso-8859-1] Fri Oct 17 08:09:56 2008 @@ -258,7 +258,7 @@ { RECT WorkArea; PTHREADINFO pti = PsGetCurrentThreadWin32Thread(); - PDESKTOP_OBJECT Desktop = pti->Desktop; /* Or rather get it from the window? */ + PDESKTOP Desktop = pti->Desktop; /* Or rather get it from the window? */ Parent = Window->Parent; if(Parent) @@ -403,7 +403,7 @@ UINT XInc, YInc; RECT WorkArea; PTHREADINFO pti = PsGetCurrentThreadWin32Thread(); - PDESKTOP_OBJECT Desktop = pti->Desktop; /* Or rather get it from the window? */ + PDESKTOP Desktop = pti->Desktop; /* Or rather get it from the window? */ IntGetDesktopWorkArea(Desktop, &WorkArea); Modified: trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c [iso-8859-1] Fri Oct 17 08:09:56 2008 @@ -755,7 +755,7 @@ PDWORD nLengthNeeded) { PWINSTATION_OBJECT WinStaObject = NULL; - PDESKTOP_OBJECT DesktopObject = NULL; + PDESKTOP DesktopObject = NULL; NTSTATUS Status; PVOID pvData = NULL; DWORD nDataSize = 0; @@ -1367,7 +1367,7 @@ PWINSTATION_OBJECT WindowStation; KIRQL OldLevel; PLIST_ENTRY DesktopEntry; - PDESKTOP_OBJECT DesktopObject; + PDESKTOP DesktopObject; DWORD EntryCount; ULONG ReturnLength; WCHAR NullWchar; @@ -1392,7 +1392,7 @@ DesktopEntry != &WindowStation->DesktopListHead; DesktopEntry = DesktopEntry->Flink) { - DesktopObject = CONTAINING_RECORD(DesktopEntry, DESKTOP_OBJECT, ListEntry); + DesktopObject = CONTAINING_RECORD(DesktopEntry, DESKTOP, ListEntry); ReturnLength += ((PUNICODE_STRING)GET_DESKTOP_NAME(DesktopObject))->Length + sizeof(WCHAR); EntryCount++; } @@ -1435,7 +1435,7 @@ DesktopEntry != &WindowStation->DesktopListHead; DesktopEntry = DesktopEntry->Flink) { - DesktopObject = CONTAINING_RECORD(DesktopEntry, DESKTOP_OBJECT, ListEntry); + DesktopObject = CONTAINING_RECORD(DesktopEntry, DESKTOP, ListEntry); Status = MmCopyToCaller(lpBuffer, ((PUNICODE_STRING)GET_DESKTOP_NAME(DesktopObject))->Buffer, ((PUNICODE_STRING)GET_DESKTOP_NAME(DesktopObject))->Length); if (! NT_SUCCESS(Status)) {
16 years, 2 months
1
0
0
0
[tkreuzer] 36788: Fix GetAppCompatFlags to use Teb->ClientInfo instead of Teb->Win32ThreadInfo, which should be a kernel pointer.
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Fri Oct 17 06:18:57 2008 New Revision: 36788 URL:
http://svn.reactos.org/svn/reactos?rev=36788&view=rev
Log: Fix GetAppCompatFlags to use Teb->ClientInfo instead of Teb->Win32ThreadInfo, which should be a kernel pointer. Modified: trunk/reactos/dll/win32/user32/misc/stubs.c Modified: trunk/reactos/dll/win32/user32/misc/stubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/stub…
============================================================================== --- trunk/reactos/dll/win32/user32/misc/stubs.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/misc/stubs.c [iso-8859-1] Fri Oct 17 06:18:57 2008 @@ -109,12 +109,9 @@ STDCALL GetAppCompatFlags(HTASK hTask) { - PW32THREADINFO ti = GetW32ThreadInfo(); - - /* If there is no threadinfo (?!), then return 0 */ - if (!ti) return 0; - - return ti->AppCompatFlags; + PCLIENTINFO pci = GetWin32ClientInfo(); + + return pci->dwCompatFlags; } /* @@ -124,12 +121,9 @@ STDCALL GetAppCompatFlags2(HTASK hTask) { - PW32THREADINFO ti = GetW32ThreadInfo(); - - /* If there is no threadinfo (?!), then return 0 */ - if (!ti) return 0; - - return ti->AppCompatFlags2; + PCLIENTINFO pci = GetWin32ClientInfo(); + + return pci->dwCompatFlags2; } /*
16 years, 2 months
1
0
0
0
[cgutman] 36787: - Merge aicom-network-fixes up to r36785
by cgutman@svn.reactos.org
Author: cgutman Date: Fri Oct 17 05:42:44 2008 New Revision: 36787 URL:
http://svn.reactos.org/svn/reactos?rev=36787&view=rev
Log: - Merge aicom-network-fixes up to r36785 Modified: trunk/reactos/drivers/network/tcpip/tcpip/main.c trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c Modified: trunk/reactos/drivers/network/tcpip/tcpip/main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
============================================================================== --- trunk/reactos/drivers/network/tcpip/tcpip/main.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/tcpip/main.c [iso-8859-1] Fri Oct 17 05:42:44 2008 @@ -783,6 +783,7 @@ /* Initialize transport level protocol subsystems */ Status = RawIPStartup(); if( !NT_SUCCESS(Status) ) { + IPShutdown(); ChewShutdown(); IoDeleteDevice(IPDeviceObject); IoDeleteDevice(RawIPDeviceObject); @@ -791,12 +792,13 @@ ExFreePool(EntityList); NdisFreePacketPool(GlobalPacketPool); NdisFreeBufferPool(GlobalBufferPool); - IPShutdown(); return Status; } Status = UDPStartup(); if( !NT_SUCCESS(Status) ) { + RawIPShutdown(); + IPShutdown(); ChewShutdown(); IoDeleteDevice(IPDeviceObject); IoDeleteDevice(RawIPDeviceObject); @@ -805,13 +807,14 @@ ExFreePool(EntityList); NdisFreePacketPool(GlobalPacketPool); NdisFreeBufferPool(GlobalBufferPool); - IPShutdown(); - RawIPShutdown(); return Status; } Status = TCPStartup(); if( !NT_SUCCESS(Status) ) { + UDPShutdown(); + RawIPShutdown(); + IPShutdown(); ChewShutdown(); IoDeleteDevice(IPDeviceObject); IoDeleteDevice(RawIPDeviceObject); @@ -820,9 +823,6 @@ ExFreePool(EntityList); NdisFreePacketPool(GlobalPacketPool); NdisFreeBufferPool(GlobalBufferPool); - IPShutdown(); - RawIPShutdown(); - UDPShutdown(); return Status; } @@ -842,6 +842,11 @@ NULL, 0, NULL); + LANShutdown(); + TCPShutdown(); + UDPShutdown(); + RawIPShutdown(); + IPShutdown(); ChewShutdown(); IoDeleteDevice(IPDeviceObject); IoDeleteDevice(RawIPDeviceObject); @@ -850,11 +855,6 @@ ExFreePool(EntityList); NdisFreePacketPool(GlobalPacketPool); NdisFreeBufferPool(GlobalBufferPool); - IPShutdown(); - RawIPShutdown(); - UDPShutdown(); - TCPShutdown(); - LANShutdown(); return Status; } @@ -862,6 +862,11 @@ Status = LoopRegisterAdapter(NULL, NULL); if (!NT_SUCCESS(Status)) { TI_DbgPrint(MIN_TRACE, ("Failed to create loopback adapter. Status (0x%X).\n", Status)); + LANShutdown(); + TCPShutdown(); + UDPShutdown(); + RawIPShutdown(); + IPShutdown(); ChewShutdown(); IoDeleteDevice(IPDeviceObject); IoDeleteDevice(RawIPDeviceObject); @@ -870,11 +875,6 @@ ExFreePool(EntityList); NdisFreePacketPool(GlobalPacketPool); NdisFreeBufferPool(GlobalBufferPool); - IPShutdown(); - RawIPShutdown(); - UDPShutdown(); - TCPShutdown(); - LANShutdown(); LANUnregisterProtocol(); return Status; } Modified: trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/transport/t…
============================================================================== --- trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] Fri Oct 17 05:42:44 2008 @@ -406,10 +406,9 @@ Timeout.QuadPart = (LONGLONG) (Next - Current) * -1000000; /* 100 ms */ Status = KeWaitForSingleObject(&TimerLoopEvent, Executive, KernelMode, FALSE, &Timeout); - if (STATUS_SUCCESS == Status) { - PsTerminateSystemThread(STATUS_SUCCESS); + if (Status != STATUS_TIMEOUT) { + PsTerminateSystemThread(Status); } - ASSERT(STATUS_TIMEOUT == Status); TcpipRecursiveMutexEnter( &TCPLock, TRUE ); TimerOskitTCP( Next == NextFast, Next == NextSlow );
16 years, 2 months
1
0
0
0
[tkreuzer] 36786: Win32 structure cleanup part 2 / x: - rename DESKTOP to DESKTOPINFO
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Fri Oct 17 05:40:04 2008 New Revision: 36786 URL:
http://svn.reactos.org/svn/reactos?rev=36786&view=rev
Log: Win32 structure cleanup part 2 / x: - rename DESKTOP to DESKTOPINFO Modified: trunk/reactos/dll/win32/user32/include/user32.h trunk/reactos/dll/win32/user32/misc/desktop.c trunk/reactos/dll/win32/user32/windows/defwnd.c trunk/reactos/include/reactos/win32k/ntuser.h trunk/reactos/subsystems/win32/win32k/include/class.h trunk/reactos/subsystems/win32/win32k/include/desktop.h trunk/reactos/subsystems/win32/win32k/include/window.h trunk/reactos/subsystems/win32/win32k/ntuser/callproc.c trunk/reactos/subsystems/win32/win32k/ntuser/class.c trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c trunk/reactos/subsystems/win32/win32k/ntuser/window.c Modified: trunk/reactos/dll/win32/user32/include/user32.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/include/u…
============================================================================== --- trunk/reactos/dll/win32/user32/include/user32.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/include/user32.h [iso-8859-1] Fri Oct 17 05:40:04 2008 @@ -96,11 +96,11 @@ return ti->Hooks != 0; } -static __inline PDESKTOP +static __inline PDESKTOPINFO GetThreadDesktopInfo(VOID) { PW32THREADINFO ti; - PDESKTOP di = NULL; + PDESKTOPINFO di = NULL; ti = GetW32ThreadInfo(); if (ti != NULL) Modified: trunk/reactos/dll/win32/user32/misc/desktop.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/desk…
============================================================================== --- trunk/reactos/dll/win32/user32/misc/desktop.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/misc/desktop.c [iso-8859-1] Fri Oct 17 05:40:04 2008 @@ -703,7 +703,7 @@ HWND STDCALL GetShellWindow(VOID) { - PDESKTOP pdi; + PDESKTOPINFO pdi; pdi = GetThreadDesktopInfo(); if (pdi) return pdi->hShellWindow; return NULL; Modified: trunk/reactos/dll/win32/user32/windows/defwnd.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/d…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/defwnd.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/defwnd.c [iso-8859-1] Fri Oct 17 05:40:04 2008 @@ -1620,7 +1620,7 @@ if (Action == UIS_INITIALIZE) { - PDESKTOP Desk = GetThreadDesktopInfo(); + PDESKTOPINFO Desk = GetThreadDesktopInfo(); if (Desk == NULL) break; @@ -1702,7 +1702,7 @@ if (Action == UIS_INITIALIZE) { - PDESKTOP Desk = GetThreadDesktopInfo(); + PDESKTOPINFO Desk = GetThreadDesktopInfo(); if (Desk == NULL) break; Modified: trunk/reactos/include/reactos/win32k/ntuser.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntu…
============================================================================== --- trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] Fri Oct 17 05:40:04 2008 @@ -35,7 +35,7 @@ HANDLE Handle; } USER_OBJHDR, PUSER_OBJHDR; -typedef struct _DESKTOP +typedef struct _DESKTOPINFO { HANDLE hKernelHeap; ULONG_PTR HeapLimit; @@ -54,7 +54,7 @@ }; WCHAR szDesktopName[1]; -} DESKTOP, *PDESKTOP; +} DESKTOPINFO, *PDESKTOPINFO; typedef struct _CALLPROC { @@ -70,7 +70,7 @@ struct _WINDOWCLASS *Next; struct _WINDOWCLASS *Clone; struct _WINDOWCLASS *Base; - PDESKTOP Desktop; + PDESKTOPINFO Desktop; RTL_ATOM Atom; ULONG Windows; @@ -309,7 +309,7 @@ { PW32PROCESSINFO pi; /* [USER] */ PW32PROCESSINFO kpi; /* [KERNEL] */ - PDESKTOP Desktop; + PDESKTOPINFO Desktop; PVOID DesktopHeapBase; ULONG_PTR DesktopHeapLimit; ULONG_PTR DesktopHeapDelta; Modified: trunk/reactos/subsystems/win32/win32k/include/class.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/class.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/class.h [iso-8859-1] Fri Oct 17 05:40:04 2008 @@ -23,15 +23,15 @@ GetCallProcHandle(IN PCALLPROC CallProc); VOID -DestroyCallProc(IN PDESKTOP Desktop, +DestroyCallProc(IN PDESKTOPINFO Desktop, IN OUT PCALLPROC CallProc); PCALLPROC -CloneCallProc(IN PDESKTOP Desktop, +CloneCallProc(IN PDESKTOPINFO Desktop, IN PCALLPROC CallProc); PCALLPROC -CreateCallProc(IN PDESKTOP Desktop, +CreateCallProc(IN PDESKTOPINFO Desktop, IN WNDPROC WndProc, IN BOOL Unicode, IN PW32PROCESSINFO pi); @@ -46,11 +46,11 @@ PWINDOWCLASS IntReferenceClass(IN OUT PWINDOWCLASS BaseClass, IN OUT PWINDOWCLASS *ClassLink, - IN PDESKTOP Desktop); + IN PDESKTOPINFO Desktop); VOID IntDereferenceClass(IN OUT PWINDOWCLASS Class, - IN PDESKTOP Desktop, + IN PDESKTOPINFO Desktop, IN PW32PROCESSINFO pi); RTL_ATOM @@ -95,7 +95,7 @@ OUT RTL_ATOM *Atom); BOOL -IntCheckProcessDesktopClasses(IN PDESKTOP Desktop, +IntCheckProcessDesktopClasses(IN PDESKTOPINFO Desktop, IN BOOL FreeOnFailure); #endif /* _WIN32K_CLASS_H */ Modified: trunk/reactos/subsystems/win32/win32k/include/desktop.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/desktop.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/desktop.h [iso-8859-1] Fri Oct 17 05:40:04 2008 @@ -25,7 +25,7 @@ HANDLE hDesktopHeap; PSECTION_OBJECT DesktopHeapSection; - PDESKTOP DesktopInfo; + PDESKTOPINFO DesktopInfo; } DESKTOP_OBJECT, *PDESKTOP_OBJECT; extern PDESKTOP_OBJECT InputDesktop; @@ -134,7 +134,7 @@ static __inline PVOID -DesktopHeapAlloc(IN PDESKTOP Desktop, +DesktopHeapAlloc(IN PDESKTOPINFO Desktop, IN SIZE_T Bytes) { return RtlAllocateHeap(Desktop->hKernelHeap, @@ -143,7 +143,7 @@ } static __inline BOOL -DesktopHeapFree(IN PDESKTOP Desktop, +DesktopHeapFree(IN PDESKTOPINFO Desktop, IN PVOID lpMem) { return RtlFreeHeap(Desktop->hKernelHeap, @@ -152,7 +152,7 @@ } static __inline PVOID -DesktopHeapReAlloc(IN PDESKTOP Desktop, +DesktopHeapReAlloc(IN PDESKTOPINFO Desktop, IN PVOID lpMem, IN SIZE_T Bytes) { Modified: trunk/reactos/subsystems/win32/win32k/include/window.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/window.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/window.h [iso-8859-1] Fri Oct 17 05:40:04 2008 @@ -26,7 +26,7 @@ /* Pointer to the thread information */ PW32THREADINFO ti; /* Pointer to the desktop */ - PDESKTOP Desktop; + PDESKTOPINFO Desktop; /* system menu handle. */ HMENU SystemMenu; /* Entry in the thread's list of windows. */ Modified: trunk/reactos/subsystems/win32/win32k/ntuser/callproc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/callproc.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/callproc.c [iso-8859-1] Fri Oct 17 05:40:04 2008 @@ -43,7 +43,7 @@ } VOID -DestroyCallProc(IN PDESKTOP Desktop, +DestroyCallProc(IN PDESKTOPINFO Desktop, IN OUT PCALLPROC CallProc) { /* FIXME - use new object manager! */ @@ -54,7 +54,7 @@ } PCALLPROC -CloneCallProc(IN PDESKTOP Desktop, +CloneCallProc(IN PDESKTOPINFO Desktop, IN PCALLPROC CallProc) { PCALLPROC NewCallProc; @@ -78,7 +78,7 @@ } PCALLPROC -CreateCallProc(IN PDESKTOP Desktop, +CreateCallProc(IN PDESKTOPINFO Desktop, IN WNDPROC WndProc, IN BOOL Unicode, IN PW32PROCESSINFO pi) Modified: trunk/reactos/subsystems/win32/win32k/ntuser/class.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/class.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/class.c [iso-8859-1] Fri Oct 17 05:40:04 2008 @@ -395,7 +395,7 @@ static PWINDOWCLASS IntGetClassForDesktop(IN OUT PWINDOWCLASS BaseClass, IN OUT PWINDOWCLASS *ClassLink, - IN PDESKTOP Desktop) + IN PDESKTOPINFO Desktop) { SIZE_T ClassSize; PWINDOWCLASS Class; @@ -502,7 +502,7 @@ PWINDOWCLASS IntReferenceClass(IN OUT PWINDOWCLASS BaseClass, IN OUT PWINDOWCLASS *ClassLink, - IN PDESKTOP Desktop) + IN PDESKTOPINFO Desktop) { PWINDOWCLASS Class; @@ -563,7 +563,7 @@ VOID IntDereferenceClass(IN OUT PWINDOWCLASS Class, - IN PDESKTOP Desktop, + IN PDESKTOPINFO Desktop, IN PW32PROCESSINFO pi) { PWINDOWCLASS *PrevLink, BaseClass, CurrentClass; @@ -680,7 +680,7 @@ } static VOID -IntCheckDesktopClasses(IN PDESKTOP Desktop, +IntCheckDesktopClasses(IN PDESKTOPINFO Desktop, IN OUT PWINDOWCLASS *ClassList, IN BOOL FreeOnFailure, OUT BOOL *Ret) @@ -749,7 +749,7 @@ } BOOL -IntCheckProcessDesktopClasses(IN PDESKTOP Desktop, +IntCheckProcessDesktopClasses(IN PDESKTOPINFO Desktop, IN BOOL FreeOnFailure) { PW32PROCESSINFO pi; @@ -792,7 +792,7 @@ IN PUNICODE_STRING MenuName, IN WNDPROC wpExtra, IN DWORD dwFlags, - IN PDESKTOP Desktop, + IN PDESKTOPINFO Desktop, IN PW32PROCESSINFO pi) { SIZE_T ClassSize; Modified: trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1] Fri Oct 17 05:40:04 2008 @@ -991,7 +991,7 @@ RETURN(NULL); } - DesktopInfoSize = FIELD_OFFSET(DESKTOP, + DesktopInfoSize = FIELD_OFFSET(DESKTOPINFO, szDesktopName[(lpszDesktopName->Length / sizeof(WCHAR)) + 1]); DesktopObject->DesktopInfo = RtlAllocateHeap(DesktopObject->hDesktopHeap, Modified: trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] Fri Oct 17 05:40:04 2008 @@ -520,7 +520,7 @@ NTSTATUS WaitStatus; DECLARE_RETURN(BOOL); USER_REFERENCE_ENTRY Ref; - PDESKTOP Desk = NULL; + PDESKTOPINFO Desk = NULL; WaitObjects[1] = MessageQueue->NewMessages; WaitObjects[0] = &HardwareMessageQueueLock; Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] Fri Oct 17 05:40:04 2008 @@ -3195,7 +3195,7 @@ WinStaObject->ShellListView = hwndListView; ti = GetW32ThreadInfo(); - if (ti->Desktop) ((PDESKTOP)ti->Desktop)->hShellWindow = hwndShell; + if (ti->Desktop) ti->Desktop->hShellWindow = hwndShell; UserDerefObjectCo(WndShell);
16 years, 2 months
1
0
0
0
[cgutman] 36785: - Fix the order that we shutdown things
by cgutman@svn.reactos.org
Author: cgutman Date: Fri Oct 17 05:29:14 2008 New Revision: 36785 URL:
http://svn.reactos.org/svn/reactos?rev=36785&view=rev
Log: - Fix the order that we shutdown things Modified: branches/aicom-network-fixes/drivers/network/tcpip/tcpip/main.c Modified: branches/aicom-network-fixes/drivers/network/tcpip/tcpip/main.c URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
============================================================================== --- branches/aicom-network-fixes/drivers/network/tcpip/tcpip/main.c [iso-8859-1] (original) +++ branches/aicom-network-fixes/drivers/network/tcpip/tcpip/main.c [iso-8859-1] Fri Oct 17 05:29:14 2008 @@ -783,6 +783,7 @@ /* Initialize transport level protocol subsystems */ Status = RawIPStartup(); if( !NT_SUCCESS(Status) ) { + IPShutdown(); ChewShutdown(); IoDeleteDevice(IPDeviceObject); IoDeleteDevice(RawIPDeviceObject); @@ -791,12 +792,13 @@ ExFreePool(EntityList); NdisFreePacketPool(GlobalPacketPool); NdisFreeBufferPool(GlobalBufferPool); - IPShutdown(); return Status; } Status = UDPStartup(); if( !NT_SUCCESS(Status) ) { + RawIPShutdown(); + IPShutdown(); ChewShutdown(); IoDeleteDevice(IPDeviceObject); IoDeleteDevice(RawIPDeviceObject); @@ -805,13 +807,14 @@ ExFreePool(EntityList); NdisFreePacketPool(GlobalPacketPool); NdisFreeBufferPool(GlobalBufferPool); - IPShutdown(); - RawIPShutdown(); return Status; } Status = TCPStartup(); if( !NT_SUCCESS(Status) ) { + UDPShutdown(); + RawIPShutdown(); + IPShutdown(); ChewShutdown(); IoDeleteDevice(IPDeviceObject); IoDeleteDevice(RawIPDeviceObject); @@ -820,9 +823,6 @@ ExFreePool(EntityList); NdisFreePacketPool(GlobalPacketPool); NdisFreeBufferPool(GlobalBufferPool); - IPShutdown(); - RawIPShutdown(); - UDPShutdown(); return Status; } @@ -842,6 +842,11 @@ NULL, 0, NULL); + LANShutdown(); + TCPShutdown(); + UDPShutdown(); + RawIPShutdown(); + IPShutdown(); ChewShutdown(); IoDeleteDevice(IPDeviceObject); IoDeleteDevice(RawIPDeviceObject); @@ -850,11 +855,6 @@ ExFreePool(EntityList); NdisFreePacketPool(GlobalPacketPool); NdisFreeBufferPool(GlobalBufferPool); - IPShutdown(); - RawIPShutdown(); - UDPShutdown(); - TCPShutdown(); - LANShutdown(); return Status; } @@ -862,6 +862,11 @@ Status = LoopRegisterAdapter(NULL, NULL); if (!NT_SUCCESS(Status)) { TI_DbgPrint(MIN_TRACE, ("Failed to create loopback adapter. Status (0x%X).\n", Status)); + LANShutdown(); + TCPShutdown(); + UDPShutdown(); + RawIPShutdown(); + IPShutdown(); ChewShutdown(); IoDeleteDevice(IPDeviceObject); IoDeleteDevice(RawIPDeviceObject); @@ -870,11 +875,6 @@ ExFreePool(EntityList); NdisFreePacketPool(GlobalPacketPool); NdisFreeBufferPool(GlobalBufferPool); - IPShutdown(); - RawIPShutdown(); - UDPShutdown(); - TCPShutdown(); - LANShutdown(); LANUnregisterProtocol(); return Status; }
16 years, 2 months
1
0
0
0
[cgutman] 36784: - Kill the thread if KeWaitForSingleObject didn't return STATUS_TIMEOUT
by cgutman@svn.reactos.org
Author: cgutman Date: Fri Oct 17 05:27:20 2008 New Revision: 36784 URL:
http://svn.reactos.org/svn/reactos?rev=36784&view=rev
Log: - Kill the thread if KeWaitForSingleObject didn't return STATUS_TIMEOUT Modified: branches/aicom-network-fixes/lib/drivers/ip/transport/tcp/tcp.c Modified: branches/aicom-network-fixes/lib/drivers/ip/transport/tcp/tcp.c URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/lib/drivers…
============================================================================== --- branches/aicom-network-fixes/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] (original) +++ branches/aicom-network-fixes/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] Fri Oct 17 05:27:20 2008 @@ -406,10 +406,9 @@ Timeout.QuadPart = (LONGLONG) (Next - Current) * -1000000; /* 100 ms */ Status = KeWaitForSingleObject(&TimerLoopEvent, Executive, KernelMode, FALSE, &Timeout); - if (STATUS_SUCCESS == Status) { - PsTerminateSystemThread(STATUS_SUCCESS); + if (Status != STATUS_TIMEOUT) { + PsTerminateSystemThread(Status); } - ASSERT(STATUS_TIMEOUT == Status); TcpipRecursiveMutexEnter( &TCPLock, TRUE ); TimerOskitTCP( Next == NextFast, Next == NextSlow );
16 years, 2 months
1
0
0
0
[janderwald] 36783: - Hide ncpa.cpl from control panel
by janderwald@svn.reactos.org
Author: janderwald Date: Fri Oct 17 05:21:15 2008 New Revision: 36783 URL:
http://svn.reactos.org/svn/reactos?rev=36783&view=rev
Log: - Hide ncpa.cpl from control panel Modified: trunk/reactos/dll/win32/shell32/shfldr_cpanel.c Modified: trunk/reactos/dll/win32/shell32/shfldr_cpanel.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shfldr_c…
============================================================================== --- trunk/reactos/dll/win32/shell32/shfldr_cpanel.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shfldr_cpanel.c [iso-8859-1] Fri Oct 17 05:21:15 2008 @@ -420,7 +420,8 @@ if (!(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { strcpy(p, wfd.cFileName); - SHELL_RegisterCPanelApp((IEnumIDList*)iface, szPath); + if (strcmp(wfd.cFileName, "ncpa.cpl")) + SHELL_RegisterCPanelApp((IEnumIDList*)iface, szPath); } } while(FindNextFileA(hFile, &wfd)); FindClose(hFile);
16 years, 2 months
1
0
0
0
[sginsberg] 36782: - Add comments to GetTextFaceW - Apology to GreatLord, his code was correct and I fail -- hint: don't code and commit at late night ; 0)
by sginsberg@svn.reactos.org
Author: sginsberg Date: Fri Oct 17 02:20:23 2008 New Revision: 36782 URL:
http://svn.reactos.org/svn/reactos?rev=36782&view=rev
Log: - Add comments to GetTextFaceW - Apology to GreatLord, his code was correct and I fail -- hint: don't code and commit at late night ;0) Modified: trunk/reactos/dll/win32/gdi32/objects/text.c Modified: trunk/reactos/dll/win32/gdi32/objects/text.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/te…
============================================================================== --- trunk/reactos/dll/win32/gdi32/objects/text.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdi32/objects/text.c [iso-8859-1] Fri Oct 17 02:20:23 2008 @@ -363,11 +363,15 @@ INT nCount, PWSTR pFaceName) { + /* Validate parameters */ if (pFaceName && nCount <= 0) { + /* Set last error and return failure */ GdiSetLastError(ERROR_INVALID_PARAMETER); return 0; } + + /* Forward to kernel */ return NtGdiGetTextFaceW(hDC, nCount, pFaceName, FALSE); }
16 years, 2 months
1
0
0
0
[jimtabor] 36781: Checked code format, compiler has issues.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Thu Oct 16 23:56:47 2008 New Revision: 36781 URL:
http://svn.reactos.org/svn/reactos?rev=36781&view=rev
Log: Checked code format, compiler has issues. Modified: trunk/reactos/dll/win32/gdi32/objects/text.c Modified: trunk/reactos/dll/win32/gdi32/objects/text.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/te…
============================================================================== --- trunk/reactos/dll/win32/gdi32/objects/text.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdi32/objects/text.c [iso-8859-1] Thu Oct 16 23:56:47 2008 @@ -365,7 +365,7 @@ { if (pFaceName && nCount <= 0) { - // GdiSetLastError(ERROR_INVALID_PARAMETER); + GdiSetLastError(ERROR_INVALID_PARAMETER); return 0; } return NtGdiGetTextFaceW(hDC, nCount, pFaceName, FALSE);
16 years, 2 months
1
0
0
0
← Newer
1
...
31
32
33
34
35
36
37
...
52
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
Results per page:
10
25
50
100
200