Real Geek Forums  

Go Back   Real Geek Forums > Archives > Operating Systems > Windows Vista

Notices

Reply

Route addition in Vista

 

LinkBack Thread Tools Display Modes
Old 08-08-2006, 10:42 AM   #1 (permalink)
Default Route addition in Vista

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
Jothi
Guest
 
Posts: n/a
Reply With Quote  
Old 08-08-2006, 10:44 AM   #2 (permalink)
Default route addition in Vista

I am facing route addition problem in widows vista.
--
JothiKumar
Technical Consultant
Calsoft, Chennai
Jothi
Guest
 
Posts: n/a
Reply With Quote  
Reply

Tags
None

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

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


All times are GMT. The time now is 10:48 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright © 2005 - 2007 RealGeek.com. All rights reserved.

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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90