![]() |
| | #1 (permalink) |
| Hi, I am using Windows Vista Beta for my network application development under administrator login(full access). I am trying to add a route to the existing route table using CreateIpForwardEntry API. I am getting following error. "160 - One or more argument are not correct". Same code working in Win2000 and XP. But From command prompt I was able to add/delete the route using route command. If you have idea on solving this issue please let me know. The source is here BOOL Add_Route_x( DWORD destination, DWORD gateway, DWORD mask, DWORD metric, int row_number, DWORD index, DWORD fwdType) { BOOL bRet = FALSE; MIB_IPFORWARDROW pfwrow; DWORD dwStatus; pfwrow.dwForwardNextHop = gateway; pfwrow.dwForwardDest = destination; pfwrow.dwForwardMask = mask; pfwrow.dwForwardMetric1 = metric; pfwrow.dwForwardPolicy = 0; pfwrow.dwForwardType = fwdType; pfwrow.dwForwardProto = 3;//PROTO_IP_NETMGMT; pfwrow.dwForwardAge = -1 ; pfwrow.dwForwardNextHopAS =0; pfwrow.dwForwardMetric2 = 0xffffffff; pfwrow.dwForwardMetric3 = 0xffffffff; pfwrow.dwForwardMetric4 = 0xffffffff; pfwrow.dwForwardMetric5 = 0xffffffff; pfwrow.dwForwardIfIndex = index; LOG("Adding route for following parameters"); LOG("Gateway = %s",print_in_addr_t(ntohl(gateway))); LOG("Destination = %s",print_in_addr_t(ntohl(destination))); LOG("Mask = %s",print_in_addr_t(ntohl(mask))); LOG("Forward Type = %d", fwdType); LOG("Index = %x",index); LOG("Metric = %d",metric); // Create a new route entry for the default gateway. dwStatus = CreateIpForwardEntry(&pfwrow); if (dwStatus == NO_ERROR) { LOG("Add route successfull"); bRet = TRUE; } else { LOG("Add route failed. CreateIpForwardEntry returning Error code = %d", dwStatus); if(ERROR_INVALID_PARAMETER == dwStatus) { LOG("One of the members of the MIB_IPFORWARDROW structure is invalid."); } else if(ERROR_NOT_SUPPORTED == dwStatus) { LOG("The IP transport is not configured on the local computer"); } bRet = FALSE; } return bRet; } // End of AddRoute() log file contains following info ================================================== ========== Routing Table in System... ForwardDest ForwardMask ForwardNextHop ForwardMetric IfIndex 0.0.0.0 0.0.0.0 172.16.2.1 276 0000000b 127.0.0.0 255.0.0.0 0.0.0.0 306 00000001 127.0.0.1 255.255.255.255 0.0.0.0 306 00000001 127.255.255.255 255.255.255.255 0.0.0.0 306 00000001 172.16.0.0 255.255.0.0 0.0.0.0 276 0000000b 172.16.91.15 255.255.255.255 0.0.0.0 276 0000000b 172.16.255.255 255.255.255.255 0.0.0.0 276 0000000b 224.0.0.0 240.0.0.0 0.0.0.0 306 00000001 224.0.0.0 240.0.0.0 0.0.0.0 276 0000000b 224.0.0.0 240.0.0.0 0.0.0.0 266 0000000f 239.255.255.255 255.255.255.255 0.0.0.0 306 00000001 239.255.255.255 255.255.255.255 0.0.0.0 276 0000000b 239.255.255.255 255.255.255.255 0.0.0.0 266 0000000f 255.255.255.255 255.255.255.255 0.0.0.0 306 00000001 255.255.255.255 255.255.255.255 0.0.0.0 276 0000000b 255.255.255.255 255.255.255.255 0.0.0.0 266 0000000f Adding route for following parameters Gateway = 172.16.91.15 Destination = 172.16.100.68 Mask = 255.255.255.255 Forward Type = 3 Index = b Metric = 1 Add route failed. CreateIpForwardEntry returning Error code = 160 ================================================== ========== If you know how to solve this issue, please let me know. In parallel I will change other parameter details and try. I am not getting meaning of "On Windows Vista and Windows Server "Longhorn", the CreateIpForwardEntry only works on interfaces with a single sub-interface (where the interface LUID and subinterface LUID are the same). The dwForwardIfIndex member of the MIB_IPFORWARDROW structure specifies the interface. " in the following link. http://msdn.microsoft.com/library/de...rwardentry.asp Please explain me. -- Jothi -- JothiKumar Technical Consultant Calsoft, Chennai | Guest
Posts: n/a
|
|
![]() |
| Tags |
| None |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to block IPs with 'route.exe' in Vista | Robert Weiss | Windows Vista Networking & Sharing | 7 | 03-02-2008 04:54 AM |
| route add vista | Christian Krüsi | Windows Vista Networking & Sharing | 0 | 08-14-2007 08:55 AM |
| Remote Desktop and Vista Home Addition | MDB | Windows Vista Networking & Sharing | 1 | 01-30-2007 02:26 PM |
| have vista, want to re-upload xp in addition | wakedude06 | Windows Vista Install & Setup | 8 | 11-29-2006 11:14 AM |
| Route addition in Vista | Jothi | Windows Vista Networking & Sharing | 0 | 08-08-2006 10:40 AM |