Author: cgutman
Date: Sun Jan 15 19:53:52 2012
New Revision: 54981

URL: http://svn.reactos.org/svn/reactos?rev=54981&view=rev
Log:
- Merge r54980 from wlan-bringup

Modified:
    trunk/reactos/   (props changed)
    trunk/reactos/dll/win32/netcfgx/CMakeLists.txt
    trunk/reactos/dll/win32/netcfgx/netcfgx.rbuild
    trunk/reactos/dll/win32/netcfgx/precomp.h
    trunk/reactos/dll/win32/netcfgx/tcpipconf_notify.c

Propchange: trunk/reactos/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Jan 15 19:53:52 2012
@@ -10,4 +10,4 @@
 
/branches/ros-amd64-bringup/reactos:34711-34712,34741,34743,34770,34780-34782,34803,34812,34839,34842,34864,34870,34874,34877,34908-34909,34917,34965,35323-35324,35347-35348,35361,35436,35509,35515,35588,35655,35683,35739,35746,35762,35771,35777,35781,35789,35805,35823,35827,35902,35904-35906,35942,35947-35949,35952-35953,35966,36011-36013,36172,36360,36380,36388-36389,36393,36397,36443,36445,36475,36502-36503,36505,36570,36614,36852,36898-36899,36930,36936,36949,36951,36958,36961,36964,36969,36972,36987-36988,36990,36992,37019,37322-37323,37333-37334,37434,37472,37475,37536,37820-37821,37868-37869,37873,37990-37991,38013-38014,38092,38100,38148-38151,38264-38265,38268,38355,39151,39333,39335,39345,39639,40120,40122-40123,40125,40127-40128,40155,40247,40324,40608,40753,40926-40928,40986-40987,40989,40991,40993,40995-40996,41000-41001,41027-41030,41044-41045,41047-41050,41052,41070,41082-41086,41097-41098,41101,41449,41479-41480,41483-41485,41499-41500,41502,41531,41536,41540,41546-41547,41549,43080,43426,43451,43454,43506,43566,43574,43598,43600-43602,43604-43605,43677,43682,43757,43775,43836,43838-43840,43852,43857-43858,43860,43905-43907,43952,43954,43965,43969,43979,43981,43992,44002,44036-44037,44039-44040,44044-44045,44053,44065,44095,44123,44143-44144,44205,44238,44257,44259,44294,44338-44339,44385,44389,44391,44426,44460,44467-44468,44470-44471,44499,44501,44503-44504,44506,44510-44512,44521,44523-44526,44530,44540,44601,44634,44639,44772,44818,45124,45126-45127,45430,46394,46404,46478,46511,46523-46524,46526,46534-46535,46537-46539,46589,46805,46868,47472,47846-47847,47878,47882
 /branches/shell32_new-bringup:51893-53652,53661,53700
 /branches/tcp-rewrite-branch:48720,48840-48841,49424-49426,49454
-/branches/wlan-bringup:54895-54896,54899,54912-54913,54915-54916,54929-54930,54932-54934,54939,54941-54942,54944-54947
+/branches/wlan-bringup:54895-54896,54899,54912-54913,54915-54916,54929-54930,54932-54934,54939,54941-54942,54944-54947,54980

Modified: trunk/reactos/dll/win32/netcfgx/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netcfgx/CMakeLists.txt?rev=54981&r1=54980&r2=54981&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netcfgx/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netcfgx/CMakeLists.txt [iso-8859-1] Sun Jan 15 
19:53:52 2012
@@ -22,6 +22,6 @@
     uuid
     wine)
 
-add_importlibs(netcfgx rpcrt4 setupapi advapi32 iphlpapi ole32 user32 comctl32 
ws2_32 msvcrt kernel32 ntdll)
+add_importlibs(netcfgx rpcrt4 setupapi advapi32 iphlpapi dhcpcsvc ole32 user32 
comctl32 ws2_32 msvcrt kernel32 ntdll)
 add_pch(netcfgx precomp.h)
 add_cd_file(TARGET netcfgx DESTINATION reactos/system32 FOR all)

Modified: trunk/reactos/dll/win32/netcfgx/netcfgx.rbuild
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netcfgx/netcfgx.rbuild?rev=54981&r1=54980&r2=54981&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netcfgx/netcfgx.rbuild [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netcfgx/netcfgx.rbuild [iso-8859-1] Sun Jan 15 
19:53:52 2012
@@ -8,7 +8,7 @@
        <library>advapi32</library>
        <library>uuid</library>
        <library>iphlpapi</library>
-       <library>iphlpapi</library>
+       <library>dhcpcsvc</library>
        <library>wine</library>
        <library>ole32</library>
        <library>user32</library>

Modified: trunk/reactos/dll/win32/netcfgx/precomp.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netcfgx/precomp.h?rev=54981&r1=54980&r2=54981&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netcfgx/precomp.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netcfgx/precomp.h [iso-8859-1] Sun Jan 15 19:53:52 
2012
@@ -14,6 +14,8 @@
 #include <setupapi.h>
 #include <stdio.h>
 #include <iphlpapi.h>
+#include <dhcpcsdk.h>
+#include <dhcpcapi.h>
 #include <olectl.h>
 #include <netcfgn.h>
 #include "resource.h"

Modified: trunk/reactos/dll/win32/netcfgx/tcpipconf_notify.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netcfgx/tcpipconf_notify.c?rev=54981&r1=54980&r2=54981&view=diff
==============================================================================
--- trunk/reactos/dll/win32/netcfgx/tcpipconf_notify.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netcfgx/tcpipconf_notify.c [iso-8859-1] Sun Jan 15 
19:53:52 2012
@@ -3117,6 +3117,7 @@
     WCHAR szBuffer[200];
     TcpipSettings * pCurrentConfig, *pOldConfig;
     ULONG NTEInstance;
+    DWORD DhcpApiVersion;
 
     TcpipConfNotifyImpl * This = impl_from_INetCfgComponentControl(iface);
 
@@ -3197,39 +3198,74 @@
             RegSetValueExW(hKey, L"DefaultGatewayMetric", 0, REG_MULTI_SZ, 
(LPBYTE)L"\0", 2 * sizeof(WCHAR));
             if (!pOldConfig->DhcpEnabled)
             {
+                /* Delete this adapter's current IP address */
                 DeleteIPAddress(pOldConfig->Ip->NTEContext);
-                //FIXME
-                // start dhcp client service for the adapter
+
+                /* Delete all default routes for this adapter */
+                dwSize = 0;
+                if (GetIpForwardTable(NULL, &dwSize, FALSE) == 
ERROR_INSUFFICIENT_BUFFER)
+                {
+                    DWORD Index;
+                    PMIB_IPFORWARDTABLE pIpForwardTable = 
(PMIB_IPFORWARDTABLE)CoTaskMemAlloc(dwSize);
+                    if (pIpForwardTable)
+                    {
+                        if (GetIpForwardTable(pIpForwardTable, &dwSize, FALSE) 
== NO_ERROR)
+                        {
+                            for (Index = 0; Index < 
pIpForwardTable->dwNumEntries; Index++)
+                            {
+                                if 
(pIpForwardTable->table[Index].dwForwardIfIndex == pOldConfig->Index &&
+                                    
pIpForwardTable->table[Index].dwForwardDest == 0)
+                                {
+                                    
DeleteIpForwardEntry(&pIpForwardTable->table[Index]);
+                                }
+                            }
+                        }
+                        CoTaskMemFree(pIpForwardTable);
+                    }
+                }
             }
         }
         else
         {
-            if (!pOldConfig->DhcpEnabled)
-            {
+            /* Open the DHCP API if DHCP is enabled */
+            if (pOldConfig->DhcpEnabled && DhcpCApiInitialize(&DhcpApiVersion) 
== NO_ERROR)
+            {
+                /* We have to tell DHCP about this */
+                DhcpStaticRefreshParams(pCurrentConfig->Index,
+                                        htonl(pCurrentConfig->Ip->IpAddress),
+                                        
htonl(pCurrentConfig->Ip->u.Subnetmask));
+
+                /* Close the API */
+                DhcpCApiCleanup();
+            }
+            else
+            {
+                /* Delete this adapter's current static IP address */
                 DeleteIPAddress(pOldConfig->Ip->NTEContext);
-                //TODO
-                //delete multiple ip addresses when required
-            }
-
-            //TODO
-            // add multiple ip addresses when required
-            if (AddIPAddress(htonl(pCurrentConfig->Ip->IpAddress), 
htonl(pCurrentConfig->Ip->u.Subnetmask), pCurrentConfig->Index, 
&pCurrentConfig->Ip->NTEContext, &NTEInstance) == NO_ERROR)
-            {
-                pStr = CreateMultiSzString(pCurrentConfig->Ip, IPADDR, 
&dwSize, FALSE);
-                if(pStr)
-                {
-                    RegSetValueExW(hKey, L"IPAddress", 0, REG_MULTI_SZ, 
(LPBYTE)pStr, dwSize);
-                    CoTaskMemFree(pStr);
-                }
-
-                pStr = CreateMultiSzString(pCurrentConfig->Ip, SUBMASK, 
&dwSize, FALSE);
-                if(pStr)
-                {
-                    RegSetValueExW(hKey, L"SubnetMask", 0, REG_MULTI_SZ, 
(LPBYTE)pStr, dwSize);
-                    CoTaskMemFree(pStr);
-                }
-            }
-
+
+                /* Add the static IP address via the standard IPHLPAPI 
function */
+                AddIPAddress(htonl(pCurrentConfig->Ip->IpAddress),
+                             htonl(pCurrentConfig->Ip->u.Subnetmask),
+                             pCurrentConfig->Index,
+                             &pCurrentConfig->Ip->NTEContext,
+                             &NTEInstance);
+            }
+            
+            pStr = CreateMultiSzString(pCurrentConfig->Ip, IPADDR, &dwSize, 
FALSE);
+            if(pStr)
+            {
+                RegSetValueExW(hKey, L"IPAddress", 0, REG_MULTI_SZ, 
(LPBYTE)pStr, dwSize);
+                CoTaskMemFree(pStr);
+            }
+            
+            pStr = CreateMultiSzString(pCurrentConfig->Ip, SUBMASK, &dwSize, 
FALSE);
+            if(pStr)
+            {
+                RegSetValueExW(hKey, L"SubnetMask", 0, REG_MULTI_SZ, 
(LPBYTE)pStr, dwSize);
+                CoTaskMemFree(pStr);
+            }
+
+            /* Delete all default routes for this adapter */
             dwSize = 0;
             if (GetIpForwardTable(NULL, &dwSize, FALSE) == 
ERROR_INSUFFICIENT_BUFFER)
             {


Reply via email to